Files
StudyDiary-20251025/.obsidian/plugins/copilot/main.js
2025-09-01 12:32:47 +08:00

2511 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 ewr=Object.create;var e6=Object.defineProperty;var twr=Object.getOwnPropertyDescriptor;var rwr=Object.getOwnPropertyNames;var nwr=Object.getPrototypeOf,owr=Object.prototype.hasOwnProperty;var wGe=t=>{throw TypeError(t)};var iwr=(t,e,r)=>e in t?e6(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),os=(t,e)=>{for(var r in e)e6(t,r,{get:e[r],enumerable:!0})},xGe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rwr(e))!owr.call(t,o)&&o!==r&&e6(t,o,{get:()=>e[o],enumerable:!(n=twr(e,o))||n.enumerable});return t};var j=(t,e,r)=>(r=t!=null?ewr(nwr(t)):{},xGe(e||!t||!t.__esModule?e6(r,"default",{value:t,enumerable:!0}):r,t)),Nc=t=>xGe(e6({},"__esModule",{value:!0}),t);var bd=(t,e,r)=>iwr(t,typeof e!="symbol"?e+"":e,r),awr=(t,e,r)=>e.has(t)||wGe("Cannot "+r);var bwe=(t,e,r)=>e.has(t)?wGe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var SGe=(t,e,r)=>(awr(t,e,"access private method"),r);function _we(){if(!OX&&(OX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!OX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return OX(swr)}var OX,swr,CGe=b(()=>{swr=new Uint8Array(16)});function OGe(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,EGe=b(()=>{_d=[];for(let t=0;t<256;++t)_d.push((t+256).toString(16).slice(1))});var uwr,vwe,PGe=b(()=>{uwr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vwe={randomUUID:uwr}});function lwr(t,e,r){if(vwe.randomUUID&&!e&&!t)return vwe.randomUUID();t=t||{};let n=t.random||(t.rng||_we)();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 OGe(n)}var dm,TGe=b(()=>{PGe();CGe();EGe();dm=lwr});var zN=b(()=>{TGe()});var Gn,wwe,yt,gv,t6=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})})(wwe||(wwe={}));yt=Gn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gv=t=>{switch(typeof t){case"undefined":return yt.undefined;case"string":return yt.string;case"number":return Number.isNaN(t)?yt.nan:yt.number;case"boolean":return yt.boolean;case"function":return yt.function;case"bigint":return yt.bigint;case"symbol":return yt.symbol;case"object":return Array.isArray(t)?yt.array:t===null?yt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?yt.promise:typeof Map<"u"&&t instanceof Map?yt.map:typeof Set<"u"&&t instanceof Set?yt.set:typeof Date<"u"&&t instanceof Date?yt.date:yt.object;default:return yt.unknown}}});var Ue,cwr,fm,EX=b(()=>{t6();Ue=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"]),cwr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),fm=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()}};fm.create=t=>new fm(t)});var dwr,aE,xwe=b(()=>{EX();t6();dwr=(t,e)=>{let r;switch(t.code){case Ue.invalid_type:t.received===yt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Gn.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${Gn.joinValues(t.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Gn.joinValues(t.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${Gn.joinValues(t.options)}, received '${t.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.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 Ue.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 Ue.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 Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=e.defaultError,Gn.assertNever(t)}return{message:r}},aE=dwr});function fwr(t){AGe=t}function sB(){return AGe}var AGe,PX=b(()=>{xwe();AGe=aE});function ut(t,e){let r=sB(),n=r6({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===aE?void 0:aE].filter(o=>!!o)});t.common.issues.push(n)}var r6,pwr,vd,xr,UN,xf,TX,AX,MA,uB,Swe=b(()=>{PX();xwe();r6=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}},pwr=[];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 xr;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 xr;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}}},xr=Object.freeze({status:"aborted"}),UN=t=>({status:"dirty",value:t}),xf=t=>({status:"valid",value:t}),TX=t=>t.status==="aborted",AX=t=>t.status==="dirty",MA=t=>t.status==="valid",uB=t=>typeof Promise<"u"&&t instanceof Promise});var IGe=b(()=>{});var Kt,MGe=b(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Kt||(Kt={}))});function dn(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 DGe(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 Iwr(t){return new RegExp(`^${DGe(t)}$`)}function LGe(t){let e=`${jGe}T${DGe(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 Mwr(t,e){return!!((e==="v4"||!e)&&Swr.test(t)||(e==="v6"||!e)&&Owr.test(t))}function Rwr(t,e){if(!_wr.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 Nwr(t,e){return!!((e==="v4"||!e)&&Cwr.test(t)||(e==="v6"||!e)&&Ewr.test(t))}function jwr(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 lB(t){if(t instanceof mm){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=pm.create(lB(n))}return new mm({...t._def,shape:()=>e})}else return t instanceof lE?new lE({...t._def,type:lB(t.element)}):t instanceof pm?pm.create(lB(t.unwrap())):t instanceof bv?bv.create(lB(t.unwrap())):t instanceof yv?yv.create(t.items.map(e=>lB(e))):t}function Owe(t,e){let r=gv(t),n=gv(e);if(t===e)return{valid:!0,data:t};if(r===yt.object&&n===yt.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=Owe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===yt.array&&n===yt.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=Owe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===yt.date&&n===yt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function FGe(t,e){return new QN({values:t,typeName:re.ZodEnum,...dn(e)})}function NGe(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function kGe(t,e={},r){return t?NA.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=NGe(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=NGe(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):NA.create()}var Dg,RGe,An,mwr,hwr,gwr,ywr,bwr,_wr,vwr,wwr,xwr,Cwe,Swr,Cwr,Owr,Ewr,Pwr,Twr,jGe,Awr,RA,qN,HN,VN,WN,cB,KN,GN,NA,uE,Tb,dB,lE,mm,JN,sE,IX,ZN,yv,MX,fB,pB,RX,YN,XN,QN,ej,jA,Lg,pm,bv,tj,rj,mB,Dwr,n6,o6,nj,Lwr,re,Fwr,$Ge,BGe,kwr,$wr,zGe,Bwr,zwr,Uwr,qwr,Hwr,Vwr,Wwr,Kwr,Gwr,Jwr,Zwr,Ywr,Xwr,Qwr,e0r,t0r,r0r,n0r,o0r,i0r,a0r,s0r,u0r,l0r,c0r,d0r,f0r,p0r,m0r,h0r,g0r,y0r,b0r,_0r,UGe=b(()=>{EX();PX();MGe();Swe();t6();Dg=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}},RGe=(t,e)=>{if(MA(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 fm(t.common.issues);return this._error=r,this._error}}};An=class{get description(){return this._def.description}_getType(e){return gv(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:gv(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:gv(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(uB(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:gv(e)},o=this._parseSync({data:e,path:n.path,parent:n});return RGe(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gv(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return MA(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=>MA(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:gv(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(uB(o)?o:Promise.resolve(o));return RGe(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:Ue.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 Lg({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 pm.create(this,this._def)}nullable(){return bv.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lE.create(this)}promise(){return jA.create(this,this._def)}or(e){return JN.create([this,e],this._def)}and(e){return ZN.create(this,e,this._def)}transform(e){return new Lg({...dn(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new tj({...dn(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new n6({typeName:re.ZodBranded,type:this,...dn(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new rj({...dn(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 o6.create(this,e)}readonly(){return nj.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},mwr=/^c[^\s-]{8,}$/i,hwr=/^[0-9a-z]+$/,gwr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ywr=/^[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,bwr=/^[a-z0-9_-]{21}$/i,_wr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vwr=/^[-+]?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)?)??$/,wwr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xwr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Swr=/^(?:(?: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])$/,Cwr=/^(?:(?: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])$/,Owr=/^(([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]))$/,Ewr=/^(([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])$/,Pwr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Twr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jGe="((\\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])))",Awr=new RegExp(`^${jGe}$`);RA=class t extends An{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==yt.string){let i=this._getOrReturnCtx(e);return ut(i,{code:Ue.invalid_type,expected:yt.string,received:i.parsedType}),xr}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:Ue.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:Ue.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:Ue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ut(o,{code:Ue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")wwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"email",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Cwe||(Cwe=new RegExp(xwr,"u")),Cwe.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"emoji",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")ywr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"uuid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")bwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"nanoid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")mwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cuid",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")hwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cuid2",code:Ue.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")gwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"ulid",code:Ue.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:Ue.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:Ue.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:Ue.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:Ue.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:Ue.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?LGe(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Ue.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Awr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Ue.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Iwr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Ue.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?vwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"duration",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Mwr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"ip",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Rwr(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"jwt",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Nwr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cidr",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Pwr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"base64",code:Ue.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Twr.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"base64url",code:Ue.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:Ue.invalid_string,...Kt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Kt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Kt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Kt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Kt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Kt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Kt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Kt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Kt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Kt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Kt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Kt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Kt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Kt.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,...Kt.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,...Kt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Kt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Kt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Kt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Kt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Kt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Kt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Kt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Kt.errToObj(r)})}nonempty(e){return this.min(1,Kt.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}};RA.create=t=>new RA({checks:[],typeName:re.ZodString,coerce:t?.coerce??!1,...dn(t)});qN=class t extends An{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)!==yt.number){let i=this._getOrReturnCtx(e);return ut(i,{code:Ue.invalid_type,expected:yt.number,received:i.parsedType}),xr}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:Ue.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:Ue.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:Ue.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?jwr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Ue.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:Ue.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,Kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Kt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Kt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Kt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Kt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Kt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Kt.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)}};qN.create=t=>new qN({checks:[],typeName:re.ZodNumber,coerce:t?.coerce||!1,...dn(t)});HN=class t extends An{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)!==yt.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:Ue.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:Ue.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:Ue.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:Ue.invalid_type,expected:yt.bigint,received:r.parsedType}),xr}gte(e,r){return this.setLimit("min",e,!0,Kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Kt.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:Kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Kt.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}};HN.create=t=>new HN({checks:[],typeName:re.ZodBigInt,coerce:t?.coerce??!1,...dn(t)});VN=class extends An{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==yt.boolean){let n=this._getOrReturnCtx(e);return ut(n,{code:Ue.invalid_type,expected:yt.boolean,received:n.parsedType}),xr}return xf(e.data)}};VN.create=t=>new VN({typeName:re.ZodBoolean,coerce:t?.coerce||!1,...dn(t)});WN=class t extends An{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==yt.date){let i=this._getOrReturnCtx(e);return ut(i,{code:Ue.invalid_type,expected:yt.date,received:i.parsedType}),xr}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ut(i,{code:Ue.invalid_date}),xr}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:Ue.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:Ue.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:Kt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Kt.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}};WN.create=t=>new WN({checks:[],coerce:t?.coerce||!1,typeName:re.ZodDate,...dn(t)});cB=class extends An{_parse(e){if(this._getType(e)!==yt.symbol){let n=this._getOrReturnCtx(e);return ut(n,{code:Ue.invalid_type,expected:yt.symbol,received:n.parsedType}),xr}return xf(e.data)}};cB.create=t=>new cB({typeName:re.ZodSymbol,...dn(t)});KN=class extends An{_parse(e){if(this._getType(e)!==yt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Ue.invalid_type,expected:yt.undefined,received:n.parsedType}),xr}return xf(e.data)}};KN.create=t=>new KN({typeName:re.ZodUndefined,...dn(t)});GN=class extends An{_parse(e){if(this._getType(e)!==yt.null){let n=this._getOrReturnCtx(e);return ut(n,{code:Ue.invalid_type,expected:yt.null,received:n.parsedType}),xr}return xf(e.data)}};GN.create=t=>new GN({typeName:re.ZodNull,...dn(t)});NA=class extends An{constructor(){super(...arguments),this._any=!0}_parse(e){return xf(e.data)}};NA.create=t=>new NA({typeName:re.ZodAny,...dn(t)});uE=class extends An{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xf(e.data)}};uE.create=t=>new uE({typeName:re.ZodUnknown,...dn(t)});Tb=class extends An{_parse(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Ue.invalid_type,expected:yt.never,received:r.parsedType}),xr}};Tb.create=t=>new Tb({typeName:re.ZodNever,...dn(t)});dB=class extends An{_parse(e){if(this._getType(e)!==yt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Ue.invalid_type,expected:yt.void,received:n.parsedType}),xr}return xf(e.data)}};dB.create=t=>new dB({typeName:re.ZodVoid,...dn(t)});lE=class t extends An{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==yt.array)return ut(r,{code:Ue.invalid_type,expected:yt.array,received:r.parsedType}),xr;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?Ue.too_big:Ue.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:Ue.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:Ue.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 Dg(r,a,r.path,s)))).then(a=>vd.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Dg(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:Kt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Kt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Kt.toString(r)}})}nonempty(e){return this.min(1,e)}};lE.create=(t,e)=>new lE({type:t,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...dn(e)});mm=class t extends An{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)!==yt.object){let l=this._getOrReturnCtx(e);return ut(l,{code:Ue.invalid_type,expected:yt.object,received:l.parsedType}),xr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Tb&&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 Dg(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Tb){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:Ue.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 Dg(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 Kt.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:Kt.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 lB(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 pm;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return FGe(Gn.objectKeys(this.shape))}};mm.create=(t,e)=>new mm({shape:()=>t,unknownKeys:"strip",catchall:Tb.create(),typeName:re.ZodObject,...dn(e)});mm.strictCreate=(t,e)=>new mm({shape:()=>t,unknownKeys:"strict",catchall:Tb.create(),typeName:re.ZodObject,...dn(e)});mm.lazycreate=(t,e)=>new mm({shape:t,unknownKeys:"strip",catchall:Tb.create(),typeName:re.ZodObject,...dn(e)});JN=class extends An{_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 fm(s.ctx.common.issues));return ut(r,{code:Ue.invalid_union,unionErrors:a}),xr}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 fm(u));return ut(r,{code:Ue.invalid_union,unionErrors:s}),xr}}get options(){return this._def.options}};JN.create=(t,e)=>new JN({options:t,typeName:re.ZodUnion,...dn(e)});sE=t=>t instanceof YN?sE(t.schema):t instanceof Lg?sE(t.innerType()):t instanceof XN?[t.value]:t instanceof QN?t.options:t instanceof ej?Gn.objectValues(t.enum):t instanceof tj?sE(t._def.innerType):t instanceof KN?[void 0]:t instanceof GN?[null]:t instanceof pm?[void 0,...sE(t.unwrap())]:t instanceof bv?[null,...sE(t.unwrap())]:t instanceof n6||t instanceof nj?sE(t.unwrap()):t instanceof rj?sE(t._def.innerType):[],IX=class t extends An{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.object)return ut(r,{code:Ue.invalid_type,expected:yt.object,received:r.parsedType}),xr;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:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),xr)}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=sE(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,...dn(n)})}};ZN=class extends An{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(TX(i)||TX(a))return xr;let s=Owe(i.value,a.value);return s.valid?((AX(i)||AX(a))&&r.dirty(),{status:r.value,value:s.data}):(ut(n,{code:Ue.invalid_intersection_types}),xr)};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}))}};ZN.create=(t,e,r)=>new ZN({left:t,right:e,typeName:re.ZodIntersection,...dn(r)});yv=class t extends An{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yt.array)return ut(n,{code:Ue.invalid_type,expected:yt.array,received:n.parsedType}),xr;if(n.data.length<this._def.items.length)return ut(n,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),xr;!this._def.rest&&n.data.length>this._def.items.length&&(ut(n,{code:Ue.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 Dg(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})}};yv.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yv({items:t,typeName:re.ZodTuple,rest:null,...dn(e)})};MX=class t extends An{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!==yt.object)return ut(n,{code:Ue.invalid_type,expected:yt.object,received:n.parsedType}),xr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Dg(n,s,n.path,s)),value:a._parse(new Dg(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 An?new t({keyType:e,valueType:r,typeName:re.ZodRecord,...dn(n)}):new t({keyType:RA.create(),valueType:e,typeName:re.ZodRecord,...dn(r)})}},fB=class extends An{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!==yt.map)return ut(n,{code:Ue.invalid_type,expected:yt.map,received:n.parsedType}),xr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Dg(n,s,n.path,[l,"key"])),value:i._parse(new Dg(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 xr;(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 xr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};fB.create=(t,e,r)=>new fB({valueType:e,keyType:t,typeName:re.ZodMap,...dn(r)});pB=class t extends An{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yt.set)return ut(n,{code:Ue.invalid_type,expected:yt.set,received:n.parsedType}),xr;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ut(n,{code:Ue.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:Ue.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 xr;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 Dg(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:Kt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Kt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};pB.create=(t,e)=>new pB({valueType:t,minSize:null,maxSize:null,typeName:re.ZodSet,...dn(e)});RX=class t extends An{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.function)return ut(r,{code:Ue.invalid_type,expected:yt.function,received:r.parsedType}),xr;function n(s,u){return r6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,sB(),aE].filter(l=>!!l),issueData:{code:Ue.invalid_arguments,argumentsError:u}})}function o(s,u){return r6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,sB(),aE].filter(l=>!!l),issueData:{code:Ue.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof jA){let s=this;return xf(async function(...u){let l=new fm([]),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 xf(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new fm([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new fm([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:yv.create(e).rest(uE.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||yv.create([]).rest(uE.create()),returns:r||uE.create(),typeName:re.ZodFunction,...dn(n)})}},YN=class extends An{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})}};YN.create=(t,e)=>new YN({getter:t,typeName:re.ZodLazy,...dn(e)});XN=class extends An{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ut(r,{received:r.data,code:Ue.invalid_literal,expected:this._def.value}),xr}return{status:"valid",value:e.data}}get value(){return this._def.value}};XN.create=(t,e)=>new XN({value:t,typeName:re.ZodLiteral,...dn(e)});QN=class t extends An{_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:Ue.invalid_type}),xr}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:Ue.invalid_enum_value,options:n}),xr}return xf(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})}};QN.create=FGe;ej=class extends An{_parse(e){let r=Gn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==yt.string&&n.parsedType!==yt.number){let o=Gn.objectValues(r);return ut(n,{expected:Gn.joinValues(o),received:n.parsedType,code:Ue.invalid_type}),xr}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:Ue.invalid_enum_value,options:o}),xr}return xf(e.data)}get enum(){return this._def.values}};ej.create=(t,e)=>new ej({values:t,typeName:re.ZodNativeEnum,...dn(e)});jA=class extends An{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.promise&&r.common.async===!1)return ut(r,{code:Ue.invalid_type,expected:yt.promise,received:r.parsedType}),xr;let n=r.parsedType===yt.promise?r.data:Promise.resolve(r.data);return xf(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};jA.create=(t,e)=>new jA({type:t,typeName:re.ZodPromise,...dn(e)});Lg=class extends An{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 xr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?xr:u.status==="dirty"?UN(u.value):r.value==="dirty"?UN(u.value):u});{if(r.value==="aborted")return xr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?xr:s.status==="dirty"?UN(s.value):r.value==="dirty"?UN(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"?xr:(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"?xr:(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(!MA(a))return xr;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=>MA(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):xr);Gn.assertNever(o)}};Lg.create=(t,e,r)=>new Lg({schema:t,typeName:re.ZodEffects,effect:e,...dn(r)});Lg.createWithPreprocess=(t,e,r)=>new Lg({schema:e,effect:{type:"preprocess",transform:t},typeName:re.ZodEffects,...dn(r)});pm=class extends An{_parse(e){return this._getType(e)===yt.undefined?xf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pm.create=(t,e)=>new pm({innerType:t,typeName:re.ZodOptional,...dn(e)});bv=class extends An{_parse(e){return this._getType(e)===yt.null?xf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};bv.create=(t,e)=>new bv({innerType:t,typeName:re.ZodNullable,...dn(e)});tj=class extends An{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===yt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};tj.create=(t,e)=>new tj({innerType:t,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...dn(e)});rj=class extends An{_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 uB(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new fm(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new fm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};rj.create=(t,e)=>new rj({innerType:t,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...dn(e)});mB=class extends An{_parse(e){if(this._getType(e)!==yt.nan){let n=this._getOrReturnCtx(e);return ut(n,{code:Ue.invalid_type,expected:yt.nan,received:n.parsedType}),xr}return{status:"valid",value:e.data}}};mB.create=t=>new mB({typeName:re.ZodNaN,...dn(t)});Dwr=Symbol("zod_brand"),n6=class extends An{_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}},o6=class t extends An{_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"?xr:i.status==="dirty"?(r.dirty(),UN(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"?xr: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})}},nj=class extends An{_parse(e){let r=this._def.innerType._parse(e),n=o=>(MA(o)&&(o.value=Object.freeze(o.value)),o);return uB(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};nj.create=(t,e)=>new nj({innerType:t,typeName:re.ZodReadonly,...dn(e)});Lwr={object:mm.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={}));Fwr=(t,e={message:`Input not instance of ${t.name}`})=>kGe(r=>r instanceof t,e),$Ge=RA.create,BGe=qN.create,kwr=mB.create,$wr=HN.create,zGe=VN.create,Bwr=WN.create,zwr=cB.create,Uwr=KN.create,qwr=GN.create,Hwr=NA.create,Vwr=uE.create,Wwr=Tb.create,Kwr=dB.create,Gwr=lE.create,Jwr=mm.create,Zwr=mm.strictCreate,Ywr=JN.create,Xwr=IX.create,Qwr=ZN.create,e0r=yv.create,t0r=MX.create,r0r=fB.create,n0r=pB.create,o0r=RX.create,i0r=YN.create,a0r=XN.create,s0r=QN.create,u0r=ej.create,l0r=jA.create,c0r=Lg.create,d0r=pm.create,f0r=bv.create,p0r=Lg.createWithPreprocess,m0r=o6.create,h0r=()=>$Ge().optional(),g0r=()=>BGe().optional(),y0r=()=>zGe().optional(),b0r={string:t=>RA.create({...t,coerce:!0}),number:t=>qN.create({...t,coerce:!0}),boolean:t=>VN.create({...t,coerce:!0}),bigint:t=>HN.create({...t,coerce:!0}),date:t=>WN.create({...t,coerce:!0})},_0r=xr});var dt={};os(dt,{BRAND:()=>Dwr,DIRTY:()=>UN,EMPTY_PATH:()=>pwr,INVALID:()=>xr,NEVER:()=>_0r,OK:()=>xf,ParseStatus:()=>vd,Schema:()=>An,ZodAny:()=>NA,ZodArray:()=>lE,ZodBigInt:()=>HN,ZodBoolean:()=>VN,ZodBranded:()=>n6,ZodCatch:()=>rj,ZodDate:()=>WN,ZodDefault:()=>tj,ZodDiscriminatedUnion:()=>IX,ZodEffects:()=>Lg,ZodEnum:()=>QN,ZodError:()=>fm,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>RX,ZodIntersection:()=>ZN,ZodIssueCode:()=>Ue,ZodLazy:()=>YN,ZodLiteral:()=>XN,ZodMap:()=>fB,ZodNaN:()=>mB,ZodNativeEnum:()=>ej,ZodNever:()=>Tb,ZodNull:()=>GN,ZodNullable:()=>bv,ZodNumber:()=>qN,ZodObject:()=>mm,ZodOptional:()=>pm,ZodParsedType:()=>yt,ZodPipeline:()=>o6,ZodPromise:()=>jA,ZodReadonly:()=>nj,ZodRecord:()=>MX,ZodSchema:()=>An,ZodSet:()=>pB,ZodString:()=>RA,ZodSymbol:()=>cB,ZodTransformer:()=>Lg,ZodTuple:()=>yv,ZodType:()=>An,ZodUndefined:()=>KN,ZodUnion:()=>JN,ZodUnknown:()=>uE,ZodVoid:()=>dB,addIssueToContext:()=>ut,any:()=>Hwr,array:()=>Gwr,bigint:()=>$wr,boolean:()=>zGe,coerce:()=>b0r,custom:()=>kGe,date:()=>Bwr,datetimeRegex:()=>LGe,defaultErrorMap:()=>aE,discriminatedUnion:()=>Xwr,effect:()=>c0r,enum:()=>s0r,function:()=>o0r,getErrorMap:()=>sB,getParsedType:()=>gv,instanceof:()=>Fwr,intersection:()=>Qwr,isAborted:()=>TX,isAsync:()=>uB,isDirty:()=>AX,isValid:()=>MA,late:()=>Lwr,lazy:()=>i0r,literal:()=>a0r,makeIssue:()=>r6,map:()=>r0r,nan:()=>kwr,nativeEnum:()=>u0r,never:()=>Wwr,null:()=>qwr,nullable:()=>f0r,number:()=>BGe,object:()=>Jwr,objectUtil:()=>wwe,oboolean:()=>y0r,onumber:()=>g0r,optional:()=>d0r,ostring:()=>h0r,pipeline:()=>m0r,preprocess:()=>p0r,promise:()=>l0r,quotelessJson:()=>cwr,record:()=>t0r,set:()=>n0r,setErrorMap:()=>fwr,strictObject:()=>Zwr,string:()=>$Ge,symbol:()=>zwr,transformer:()=>c0r,tuple:()=>e0r,undefined:()=>Uwr,union:()=>Ywr,unknown:()=>Vwr,util:()=>Gn,void:()=>Kwr});var i6=b(()=>{PX();Swe();IGe();t6();UGe();EX()});var NX=b(()=>{i6();i6()});var HGe=x((wJn,qGe)=>{function Fg(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))}qGe.exports=Fg;Fg.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Fg.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Fg.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};Fg.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)};Fg.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Fg.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Fg.prototype.start=Fg.prototype.try;Fg.prototype.errors=function(){return this._errors};Fg.prototype.attempts=function(){return this._attempts};Fg.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 VGe=x(oj=>{var v0r=HGe();oj.operation=function(t){var e=oj.timeouts(t);return new v0r(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};oj.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};oj.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};oj.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=oj.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 KGe=x((SJn,WGe)=>{WGe.exports=VGe()});var LX=x((CJn,DX)=>{"use strict";var w0r=KGe(),x0r=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],jX=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}},S0r=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},C0r=t=>x0r.includes(t),GGe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=w0r.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 jX)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!C0r(a.message))o.stop(),n(a);else{S0r(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});DX.exports=GGe;DX.exports.default=GGe;DX.exports.AbortError=jX});var JGe,ZGe=b(()=>{JGe=/^(?:[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 O0r(t){return typeof t=="string"&&JGe.test(t)}var DA,Ewe=b(()=>{ZGe();DA=O0r});function E0r(t){if(!DA(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 YGe,XGe=b(()=>{Ewe();YGe=E0r});function kX(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,FX,Pwe=b(()=>{wd=[];for(FX=0;FX<256;++FX)wd.push((FX+256).toString(16).slice(1))});function Twe(){if(!$X&&($X=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$X))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $X(P0r)}var $X,P0r,QGe=b(()=>{P0r=new Uint8Array(16)});function T0r(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function Awe(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=T0r(o)),typeof i=="string"&&(i=YGe(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 kX(l)}try{n.name=t}catch{}return n.DNS=A0r,n.URL=I0r,n}var A0r,I0r,eJe=b(()=>{Pwe();XGe();A0r="6ba7b810-9dad-11d1-80b4-00c04fd430c8",I0r="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var M0r,Iwe,tJe=b(()=>{M0r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Iwe={randomUUID:M0r}});function R0r(t,e,r){if(Iwe.randomUUID&&!e&&!t)return Iwe.randomUUID();t=t||{};var n=t.random||(t.rng||Twe)();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 kX(n)}var Ms,rJe=b(()=>{tJe();QGe();Pwe();Ms=R0r});function N0r(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 Mwe(t,e){return t<<e|t>>>32-e}function j0r(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 h=16;h<80;++h)f[h]=Mwe(f[h-3]^f[h-8]^f[h-14]^f[h-16],1);for(var m=r[0],g=r[1],y=r[2],_=r[3],w=r[4],S=0;S<80;++S){var C=Math.floor(S/20),E=Mwe(m,5)+N0r(C,g,y,_)+w+e[C]+f[S]>>>0;w=_,_=y,y=Mwe(g,30)>>>0,g=m,m=E}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>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 nJe,oJe=b(()=>{nJe=j0r});var D0r,BX,iJe=b(()=>{eJe();oJe();D0r=Awe("v5",80,nJe),BX=D0r});var ij=b(()=>{rJe();iJe();Ewe()});function aJe(t=!1){let e=F0r.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 zX(t){return typeof t=="function"&&"langsmith:traceable"in t}var jwe,Nwe,L0r,Dwe,F0r,KJn,sJe=b(()=>{jwe=class{getStore(){}run(e,r){return r()}},Nwe=Symbol.for("ls:tracing_async_local_storage"),L0r=new jwe,Dwe=class{getInstance(){return globalThis[Nwe]??L0r}initializeGlobalInstance(e){globalThis[Nwe]===void 0&&(globalThis[Nwe]=e)}},F0r=new Dwe;KJn=Symbol.for("langsmith:traceable:root")});var Lwe=b(()=>{sJe()});function qX(t,e){return k0r.call(t,e)}function HX(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 Sf(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function VX(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 _v(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function a6(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function UX(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(UX(t[r]))return!0}else if(typeof t=="object"){let r=HX(t),n=r.length;for(var e=0;e<n;e++)if(UX(t[r[e]]))return!0}}return!1}function uJe(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 k0r,aj,s6=b(()=>{k0r=Object.prototype.hasOwnProperty;aj=class extends Error{constructor(e,r,n,o,i){super(uJe(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=uJe(e,{name:r,index:n,operation:o,tree:i})}}});var Fwe={};os(Fwe,{JsonPatchError:()=>Rs,_areEquals:()=>u6,applyOperation:()=>sj,applyPatch:()=>LA,applyReducer:()=>z0r,deepClone:()=>$0r,getValueByPointer:()=>WX,validate:()=>lJe,validator:()=>KX});function WX(t,e){if(e=="")return t;var r={op:"_get",path:e};return sj(t,r),r.value}function sj(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):KX(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=WX(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=u6(t,e.value),a.test===!1)throw new Rs("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 Rs("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Sf(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=KX;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=a6(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&&!VX(f))throw new Rs("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);VX(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Rs("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let h=B0r[e.op].call(e,u,f,t);if(h.test===!1)throw new Rs("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return h}}else if(l>=c){let h=hB[e.op].call(e,u,f,t);if(h.test===!1)throw new Rs("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return h}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Rs("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function LA(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Rs("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=Sf(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=sj(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function z0r(t,e,r){let n=sj(t,e);if(n.test===!1)throw new Rs("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function KX(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Rs("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(hB[t.op]){if(typeof t.path!="string")throw new Rs("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Rs('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 Rs("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 Rs("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")&&UX(t.value))throw new Rs("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 Rs("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 Rs("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=lJe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Rs("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Rs("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function lJe(t,e,r){try{if(!Array.isArray(t))throw new Rs("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)LA(Sf(e),Sf(t),r||!0);else{r=r||KX;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Rs)return o;throw o}}function u6(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(!u6(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],!u6(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var Rs,$0r,hB,B0r,GX=b(()=>{s6();Rs=aj,$0r=Sf,hB={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=WX(r,this.path);n&&(n=Sf(n));let o=sj(r,{op:"remove",path:this.from}).removed;return sj(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=WX(r,this.from);return sj(r,{op:"add",path:this.path,value:Sf(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:u6(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},B0r={add:function(t,e,r){return VX(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:hB.move,copy:hB.copy,test:hB.test,_get:hB._get}});function cJe(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=HX(e),a=HX(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)?cJe(d,f,r,n+"/"+_v(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+_v(c),value:Sf(d)}),r.push({op:"replace",path:n+"/"+_v(c),value:Sf(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+_v(c),value:Sf(d)}),r.push({op:"remove",path:n+"/"+_v(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+"/"+_v(c),value:Sf(e[c])})}}}function JX(t,e,r=!1){var n=[];return cJe(t,e,n,"",r),n}var dJe=b(()=>{s6();GX();});var n7n,kwe=b(()=>{GX();dJe();s6();GX();s6();n7n={...Fwe,JsonPatchError:aj,deepClone:Sf,escapePathComponent:_v,unescapePathComponent:a6}});var fJe,pJe,$we,mJe,Bwe,zwe,Uwe,hJe,gJe,yJe,bJe,_Je,vJe,wJe,xJe,SJe,CJe,OJe,EJe,PJe,TJe,AJe,IJe,MJe,RJe,NJe,jJe,DJe,LJe,FJe,qwe,kJe,$Je,BJe=b(()=>{fJe="gen_ai.operation.name",pJe="gen_ai.system",$we="gen_ai.request.model",mJe="gen_ai.response.model",Bwe="gen_ai.usage.input_tokens",zwe="gen_ai.usage.output_tokens",Uwe="gen_ai.usage.total_tokens",hJe="gen_ai.request.max_tokens",gJe="gen_ai.request.temperature",yJe="gen_ai.request.top_p",bJe="gen_ai.request.frequency_penalty",_Je="gen_ai.request.presence_penalty",vJe="gen_ai.response.finish_reasons",wJe="gen_ai.prompt",xJe="gen_ai.completion",SJe="gen_ai.request.extra_query",CJe="gen_ai.request.extra_body",OJe="gen_ai.serialized.name",EJe="gen_ai.serialized.signature",PJe="gen_ai.serialized.doc",TJe="gen_ai.response.id",AJe="gen_ai.response.service_tier",IJe="gen_ai.response.system_fingerprint",MJe="gen_ai.usage.input_token_details",RJe="gen_ai.usage.output_token_details",NJe="langsmith.trace.session_id",jJe="langsmith.trace.session_name",DJe="langsmith.span.kind",LJe="langsmith.trace.name",FJe="langsmith.metadata",qwe="langsmith.span.tags",kJe="langsmith.request.streaming",$Je="langsmith.request.headers"});var q0r,zJe,UJe,Jt,ZX=b(()=>{cE();q0r=(...t)=>fetch(...t),zJe=Symbol.for("ls:fetch_implementation"),UJe=()=>{let t=globalThis[zJe];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},Jt=t=>async(...e)=>{if(t||nc("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[zJe]??q0r)(...e);return(t||nc("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var l6,Hwe=b(()=>{cE();l6=()=>nc("PROJECT")??Oh("LANGCHAIN_SESSION")??"default"});var YX,XX=b(()=>{Vwe();Wwe();ZX();Hwe();YX="0.3.54"});function QX(){if(Kwe===void 0){let t=G0r(),e=Z0r();Kwe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:YX,...e}}return Kwe}function HJe(){let t=J0r()||{},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 J0r(){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 Oh(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function nc(t){return Oh(`LANGSMITH_${t}`)||Oh(`LANGCHAIN_${t}`)}function Z0r(){if(Gwe!==void 0)return Gwe;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=Oh(r);n!==void 0&&(e[r]=n)}return Gwe=e,e}function eQ(){return Oh("OTEL_ENABLED")==="true"||nc("OTEL_ENABLED")==="true"}var dE,H0r,V0r,W0r,qJe,K0r,G0r,Kwe,Gwe,cE=b(()=>{XX();H0r=()=>typeof window<"u"&&typeof window.document<"u",V0r=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",W0r=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),qJe=()=>typeof Deno<"u",K0r=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!qJe(),G0r=()=>dE||(H0r()?dE="browser":K0r()?dE="node":V0r()?dE="webworker":W0r()?dE="jsdom":qJe()?dE="deno":dE="other",dE)});function tQ(){return t0e.getTraceInstance()}function WJe(){return t0e.getContextInstance()}function KJe(){return t0e.getDefaultOTLPTracerComponents()}var Ywe,Xwe,Qwe,Jwe,Zwe,VJe,Y0r,X0r,e0e,t0e,r0e=b(()=>{cE();Ywe=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&eQ()&&(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()}},Xwe=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new Ywe})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},Qwe=class{active(){return{}}with(e,r){return r()}},Jwe=Symbol.for("ls:otel_trace"),Zwe=Symbol.for("ls:otel_context"),VJe=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),Y0r=new Xwe,X0r=new Qwe,e0e=class{getTraceInstance(){return globalThis[Jwe]??Y0r}getContextInstance(){return globalThis[Zwe]??X0r}initializeGlobalInstances(e){globalThis[Jwe]===void 0&&(globalThis[Jwe]=e.trace),globalThis[Zwe]===void 0&&(globalThis[Zwe]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[VJe]=e}getDefaultOTLPTracerComponents(){return globalThis[VJe]??void 0}},t0e=new e0e});function exr(t){return Q0r[t]||t}var Q0r,rQ,GJe=b(()=>{BJe();r0e();Q0r={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};rQ=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&&tQ().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(DJe,r.run_type);let s=exr(r.run_type||"chain");e.setAttribute(fJe,s)}"name"in r&&r.name&&e.setAttribute(LJe,r.name),"session_id"in r&&r.session_id&&e.setAttribute(NJe,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(jJe,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute($we,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(Bwe,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(zwe,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(Uwe,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${FJe}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(qwe,a.join(", ")):a&&e.setAttribute(qwe,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(OJe,String(s.name)),s.signature&&e.setAttribute(EJe,String(s.signature)),s.doc&&e.setAttribute(PJe,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(pJe,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(hJe,n.max_tokens),n.temperature!==void 0&&e.setAttribute(gJe,n.temperature),n.top_p!==void 0&&e.setAttribute(yJe,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(bJe,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(_Je,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($we,n.model),n.stream!==void 0&&e.setAttribute(kJe,n.stream),n.extra_headers&&e.setAttribute($Je,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(SJe,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(CJe,JSON.stringify(n.extra_body))),e.setAttribute(wJe,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(Bwe,o[0]),e.setAttribute(zwe,o[1]),e.setAttribute(Uwe,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(mJe,String(n.model)),n.id&&e.setAttribute(TJe,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(vJe,i.join(", "))}if(n.service_tier&&e.setAttribute(AJe,n.service_tier),n.system_fingerprint&&e.setAttribute(IJe,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(MJe,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(RJe,JSON.stringify(i.output_token_details))}}e.setAttribute(xJe,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 ZJe=x((C7n,n0e)=>{"use strict";var txr=Object.prototype.hasOwnProperty,_p="~";function c6(){}Object.create&&(c6.prototype=Object.create(null),new c6().__proto__||(_p=!1));function rxr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function JJe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new rxr(r,n||t,o),a=_p?_p+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 nQ(t,e){--t._eventsCount===0?t._events=new c6:delete t._events[e]}function Cf(){this._events=new c6,this._eventsCount=0}Cf.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)txr.call(r,n)&&e.push(_p?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Cf.prototype.listeners=function(e){var r=_p?_p+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};Cf.prototype.listenerCount=function(e){var r=_p?_p+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Cf.prototype.emit=function(e,r,n,o,i,a){var s=_p?_p+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};Cf.prototype.on=function(e,r,n){return JJe(this,e,r,n,!1)};Cf.prototype.once=function(e,r,n){return JJe(this,e,r,n,!0)};Cf.prototype.removeListener=function(e,r,n,o){var i=_p?_p+e:e;if(!this._events[i])return this;if(!r)return nQ(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&nQ(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:nQ(this,i)}return this};Cf.prototype.removeAllListeners=function(e){var r;return e?(r=_p?_p+e:e,this._events[r]&&nQ(this,r)):(this._events=new c6,this._eventsCount=0),this};Cf.prototype.off=Cf.prototype.removeListener;Cf.prototype.addListener=Cf.prototype.on;Cf.prefixed=_p;Cf.EventEmitter=Cf;typeof n0e<"u"&&(n0e.exports=Cf)});var XJe=x((O7n,YJe)=>{"use strict";YJe.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 e7e=x((E7n,iQ)=>{"use strict";var nxr=XJe(),oQ=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},QJe=(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 oQ(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);nxr(t.then(n,o),()=>{clearTimeout(i)})});iQ.exports=QJe;iQ.exports.default=QJe;iQ.exports.TimeoutError=oQ});var t7e=x(o0e=>{"use strict";Object.defineProperty(o0e,"__esModule",{value:!0});function oxr(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}o0e.default=oxr});var r7e=x(a0e=>{"use strict";Object.defineProperty(a0e,"__esModule",{value:!0});var ixr=t7e(),i0e=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=ixr.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}};a0e.default=i0e});var sQ=x(u0e=>{"use strict";Object.defineProperty(u0e,"__esModule",{value:!0});var axr=ZJe(),n7e=e7e(),sxr=r7e(),aQ=()=>{},uxr=new n7e.TimeoutError,s0e=class extends axr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=aQ,this._resolveIdle=aQ,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:sxr.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=aQ,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=aQ,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():n7e.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(uxr)});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}};u0e.default=s0e});var o7e,uQ,lxr,cxr,d6,i7e=b(()=>{o7e=j(LX(),1),uQ=j(sQ(),1);ZX();lxr=[400,401,403,404,405,406,407,408],cxr=[409],d6=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 uQ.default?this.queue=new uQ.default.default({concurrency:this.maxConcurrency}):this.queue=new uQ.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,o7e.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(lxr.includes(+a))throw o;if(cxr.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(()=>Jt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function l0e(t){return typeof t?._getType=="function"}function c0e(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 a7e=b(()=>{});function an(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 lQ(t){u7e[t]||(console.warn(t),u7e[t]=!0)}var u7e,d0e=b(()=>{u7e={}});var f6=x((D7n,l7e)=>{var fxr="2.0.0",pxr=Number.MAX_SAFE_INTEGER||9007199254740991,mxr=16,hxr=250,gxr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];l7e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:mxr,MAX_SAFE_BUILD_LENGTH:hxr,MAX_SAFE_INTEGER:pxr,RELEASE_TYPES:gxr,SEMVER_SPEC_VERSION:fxr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var p6=x((L7n,c7e)=>{var yxr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};c7e.exports=yxr});var gB=x((fE,d7e)=>{var{MAX_SAFE_COMPONENT_LENGTH:f0e,MAX_SAFE_BUILD_LENGTH:bxr,MAX_LENGTH:_xr}=f6(),vxr=p6();fE=d7e.exports={};var wxr=fE.re=[],xxr=fE.safeRe=[],Pt=fE.src=[],Tt=fE.t={},Sxr=0,p0e="[a-zA-Z0-9-]",Cxr=[["\\s",1],["\\d",_xr],[p0e,bxr]],Oxr=t=>{for(let[e,r]of Cxr)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},sn=(t,e,r)=>{let n=Oxr(e),o=Sxr++;vxr(t,o,e),Tt[t]=o,Pt[o]=e,wxr[o]=new RegExp(e,r?"g":void 0),xxr[o]=new RegExp(n,r?"g":void 0)};sn("NUMERICIDENTIFIER","0|[1-9]\\d*");sn("NUMERICIDENTIFIERLOOSE","\\d+");sn("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p0e}*`);sn("MAINVERSION",`(${Pt[Tt.NUMERICIDENTIFIER]})\\.(${Pt[Tt.NUMERICIDENTIFIER]})\\.(${Pt[Tt.NUMERICIDENTIFIER]})`);sn("MAINVERSIONLOOSE",`(${Pt[Tt.NUMERICIDENTIFIERLOOSE]})\\.(${Pt[Tt.NUMERICIDENTIFIERLOOSE]})\\.(${Pt[Tt.NUMERICIDENTIFIERLOOSE]})`);sn("PRERELEASEIDENTIFIER",`(?:${Pt[Tt.NUMERICIDENTIFIER]}|${Pt[Tt.NONNUMERICIDENTIFIER]})`);sn("PRERELEASEIDENTIFIERLOOSE",`(?:${Pt[Tt.NUMERICIDENTIFIERLOOSE]}|${Pt[Tt.NONNUMERICIDENTIFIER]})`);sn("PRERELEASE",`(?:-(${Pt[Tt.PRERELEASEIDENTIFIER]}(?:\\.${Pt[Tt.PRERELEASEIDENTIFIER]})*))`);sn("PRERELEASELOOSE",`(?:-?(${Pt[Tt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Pt[Tt.PRERELEASEIDENTIFIERLOOSE]})*))`);sn("BUILDIDENTIFIER",`${p0e}+`);sn("BUILD",`(?:\\+(${Pt[Tt.BUILDIDENTIFIER]}(?:\\.${Pt[Tt.BUILDIDENTIFIER]})*))`);sn("FULLPLAIN",`v?${Pt[Tt.MAINVERSION]}${Pt[Tt.PRERELEASE]}?${Pt[Tt.BUILD]}?`);sn("FULL",`^${Pt[Tt.FULLPLAIN]}$`);sn("LOOSEPLAIN",`[v=\\s]*${Pt[Tt.MAINVERSIONLOOSE]}${Pt[Tt.PRERELEASELOOSE]}?${Pt[Tt.BUILD]}?`);sn("LOOSE",`^${Pt[Tt.LOOSEPLAIN]}$`);sn("GTLT","((?:<|>)?=?)");sn("XRANGEIDENTIFIERLOOSE",`${Pt[Tt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);sn("XRANGEIDENTIFIER",`${Pt[Tt.NUMERICIDENTIFIER]}|x|X|\\*`);sn("XRANGEPLAIN",`[v=\\s]*(${Pt[Tt.XRANGEIDENTIFIER]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIER]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIER]})(?:${Pt[Tt.PRERELEASE]})?${Pt[Tt.BUILD]}?)?)?`);sn("XRANGEPLAINLOOSE",`[v=\\s]*(${Pt[Tt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Pt[Tt.XRANGEIDENTIFIERLOOSE]})(?:${Pt[Tt.PRERELEASELOOSE]})?${Pt[Tt.BUILD]}?)?)?`);sn("XRANGE",`^${Pt[Tt.GTLT]}\\s*${Pt[Tt.XRANGEPLAIN]}$`);sn("XRANGELOOSE",`^${Pt[Tt.GTLT]}\\s*${Pt[Tt.XRANGEPLAINLOOSE]}$`);sn("COERCEPLAIN",`(^|[^\\d])(\\d{1,${f0e}})(?:\\.(\\d{1,${f0e}}))?(?:\\.(\\d{1,${f0e}}))?`);sn("COERCE",`${Pt[Tt.COERCEPLAIN]}(?:$|[^\\d])`);sn("COERCEFULL",Pt[Tt.COERCEPLAIN]+`(?:${Pt[Tt.PRERELEASE]})?(?:${Pt[Tt.BUILD]})?(?:$|[^\\d])`);sn("COERCERTL",Pt[Tt.COERCE],!0);sn("COERCERTLFULL",Pt[Tt.COERCEFULL],!0);sn("LONETILDE","(?:~>?)");sn("TILDETRIM",`(\\s*)${Pt[Tt.LONETILDE]}\\s+`,!0);fE.tildeTrimReplace="$1~";sn("TILDE",`^${Pt[Tt.LONETILDE]}${Pt[Tt.XRANGEPLAIN]}$`);sn("TILDELOOSE",`^${Pt[Tt.LONETILDE]}${Pt[Tt.XRANGEPLAINLOOSE]}$`);sn("LONECARET","(?:\\^)");sn("CARETTRIM",`(\\s*)${Pt[Tt.LONECARET]}\\s+`,!0);fE.caretTrimReplace="$1^";sn("CARET",`^${Pt[Tt.LONECARET]}${Pt[Tt.XRANGEPLAIN]}$`);sn("CARETLOOSE",`^${Pt[Tt.LONECARET]}${Pt[Tt.XRANGEPLAINLOOSE]}$`);sn("COMPARATORLOOSE",`^${Pt[Tt.GTLT]}\\s*(${Pt[Tt.LOOSEPLAIN]})$|^$`);sn("COMPARATOR",`^${Pt[Tt.GTLT]}\\s*(${Pt[Tt.FULLPLAIN]})$|^$`);sn("COMPARATORTRIM",`(\\s*)${Pt[Tt.GTLT]}\\s*(${Pt[Tt.LOOSEPLAIN]}|${Pt[Tt.XRANGEPLAIN]})`,!0);fE.comparatorTrimReplace="$1$2$3";sn("HYPHENRANGE",`^\\s*(${Pt[Tt.XRANGEPLAIN]})\\s+-\\s+(${Pt[Tt.XRANGEPLAIN]})\\s*$`);sn("HYPHENRANGELOOSE",`^\\s*(${Pt[Tt.XRANGEPLAINLOOSE]})\\s+-\\s+(${Pt[Tt.XRANGEPLAINLOOSE]})\\s*$`);sn("STAR","(<|>)?=?\\s*\\*");sn("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");sn("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var cQ=x((F7n,f7e)=>{var Exr=Object.freeze({loose:!0}),Pxr=Object.freeze({}),Txr=t=>t?typeof t!="object"?Exr:t:Pxr;f7e.exports=Txr});var m0e=x((k7n,h7e)=>{var p7e=/^[0-9]+$/,m7e=(t,e)=>{let r=p7e.test(t),n=p7e.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Axr=(t,e)=>m7e(e,t);h7e.exports={compareIdentifiers:m7e,rcompareIdentifiers:Axr}});var Of=x(($7n,_7e)=>{var dQ=p6(),{MAX_LENGTH:g7e,MAX_SAFE_INTEGER:fQ}=f6(),{safeRe:y7e,t:b7e}=gB(),Ixr=cQ(),{compareIdentifiers:yB}=m0e(),h0e=class t{constructor(e,r){if(r=Ixr(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>g7e)throw new TypeError(`version is longer than ${g7e} characters`);dQ("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?y7e[b7e.LOOSE]:y7e[b7e.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>fQ||this.major<0)throw new TypeError("Invalid major version");if(this.minor>fQ||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>fQ||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<fQ)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(dQ("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)),yB(this.major,e.major)||yB(this.minor,e.minor)||yB(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(dQ("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 yB(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(dQ("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 yB(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]),yB(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}};_7e.exports=h0e});var lj=x((B7n,w7e)=>{var v7e=Of(),Mxr=(t,e,r=!1)=>{if(t instanceof v7e)return t;try{return new v7e(t,e)}catch(n){if(!r)return null;throw n}};w7e.exports=Mxr});var S7e=x((z7n,x7e)=>{var Rxr=lj(),Nxr=(t,e)=>{let r=Rxr(t,e);return r?r.version:null};x7e.exports=Nxr});var O7e=x((U7n,C7e)=>{var jxr=lj(),Dxr=(t,e)=>{let r=jxr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};C7e.exports=Dxr});var T7e=x((q7n,P7e)=>{var E7e=Of(),Lxr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new E7e(t instanceof E7e?t.version:t,r).inc(e,n,o).version}catch{return null}};P7e.exports=Lxr});var M7e=x((H7n,I7e)=>{var A7e=lj(),Fxr=(t,e)=>{let r=A7e(t,null,!0),n=A7e(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"};I7e.exports=Fxr});var N7e=x((V7n,R7e)=>{var kxr=Of(),$xr=(t,e)=>new kxr(t,e).major;R7e.exports=$xr});var D7e=x((W7n,j7e)=>{var Bxr=Of(),zxr=(t,e)=>new Bxr(t,e).minor;j7e.exports=zxr});var F7e=x((K7n,L7e)=>{var Uxr=Of(),qxr=(t,e)=>new Uxr(t,e).patch;L7e.exports=qxr});var $7e=x((G7n,k7e)=>{var Hxr=lj(),Vxr=(t,e)=>{let r=Hxr(t,e);return r&&r.prerelease.length?r.prerelease:null};k7e.exports=Vxr});var kg=x((J7n,z7e)=>{var B7e=Of(),Wxr=(t,e,r)=>new B7e(t,r).compare(new B7e(e,r));z7e.exports=Wxr});var q7e=x((Z7n,U7e)=>{var Kxr=kg(),Gxr=(t,e,r)=>Kxr(e,t,r);U7e.exports=Gxr});var V7e=x((Y7n,H7e)=>{var Jxr=kg(),Zxr=(t,e)=>Jxr(t,e,!0);H7e.exports=Zxr});var pQ=x((X7n,K7e)=>{var W7e=Of(),Yxr=(t,e,r)=>{let n=new W7e(t,r),o=new W7e(e,r);return n.compare(o)||n.compareBuild(o)};K7e.exports=Yxr});var J7e=x((Q7n,G7e)=>{var Xxr=pQ(),Qxr=(t,e)=>t.sort((r,n)=>Xxr(r,n,e));G7e.exports=Qxr});var Y7e=x((eZn,Z7e)=>{var eSr=pQ(),tSr=(t,e)=>t.sort((r,n)=>eSr(n,r,e));Z7e.exports=tSr});var m6=x((tZn,X7e)=>{var rSr=kg(),nSr=(t,e,r)=>rSr(t,e,r)>0;X7e.exports=nSr});var mQ=x((rZn,Q7e)=>{var oSr=kg(),iSr=(t,e,r)=>oSr(t,e,r)<0;Q7e.exports=iSr});var g0e=x((nZn,eZe)=>{var aSr=kg(),sSr=(t,e,r)=>aSr(t,e,r)===0;eZe.exports=sSr});var y0e=x((oZn,tZe)=>{var uSr=kg(),lSr=(t,e,r)=>uSr(t,e,r)!==0;tZe.exports=lSr});var hQ=x((iZn,rZe)=>{var cSr=kg(),dSr=(t,e,r)=>cSr(t,e,r)>=0;rZe.exports=dSr});var gQ=x((aZn,nZe)=>{var fSr=kg(),pSr=(t,e,r)=>fSr(t,e,r)<=0;nZe.exports=pSr});var b0e=x((sZn,oZe)=>{var mSr=g0e(),hSr=y0e(),gSr=m6(),ySr=hQ(),bSr=mQ(),_Sr=gQ(),vSr=(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 mSr(t,r,n);case"!=":return hSr(t,r,n);case">":return gSr(t,r,n);case">=":return ySr(t,r,n);case"<":return bSr(t,r,n);case"<=":return _Sr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};oZe.exports=vSr});var aZe=x((uZn,iZe)=>{var wSr=Of(),xSr=lj(),{safeRe:yQ,t:bQ}=gB(),SSr=(t,e)=>{if(t instanceof wSr)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?yQ[bQ.COERCEFULL]:yQ[bQ.COERCE]);else{let u=e.includePrerelease?yQ[bQ.COERCERTLFULL]:yQ[bQ.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 xSr(`${n}.${o}.${i}${a}${s}`,e)};iZe.exports=SSr});var uZe=x((lZn,sZe)=>{var _0e=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=_0e});var $g=x((cZn,fZe)=>{var CSr=/\s+/g,v0e=class t{constructor(e,r){if(r=ESr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof w0e)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(CSr," "),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=>!cZe(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&&NSr(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&&MSr)|(this.options.loose&&RSr))+":"+e,o=lZe.get(n);if(o)return o;let i=this.options.loose,a=i?hm[vp.HYPHENRANGELOOSE]:hm[vp.HYPHENRANGE];e=e.replace(a,qSr(this.options.includePrerelease)),_a("hyphen replace",e),e=e.replace(hm[vp.COMPARATORTRIM],TSr),_a("comparator trim",e),e=e.replace(hm[vp.TILDETRIM],ASr),_a("tilde trim",e),e=e.replace(hm[vp.CARETTRIM],ISr),_a("caret trim",e);let s=e.split(" ").map(d=>jSr(d,this.options)).join(" ").split(/\s+/).map(d=>USr(d,this.options));i&&(s=s.filter(d=>(_a("loose invalid filter",d,this.options),!!d.match(hm[vp.COMPARATORLOOSE])))),_a("range list",s);let u=new Map,l=s.map(d=>new w0e(d,this.options));for(let d of l){if(cZe(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return lZe.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>dZe(n,r)&&e.set.some(o=>dZe(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 PSr(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(HSr(this.set[r],e,this.options))return!0;return!1}};fZe.exports=v0e;var OSr=uZe(),lZe=new OSr,ESr=cQ(),w0e=h6(),_a=p6(),PSr=Of(),{safeRe:hm,t:vp,comparatorTrimReplace:TSr,tildeTrimReplace:ASr,caretTrimReplace:ISr}=gB(),{FLAG_INCLUDE_PRERELEASE:MSr,FLAG_LOOSE:RSr}=f6(),cZe=t=>t.value==="<0.0.0-0",NSr=t=>t.value==="",dZe=(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},jSr=(t,e)=>(_a("comp",t,e),t=FSr(t,e),_a("caret",t),t=DSr(t,e),_a("tildes",t),t=$Sr(t,e),_a("xrange",t),t=zSr(t,e),_a("stars",t),t),wp=t=>!t||t.toLowerCase()==="x"||t==="*",DSr=(t,e)=>t.trim().split(/\s+/).map(r=>LSr(r,e)).join(" "),LSr=(t,e)=>{let r=e.loose?hm[vp.TILDELOOSE]:hm[vp.TILDE];return t.replace(r,(n,o,i,a,s)=>{_a("tilde",t,n,o,i,a,s);let u;return wp(o)?u="":wp(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:wp(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(_a("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,_a("tilde return",u),u})},FSr=(t,e)=>t.trim().split(/\s+/).map(r=>kSr(r,e)).join(" "),kSr=(t,e)=>{_a("caret",t,e);let r=e.loose?hm[vp.CARETLOOSE]:hm[vp.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{_a("caret",t,o,i,a,s,u);let l;return wp(i)?l="":wp(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:wp(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(_a("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`):(_a("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`),_a("caret return",l),l})},$Sr=(t,e)=>(_a("replaceXRanges",t,e),t.split(/\s+/).map(r=>BSr(r,e)).join(" ")),BSr=(t,e)=>{t=t.trim();let r=e.loose?hm[vp.XRANGELOOSE]:hm[vp.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{_a("xRange",t,n,o,i,a,s,u);let l=wp(i),c=l||wp(a),d=c||wp(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`),_a("xRange return",n),n})},zSr=(t,e)=>(_a("replaceStars",t,e),t.trim().replace(hm[vp.STAR],"")),USr=(t,e)=>(_a("replaceGTE0",t,e),t.trim().replace(hm[e.includePrerelease?vp.GTE0PRE:vp.GTE0],"")),qSr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(wp(n)?r="":wp(o)?r=`>=${n}.0.0${t?"-0":""}`:wp(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,wp(l)?u="":wp(c)?u=`<${+l+1}.0.0-0`:wp(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()),HSr=(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(_a(t[n].semver),t[n].semver!==w0e.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 h6=x((dZn,bZe)=>{var g6=Symbol("SemVer ANY"),C0e=class t{static get ANY(){return g6}constructor(e,r){if(r=pZe(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),S0e("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===g6?this.value="":this.value=this.operator+this.semver.version,S0e("comp",this)}parse(e){let r=this.options.loose?mZe[hZe.COMPARATORLOOSE]:mZe[hZe.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 gZe(n[2],this.options.loose):this.semver=g6}toString(){return this.value}test(e){if(S0e("Comparator.test",e,this.options.loose),this.semver===g6||e===g6)return!0;if(typeof e=="string")try{e=new gZe(e,this.options)}catch{return!1}return x0e(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 yZe(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new yZe(this.value,r).test(e.semver):(r=pZe(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("=")||x0e(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||x0e(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};bZe.exports=C0e;var pZe=cQ(),{safeRe:mZe,t:hZe}=gB(),x0e=b0e(),S0e=p6(),gZe=Of(),yZe=$g()});var y6=x((fZn,_Ze)=>{var VSr=$g(),WSr=(t,e,r)=>{try{e=new VSr(e,r)}catch{return!1}return e.test(t)};_Ze.exports=WSr});var wZe=x((pZn,vZe)=>{var KSr=$g(),GSr=(t,e)=>new KSr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));vZe.exports=GSr});var SZe=x((mZn,xZe)=>{var JSr=Of(),ZSr=$g(),YSr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new ZSr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new JSr(n,r))}),n};xZe.exports=YSr});var OZe=x((hZn,CZe)=>{var XSr=Of(),QSr=$g(),eCr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new QSr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new XSr(n,r))}),n};CZe.exports=eCr});var TZe=x((gZn,PZe)=>{var O0e=Of(),tCr=$g(),EZe=m6(),rCr=(t,e)=>{t=new tCr(t,e);let r=new O0e("0.0.0");if(t.test(r)||(r=new O0e("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 O0e(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||EZe(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||EZe(r,i))&&(r=i)}return r&&t.test(r)?r:null};PZe.exports=rCr});var IZe=x((yZn,AZe)=>{var nCr=$g(),oCr=(t,e)=>{try{return new nCr(t,e).range||"*"}catch{return null}};AZe.exports=oCr});var _Q=x((bZn,jZe)=>{var iCr=Of(),NZe=h6(),{ANY:aCr}=NZe,sCr=$g(),uCr=y6(),MZe=m6(),RZe=mQ(),lCr=gQ(),cCr=hQ(),dCr=(t,e,r,n)=>{t=new iCr(t,n),e=new sCr(e,n);let o,i,a,s,u;switch(r){case">":o=MZe,i=lCr,a=RZe,s=">",u=">=";break;case"<":o=RZe,i=cCr,a=MZe,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(uCr(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===aCr&&(p=new NZe(">=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};jZe.exports=dCr});var LZe=x((_Zn,DZe)=>{var fCr=_Q(),pCr=(t,e,r)=>fCr(t,e,">",r);DZe.exports=pCr});var kZe=x((vZn,FZe)=>{var mCr=_Q(),hCr=(t,e,r)=>mCr(t,e,"<",r);FZe.exports=hCr});var zZe=x((wZn,BZe)=>{var $Ze=$g(),gCr=(t,e,r)=>(t=new $Ze(t,r),e=new $Ze(e,r),t.intersects(e,r));BZe.exports=gCr});var qZe=x((xZn,UZe)=>{var yCr=y6(),bCr=kg();UZe.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>bCr(c,d,r));for(let c of a)yCr(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 JZe=x((SZn,GZe)=>{var HZe=$g(),P0e=h6(),{ANY:E0e}=P0e,b6=y6(),T0e=kg(),_Cr=(t,e,r={})=>{if(t===e)return!0;t=new HZe(t,r),e=new HZe(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=wCr(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},vCr=[new P0e(">=0.0.0-0")],VZe=[new P0e(">=0.0.0")],wCr=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===E0e){if(e.length===1&&e[0].semver===E0e)return!0;r.includePrerelease?t=vCr:t=VZe}if(e.length===1&&e[0].semver===E0e){if(r.includePrerelease)return!0;e=VZe}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=WZe(o,p,r):p.operator==="<"||p.operator==="<="?i=KZe(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=T0e(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&&!b6(p,String(o),r)||i&&!b6(p,String(i),r))return null;for(let h of e)if(!b6(p,String(h),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=WZe(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!b6(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=KZe(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!b6(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)},WZe=(t,e,r)=>{if(!t)return e;let n=T0e(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},KZe=(t,e,r)=>{if(!t)return e;let n=T0e(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};GZe.exports=_Cr});var QZe=x((CZn,XZe)=>{var A0e=gB(),ZZe=f6(),xCr=Of(),YZe=m0e(),SCr=lj(),CCr=S7e(),OCr=O7e(),ECr=T7e(),PCr=M7e(),TCr=N7e(),ACr=D7e(),ICr=F7e(),MCr=$7e(),RCr=kg(),NCr=q7e(),jCr=V7e(),DCr=pQ(),LCr=J7e(),FCr=Y7e(),kCr=m6(),$Cr=mQ(),BCr=g0e(),zCr=y0e(),UCr=hQ(),qCr=gQ(),HCr=b0e(),VCr=aZe(),WCr=h6(),KCr=$g(),GCr=y6(),JCr=wZe(),ZCr=SZe(),YCr=OZe(),XCr=TZe(),QCr=IZe(),eOr=_Q(),tOr=LZe(),rOr=kZe(),nOr=zZe(),oOr=qZe(),iOr=JZe();XZe.exports={parse:SCr,valid:CCr,clean:OCr,inc:ECr,diff:PCr,major:TCr,minor:ACr,patch:ICr,prerelease:MCr,compare:RCr,rcompare:NCr,compareLoose:jCr,compareBuild:DCr,sort:LCr,rsort:FCr,gt:kCr,lt:$Cr,eq:BCr,neq:zCr,gte:UCr,lte:qCr,cmp:HCr,coerce:VCr,Comparator:WCr,Range:KCr,satisfies:GCr,toComparators:JCr,maxSatisfying:ZCr,minSatisfying:YCr,minVersion:XCr,validRange:QCr,outside:eOr,gtr:tOr,ltr:rOr,intersects:nOr,simplifyRange:oOr,subset:iOr,SemVer:xCr,re:A0e.re,src:A0e.src,tokens:A0e.t,SEMVER_SPEC_VERSION:ZZe.SEMVER_SPEC_VERSION,RELEASE_TYPES:ZZe.RELEASE_TYPES,compareIdentifiers:YZe.compareIdentifiers,rcompareIdentifiers:YZe.rcompareIdentifiers}});function pE(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 aOr,eYe=b(()=>{aOr=j(QZe(),1)});async function fn(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 I0e(o);let i=new Error(o);throw i.status=t.status,i}function rYe(t){return typeof t=="object"&&t!==null&&t.code===tYe}var I0e,tYe,vQ,M0e=b(()=>{I0e=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}};tYe="ERR_CONFLICTING_ENDPOINTS",vQ=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:tYe}),this.name="ConflictingEndpointsError"}}});function lOr(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function wQ(t){return uOr.encode(t)}function oYe(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 cOr(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return oYe(r)}}function gm(t,e,r,n,o){try{let i=JSON.stringify(t,cOr(r),n);return wQ(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
Context: ${e}`:""}`),wQ("[Unserializable]");nc("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
Context: ${e}`:""}`),typeof o>"u"&&(o=lOr()),N0e(t,"",0,[],void 0,0,o);let a;try{bB.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,dOr(r),n)}catch{return wQ("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;xQ.length!==0;){let s=xQ.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return wQ(a)}}function R0e(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),xQ.push([n,r,e,o])):bB.push([e,r,t]):(n[r]=t,xQ.push([n,r,e]))}function N0e(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){R0e(sOr,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){R0e(nYe,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){R0e(nYe,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)N0e(t[s],s,s,n,t,i,a);else{t=oYe(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];N0e(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(bB.length>0)for(var n=0;n<bB.length;n++){var o=bB[n];if(o[1]===e&&o[0]===r){r=o[2],bB.splice(n,1);break}}return t.call(this,e,r)}}var nYe,sOr,xQ,bB,uOr,iYe=b(()=>{cE();nYe="[...]",sOr={result:"[Circular]"},xQ=[],bB=[],uOr=new TextEncoder});function aYe(t){let e=QX(),r=HJe(),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 mOr(t){let e=[];for await(let r of t)e.push(r);return e}function j0e(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 lYe(t){return"dataset_id"in t||"dataset_name"in t}var fOr,pOr,hOr,D0e,gOr,yOr,uYe,uj,Vwe=b(()=>{ij();GJe();r0e();i7e();a7e();cE();XX();s7e();d0e();eYe();M0e();ZX();iYe();fOr=t=>{let e=t?.toString()??nc("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},pOr=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};hOr=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};D0e=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=gm(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())]}},gOr=20971520,yOr=2500,uYe="https://api.smith.langchain.com",uj=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 D0e}),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:Oh("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:Oh("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=fOr(e.tracingSamplingRate),this.apiUrl=j0e(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=j0e(e.apiKey??r.apiKey),this.webUrl=j0e(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new d6({...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 d6({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:hOr,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,eQ()&&(this.langSmithToOTELTranslator=new rQ)}static getDefaultClientConfig(){let e=nc("API_KEY"),r=nc("ENDPOINT")??uYe,n=nc("HIDE_INPUTS")==="true",o=nc("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:pOr(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/${YX}`};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(Jt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(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(Jt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(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(Jt(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??gOr}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=aYe(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(Jt(this.debug),`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(yOr),...this.fetchOptions});await fn(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=tQ(),r=WJe();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=aYe(i);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey);let s=await this.caller.call(Jt(this.debug),`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,body:gm(a,`Creating run with id: ${a.id}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(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(gm(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(Jt(this.debug),`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(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,h)=>(h.id&&(p[h.id]=h),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:h,outputs:m,events:g,attachments:y,..._}=p,w={inputs:h,outputs:m,events:g},S=gm(_,`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=gm(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=UJe(),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(Jt(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)!==uYe&&(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 fn(l,"ingest multipart runs",!0)}catch(l){console.warn(`${l.message.trim()}
Context: ${r}`)}}async updateRun(e,r,n){an(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(Jt(this.debug),`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,body:gm(r,`Serializing payload to update run with id: ${e}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(a,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){an(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:nc("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 mOr(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:h,traceFilter:m,treeFilter:g,limit:y,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:h,trace_filter:m,tree_filter:g,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:y,trace:i,select:_||C,is_root:l,order:w},P=0;for await(let T of this._getCursorPaginatedList("/runs/query",E))if(y){if(P>=y)break;if(T.length+P>y){yield*T.slice(0,y-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",h=`${this.apiUrl}${p}`;for(;;){let m={...d,offset:f},g=Object.fromEntries(Object.entries(m).filter(([C,E])=>E!==void 0)),y=await this.caller.call(Jt(),h,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(g),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(y,`Failed to fetch ${p}`);let _=await y.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:h,isRoot:m,dataSourceType:g}){let y=a||[];i&&(y=[...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:y,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:h,is_root:m,data_source_type:g}).filter(([E,P])=>P!==void 0));return await(await this.caller.call(Jt(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||Ms()};an(e);let i=await(await this.caller.call(Jt(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){an(e);let r=await this.caller.call(Jt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(r,"unshare run",!0)}async readRunSharedLink(e){an(e);let n=await(await this.caller.call(Jt(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 an(e),await(await this.caller.call(Jt(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),an(e);let o=await(await this.caller.call(Jt(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};an(e);let i=await(await this.caller.call(Jt(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){an(e);let r=await this.caller.call(Jt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(r,"unshare dataset",!0)}async readSharedDataset(e){return an(e),await(await this.caller.call(Jt(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(Jt(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(Jt(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 fn(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(Jt(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 fn(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)an(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(Jt(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)an(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,an(n);let o=await this.caller.call(Jt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(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(Jt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(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(Jt(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 fn(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)an(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;an(i);let a=await this.caller.call(Jt(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 fn(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;an(a);let s=await this.caller.call(Jt(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 fn(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)an(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Jt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(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),an(o);let i={tag:n},a=await this.caller.call(Jt(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 fn(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),an(r);let a=await this.caller.call(Jt(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 fn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(lYe(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;lYe(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]??Ms())}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,h=f;if(p===void 0&&h===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&h!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:h})).id);let m=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]})),g=await this._uploadExamplesMultipart(p,m);return await Promise.all(g.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=>l0e(a)?c0e(a):a),i=l0e(r)?c0e(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){an(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}),h=o?typeof o=="string"?o:o?.toISOString():void 0;h&&p.append("as_of",h);let m=a??!0;if(p.append("inline_s3_urls",m.toString()),n!==void 0)for(let y of n)p.append("id",y);if(i!==void 0)for(let y of i)p.append("splits",y);if(s!==void 0){let y=JSON.stringify(s);p.append("metadata",y)}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(y=>p.append("select",y));let g=0;for await(let y of this._getPaginated("/examples",p)){for(let _ of y){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,g++}if(u!==void 0&&g>=u)break}}async deleteExample(e){an(e);let r=`/examples/${e}`,n=await this.caller.call(Jt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,an(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,an(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(Jt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(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,an(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,an(a);let s={split_name:n,examples:o.map(l=>(an(l),l)),remove:i},u=await this.caller.call(Jt(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 fn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){lQ("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 h={type:u??"api",metadata:s??{}};l!==void 0&&h?.metadata!==void 0&&!h.metadata.__run&&(h.metadata.__run={run_id:l}),h?.metadata!==void 0&&h.metadata.__run?.run_id!==void 0&&an(h.metadata.__run.run_id);let m={id:c??Ms(),run_id:e,key:r,score:sYe(n),value:o,correction:i,comment:a,feedback_source:h,comparative_experiment_id:p,feedbackConfig:d,session_id:f},g=`${this.apiUrl}/feedback`,y=await this.caller.call(Jt(this.debug),g,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(m),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(y,"create feedback",!0),m}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),an(e);let s=await this.caller.call(Jt(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 fn(s,"update feedback",!0)}async readFeedback(e){an(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){an(e);let r=`/feedback/${e}`,n=await this.caller.call(Jt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(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(Jt(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(Jt(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){an(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)=>{an(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||Ms(),rubric_instructions:i},s=await this.caller.call(Jt(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 fn(s,"create annotation queue"),await s.json()}async readAnnotationQueue(e){let r=await this.caller.call(Jt(this.debug),`${this.apiUrl}/annotation-queues/${an(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(r,"read annotation queue"),await r.json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,a=await this.caller.call(Jt(this.debug),`${this.apiUrl}/annotation-queues/${an(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 fn(a,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Jt(this.debug),`${this.apiUrl}/annotation-queues/${an(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Jt(this.debug),`${this.apiUrl}/annotation-queues/${an(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>an(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${an(e,"queueId")}/run`,o=await this.caller.call(Jt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Jt(this.debug),`${this.apiUrl}/annotation-queues/${an(e,"queueId")}/runs/${an(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await fn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Jt(this.debug),`${this.apiUrl}/annotation-queues/${an(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await fn(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(Jt(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]=pE(e),a=await this.caller.call(Jt(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 fn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=pE(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]=pE(e),i=await this.caller.call(Jt(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 fn(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]=pE(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(Jt(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 fn(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]=pE(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(Jt(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 fn(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=gm(l,`Serializing body for example with id: ${u}`),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=gm(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=gm(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 h,m;Array.isArray(p)?[h,m]=p:(h=p.mimeType,m=p.data);let g=new Blob([m],{type:`${h}; length=${m.byteLength}`});n.append(`${u}.attachment.${f}`,g)}if(s.attachments_operations){let f=gm(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(Jt(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??Ms()).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=gm(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=gm(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=gm(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,h;Array.isArray(f)?[p,h]=f:(p=f.mimeType,h=f.data);let m=new Blob([h],{type:`${p}; length=${h.byteLength}`});n.append(`${s}.attachment.${d}`,m)}}let o=await this.caller.call(Jt(this.debug),`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,body:n});return await fn(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]=pE(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(Jt(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 fn(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]=pE(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Jt(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]=pE(e),a=await this.caller.call(Jt(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 fn(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 an(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 KJe()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var cYe,dYe=b(()=>{cE();cYe=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>nc(r)==="true")});var SQ,fYe=b(()=>{SQ=Symbol.for("lc:context_variables")});function bOr(t){return t.replace(/[-:.]/g,"")}function L0e(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:bOr(o)+e,microsecondPrecisionDatestring:o}}function mYe(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function hYe(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function pYe(t){return Array.isArray(t)&&t.some(e=>hYe(e))}function _Or(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function vOr(t){return t!==void 0&&typeof t.callbacks=="object"&&(pYe(t.callbacks?.handlers)||pYe(t.callbacks))}function wOr(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 xOr(){let t=Oh("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){COr(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(rYe(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 SOr(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):xOr()}function COr(t){if(Object.keys(t).length>0&&nc("ENDPOINT"))throw new vQ}var CQ,Ab,Wwe=b(()=>{ij();Vwe();dYe();M0e();fYe();cE();Hwe();cE();d0e();CQ=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(",")}},Ab=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}),mYe(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=SOr(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}=L0e(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:Ms(),run_type:"chain",project_name:l6(),child_runs:[],api_url:Oh("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Oh("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new uj),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});SQ in this&&(n[SQ]=this[SQ]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(vOr(i)){let u={...i},l=_Or(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(hYe)?.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=>BX(`${d}:${e}`,BX.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=wOr(o.dotted_order),f=[];for(let h=0;h<d.length-1;h++){let[m,g]=d[h],y=i(g);f.push(m.toISOString().replace(/[-:]/g,"").replace(".","")+y)}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=QX();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){lQ("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=cYe();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=CQ.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 CQ(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(Ab,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var OQ=b(()=>{Wwe()});var yYe=x((rYn,gYe)=>{"use strict";gYe.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 CYe=x((nYn,F0e)=>{"use strict";var OOr=/[\p{Lu}]/u,EOr=/[\p{Ll}]/u,bYe=/^[\p{Lu}](?![\p{Lu}])/gu,wYe=/([\p{Alpha}\p{N}_]|$)/u,xYe=/[_.\- ]+/,POr=new RegExp("^"+xYe.source),_Ye=new RegExp(xYe.source+wYe.source,"gu"),vYe=new RegExp("\\d+"+wYe.source,"gu"),TOr=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&OOr.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&EOr.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},AOr=(t,e)=>(bYe.lastIndex=0,t.replace(bYe,r=>e(r))),IOr=(t,e)=>(_Ye.lastIndex=0,vYe.lastIndex=0,t.replace(_Ye,(r,n)=>e(n)).replace(vYe,r=>e(r))),SYe=(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=TOr(t,r,n)),t=t.replace(POr,""),e.preserveConsecutiveUppercase?t=AOr(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),IOr(t,n))};F0e.exports=SYe;F0e.exports.default=SYe});function EYe(t,e){return e?.[t]||(0,OYe.default)(t)}function PYe(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var OYe,MOr,TYe=b(()=>{OYe=j(yYe(),1),MOr=j(CYe(),1)});function AYe(t){return Array.isArray(t)?[...t]:{...t}}function ROr(t,e){let r=AYe(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]=AYe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function k0e(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 ym,cj=b(()=>{TYe();ym=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,k0e(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:PYe(Object.keys(r).length?ROr(n,r):n,EYe,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function IYe(){return $0e===void 0&&($0e={library:"langchain-js",runtime:EQ()}),$0e}function lt(t){try{return typeof process<"u"?process.env?.[t]:B0e()?Deno?.env.get(t):void 0}catch{return}}var NOr,jOr,DOr,B0e,LOr,EQ,$0e,dj=b(()=>{NOr=()=>typeof window<"u"&&typeof window.document<"u",jOr=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",DOr=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),B0e=()=>typeof Deno<"u",LOr=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!B0e(),EQ=()=>{let t;return NOr()?t="browser":LOr()?t="node":jOr()?t="webworker":DOr()?t="jsdom":B0e()?t="deno":t="other",t}});function U0e(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var z0e,fj,MYe,_6=b(()=>{ij();cj();dj();z0e=class{};fj=class t extends z0e{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,k0e(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 ym.prototype.toJSON.call(this)}toJSONNotImplemented(){return ym.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Ms()}),Object.assign(this,e)}}return new r}},MYe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function H0e(t,e){if(t)return new Ab({...t,start_time:t._serialized_start_time??t.start_time,parent_run:H0e(e),child_runs:t.child_runs.map(r=>H0e(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:IYe()},tracingEnabled:!1})}function q0e(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function _B(t){return typeof t._addRunToRunMap=="function"}var FOr,Bg,pj=b(()=>{OQ();_6();dj();FOr=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};Bg=class extends fj{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?FOr(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}=L0e(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=H0e(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=q0e(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=q0e(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=q0e(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 DYe=x((hYn,jYe)=>{"use strict";var RYe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,NYe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function kOr(){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=RYe(),e.color.ansi16m=NYe(),e.bgColor.ansi256=RYe(10),e.bgColor.ansi16m=NYe(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(jYe,"exports",{enumerable:!0,get:kOr})});function xp(t,e){return`${t.open}${e}${t.close}`}function zg(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function LYe(t){return typeof t=="string"?t.trim():t==null?t:zg(t,t.toString())}function FA(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 V0e,bm,v6,FYe=b(()=>{V0e=j(DYe(),1);pj();({color:bm}=V0e.default),v6=class extends Bg{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?xp(V0e.default.bold,s):s}).join(" > ");return xp(bm.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.green,"[chain/start]")} [${r}] Entering Chain run with input: ${zg(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.cyan,"[chain/end]")} [${r}] [${FA(e)}] Exiting Chain run with output: ${zg(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.red,"[chain/error]")} [${r}] [${FA(e)}] Chain run errored with error: ${zg(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(`${xp(bm.green,"[llm/start]")} [${r}] Entering LLM run with input: ${zg(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.cyan,"[llm/end]")} [${r}] [${FA(e)}] Exiting LLM run with output: ${zg(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.red,"[llm/error]")} [${r}] [${FA(e)}] LLM run errored with error: ${zg(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.green,"[tool/start]")} [${r}] Entering Tool run with input: "${LYe(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.cyan,"[tool/end]")} [${r}] [${FA(e)}] Exiting Tool run with output: "${LYe(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.red,"[tool/error]")} [${r}] [${FA(e)}] Tool run errored with error: ${zg(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${zg(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.cyan,"[retriever/end]")} [${r}] [${FA(e)}] Exiting Retriever run with output: ${zg(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${xp(bm.red,"[retriever/error]")} [${r}] [${FA(e)}] Retriever run errored with error: ${zg(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${xp(bm.blue,"[agent/action]")} [${n}] Agent selected action: ${zg(r.actions[r.actions.length-1],"[action]")}`)}}});function kA(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var w6=b(()=>{});function $A(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function kYe(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 mj,PQ=b(()=>{mj=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 W0e(t,e=vB){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 vB(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 K0e=b(()=>{});function Ib(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 $Ye(t){return Ib(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function BYe(t){return Ib(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function zYe(t){if(Ib(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 G0e(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 wB({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 x6(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 J0e=b(()=>{});function Ug(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>Ib(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?S6(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Ib(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function UYe(t,e){return t==="error"||e==="error"?"error":"success"}function $Or(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 Zs(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]=Zs(r[n],o);else if(Array.isArray(r[n]))r[n]=S6(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 S6(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]=Zs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function qYe(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 S6(t,e);if(typeof t=="object"&&typeof e=="object")return Zs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function HYe(t){return typeof t.role=="string"}function qg(t){return typeof t?._getType=="function"}function Z0e(t){return qg(t)&&typeof t.concat=="function"}var oc,_m,Hg=b(()=>{cj();J0e();oc=class extends ym{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=$Or(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};_m=class extends oc{}});function VYe(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function WYe(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 mE,Vg,xB=b(()=>{Hg();mE=class extends oc{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}}},Vg=class t extends _m{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:Ug(this.content,e.content),additional_kwargs:Zs(this.additional_kwargs,e.additional_kwargs),response_metadata:Zs(this.response_metadata,e.response_metadata),artifact:qYe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:UYe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Wi(t){return t._getType()==="ai"}function Y0e(t){return t._getType()==="ai"}var kn,Sr,hj=b(()=>{K0e();Hg();xB();kn=class extends oc{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]=WYe(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}}};Sr=class t extends _m{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=vB(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:Ug(this.content,e.content),additional_kwargs:Zs(this.additional_kwargs,e.additional_kwargs),response_metadata:Zs(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=S6(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 Ys,Sp,TQ=b(()=>{Hg();Ys=class t extends oc{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}}},Sp=class t extends _m{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:Ug(this.content,e.content),additional_kwargs:Zs(this.additional_kwargs,e.additional_kwargs),response_metadata:Zs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var Eh,AQ=b(()=>{Hg();Eh=class t extends _m{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Ug(this.content,e.content),additional_kwargs:Zs(this.additional_kwargs,e.additional_kwargs),response_metadata:Zs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Xs,Cp,C6=b(()=>{Hg();Xs=class extends oc{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},Cp=class t extends _m{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:Ug(this.content,e.content),additional_kwargs:Zs(this.additional_kwargs,e.additional_kwargs),response_metadata:Zs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var hE,Ef,IQ=b(()=>{Hg();hE=class extends oc{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},Ef=class t extends _m{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:Ug(this.content,e.content),additional_kwargs:Zs(this.additional_kwargs,e.additional_kwargs),response_metadata:Zs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function zOr(t){return $A(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 UOr(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function X0e(t){let e,r;if(UOr(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 Xs(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new kn(r);let i=n.map(zOr);return new kn({...o,tool_calls:i})}else{if(e==="system")return new hE(r);if(e==="developer")return new hE({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new mE({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw kA(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 Mb(t){if(typeof t=="string")return new Xs(t);if(qg(t))return t;if(Array.isArray(t)){let[e,r]=t;return X0e({type:e,content:r})}else if(HYe(t)){let{role:e,...r}=t;return X0e({...r,type:e})}else return X0e(t)}function Op(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 Q0e(t){let e=t._getType();if(e==="human")return new Cp({...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 Sr({...r})}else{if(e==="system")return new Ef({...t});if(e==="function")return new Eh({...t});if(Ys.isInstance(t))return new Sp({...t});throw new Error("Unknown message type.")}}var BA=b(()=>{w6();PQ();hj();Hg();TQ();AQ();C6();IQ();xB()});var MQ=b(()=>{XX()});var exe,txe,rxe=b(()=>{MQ();dj();txe=()=>{if(exe===void 0){let t=lt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};exe=new uj(t)}return exe}});var SB,KYe=b(()=>{MQ();OQ();Lwe();pj();rxe();SB=class t extends Bg{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??l6(),this.replicas=i,this.exampleId=r,this.client=o??txe();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 Ab({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return aJe(!0)}catch{return}}}});var GYe,gj,JYe,zA,O6=b(()=>{GYe=Symbol.for("ls:tracing_async_local_storage"),gj=Symbol.for("lc:context_variables"),JYe=t=>{globalThis[GYe]=t},zA=()=>globalThis[GYe]});function qOr(){let t="default"in RQ.default?RQ.default.default:RQ.default;return new t({autoStart:!0,concurrency:1})}function HOr(){return typeof E6>"u"&&(E6=qOr()),E6}async function Qs(t,e){if(e===!0){let r=zA();r!==void 0?await r.run(void 0,async()=>t()):await t()}else E6=HOr(),E6.add(async()=>{let r=zA();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var RQ,E6,ZYe=b(()=>{RQ=j(sQ(),1);O6();rxe()});var YYe=b(()=>{ZYe()});var XYe,QYe=b(()=>{dj();XYe=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>lt(r)==="true")});function nxe(t){let e=zA();return e===void 0?void 0:e.getStore()?.[gj]?.[t]}var VOr,eXe,tXe=b(()=>{OQ();O6();VOr=Symbol("lc:configure_hooks"),eXe=()=>nxe(VOr)||[]});function T6(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function P6(t){return"name"in t?t:fj.fromMethods(t)}var oxe,CB,ixe,NQ,axe,sxe,gu,UA=b(()=>{ij();_6();FYe();BA();dj();KYe();YYe();QYe();pj();tXe();oxe=class{setHandler(e){return this.setHandlers([e])}},CB=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=>Qs(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=>Qs(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)))}},ixe=class extends CB{getChild(e){let r=new gu(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=>Qs(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=>Qs(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)))}},NQ=class extends CB{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>Qs(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=>Qs(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=>Qs(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)))}},axe=class extends CB{getChild(e){let r=new gu(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=>Qs(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=>Qs(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=>Qs(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=>Qs(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)))}},sxe=class extends CB{getChild(e){let r=new gu(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=>Qs(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=>Qs(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)))}},gu=class t extends oxe{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:Ms();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return _B(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Qs(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 NQ(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:Ms();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return _B(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Qs(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=Op(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 NQ(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Ms(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return _B(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),Qs(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 axe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Ms(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return _B(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Qs(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 sxe(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Ms(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return _B(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Qs(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 ixe(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=>Qs(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 fj{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Ms()}),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(P6)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(P6):r?.handlers,!1));let l=lt("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=SB.getTraceableRunTree()?.tracingEnabled||XYe(),d=c||(lt("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===v6.prototype.name)){let f=new v6;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new SB;u.addHandler(f,!0),u._parentRunId=SB.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:h,envVar:m}of eXe()){let g=m&&lt(m)==="true"&&h,y,_=f!==void 0?nxe(f):void 0;_&&MYe(_)?y=_:g&&(y=new h({})),y!==void 0&&(u||(u=new t),u.handlers.some(w=>w.name===y.name)||u.addHandler(y,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var jQ,WOr,rXe,uxe,Ep,nXe=b(()=>{MQ();O6();UA();jQ=class{getStore(){}run(e,r){return r()}enterWith(e){}},WOr=new jQ,rXe=Symbol.for("lc:child_config"),uxe=class{getInstance(){return zA()??WOr}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[rXe]}runWithConfig(e,r,n){let o=gu._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 Ab({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[rXe]:e}),a!==void 0&&a[gj]!==void 0&&(l===void 0&&(l={}),l[gj]=a[gj]),i.run(l,r)}initializeGlobalInstance(e){zA()===void 0&&JYe(e)}},Ep=new uxe});var yj=b(()=>{nXe();O6()});async function vm(t){return gu._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function OB(...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(P6(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(P6(s),!0);e.callbacks=a}else e.callbacks=new gu(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 In(t){let e=Ep.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))KOr.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 eu(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=In(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 Wg(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 DQ,KOr,vv=b(()=>{UA();yj();DQ=25;KOr=new Set(["string","number","boolean"])});async function wv(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 lxe=b(()=>{});function cxe(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 jc(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]=jc(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function oXe(t,e,r,n,...o){let i=new gE({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Pf,gE,xv=b(()=>{vv();yj();lxe();Pf=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)}})}};gE=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)=>{Ep.runWithConfig(Wg(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?Ep.runWithConfig(Wg(this.config),this.signal?async()=>wv(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 iXe(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 aXe(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 GOr(t){return t!==void 0&&t.message!==void 0}var Rb,A6,sXe,I6,uXe=b(()=>{kwe();pj();xv();hj();Rb=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=LA({},r);return new A6({ops:r,state:n[n.length-1].newDocument})}},A6=class t extends Rb{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=LA(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=LA({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},sXe=t=>t.name==="log_stream_tracer";I6=class extends Bg{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=Pf.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 Rb({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 Rb({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 iXe(e,this._schemaFormat)),await this.writer.write(new Rb({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 iXe(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await aXe(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 Rb({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new Rb({ops:[{op:"replace",path:"/final_output",value:await aXe(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?GOr(n?.chunk)?a=n?.chunk:a=new Sr({id:`run-${e.id}`,content:r}):a=r;let s=new Rb({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 M6,wm,co,EB=b(()=>{M6="__run",wm=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 wm{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 LQ({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 lXe,FQ,cXe=b(()=>{pj();xv();hj();EB();lXe=t=>t.name==="event_stream_tracer",FQ=class extends Bg{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=Pf.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 wm({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=LQ(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 Sr({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 wm({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=LQ(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=LQ(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=LQ(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 dXe,kQ,JOr,ZOr,Ph,PB=b(()=>{dXe=j(LX(),1),kQ=j(sQ(),1),JOr=[400,401,402,403,404,405,406,407,409],ZOr=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&&JOr.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Ph=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??ZOr;let r="default"in kQ.default?kQ.default.default:kQ.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,dXe.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 R6,fXe=b(()=>{pj();R6=class extends Bg{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 N6(t){return t?t.lc_runnable:!1}var $Q,dxe=b(()=>{$Q=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 fxe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function XOr(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function pXe(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",h={[p]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[m,g]of Object.entries(t)){let y=g.name.split(":").pop()??"",w=YOr.some(C=>y.startsWith(C)&&y.endsWith(C))?`<p>${y}</p>`:y;Object.keys(g.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(g.metadata??{}).map(([C,E])=>`${C} = ${E}`).join(`
`)}</em></small>`);let S=(h[m]??h[p]).replace("{0}",fxe(m)).replace("{1}",w);l+=` ${S}
`}}let c={};for(let p of e){let h=p.source.split(":"),m=p.target.split(":"),g=h.filter((y,_)=>y===m[_]).join(":");c[g]||(c[g]=[]),c[g].push(p)}let d=new Set;function f(p,h){let m=p.length===1&&p[0].source===p[0].target;if(h&&!m){let g=h.split(":").pop();if(d.has(g))throw new Error(`Found duplicate subgraph '${g}' -- 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(g),l+=` subgraph ${g}
`}for(let g of p){let{source:y,target:_,data:w,conditional:S}=g,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+=` ${fxe(y)}${C}${fxe(_)};
`}for(let g in c)g.startsWith(`${h}:`)&&g!==h&&f(c[g],g);h&&!m&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=XOr(i??{})),l}async function mXe(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 YOr,hXe=b(()=>{YOr=["*","_","`"]});function TB(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 AB(t){return t&&Object.assign(pxe,t),pxe}var aQn,sQn,qA,pxe,j6=b(()=>{aQn=Object.freeze({status:"aborted"});sQn=Symbol("zod_brand"),qA=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},pxe={}});function mxe(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 yXe(t,e){return typeof e=="bigint"?e.toString():e}function bXe(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function IB(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function _Xe(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 zQ(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function BQ(t){return typeof t=="string"?t:t?.message}function MB(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=BQ(t.inst?._zod.def?.error?.(t))??BQ(e?.error?.(t))??BQ(r.customError?.(t))??BQ(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}var hxe,QOr,uQn,HA=b(()=>{hxe=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{},QOr=bXe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});uQn={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 vXe,wXe,D6,gxe=b(()=>{j6();HA();vXe=(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,yXe,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},wXe=TB("$ZodError",vXe),D6=TB("$ZodError",vXe,{Parent:Error})});var tEr,UQ,rEr,xXe,nEr,SXe,oEr,CXe,yxe=b(()=>{j6();gxe();HA();tEr=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 qA;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>MB(u,i,AB())));throw hxe(s,o?.callee),s}return a.value},UQ=tEr(D6),rEr=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=>MB(u,i,AB())));throw hxe(s,o?.callee),s}return a.value},xXe=rEr(D6),nEr=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 qA;return i.issues.length?{success:!1,error:new(t??wXe)(i.issues.map(a=>MB(a,o,AB())))}:{success:!0,data:i.value}},SXe=nEr(D6),oEr=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=>MB(a,o,AB())))}:{success:!0,data:i.value}},CXe=oEr(D6)});var iEr,dQn,OXe=b(()=>{iEr="(?:(?:\\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])))",dQn=new RegExp(`^${iEr}$`)});var EXe=b(()=>{});var PXe=b(()=>{});var TXe,bxe=b(()=>{TXe={major:4,minor:0,patch:0}});var sEr,AXe,IXe=b(()=>{j6();yxe();HA();bxe();HA();sEr=TB("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=TXe;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=zQ(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 qA;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=zQ(i,d)))});else{if(i.issues.length===d)continue;u||(u=zQ(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 qA;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=SXe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return CXe(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),AXe=TB("$ZodNever",(t,e)=>{sEr.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)})});var MXe=b(()=>{});function lEr(){return new L6}var IQn,MQn,L6,Sv,_xe=b(()=>{IQn=Symbol("ZodOutput"),MQn=Symbol("ZodInput"),L6=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)}};Sv=lEr()});function RXe(t,e){return new t({type:"never",..._Xe(e)})}var NXe=b(()=>{HA()});var jXe=b(()=>{});function F6(t,e){if(t instanceof L6){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 ic(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 ic(o.element,r);case"object":{for(let i in o.shape)if(ic(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(ic(i,r))return!0;return!1}case"intersection":return ic(o.left,r)||ic(o.right,r);case"tuple":{for(let i of o.items)if(ic(i,r))return!0;return!!(o.rest&&ic(o.rest,r))}case"record":return ic(o.keyType,r)||ic(o.valueType,r);case"map":return ic(o.keyType,r)||ic(o.valueType,r);case"set":return ic(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return ic(o.innerType,r);case"lazy":return ic(o.getter(),r);case"default":return ic(o.innerType,r);case"prefault":return ic(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return ic(o.in,r)||ic(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var qQ,DXe=b(()=>{_xe();HA();qQ=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Sv,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 h=p;h.type="string";let{minimum:m,maximum:g,format:y,patterns:_,contentEncoding:w}=e._zod.bag;if(typeof m=="number"&&(h.minLength=m),typeof g=="number"&&(h.maxLength=g),y&&(h.format=i[y]??y,h.format===""&&delete h.format),w&&(h.contentEncoding=w),_&&_.size>0){let S=[..._];S.length===1?h.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 h=p,{minimum:m,maximum:g,format:y,multipleOf:_,exclusiveMaximum:w,exclusiveMinimum:S}=e._zod.bag;typeof y=="string"&&y.includes("int")?h.type="integer":h.type="number",typeof S=="number"&&(h.exclusiveMinimum=S),typeof m=="number"&&(h.minimum=m,typeof S=="number"&&(S>=m?delete h.minimum:delete h.exclusiveMinimum)),typeof w=="number"&&(h.exclusiveMaximum=w),typeof g=="number"&&(h.maximum=g,typeof w=="number"&&(w<=g?delete h.maximum:delete h.exclusiveMaximum)),typeof _=="number"&&(h.multipleOf=_);break}case"boolean":{let h=p;h.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 h=p,{minimum:m,maximum:g}=e._zod.bag;typeof m=="number"&&(h.minItems=m),typeof g=="number"&&(h.maxItems=g),h.type="array",h.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let h=p;h.type="object",h.properties={};let m=o.shape;for(let _ in m)h.properties[_]=this.process(m[_],{...d,path:[...d.path,"properties",_]});let g=new Set(Object.keys(m)),y=new Set([...g].filter(_=>{let w=o.shape[_]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));y.size>0&&(h.required=Array.from(y)),o.catchall?._zod.def.type==="never"?h.additionalProperties=!1:o.catchall?o.catchall&&(h.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{let h=p;h.anyOf=o.options.map((m,g)=>this.process(m,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let h=p,m=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),y=w=>"allOf"in w&&Object.keys(w).length===1,_=[...y(m)?m.allOf:[m],...y(g)?g.allOf:[g]];h.allOf=_;break}case"tuple":{let h=p;h.type="array";let m=o.items.map((_,w)=>this.process(_,{...d,path:[...d.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?h.prefixItems=m:h.items=m,o.rest){let _=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?h.items=_:h.additionalItems=_}o.rest&&(h.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:y}=e._zod.bag;typeof g=="number"&&(h.minItems=g),typeof y=="number"&&(h.maxItems=y);break}case"record":{let h=p;h.type="object",h.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),h.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 h=p,m=mxe(o.entries);m.every(g=>typeof g=="number")&&(h.type="number"),m.every(g=>typeof g=="string")&&(h.type="string"),h.enum=m;break}case"literal":{let h=p,m=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){let g=m[0];h.type=g===null?"null":typeof g,h.const=g}else m.every(g=>typeof g=="number")&&(h.type="number"),m.every(g=>typeof g=="string")&&(h.type="string"),m.every(g=>typeof g=="boolean")&&(h.type="string"),m.every(g=>g===null)&&(h.type="null"),h.enum=m;break}case"file":{let h=p,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:y,mime:_}=e._zod.bag;g!==void 0&&(m.minLength=g),y!==void 0&&(m.maxLength=y),_?_.length===1?(m.contentMediaType=_[0],Object.assign(h,m)):h.anyOf=_.map(w=>({...m,contentMediaType:w})):Object.assign(h,m);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let h=this.process(o.innerType,d);p.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let h=p;h.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 h;try{h=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let h=p,m=e._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=m.source;break}case"pipe":{let h=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(h,d),s.ref=h;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 h=e._zod.innerType;this.process(h,d),s.ref=h;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"&&ic(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 m=n.external.registry.get(c[0])?.id,g=n.external.uri??(_=>_);if(m)return{ref:g(m)};let y=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=y,{defId:y,ref:`${g("__shared")}#/${d}/${y}`}}if(c[1]===o)return{ref:"#"};let p=`#/${d}/`,h=c[1].schema.id??`__schema${this.counter++}`;return{defId:h,ref:p+h}},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 h=d.schema;for(let m in h)delete h[m];h.$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,h={...p};if(f.ref===null)return;let m=f.ref;if(f.ref=null,m){s(m,d);let g=this.seen.get(m).schema;g.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(g)):(Object.assign(p,g),Object.assign(p,h))}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 LXe=b(()=>{});var HQ=b(()=>{j6();yxe();gxe();IXe();EXe();bxe();HA();OXe();MXe();_xe();PXe();jXe();NXe();DXe();LXe()});var kXe,FXe,$Xe,VQ=b(()=>{kXe=Symbol("Let zodToJsonSchema decide on which parser to use"),FXe={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"},$Xe=t=>typeof t=="string"?{...FXe,name:t}:{...FXe,...t}});var BXe,vxe=b(()=>{VQ();BXe=t=>{let e=$Xe(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 wxe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function fo(t,e,r,n,o){t[e]=r,wxe(t,e,n,o)}var VA=b(()=>{});var xd=b(()=>{i6();i6()});function zXe(){return{}}var xxe=b(()=>{});function UXe(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==re.ZodAny&&(r.items=Or(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 Sxe=b(()=>{xd();VA();yu()});function qXe(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 Cxe=b(()=>{VA()});function HXe(){return{type:"boolean"}}var Oxe=b(()=>{});function WQ(t,e){return Or(t.type._def,e)}var KQ=b(()=>{yu()});var VXe,Exe=b(()=>{yu();VXe=(t,e)=>Or(t.innerType._def,e)});function Pxe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Pxe(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 cEr(t,e)}}var cEr,Txe=b(()=>{VA();cEr=(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 WXe(t,e){return{...Or(t.innerType._def,e),default:t.defaultValue()}}var Axe=b(()=>{yu()});function KXe(t,e){return e.effectStrategy==="input"?Or(t.schema._def,e):{}}var Ixe=b(()=>{yu()});function GXe(t){return{type:"string",enum:Array.from(t.values)}}var Mxe=b(()=>{});function JXe(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(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,Rxe=b(()=>{yu();dEr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function ZXe(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 Nxe=b(()=>{});function GQ(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":jb(r,"email",n.message,e);break;case"format:idn-email":jb(r,"idn-email",n.message,e);break;case"pattern:zod":Pp(r,Nb.email,n.message,e);break}break;case"url":jb(r,"uri",n.message,e);break;case"uuid":jb(r,"uuid",n.message,e);break;case"regex":Pp(r,n.regex,n.message,e);break;case"cuid":Pp(r,Nb.cuid,n.message,e);break;case"cuid2":Pp(r,Nb.cuid2,n.message,e);break;case"startsWith":Pp(r,RegExp(`^${Dxe(n.value,e)}`),n.message,e);break;case"endsWith":Pp(r,RegExp(`${Dxe(n.value,e)}$`),n.message,e);break;case"datetime":jb(r,"date-time",n.message,e);break;case"date":jb(r,"date",n.message,e);break;case"time":jb(r,"time",n.message,e);break;case"duration":jb(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":{Pp(r,RegExp(Dxe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&jb(r,"ipv4",n.message,e),n.version!=="v4"&&jb(r,"ipv6",n.message,e);break}case"base64url":Pp(r,Nb.base64url,n.message,e);break;case"jwt":Pp(r,Nb.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Pp(r,Nb.ipv4Cidr,n.message,e),n.version!=="v4"&&Pp(r,Nb.ipv6Cidr,n.message,e);break}case"emoji":Pp(r,Nb.emoji(),n.message,e);break;case"ulid":{Pp(r,Nb.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{jb(r,"binary",n.message,e);break}case"contentEncoding:base64":{fo(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Pp(r,Nb.base64,n.message,e);break}}break}case"nanoid":Pp(r,Nb.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Dxe(t,e){return e.patternStrategy==="escape"?pEr(t):t}function pEr(t){let e="";for(let r=0;r<t.length;r++)fEr.has(t[r])||(e+="\\"),e+=t[r];return e}function jb(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 Pp(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:YXe(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):fo(t,"pattern",YXe(e,n),r,n)}function YXe(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 jxe,Nb,fEr,JQ=b(()=>{VA();Nb={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:()=>(jxe===void 0&&(jxe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jxe),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-_]*$/};fEr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function ZQ(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]: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{type:n,...o}=GQ(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}=WQ(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var YQ=b(()=>{xd();yu();JQ();KQ()});function XXe(t,e){if(e.mapStrategy==="record")return ZQ(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 Lxe=b(()=>{yu();YQ()});function QXe(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 Fxe=b(()=>{});function eQe(){return{not:{}}}var kxe=b(()=>{});function tQe(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var $xe=b(()=>{});function nQe(t,e){if(e.target==="openApi3")return rQe(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in k6&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=k6[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 rQe(t,e)}var k6,rQe,XQ=b(()=>{yu();k6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};rQe=(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 oQe(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:k6[t.innerType._def.typeName],nullable:!0}:{type:[k6[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 Bxe=b(()=>{yu();XQ()});function iQe(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",wxe(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 zxe=b(()=>{VA()});function mEr(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 aQe(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 pm&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=Or(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:mEr(t,e)};return n.required.length||delete n.required,n}var Uxe=b(()=>{xd();yu()});var sQe,qxe=b(()=>{yu();sQe=(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 uQe,Hxe=b(()=>{yu();uQe=(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 lQe(t,e){return Or(t.type._def,e)}var Vxe=b(()=>{yu()});function cQe(t,e){let n={type:"array",uniqueItems:!0,items:Or(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 Wxe=b(()=>{VA();yu()});function dQe(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 Kxe=b(()=>{yu()});function fQe(){return{not:{}}}var Gxe=b(()=>{});function pQe(){return{}}var Jxe=b(()=>{});var mQe,Zxe=b(()=>{yu();mQe=(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!==kXe)return a}if(n&&!r){let a=hEr(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=yEr(t,t.typeName,e);return i&&bEr(t,e,i),o.jsonSchema=i,i}var hEr,gEr,yEr,bEr,yu=b(()=>{xd();xxe();Sxe();Cxe();Oxe();KQ();Exe();Txe();Axe();Ixe();Mxe();Rxe();Nxe();Lxe();Fxe();kxe();$xe();Bxe();zxe();Uxe();qxe();Hxe();Vxe();YQ();Wxe();JQ();Kxe();Gxe();XQ();Jxe();Zxe();VQ();hEr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:gEr(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}},gEr=(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("/")},yEr=(t,e,r)=>{switch(e){case re.ZodString:return GQ(t,r);case re.ZodNumber:return iQe(t,r);case re.ZodObject:return aQe(t,r);case re.ZodBigInt:return qXe(t,r);case re.ZodBoolean:return HXe();case re.ZodDate:return Pxe(t,r);case re.ZodUndefined:return fQe();case re.ZodNull:return tQe(r);case re.ZodArray:return UXe(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return nQe(t,r);case re.ZodIntersection:return JXe(t,r);case re.ZodTuple:return dQe(t,r);case re.ZodRecord:return ZQ(t,r);case re.ZodLiteral:return ZXe(t,r);case re.ZodEnum:return GXe(t);case re.ZodNativeEnum:return QXe(t);case re.ZodNullable:return oQe(t,r);case re.ZodOptional:return sQe(t,r);case re.ZodMap:return XXe(t,r);case re.ZodSet:return cQe(t,r);case re.ZodLazy:return Or(t.getter()._def,r);case re.ZodPromise:return lQe(t,r);case re.ZodNaN:case re.ZodNever:return eQe();case re.ZodEffects:return KXe(t,r);case re.ZodAny:return zXe();case re.ZodUnknown:return pQe();case re.ZodDefault:return WXe(t,r);case re.ZodBranded:return WQ(t,r);case re.ZodReadonly:return mQe(t,r);case re.ZodCatch:return VXe(t,r);case re.ZodPipeline:return uQe(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(n=>{})(e)}},bEr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var is,Yxe=b(()=>{yu();vxe();is=(t,e)=>{let r=BXe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:Or(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=Or(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 Kg=b(()=>{VQ();vxe();VA();yu();xxe();Sxe();Cxe();Oxe();KQ();Exe();Txe();Axe();Ixe();Mxe();Rxe();Nxe();Lxe();Fxe();kxe();$xe();Bxe();zxe();Uxe();qxe();Hxe();Vxe();Zxe();YQ();Wxe();JQ();Kxe();Gxe();XQ();Jxe();Yxe();Yxe()});function yE(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(!yE(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(!yE(t[a],e[a]))return!1;return!0}return t===e}var Xxe=b(()=>{});function Th(t){return encodeURI(_Er(t))}function _Er(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var QQ=b(()=>{});function WA(t,e=Object.create(null),r=SEr,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:WA(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(xEr[i])continue;let a=`${n}/${Th(i)}`,s=t[i];if(Array.isArray(s)){if(vEr[i]){let u=s.length;for(let l=0;l<u;l++)WA(s[l],e,r,`${a}/${l}`)}}else if(wEr[i])for(let u in s)WA(s[u],e,r,`${a}/${Th(u)}`);else WA(s,e,r,a)}return e}var vEr,wEr,xEr,SEr,eee=b(()=>{QQ();vEr={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},wEr={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},xEr={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},SEr=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 xm(t){return t.test.bind(t)}function HEr(t){return t%4===0&&(t%100!==0||t%400===0)}function hQe(t){let e=t.match(CEr);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&HEr(r)?29:OEr[n])}function gQe(t,e){let r=e.match(EEr);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 WEr(t){let e=t.split(VEr);return e.length==2&&hQe(e[0])&&gQe(!0,e[1])}function JEr(t){return KEr.test(t)&&GEr.test(t)}function YEr(t){if(ZEr.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var CEr,OEr,EEr,PEr,TEr,AEr,IEr,MEr,REr,NEr,jEr,DEr,LEr,FEr,kEr,$Er,BEr,zEr,UEr,qEr,Qxe,VEr,KEr,GEr,ZEr,eSe=b(()=>{CEr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,OEr=[0,31,28,31,30,31,30,31,31,30,31,30,31],EEr=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,PEr=/^(?=.{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,TEr=/^(?:[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,AEr=/^(?:(?:[^\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,IEr=/^(?:(?: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,MEr=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,REr=/^(?:\/(?:[^~/]|~0|~1)*)*$/,NEr=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,jEr=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,DEr=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,LEr=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,FEr=/^\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,kEr=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,$Er=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))},BEr=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,zEr=/^((([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,UEr=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));qEr={date:hQe,time:gQe.bind(void 0,!1),"date-time":WEr,duration:UEr,uri:JEr,"uri-reference":xm(TEr),"uri-template":xm(AEr),url:xm(IEr),email:$Er,hostname:xm(PEr),ipv4:xm(BEr),ipv6:xm(zEr),regex:YEr,uuid:xm(MEr),"json-pointer":xm(REr),"json-pointer-uri-fragment":xm(NEr),"relative-json-pointer":xm(jEr)},Qxe={...qEr,date:xm(DEr),time:xm(LEr),"date-time":xm(FEr),"uri-reference":xm(kEr)};VEr=/t|\s/i;KEr=/\/|:/,GEr=/^(?:[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;ZEr=/[^\\]\\Z/});var yQe,bQe=b(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(yQe||(yQe={}))});function _Qe(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 tSe=b(()=>{});function va(t,e,r="2019-09",n=WA(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:h,const:m,enum:g,required:y,not:_,anyOf:w,allOf:S,oneOf:C,if:E,then:P,else:T,format:I,properties:N,patternProperties:M,additionalProperties:D,unevaluatedProperties:k,minProperties:F,maxProperties:K,propertyNames:U,dependentRequired:X,dependentSchemas:ee,dependencies:L,prefixItems:Q,items:z,additionalItems:W,unevaluatedItems:V,contains:q,minContains:H,maxContains:G,minItems:Z,maxItems:de,uniqueItems:pe,minimum:ae,maximum:Te,exclusiveMinimum:Ae,exclusiveMaximum:ke,multipleOf:Ot,minLength:jr,maxLength:Mr,pattern:Vn,__absolute_ref__:Xr,__absolute_recursive_ref__:Cr}=e,Me=[];if(p===!0&&i===null&&(i=e),f==="#"){let je=i===null?n[Cr]:i,le=`${s}/$recursiveRef`,ne=va(t,i===null?e:i,r,n,o,je,a,le,u);ne.valid||Me.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:le,error:"A subschema had errors."},...ne.errors)}if(d!==void 0){let le=n[Xr||d];if(le===void 0){let be=`Unresolved $ref "${d}".`;throw Xr&&Xr!==d&&(be+=` Absolute URI "${Xr}".`),be+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(be)}let ne=`${s}/$ref`,fe=va(t,le,r,n,o,i,a,ne,u);if(fe.valid||Me.push({instanceLocation:a,keyword:"$ref",keywordLocation:ne,error:"A subschema had errors."},...fe.errors),r==="4"||r==="7")return{valid:Me.length===0,errors:Me}}if(Array.isArray(h)){let je=h.length,le=!1;for(let ne=0;ne<je;ne++)if(c===h[ne]||h[ne]==="integer"&&c==="number"&&t%1===0&&t===t){le=!0;break}le||Me.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h.join('", "')}".`})}else h==="integer"?(c!=="number"||t%1||t!==t)&&Me.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`}):h!==void 0&&c!==h&&Me.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`});if(m!==void 0&&(c==="object"||c==="array"?yE(t,m)||Me.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(m)}.`}):t!==m&&Me.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(m)}.`})),g!==void 0&&(c==="object"||c==="array"?g.some(je=>yE(t,je))||Me.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(je=>t===je)||Me.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),_!==void 0){let je=`${s}/not`;va(t,_,r,n,o,i,a,je).valid&&Me.push({instanceLocation:a,keyword:"not",keywordLocation:je,error:'Instance matched "not" schema.'})}let Ze=[];if(w!==void 0){let je=`${s}/anyOf`,le=Me.length,ne=!1;for(let fe=0;fe<w.length;fe++){let be=w[fe],ye=Object.create(u),ze=va(t,be,r,n,o,p===!0?i:null,a,`${je}/${fe}`,ye);Me.push(...ze.errors),ne=ne||ze.valid,ze.valid&&Ze.push(ye)}ne?Me.length=le:Me.splice(le,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:je,error:"Instance does not match any subschemas."})}if(S!==void 0){let je=`${s}/allOf`,le=Me.length,ne=!0;for(let fe=0;fe<S.length;fe++){let be=S[fe],ye=Object.create(u),ze=va(t,be,r,n,o,p===!0?i:null,a,`${je}/${fe}`,ye);Me.push(...ze.errors),ne=ne&&ze.valid,ze.valid&&Ze.push(ye)}ne?Me.length=le:Me.splice(le,0,{instanceLocation:a,keyword:"allOf",keywordLocation:je,error:"Instance does not match every subschema."})}if(C!==void 0){let je=`${s}/oneOf`,le=Me.length,ne=C.filter((fe,be)=>{let ye=Object.create(u),ze=va(t,fe,r,n,o,p===!0?i:null,a,`${je}/${be}`,ye);return Me.push(...ze.errors),ze.valid&&Ze.push(ye),ze.valid}).length;ne===1?Me.length=le:Me.splice(le,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:je,error:`Instance does not match exactly one subschema (${ne} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Ze),E!==void 0){let je=`${s}/if`;if(va(t,E,r,n,o,i,a,je,u).valid){if(P!==void 0){let ne=va(t,P,r,n,o,i,a,`${s}/then`,u);ne.valid||Me.push({instanceLocation:a,keyword:"if",keywordLocation:je,error:'Instance does not match "then" schema.'},...ne.errors)}}else if(T!==void 0){let ne=va(t,T,r,n,o,i,a,`${s}/else`,u);ne.valid||Me.push({instanceLocation:a,keyword:"if",keywordLocation:je,error:'Instance does not match "else" schema.'},...ne.errors)}}if(c==="object"){if(y!==void 0)for(let fe of y)fe in t||Me.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${fe}".`});let je=Object.keys(t);if(F!==void 0&&je.length<F&&Me.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${F} properties.`}),K!==void 0&&je.length>K&&Me.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${K} properties.`}),U!==void 0){let fe=`${s}/propertyNames`;for(let be in t){let ye=`${a}/${Th(be)}`,ze=va(be,U,r,n,o,i,ye,fe);ze.valid||Me.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:fe,error:`Property name "${be}" does not match schema.`},...ze.errors)}}if(X!==void 0){let fe=`${s}/dependantRequired`;for(let be in X)if(be in t){let ye=X[be];for(let ze of ye)ze in t||Me.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:fe,error:`Instance has "${be}" but does not have "${ze}".`})}}if(ee!==void 0)for(let fe in ee){let be=`${s}/dependentSchemas`;if(fe in t){let ye=va(t,ee[fe],r,n,o,i,a,`${be}/${Th(fe)}`,u);ye.valid||Me.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:be,error:`Instance has "${fe}" but does not match dependant schema.`},...ye.errors)}}if(L!==void 0){let fe=`${s}/dependencies`;for(let be in L)if(be in t){let ye=L[be];if(Array.isArray(ye))for(let ze of ye)ze in t||Me.push({instanceLocation:a,keyword:"dependencies",keywordLocation:fe,error:`Instance has "${be}" but does not have "${ze}".`});else{let ze=va(t,ye,r,n,o,i,a,`${fe}/${Th(be)}`);ze.valid||Me.push({instanceLocation:a,keyword:"dependencies",keywordLocation:fe,error:`Instance has "${be}" but does not match dependant schema.`},...ze.errors)}}}let le=Object.create(null),ne=!1;if(N!==void 0){let fe=`${s}/properties`;for(let be in N){if(!(be in t))continue;let ye=`${a}/${Th(be)}`,ze=va(t[be],N[be],r,n,o,i,ye,`${fe}/${Th(be)}`);if(ze.valid)u[be]=le[be]=!0;else if(ne=o,Me.push({instanceLocation:a,keyword:"properties",keywordLocation:fe,error:`Property "${be}" does not match schema.`},...ze.errors),ne)break}}if(!ne&&M!==void 0){let fe=`${s}/patternProperties`;for(let be in M){let ye=new RegExp(be,"u"),ze=M[be];for(let hr in t){if(!ye.test(hr))continue;let Ii=`${a}/${Th(hr)}`,_i=va(t[hr],ze,r,n,o,i,Ii,`${fe}/${Th(be)}`);_i.valid?u[hr]=le[hr]=!0:(ne=o,Me.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:fe,error:`Property "${hr}" matches pattern "${be}" but does not match associated schema.`},..._i.errors))}}}if(!ne&&D!==void 0){let fe=`${s}/additionalProperties`;for(let be in t){if(le[be])continue;let ye=`${a}/${Th(be)}`,ze=va(t[be],D,r,n,o,i,ye,fe);ze.valid?u[be]=!0:(ne=o,Me.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:fe,error:`Property "${be}" does not match additional properties schema.`},...ze.errors))}}else if(!ne&&k!==void 0){let fe=`${s}/unevaluatedProperties`;for(let be in t)if(!u[be]){let ye=`${a}/${Th(be)}`,ze=va(t[be],k,r,n,o,i,ye,fe);ze.valid?u[be]=!0:Me.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:fe,error:`Property "${be}" does not match unevaluated properties schema.`},...ze.errors)}}}else if(c==="array"){de!==void 0&&t.length>de&&Me.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${de}).`}),Z!==void 0&&t.length<Z&&Me.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${Z}).`});let je=t.length,le=0,ne=!1;if(Q!==void 0){let fe=`${s}/prefixItems`,be=Math.min(Q.length,je);for(;le<be;le++){let ye=va(t[le],Q[le],r,n,o,i,`${a}/${le}`,`${fe}/${le}`);if(u[le]=!0,!ye.valid&&(ne=o,Me.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:fe,error:"Items did not match schema."},...ye.errors),ne))break}}if(z!==void 0){let fe=`${s}/items`;if(Array.isArray(z)){let be=Math.min(z.length,je);for(;le<be;le++){let ye=va(t[le],z[le],r,n,o,i,`${a}/${le}`,`${fe}/${le}`);if(u[le]=!0,!ye.valid&&(ne=o,Me.push({instanceLocation:a,keyword:"items",keywordLocation:fe,error:"Items did not match schema."},...ye.errors),ne))break}}else for(;le<je;le++){let be=va(t[le],z,r,n,o,i,`${a}/${le}`,fe);if(u[le]=!0,!be.valid&&(ne=o,Me.push({instanceLocation:a,keyword:"items",keywordLocation:fe,error:"Items did not match schema."},...be.errors),ne))break}if(!ne&&W!==void 0){let be=`${s}/additionalItems`;for(;le<je;le++){let ye=va(t[le],W,r,n,o,i,`${a}/${le}`,be);u[le]=!0,ye.valid||(ne=o,Me.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:be,error:"Items did not match additional items schema."},...ye.errors))}}}if(q!==void 0)if(je===0&&H===void 0)Me.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(H!==void 0&&je<H)Me.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${je}) than minContains (${H}).`});else{let fe=`${s}/contains`,be=Me.length,ye=0;for(let ze=0;ze<je;ze++){let hr=va(t[ze],q,r,n,o,i,`${a}/${ze}`,fe);hr.valid?(u[ze]=!0,ye++):Me.push(...hr.errors)}ye>=(H||0)&&(Me.length=be),H===void 0&&G===void 0&&ye===0?Me.splice(be,0,{instanceLocation:a,keyword:"contains",keywordLocation:fe,error:"Array does not contain item matching schema."}):H!==void 0&&ye<H?Me.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${H} items matching schema. Only ${ye} items were found.`}):G!==void 0&&ye>G&&Me.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${G} items matching schema. ${ye} items were found.`})}if(!ne&&V!==void 0){let fe=`${s}/unevaluatedItems`;for(le;le<je;le++){if(u[le])continue;let be=va(t[le],V,r,n,o,i,`${a}/${le}`,fe);u[le]=!0,be.valid||Me.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:fe,error:"Items did not match unevaluated items schema."},...be.errors)}}if(pe)for(let fe=0;fe<je;fe++){let be=t[fe],ye=typeof be=="object"&&be!==null;for(let ze=0;ze<je;ze++){if(fe===ze)continue;let hr=t[ze];(be===hr||ye&&(typeof hr=="object"&&hr!==null)&&yE(be,hr))&&(Me.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${fe} and ${ze}.`}),fe=Number.MAX_SAFE_INTEGER,ze=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(ae!==void 0&&(Ae===!0&&t<=ae||t<ae)&&Me.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${Ae?"or equal to ":""} ${ae}.`}),Te!==void 0&&(ke===!0&&t>=Te||t>Te)&&Me.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${ke?"or equal to ":""} ${Te}.`})):(ae!==void 0&&t<ae&&Me.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${ae}.`}),Te!==void 0&&t>Te&&Me.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Te}.`}),Ae!==void 0&&t<=Ae&&Me.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${Ae}.`}),ke!==void 0&&t>=ke&&Me.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${ke}.`})),Ot!==void 0){let je=t%Ot;Math.abs(0-je)>=11920929e-14&&Math.abs(Ot-je)>=11920929e-14&&Me.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${Ot}.`})}}else if(c==="string"){let je=jr===void 0&&Mr===void 0?0:_Qe(t);jr!==void 0&&je<jr&&Me.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${je} < ${jr}).`}),Mr!==void 0&&je>Mr&&Me.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${je} > ${Mr}).`}),Vn!==void 0&&!new RegExp(Vn,"u").test(t)&&Me.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&Qxe[I]&&!Qxe[I](t)&&Me.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:Me.length===0,errors:Me}}var rSe=b(()=>{Xxe();eee();eSe();QQ();tSe()});var vQe=b(()=>{eee();rSe()});var $6=b(()=>{Xxe();eee();eSe();QQ();bQe();tSe();rSe();vQe()});function Sm(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 Ah(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 Cv(t){return Sm(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),Ah(t)}function Ih(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(Sm(t)||Ah(t))}async function wQe(t,e){if(Sm(t))try{return{success:!0,data:await xXe(t,e)}}catch(r){return{success:!1,error:r}}if(Ah(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function DB(t,e){if(Sm(t))return UQ(t,e);if(Ah(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function bj(t){if(Sm(t))return Sv.get(t)?.description;if(Ah(t)||"description"in t&&typeof t.description=="string")return t.description}function nSe(t){return Ih(t)?Ah(t)?t._def.typeName==="ZodString":Sm(t)?t._zod.def.type==="string":!1:!1}function jB(t){return Sm(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 xQe(t){return Sm(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 tee(t,e=!1){if(Ah(t))return t.strict();if(jB(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(jB(a)){let u=tee(a,e);r[i]=u}else if(xQe(a)){let u=a._zod.def.element;jB(u)&&(u=tee(u,e)),r[i]=IB(a,{...a._zod.def,element:u})}else r[i]=a;let s=Sv.get(a);s&&Sv.add(r[i],s)}let n=IB(t,{...t._zod.def,shape:r,catchall:RXe(AXe)}),o=Sv.get(t);return o&&Sv.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function XEr(t){return Ah(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function QEr(t){return Sm(t)&&t._zod.def.type==="pipe"}function NB(t,e=!1){if(Ah(t))return XEr(t)?NB(t._def.schema,e):t;if(Sm(t)){let r=t;if(QEr(t)&&(r=NB(t._zod.def.in,e)),e){if(jB(r)){let o=r._zod.def.shape;for(let[i,a]of Object.entries(r._zod.def.shape))o[i]=NB(a,e);r=IB(r,{...r._zod.def,shape:o})}else if(xQe(r)){let o=NB(r._zod.def.element,e);r=IB(r,{...r._zod.def,element:o})}}let n=Sv.get(t);return n&&Sv.add(r,n),r}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}var bE=b(()=>{HQ()});function Cm(t){if(Sm(t)){let e=NB(t,!0);if(jB(e)){let r=tee(e,!0);return F6(r)}else return F6(t)}return Ah(t)?is(t):t}var _j=b(()=>{HQ();Kg();$6();bE();$6()});function ePr(t,e){if(t!==void 0&&!DA(t))return t;if(N6(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 tPr(t){return N6(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Cm(t.data.schema),title:t.data.name}}}function SQe(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 CQe(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 B6,OQe=b(()=>{ij();dxe();hXe();_j();B6=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]=DA(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...tPr(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??Ms(),i={id:o,data:e,name:ePr(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 SQe(this)}lastNode(){return CQe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(DA)&&(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&&SQe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&CQe(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 DA(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 pXe(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 mXe(r,{backgroundColor:e?.backgroundColor})}}});function EQe(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 Pf.fromReadableStream(r)}var PQe=b(()=>{xv()});function oSe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function ree(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*iSe(t,e){for(;;){let{value:r,done:n}=Ep.runWithConfig(Wg(t),e.next.bind(e),!0);if(n)break;yield r}}async function*nee(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Ep.runWithConfig(Wg(t),r.next.bind(e),!0);if(o)break;yield n}}var TQe,AQe=b(()=>{yj();vv();TQe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function ac(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function rPr(t){if(zX(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function _E(t){if(typeof t=="function")return new Tp({func:t});if(Un.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=_E(n);return new KA({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function nPr(t,e){let r=e.name??t.getName(),n=e.description??bj(e.schema);return nSe(e.schema)?new U6({name:r,description:n,schema:dt.object({input:dt.string()}).transform(o=>o.input),bound:t}):new U6({name:r,description:n,schema:e.schema,bound:t})}var aSe,Un,Ov,oee,z6,Li,KA,sSe,Tp,iee,LB,aee,U6,Tf=b(()=>{NX();aSe=j(LX(),1);ij();Lwe();uXe();cXe();cj();xv();lxe();vv();PB();fXe();dxe();yj();OQe();PQe();AQe();PQ();bE();Un=class extends ym{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 Ov({bound:this,kwargs:e,config:{}})}map(){return new oee({bound:this})}withRetry(e){return new z6({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new Ov({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new iee({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(In);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)=>In(i===0?e:n))}return Array.from({length:r},()=>In(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new Ph({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=In(r),o=new gE({generator:this._streamIterator(e,n),config:n});return await o.setup,Pf.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=In(e):r=In({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=In(n),a=await(await vm(o))?.handleChainStart(this.toJSON(),ac(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 wv(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(ac(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(vm)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),ac(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 wv(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(ac(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=In(n),l=await vm(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=jc(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await oXe(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(lXe),h=f.output;p!==void 0&&d!==void 0&&(h=p.tapOutputIterable(d.runId,h));let m=d?.handlers.find(sXe);m!==void 0&&d!==void 0&&(h=m.tapOutputIterable(d.runId,h));for await(let g of h)if(yield g,s)if(a===void 0)a=g;else try{a=jc(a,g)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:ac(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:ac(o,"input")})}getGraph(e){let r=new B6,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 Li({first:this,last:_E(e)})}pick(e){return this.pipe(new aee(e))}assign(e){return this.pipe(new LB(new KA({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=jc(n,o);yield*this._streamIterator(n,In(r))}async*streamLog(e,r,n){let o=new I6({...n,autoClose:!1,_schemaFormat:"original"}),i=In(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 Rb({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"?EQe(o):Pf.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new FQ({...n,autoClose:!1}),i=In(r),a=i.runId??Ms();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 h=s.copy();h.addHandler(o,!0),i.callbacks=h}let u=new AbortController,l=this;async function c(){let h,m=null;try{r?.signal?"any"in AbortSignal?h=AbortSignal.any([u.signal,r.signal]):(h=r.signal,m=()=>{u.abort()},r.signal.addEventListener("abort",m,{once:!0})):h=u.signal;let g=await l.stream(e,{...i,signal:h}),y=o.tapOutputIterable(a,g);for await(let _ of y)if(u.signal.aborted)break}finally{await o.finish(),h&&m&&h.removeEventListener("abort",m)}}let d=c(),f=!1,p;try{for await(let h of o){if(!f){h.data.input=e,f=!0,p=h.run_id,yield h;continue}h.run_id===p&&h.event.endsWith("_end")&&h.data?.input&&delete h.data.input,yield h}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=In(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new I6({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new $Q({...n}),f=this._streamLog(e,c,a);for await(let h of f){if(o?o=o.concat(h):o=A6.fromRunLogPatch(h),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 m=h.ops.filter(_=>_.path.startsWith("/logs/")).map(_=>_.path.split("/")[2]),g=[...new Set(m)];for(let _ of g){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:y}=o;if(y.streamed_output.length>0){let _=y.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} instead. Encountered in: "${y.name}"`);let w={chunk:y.streamed_output[0]};y.streamed_output=[];let S={event:`on_${y.type}_stream`,run_id:y.id,tags:s,metadata:u,name:l,data:w};d.includeEvent(S,y.type)&&(yield S)}}let p=o?.state;if(p!==void 0){let h={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(h,p.type)&&(yield h)}}static isRunnable(e){return N6(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new Ov({bound:this,config:{},configFactories:[o=>({callbacks:[new R6({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return nPr(this,e)}},Ov=class t extends Un{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=OB(this.config,...e);return OB(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 z6({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(In(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(In(i),this.kwargs))):await this._mergeConfig(In(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(In(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(In(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(In(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(In(r),o.kwargs),version:r.version},n)};return Pf.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&Un.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 R6({config:o,onStart:e,onEnd:r,onError:n})]})]})}},oee=class t extends Un{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,eu(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},z6=class extends Ov{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 eu(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,aSe.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,aSe.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],h=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[h.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)}},Li=class t extends Un{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=In(r),i=await(await vm(n))?.handleChainStart(this.toJSON(),ac(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,eu(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await wv(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,eu(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(ac(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(vm)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),ac(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 eu(o[f],{callbacks:p})}),n);s=await wv(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(ac(s,"output")))),s}async*_streamIterator(e,r){let n=await vm(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),ac(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(),eu(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,eu(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=jc(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(ac(l,"output"))}getGraph(e){let r=new B6,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:_E(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&Un.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:_E(e),middle:r.slice(0,-1).map(_E),last:_E(r[r.length-1])})}},KA=class t extends Un{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]=_E(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=In(r),i=await(await vm(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,eu(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await wv(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=cxe(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],eu(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 wv(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=In(r),i=new gE({generator:this.transform(n(),o),config:o});return await i.setup,Pf.fromAsyncGenerator(i)}},sSe=class t extends Un{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}),!zX(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 vm(n),i=this.func(eu(n,{callbacks:o}),e);return wv(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(ree(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(TQe(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})}};Tp=class t extends Un{static lc_name(){return"RunnableLambda"}constructor(e){if(zX(e.func))return sSe.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}),rPr(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=eu(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??DQ)-1});Ep.runWithConfig(Wg(a),async()=>{try{let s=await this.func(e,{...a});if(s&&Un.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??DQ)-1})}else if(ree(s)){let u;for await(let l of nee(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=jc(u,l)}catch{u=l}s=u}else if(oSe(s)){let u;for(let l of iSe(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=jc(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=jc(o,s)}catch{o=s}let i=eu(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??DQ)-1}),a=await new Promise((s,u)=>{Ep.runWithConfig(Wg(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&Un.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(ree(a))for await(let s of nee(i,a))n?.signal?.throwIfAborted(),yield s;else if(oSe(a))for(let s of iSe(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=In(r),i=new gE({generator:this.transform(n(),o),config:o});return await i.setup,Pf.fromAsyncGenerator(i)}},iee=class extends Un{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=In(r),o=await vm(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),ac(e,"input"),i,void 0,void 0,void 0,a?.runName),u=eu(a,{callbacks:s?.getChild()});return await Ep.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(ac(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=In(r),o=await vm(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),ac(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=eu(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=nee(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:jc(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(ac(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=>vm(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),ac(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)=>eu(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(ac(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.")}};LB=class extends Un{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof KA&&(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]=cxe(e),s=this.mapper.transform(a,eu(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=In(r),i=new gE({generator:this.transform(n(),o),config:o});return await i.setup,Pf.fromAsyncGenerator(i)}},aee=class extends Un{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=In(r),i=new gE({generator:this.transform(n(),o),config:o});return await i.setup,Pf.fromAsyncGenerator(i)}},U6=class extends Ov{constructor(e){let r=Li.from([Tp.from(async n=>{let o;if($A(n))try{o=await DB(this.schema,n.args)}catch{throw new mj("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 Lo,see=b(()=>{xv();Tf();vv();Lo=class extends Un{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=In(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=In(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=jc(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new LB(new KA({steps:e}))}}});var IQe=b(()=>{Tf();vv()});var MQe=b(()=>{Tf();vv();xv()});var uSe=b(()=>{Hg()});var RQe=b(()=>{Tf();hj();Hg();TQ();AQ();C6();uSe();IQ();xB();BA()});var vj=b(()=>{hj();Hg();TQ();AQ();C6();IQ();BA();RQe();uSe();J0e();xB()});var NQe=b(()=>{vj();Tf();see()});var lSe=b(()=>{Tf();vv();see();IQe();MQe();NQe()});var wj,xj,Mh,FB=b(()=>{lSe();w6();wj=class extends Un{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"})}},xj=class extends wj{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")}},Mh=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");kA(this,"OUTPUT_PARSING_FAILURE")}}});var Sj,Cj,GA=b(()=>{$6();FB();Hg();BA();EB();Sj=class extends xj{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"})}},Cj=class extends Sj{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(Z0e(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(qg(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new co({message:Q0e(o),text:o.content})}else i=new wm({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!yE(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var jQe=b(()=>{GA()});var DQe=b(()=>{FB();GA()});var uee,LQe=b(()=>{GA();uee=class extends Sj{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,FQe=b(()=>{NX();FB();bE();_j();Sd=class extends xj{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(Cm(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 DB(this.schema,JSON.parse(n))}catch(r){throw new Mh(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var cSe=b(()=>{kwe()});var Cd,dSe=b(()=>{GA();cSe();K0e();Cd=class extends Cj{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?JX(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return W0e(e[0].text)}async parse(e){return W0e(e,JSON.parse)}getFormatInstructions(){return""}}});var kQe=b(()=>{});var $Qe=b(()=>{GA();cSe();kQe()});var BQe=b(()=>{FB();jQe();DQe();LQe();FQe();GA();dSe();$Qe()});var Db=b(()=>{BQe()});var q6,kB,$B,lee,H6=b(()=>{cj();C6();BA();q6=class extends ym{},kB=class extends q6{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 Xs(this.value)]}},$B=class extends q6{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 Op(this.messages)}toChatMessages(){return this.messages}},lee=class extends q6{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 Xs({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var vE,V6=b(()=>{H6();BB();vE=class extends Ev{async formatPromptValue(e){let r=await this.format(e);return new kB(r)}}});function pSe(t){return typeof t=="function"}function iPr(t){return UB(t)?"array":typeof t}function fSe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zQe(t,e){return t!=null&&typeof t=="object"&&e in t}function aPr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function uPr(t,e){return sPr.call(t,e)}function cPr(t){return!uPr(lPr,t)}function fPr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return dPr[r]})}function yPr(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 h(T){if(typeof T=="string"&&(T=T.split(mPr,2)),!UB(T)||T.length!==2)throw new Error("Invalid tags: "+T);d=new RegExp(fSe(T[0])+"\\s*"),f=new RegExp("\\s*"+fSe(T[1])),p=new RegExp("\\s*"+fSe("}"+T[1]))}h(e||Gg.tags);for(var m=new K6(t),g,y,_,w,S,C;!m.eos();){if(g=m.pos,_=m.scanUntil(d),_)for(var E=0,P=_.length;E<P;++E)w=_.charAt(E),cPr(w)?(i.push(o.length),u+=w):(s=!0,r=!0,u+=" "),o.push(["text",w,g,g+1]),g+=1,w===`
`&&(c(),u="",l=0,r=!1);if(!m.scan(d))break;if(a=!0,y=m.scan(gPr)||"name",m.scan(pPr),y==="="?(_=m.scanUntil(UQe),m.scan(UQe),m.scanUntil(f)):y==="{"?(_=m.scanUntil(p),m.scan(hPr),m.scanUntil(f),y="&"):_=m.scanUntil(f),!m.scan(f))throw new Error("Unclosed tag at "+m.pos);if(y==">"?S=[y,_,g,m.pos,u,l,r]:S=[y,_,g,m.pos],l++,o.push(S),y==="#"||y==="^")n.push(S);else if(y==="/"){if(C=n.pop(),!C)throw new Error('Unopened section "'+_+'" at '+g);if(C[1]!==_)throw new Error('Unclosed section "'+C[1]+'" at '+g)}else y==="name"||y==="{"||y==="&"?s=!0:y==="="&&h(_)}if(c(),C=n.pop(),C)throw new Error('Unclosed section "'+C[1]+'" at '+m.pos);return _Pr(bPr(o))}function bPr(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 _Pr(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 K6(t){this.string=t,this.tail=t,this.pos=0}function zB(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Ap(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var oPr,UB,sPr,lPr,dPr,pPr,mPr,UQe,hPr,gPr,Gg,W6,cee,qQe=b(()=>{oPr=Object.prototype.toString,UB=Array.isArray||function(e){return oPr.call(e)==="[object Array]"};sPr=RegExp.prototype.test;lPr=/\S/;dPr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};pPr=/\s*/,mPr=/\s+/,UQe=/\s*=/,hPr=/\s*\}/,gPr=/#|\^|\/|>|\{|&|=|!/;K6.prototype.eos=function(){return this.tail===""};K6.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};K6.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};zB.prototype.push=function(e){return new zB(e,this)};zB.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=zQe(i,a[s])||aPr(i,a[s])),i=i[a[s++]];else i=o.view[e],u=zQe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return pSe(n)&&(n=n.call(this.view)),n};Ap.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Ap.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||Gg.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=yPr(e,r),i&&n.set(o,a)),a};Ap.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof zB?r:new zB(r,void 0);return this.renderTokens(a,s,n,e,o)};Ap.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};Ap.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(UB(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(pSe(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}};Ap.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||UB(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Ap.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(`
`)};Ap.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=pSe(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)}}};Ap.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Ap.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Gg.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Gg.escape?String(i):o(i)};Ap.prototype.rawValue=function(e){return e[1]};Ap.prototype.getConfigTags=function(e){return UB(e)?e:e&&typeof e=="object"?e.tags:void 0};Ap.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!UB(e))return e.escape};Gg={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){W6.templateCache=t},get templateCache(){return W6.templateCache}},W6=new Ap;Gg.clearCache=function(){return W6.clearCache()};Gg.parse=function(e,r){return W6.parse(e,r)};Gg.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+iPr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return W6.render(e,r,n,o)};Gg.escape=fPr;Gg.Scanner=K6;Gg.Context=zB;Gg.Writer=Ap;cee=Gg});function HQe(){cee.escape=t=>t}var G6,VQe,dee,vPr,wPr,mSe,xPr,Om,J6,Oj,Ej=b(()=>{qQe();w6();G6=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},VQe=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=VQe(r[4]);e.push(...n)}}else e.push({type:"literal",text:r[1]});return e},dee=t=>{HQe();let e=cee.parse(t);return VQe(e)},vPr=(t,e)=>G6(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},""),wPr=(t,e)=>(HQe(),cee.render(t,e)),mSe={"f-string":vPr,mustache:wPr},xPr={"f-string":G6,mustache:dee},Om=(t,e,r)=>{try{return mSe[e](t,r)}catch(n){throw kA(n,"INVALID_PROMPT_INPUT")}},J6=(t,e)=>xPr[e](t),Oj=(t,e,r)=>{if(!(e in mSe)){let n=Object.keys(mSe);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")Om(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Om(o.image_url,e,n);else{let i=o.image_url.url;Om(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Om(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var hSe={};os(hSe,{PromptTemplate:()=>Af});var Af,qB=b(()=>{V6();Ej();Af=class t extends vE{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))),Oj(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Om(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 J6(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 HB,gSe=b(()=>{H6();BB();Ej();HB=class t extends Ev{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))),Oj([{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]=Om(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 lee(r)}}});function ySe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")J6(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?J6(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...ySe(o,e));else typeof n=="object"&&n!==null&&r.push(...ySe(n,e));return Array.from(new Set(r))}function bSe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Om(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Om(s,r,e)):typeof s=="object"&&a.push(bSe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=bSe(i,e,r):n[o]=i;return n}var Z6,_Se=b(()=>{Tf();Ej();Z6=class extends Un{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=ySe(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 bSe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function SPr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function CPr(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 OPr(t){return typeof t.formatMessages=="function"}function EPr(t,e){if(OPr(t)||qg(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 Pv({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Pv({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=Mb(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 Tv.fromTemplate(n,e);if(r._getType()==="ai")return xSe.fromTemplate(n,e);if(r._getType()==="system")return JA.fromTemplate(n,e);if(Ys.isInstance(r))return wSe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function PPr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var Y6,Pv,vSe,X6,wSe,Q6,Tv,xSe,JA,Em,e8=b(()=>{vj();H6();Tf();V6();BB();qB();gSe();Ej();w6();_Se();Y6=class extends Un{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"})}},Pv=class extends Y6{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(Mb):n=[Mb(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}},vSe=class extends Y6{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)]}},X6=class extends Ev{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new $B(r)}},wSe=class extends vSe{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 Ys(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(Af.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};Q6=class extends Y6{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(Af.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(Af.fromTemplate(o,r));else if(o!==null)if(SPr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(Af.fromTemplate(i,a))}else if(CPr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=dee(i):u=G6(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 HB({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=dee(i.url):u=G6(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new HB({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 Z6({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof vE){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 vE){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof HB){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 Z6){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)]}},Tv=class extends Q6{static _messageClass(){return Xs}static lc_name(){return"HumanMessagePromptTemplate"}},xSe=class extends Q6{static _messageClass(){return kn}static lc_name(){return"AIMessagePromptTemplate"}},JA=class extends Q6{static _messageClass(){return hE}static lc_name(){return"SystemMessagePromptTemplate"}};Em=class t extends X6{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 oc))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 Af.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 oc)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(PPr(o)&&o.optional))throw kA(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=Af.fromTemplate(e,r),o=new Tv({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[EPr(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 oc))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 WQe={};os(WQe,{FewShotChatMessagePromptTemplate:()=>CSe,FewShotPromptTemplate:()=>SSe});var SSe,CSe,OSe=b(()=>{V6();Ej();qB();e8();SSe=class t extends vE{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))),Oj(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 Om(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 Af.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})}},CSe=class t extends X6{_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))),Oj(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 Om(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 Ev,BB=b(()=>{Tf();Ev=class extends Un{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(()=>(qB(),hSe));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(qB(),hSe));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(OSe(),WQe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var KQe=b(()=>{BB();e8()});var GQe=b(()=>{});var JQe=b(()=>{Tf();e8()});var ZQe=b(()=>{BB();e8();OSe();KQe();qB();GQe();V6();Ej();gSe();JQe();_Se()});var ZA=b(()=>{ZQe()});var Pm=b(()=>{lSe()});var ESe,PSe=b(()=>{ESe=t=>t.map(e=>e.pageContent).join(`
`)});var YQe=b(()=>{PSe()});function Rh(t,e){let r=`atom${++TPr}`,n={toString(){return($a.env?$a.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=APr,n.write=IPr),e&&(n.write=e),n}function APr(t){return t(this)}function IPr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var $a,TPr,XQe,TSe,ASe,pee,MSe,MPr,RPr,RSe,QQe,fee,ret,eet,VB,ISe,NPr,jPr,tet,YA,net,WB,t8,oet,NSe=b(()=>{$a={},TPr=0;XQe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,TSe=t=>"init"in t,ASe=t=>!!t.write,pee=new WeakMap,MSe=t=>{var e;return RSe(t)&&!((e=pee.get(t))!=null&&e[1])},MPr=(t,e)=>{let r=pee.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if(($a.env?$a.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},RPr=t=>{if(pee.has(t))return;let e=[new Set,!1];pee.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},RSe=t=>typeof t?.then=="function",QQe=t=>"v"in t||"e"in t,fee=t=>{if("e"in t)throw t.e;if(($a.env?$a.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},ret=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},eet=(t,e,r,n,o)=>{var i;if(($a.env?$a.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),MSe(r.v)&&ret(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&NPr(t,n,e)},VB=()=>[new Map,new Map,new Set],ISe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},NPr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},jPr=(t,e)=>t[0].get(e),tet=(t,e)=>{t[2].add(e)},YA=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},net=(...[t,e,r,n])=>{let o;($a.env?$a.env.MODE:void 0)!=="production"&&(o=new Set);let i=(w,S,C)=>{let E="v"in S,P=S.v,T=MSe(S.v)?S.v:null;if(RSe(C)){RPr(C);for(let I of S.d.keys())ret(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&&MPr(T,C))},a=(w,S,C)=>{var E;let P=t(S);if(QQe(P)&&(P.m&&!C?.has(S)||Array.from(P.d).every(([k,F])=>a(w,k,C).n===F)))return P;P.d.clear();let T=!0,I=k=>{if(XQe(S,k)){let K=t(k);if(!QQe(K))if(TSe(k))i(k,K,k.init);else throw new Error("no atom init");return fee(K)}let F=a(w,k,C);try{return fee(F)}finally{if(T)eet(w,S,P,k,F);else{let K=VB();eet(K,S,P,k,F),p(K,S,P),YA(K)}}},N,M,D={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return($a.env?$a.env.MODE:void 0)!=="production"&&!ASe(S)&&console.warn("setSelf function cannot be used with read-only atom"),!M&&ASe(S)&&(M=(...k)=>{if(($a.env?$a.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),RSe(k)){(E=k.onCancel)==null||E.call(k,()=>N?.abort());let F=()=>{if(P.m){let K=VB();p(K,S,P),YA(K)}};k.then(F,F)}return P}catch(k){return delete P.v,P.e=k,++P.n,P}finally{T=!1}},s=w=>fee(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=jPr(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 F of M.d.keys())if(F!==N&&T.has(F)){k=!0;break}k&&(a(w,N,P),p(w,N,M),D!==M.n&&(ISe(w,N,M),T.add(N))),P.delete(N)}},d=(w,S,...C)=>{let E=!0,P=I=>fee(a(w,I)),T=(I,...N)=>{let M=t(I);try{if(XQe(S,I)){if(!TSe(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&&(ISe(w,I,M),c(w,I,M));return}else return d(w,I,...N)}finally{E||YA(w)}};try{return r(S,P,T,...C)}finally{E=!1}},f=(w,...S)=>{let C=VB();try{return d(C,w,...S)}finally{YA(C)}},p=(w,S,C)=>{if(C.m&&!MSe(C.v)){for(let E of C.d.keys())C.m.d.has(E)||(h(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=m(w,E,t(E));P?.t.delete(S)}}},h=(w,S,C)=>{if(!C.m){a(w,S);for(let E of C.d.keys())h(w,E,t(E)).t.add(S);if(C.m={l:new Set,d:new Set(C.d.keys()),t:new Set},($a.env?$a.env.MODE:void 0)!=="production"&&o.add(S),ASe(S)){let E=C.m,P,T=(I,N)=>{let M=!0;P=(...D)=>{try{return d(I,S,...D)}finally{M||YA(I)}};try{return N()}finally{M=!1}};tet(w,()=>{let I=T(w,()=>n(S,(...N)=>P(...N)));I&&(E.u=N=>T(N,I))})}}return C.m},m=(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&&tet(w,()=>E(w)),delete C.m,($a.env?$a.env.MODE:void 0)!=="production"&&o.delete(S);for(let P of C.d.keys()){let T=m(w,P,t(P));T?.t.delete(S)}return}return C.m},_={get:s,set:f,sub:(w,S)=>{let C=VB(),E=t(w),T=h(C,w,E).l;return T.add(S),YA(C),()=>{T.delete(S);let I=VB();m(I,w,E),YA(I)}},unstable_derive:w=>net(...w(t,e,r,n))};return($a.env?$a.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=VB();for(let[E,P]of S)if(TSe(E)){let T=t(E),I=T.n;i(E,T,P),p(C,E,T),I!==T.n&&(ISe(C,E,T),c(C,E,T))}YA(C)}}),_},WB=()=>{let t=new WeakMap;return net(r=>{if(($a.env?$a.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)})},oet=()=>(t8||(t8=WB(),($a.env?$a.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=t8),globalThis.__JOTAI_DEFAULT_STORE__!==t8&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),t8)});var get=x(Qn=>{"use strict";var r8=Symbol.for("react.element"),DPr=Symbol.for("react.portal"),LPr=Symbol.for("react.fragment"),FPr=Symbol.for("react.strict_mode"),kPr=Symbol.for("react.profiler"),$Pr=Symbol.for("react.provider"),BPr=Symbol.for("react.context"),zPr=Symbol.for("react.forward_ref"),UPr=Symbol.for("react.suspense"),qPr=Symbol.for("react.memo"),HPr=Symbol.for("react.lazy"),iet=Symbol.iterator;function VPr(t){return t===null||typeof t!="object"?null:(t=iet&&t[iet]||t["@@iterator"],typeof t=="function"?t:null)}var uet={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cet=Object.assign,det={};function KB(t,e,r){this.props=t,this.context=e,this.refs=det,this.updater=r||uet}KB.prototype.isReactComponent={};KB.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")};KB.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function fet(){}fet.prototype=KB.prototype;function DSe(t,e,r){this.props=t,this.context=e,this.refs=det,this.updater=r||uet}var LSe=DSe.prototype=new fet;LSe.constructor=DSe;cet(LSe,KB.prototype);LSe.isPureReactComponent=!0;var aet=Array.isArray,pet=Object.prototype.hasOwnProperty,FSe={current:null},met={key:!0,ref:!0,__self:!0,__source:!0};function het(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)pet.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:r8,type:t,key:i,ref:a,props:o,_owner:FSe.current}}function WPr(t,e){return{$$typeof:r8,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function kSe(t){return typeof t=="object"&&t!==null&&t.$$typeof===r8}function KPr(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var set=/\/+/g;function jSe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?KPr(""+t.key):e.toString(36)}function hee(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 r8:case DPr:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+jSe(a,0):n,aet(o)?(r="",t!=null&&(r=t.replace(set,"$&/")+"/"),hee(o,e,r,"",function(l){return l})):o!=null&&(kSe(o)&&(o=WPr(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(set,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",aet(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+jSe(i,s);a+=hee(i,e,r,u,o)}else if(u=VPr(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+jSe(i,s++),a+=hee(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 mee(t,e,r){if(t==null)return t;var n=[],o=0;return hee(t,n,"","",function(i){return e.call(r,i,o++)}),n}function GPr(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 Ip={current:null},gee={transition:null},JPr={ReactCurrentDispatcher:Ip,ReactCurrentBatchConfig:gee,ReactCurrentOwner:FSe};Qn.Children={map:mee,forEach:function(t,e,r){mee(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return mee(t,function(){e++}),e},toArray:function(t){return mee(t,function(e){return e})||[]},only:function(t){if(!kSe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Qn.Component=KB;Qn.Fragment=LPr;Qn.Profiler=kPr;Qn.PureComponent=DSe;Qn.StrictMode=FPr;Qn.Suspense=UPr;Qn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=JPr;Qn.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=cet({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=FSe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)pet.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:r8,type:t.type,key:o,ref:i,props:n,_owner:a}};Qn.createContext=function(t){return t={$$typeof:BPr,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:$Pr,_context:t},t.Consumer=t};Qn.createElement=het;Qn.createFactory=function(t){var e=het.bind(null,t);return e.type=t,e};Qn.createRef=function(){return{current:null}};Qn.forwardRef=function(t){return{$$typeof:zPr,render:t}};Qn.isValidElement=kSe;Qn.lazy=function(t){return{$$typeof:HPr,_payload:{_status:-1,_result:t},_init:GPr}};Qn.memo=function(t,e){return{$$typeof:qPr,type:t,compare:e===void 0?null:e}};Qn.startTransition=function(t){var e=gee.transition;gee.transition={};try{t()}finally{gee.transition=e}};Qn.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Qn.useCallback=function(t,e){return Ip.current.useCallback(t,e)};Qn.useContext=function(t){return Ip.current.useContext(t)};Qn.useDebugValue=function(){};Qn.useDeferredValue=function(t){return Ip.current.useDeferredValue(t)};Qn.useEffect=function(t,e){return Ip.current.useEffect(t,e)};Qn.useId=function(){return Ip.current.useId()};Qn.useImperativeHandle=function(t,e,r){return Ip.current.useImperativeHandle(t,e,r)};Qn.useInsertionEffect=function(t,e){return Ip.current.useInsertionEffect(t,e)};Qn.useLayoutEffect=function(t,e){return Ip.current.useLayoutEffect(t,e)};Qn.useMemo=function(t,e){return Ip.current.useMemo(t,e)};Qn.useReducer=function(t,e,r){return Ip.current.useReducer(t,e,r)};Qn.useRef=function(t){return Ip.current.useRef(t)};Qn.useState=function(t){return Ip.current.useState(t)};Qn.useSyncExternalStore=function(t,e,r){return Ip.current.useSyncExternalStore(t,e,r)};Qn.useTransition=function(){return Ip.current.useTransition()};Qn.version="18.2.0"});var Y=x((zao,yet)=>{"use strict";yet.exports=get()});function n8(t,e){let r=_et(e),[[n,o,i],a]=(0,If.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,If.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);BSe(c)&&vet(bet(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,If.useDebugValue)(s),BSe(s)){let l=bet(s);return YPr(l)}return s}function XPr(t,e){let r=_et(e);return(0,If.useCallback)((...o)=>{if((yee.env?yee.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function GB(t,e){return[n8(t,e),XPr(t,e)]}var If,yee,ZPr,_et,BSe,vet,YPr,$Se,bet,wet=b(()=>{"use client";If=j(Y(),1);NSe();yee={},ZPr=(0,If.createContext)(void 0),_et=t=>{let e=(0,If.useContext)(ZPr);return t?.store||e||oet()},BSe=t=>typeof t?.then=="function",vet=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},YPr=If.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(vet(t),t)}),$Se=new WeakMap,bet=t=>{let e=$Se.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((yee.env?yee.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");BSe(l)?($Se.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),$Se.set(t,e)),e}});var o8=b(()=>{NSe();wet()});var i8={};os(i8,{getModelKeyFromModel:()=>tn,getSettings:()=>oe,getSystemPrompt:()=>Mf,resetSettings:()=>zSe,sanitizeSettings:()=>USe,setSettings:()=>wE,settingsAtom:()=>XA,settingsStore:()=>Ki,subscribeToSettingsChange:()=>wa,updateSetting:()=>nt,useSettingsValue:()=>vn});function wE(t){let e=QPr({...oe(),...t});Ki.set(XA,e)}function nt(t,e){let r=oe();wE({...r,[t]:e})}function oe(){return Ki.get(XA)}function zSe(){let t={...bu,activeModels:Av.map(e=>({...e,enabled:!0})),activeEmbeddingModels:Pj.map(e=>({...e,enabled:!0}))};wE(t)}function wa(t){let e=oe();return Ki.sub(XA,()=>{let r=oe();t(e,r),e=r})}function vn(){return n8(XA,{store:Ki})}function USe(t){let e=t||bu;e.userId||(e.userId=dm()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(c=>({...c,provider:c.provider==="azure_openai"?"azure openai":c.provider})):e.activeEmbeddingModels=Pj.map(c=>({...c,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?bu.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?bu.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?bu.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?bu.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);r.embeddingBatchSize=isNaN(s)?bu.embeddingBatchSize:s;let u=Number(e.lexicalSearchRamLimit);isNaN(u)?r.lexicalSearchRamLimit=bu.lexicalSearchRamLimit:r.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,u)),typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=bu.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=bu.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=bu.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=bu.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=bu.enableWordCompletion);let l=Number(e.autonomousAgentMaxIterations);return isNaN(l)||l<4||l>8?r.autonomousAgentMaxIterations=bu.autonomousAgentMaxIterations:r.autonomousAgentMaxIterations=l,Array.isArray(r.autonomousAgentEnabledToolIds)||(r.autonomousAgentEnabledToolIds=bu.autonomousAgentEnabledToolIds),r}function Mf(){let t=oe().userSystemPrompt,e=Cet;return t?`${e}
<user_custom_instructions>
${t}
</user_custom_instructions>`:e}function QPr(t){return t.activeModels=xet(t.activeModels,Av),t.activeEmbeddingModels=xet(t.activeEmbeddingModels,Pj),t}function tn(t){return`${t.name}|${t.provider}`}function xet(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(tn(n),{...n})}),t.forEach(n=>{let o=tn(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 Ki,XA,bt=b(()=>{o8();zN();or();Ki=WB(),XA=Rh(bu)});function B(...t){oe().debug&&console.log(...t)}function ie(...t){oe().debug&&console.error(...t)}function Bt(...t){oe().debug&&console.warn(...t)}var Gt=b(()=>{bt()});var Oet=x((qSe,JB)=>{(function(t,e){typeof qSe=="object"&&typeof JB<"u"?JB.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(qSe,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 QKe(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 h(v){return v._pf==null&&(v._pf=p()),v._pf}var m;Array.prototype.some?m=Array.prototype.some:m=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 g(v){if(v._isValid==null){var O=h(v),A=m.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 y(v){var O=f(NaN);return v!=null?d(h(O),v):h(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=h(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,we,pr=arguments.length;for(te=0;te<pr;te++){if($="",typeof arguments[te]=="object"){$+=`
[`+te+"] ";for(we in arguments[0])i(arguments[0],we)&&($+=we+": "+arguments[0][we]+", ");$=$.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 F(v){v!=null&&this.set(v)}var K;Object.keys?K=Object.keys:K=function(v){var O,A=[];for(O in v)i(v,O)&&A.push(O);return A};var U={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function X(v,O,A){var R=this._calendar[v]||this._calendar.sameElse;return M(R)?R.call(O,A):R}function ee(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 L=/(\[[^\[]*\])|(\\)?([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,z={},W={};function V(v,O,A,R){var $=R;typeof R=="string"&&($=function(){return this[R]()}),v&&(W[v]=$),O&&(W[O[0]]=function(){return ee($.apply(this,arguments),O[1],O[2])}),A&&(W[A]=function(){return this.localeData().ordinal($.apply(this,arguments),v)})}function q(v){return v.match(/\[[\s\S]/)?v.replace(/^\[|\]$/g,""):v.replace(/\\/g,"")}function H(v){var O=v.match(L),A,R;for(A=0,R=O.length;A<R;A++)W[O[A]]?O[A]=W[O[A]]:O[A]=q(O[A]);return function($){var te="",we;for(we=0;we<R;we++)te+=M(O[we])?O[we].call($,v):O[we];return te}}function G(v,O){return v.isValid()?(O=Z(O,v.localeData()),z[O]=z[O]||H(O),z[O](v)):v.localeData().invalidDate()}function Z(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 de={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 pe(v){var O=this._longDateFormat[v],A=this._longDateFormat[v.toUpperCase()];return O||!A?O:(this._longDateFormat[v]=A.match(L).map(function(R){return R==="MMMM"||R==="MM"||R==="DD"||R==="dddd"?R.slice(1):R}).join(""),this._longDateFormat[v])}var ae="Invalid date";function Te(){return this._invalidDate}var Ae="%d",ke=/\d{1,2}/;function Ot(v){return this._ordinal.replace("%d",v)}var jr={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 Mr(v,O,A,R){var $=this._relativeTime[A];return M($)?$(v,O,A,R):$.replace(/%d/i,v)}function Vn(v,O){var A=this._relativeTime[v>0?"future":"past"];return M(A)?A(O):A.replace(/%s/i,O)}var Xr={};function Cr(v,O){var A=v.toLowerCase();Xr[A]=Xr[A+"s"]=Xr[O]=v}function Me(v){return typeof v=="string"?Xr[v]||Xr[v.toLowerCase()]:void 0}function Ze(v){var O={},A,R;for(R in v)i(v,R)&&(A=Me(R),A&&(O[A]=v[R]));return O}var je={};function le(v,O){je[v]=O}function ne(v){var O=[],A;for(A in v)i(v,A)&&O.push({unit:A,priority:je[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 be(v){return v<0?Math.ceil(v)||0:Math.floor(v)}function ye(v){var O=+v,A=0;return O!==0&&isFinite(O)&&(A=be(O)),A}function ze(v,O){return function(A){return A!=null?(Ii(this,v,A),e.updateOffset(this,O),this):hr(this,v)}}function hr(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=ye(A),v._d["set"+(v._isUTC?"UTC":"")+O](A,v.month(),pX(A,v.month()))):v._d["set"+(v._isUTC?"UTC":"")+O](A))}function _i(v){return v=Me(v),M(this[v])?this[v]():this}function bf(v,O){if(typeof v=="object"){v=Ze(v);var A=ne(v),R,$=A.length;for(R=0;R<$;R++)this[A[R].unit](v[A[R].unit])}else if(v=Me(v),M(this[v]))return this[v](O);return this}var mp=/\d/,Hi=/\d\d/,gd=/\d{3}/,yd=/\d{4}/,_f=/[+-]?\d{6}/,Wn=/\d\d?/,EA=/\d\d\d\d?/,FN=/\d\d\d\d\d\d?/,PA=/\d{1,3}/,Is=/\d{1,4}/,hu=/[+-]?\d{1,6}/,ns=/\d+/,hp=/[+-]?\d+/,vf=/Z|[+-]\d\d:?\d\d/gi,Gs=/Z|[+-]\d\d(?::?\d\d)?/gi,cm=/[+-]?\d+(\.\d{1,3})?/,gp=/[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,Xn;Xn={};function Qe(v,O,A){Xn[v]=M(O)?O:function(R,$){return R&&A?A:O}}function yp(v,O){return i(Xn,v)?Xn[v](O._strict,O._locale):new RegExp(Ch(v))}function Ch(v){return tc(v.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(O,A,R,$,te){return A||R||$||te}))}function tc(v){return v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var YO={};function Kn(v,O){var A,R=O,$;for(typeof v=="string"&&(v=[v]),u(O)&&(R=function(te,we){we[O]=ye(te)}),$=v.length,A=0;A<$;A++)YO[v[A]]=R}function Ob(v,O){Kn(v,function(A,R,$,te){$._w=$._w||{},O(A,$._w,$,te)})}function KV(v,O,A){O!=null&&i(YO,v)&&YO[v](O,A._a,A,v)}var wf=0,XO=1,hv=2,rc=3,Eb=4,QO=5,kN=6,Oyr=7,Eyr=8;function Pyr(v,O){return(v%O+O)%O}var Js;Array.prototype.indexOf?Js=Array.prototype.indexOf:Js=function(v){var O;for(O=0;O<this.length;++O)if(this[O]===v)return O;return-1};function pX(v,O){if(isNaN(v)||isNaN(O))return NaN;var A=Pyr(O,12);return v+=(O-A)/12,A===1?fe(v)?29:28:31-A%7%2}V("M",["MM",2],"Mo",function(){return this.month()+1}),V("MMM",0,0,function(v){return this.localeData().monthsShort(this,v)}),V("MMMM",0,0,function(v){return this.localeData().months(this,v)}),Cr("month","M"),le("month",8),Qe("M",Wn),Qe("MM",Wn,Hi),Qe("MMM",function(v,O){return O.monthsShortRegex(v)}),Qe("MMMM",function(v,O){return O.monthsRegex(v)}),Kn(["M","MM"],function(v,O){O[XO]=ye(v)-1}),Kn(["MMM","MMMM"],function(v,O,A,R){var $=A._locale.monthsParse(v,R,A._strict);$!=null?O[XO]=$:h(A).invalidMonth=v});var Tyr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),kKe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),$Ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ayr=gp,Iyr=gp;function Myr(v,O){return v?n(this._months)?this._months[v.month()]:this._months[(this._months.isFormat||$Ke).test(O)?"format":"standalone"][v.month()]:n(this._months)?this._months:this._months.standalone}function Ryr(v,O){return v?n(this._monthsShort)?this._monthsShort[v.month()]:this._monthsShort[$Ke.test(O)?"format":"standalone"][v.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Nyr(v,O,A){var R,$,te,we=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"?($=Js.call(this._shortMonthsParse,we),$!==-1?$:null):($=Js.call(this._longMonthsParse,we),$!==-1?$:null):O==="MMM"?($=Js.call(this._shortMonthsParse,we),$!==-1?$:($=Js.call(this._longMonthsParse,we),$!==-1?$:null)):($=Js.call(this._longMonthsParse,we),$!==-1?$:($=Js.call(this._shortMonthsParse,we),$!==-1?$:null))}function jyr(v,O,A){var R,$,te;if(this._monthsParseExact)return Nyr.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 BKe(v,O){var A;if(!v.isValid())return v;if(typeof O=="string"){if(/^\d+$/.test(O))O=ye(O);else if(O=v.localeData().monthsParse(O),!u(O))return v}return A=Math.min(v.date(),pX(v.year(),O)),v._d["set"+(v._isUTC?"UTC":"")+"Month"](O,A),v}function zKe(v){return v!=null?(BKe(this,v),e.updateOffset(this,!0),this):hr(this,"Month")}function Dyr(){return pX(this.year(),this.month())}function Lyr(v){return this._monthsParseExact?(i(this,"_monthsRegex")||UKe.call(this),v?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=Ayr),this._monthsShortStrictRegex&&v?this._monthsShortStrictRegex:this._monthsShortRegex)}function Fyr(v){return this._monthsParseExact?(i(this,"_monthsRegex")||UKe.call(this),v?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=Iyr),this._monthsStrictRegex&&v?this._monthsStrictRegex:this._monthsRegex)}function UKe(){function v(we,pr){return pr.length-we.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[$]=tc(O[$]),A[$]=tc(A[$]);for($=0;$<24;$++)R[$]=tc(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")}V("Y",0,0,function(){var v=this.year();return v<=9999?ee(v,4):"+"+v}),V(0,["YY",2],0,function(){return this.year()%100}),V(0,["YYYY",4],0,"year"),V(0,["YYYYY",5],0,"year"),V(0,["YYYYYY",6,!0],0,"year"),Cr("year","y"),le("year",1),Qe("Y",hp),Qe("YY",Wn,Hi),Qe("YYYY",Is,yd),Qe("YYYYY",hu,_f),Qe("YYYYYY",hu,_f),Kn(["YYYYY","YYYYYY"],wf),Kn("YYYY",function(v,O){O[wf]=v.length===2?e.parseTwoDigitYear(v):ye(v)}),Kn("YY",function(v,O){O[wf]=e.parseTwoDigitYear(v)}),Kn("Y",function(v,O){O[wf]=parseInt(v,10)});function GV(v){return fe(v)?366:365}e.parseTwoDigitYear=function(v){return ye(v)+(ye(v)>68?1900:2e3)};var qKe=ze("FullYear",!0);function kyr(){return fe(this.year())}function $yr(v,O,A,R,$,te,we){var pr;return v<100&&v>=0?(pr=new Date(v+400,O,A,R,$,te,we),isFinite(pr.getFullYear())&&pr.setFullYear(v)):pr=new Date(v,O,A,R,$,te,we),pr}function JV(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 mX(v,O,A){var R=7+O-A,$=(7+JV(v,0,R).getUTCDay()-O)%7;return-$+R-1}function HKe(v,O,A,R,$){var te=(7+A-R)%7,we=mX(v,R,$),pr=1+7*(O-1)+te+we,Tn,Vi;return pr<=0?(Tn=v-1,Vi=GV(Tn)+pr):pr>GV(v)?(Tn=v+1,Vi=pr-GV(v)):(Tn=v,Vi=pr),{year:Tn,dayOfYear:Vi}}function ZV(v,O,A){var R=mX(v.year(),O,A),$=Math.floor((v.dayOfYear()-R-1)/7)+1,te,we;return $<1?(we=v.year()-1,te=$+eE(we,O,A)):$>eE(v.year(),O,A)?(te=$-eE(v.year(),O,A),we=v.year()+1):(we=v.year(),te=$),{week:te,year:we}}function eE(v,O,A){var R=mX(v,O,A),$=mX(v+1,O,A);return(GV(v)-R+$)/7}V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),Cr("week","w"),Cr("isoWeek","W"),le("week",5),le("isoWeek",5),Qe("w",Wn),Qe("ww",Wn,Hi),Qe("W",Wn),Qe("WW",Wn,Hi),Ob(["w","ww","W","WW"],function(v,O,A,R){O[R.substr(0,1)]=ye(v)});function Byr(v){return ZV(v,this._week.dow,this._week.doy).week}var zyr={dow:0,doy:6};function Uyr(){return this._week.dow}function qyr(){return this._week.doy}function Hyr(v){var O=this.localeData().week(this);return v==null?O:this.add((v-O)*7,"d")}function Vyr(v){var O=ZV(this,1,4).week;return v==null?O:this.add((v-O)*7,"d")}V("d",0,"do","day"),V("dd",0,0,function(v){return this.localeData().weekdaysMin(this,v)}),V("ddd",0,0,function(v){return this.localeData().weekdaysShort(this,v)}),V("dddd",0,0,function(v){return this.localeData().weekdays(this,v)}),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),Cr("day","d"),Cr("weekday","e"),Cr("isoWeekday","E"),le("day",11),le("weekday",11),le("isoWeekday",11),Qe("d",Wn),Qe("e",Wn),Qe("E",Wn),Qe("dd",function(v,O){return O.weekdaysMinRegex(v)}),Qe("ddd",function(v,O){return O.weekdaysShortRegex(v)}),Qe("dddd",function(v,O){return O.weekdaysRegex(v)}),Ob(["dd","ddd","dddd"],function(v,O,A,R){var $=A._locale.weekdaysParse(v,R,A._strict);$!=null?O.d=$:h(A).invalidWeekday=v}),Ob(["d","e","E"],function(v,O,A,R){O[R]=ye(v)});function Wyr(v,O){return typeof v!="string"?v:isNaN(v)?(v=O.weekdaysParse(v),typeof v=="number"?v:null):parseInt(v,10)}function Kyr(v,O){return typeof v=="string"?O.weekdaysParse(v)%7||7:isNaN(v)?null:v}function twe(v,O){return v.slice(O,7).concat(v.slice(0,O))}var Gyr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),VKe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Jyr="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Zyr=gp,Yyr=gp,Xyr=gp;function Qyr(v,O){var A=n(this._weekdays)?this._weekdays:this._weekdays[v&&v!==!0&&this._weekdays.isFormat.test(O)?"format":"standalone"];return v===!0?twe(A,this._week.dow):v?A[v.day()]:A}function ebr(v){return v===!0?twe(this._weekdaysShort,this._week.dow):v?this._weekdaysShort[v.day()]:this._weekdaysShort}function tbr(v){return v===!0?twe(this._weekdaysMin,this._week.dow):v?this._weekdaysMin[v.day()]:this._weekdaysMin}function rbr(v,O,A){var R,$,te,we=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"?($=Js.call(this._weekdaysParse,we),$!==-1?$:null):O==="ddd"?($=Js.call(this._shortWeekdaysParse,we),$!==-1?$:null):($=Js.call(this._minWeekdaysParse,we),$!==-1?$:null):O==="dddd"?($=Js.call(this._weekdaysParse,we),$!==-1||($=Js.call(this._shortWeekdaysParse,we),$!==-1)?$:($=Js.call(this._minWeekdaysParse,we),$!==-1?$:null)):O==="ddd"?($=Js.call(this._shortWeekdaysParse,we),$!==-1||($=Js.call(this._weekdaysParse,we),$!==-1)?$:($=Js.call(this._minWeekdaysParse,we),$!==-1?$:null)):($=Js.call(this._minWeekdaysParse,we),$!==-1||($=Js.call(this._weekdaysParse,we),$!==-1)?$:($=Js.call(this._shortWeekdaysParse,we),$!==-1?$:null))}function nbr(v,O,A){var R,$,te;if(this._weekdaysParseExact)return rbr.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 obr(v){if(!this.isValid())return v!=null?this:NaN;var O=this._isUTC?this._d.getUTCDay():this._d.getDay();return v!=null?(v=Wyr(v,this.localeData()),this.add(v-O,"d")):O}function ibr(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 abr(v){if(!this.isValid())return v!=null?this:NaN;if(v!=null){var O=Kyr(v,this.localeData());return this.day(this.day()%7?O:O-7)}else return this.day()||7}function sbr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||rwe.call(this),v?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=Zyr),this._weekdaysStrictRegex&&v?this._weekdaysStrictRegex:this._weekdaysRegex)}function ubr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||rwe.call(this),v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Yyr),this._weekdaysShortStrictRegex&&v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function lbr(v){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||rwe.call(this),v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Xyr),this._weekdaysMinStrictRegex&&v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function rwe(){function v(bp,iE){return iE.length-bp.length}var O=[],A=[],R=[],$=[],te,we,pr,Tn,Vi;for(te=0;te<7;te++)we=f([2e3,1]).day(te),pr=tc(this.weekdaysMin(we,"")),Tn=tc(this.weekdaysShort(we,"")),Vi=tc(this.weekdays(we,"")),O.push(pr),A.push(Tn),R.push(Vi),$.push(pr),$.push(Tn),$.push(Vi);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 nwe(){return this.hours()%12||12}function cbr(){return this.hours()||24}V("H",["HH",2],0,"hour"),V("h",["hh",2],0,nwe),V("k",["kk",2],0,cbr),V("hmm",0,0,function(){return""+nwe.apply(this)+ee(this.minutes(),2)}),V("hmmss",0,0,function(){return""+nwe.apply(this)+ee(this.minutes(),2)+ee(this.seconds(),2)}),V("Hmm",0,0,function(){return""+this.hours()+ee(this.minutes(),2)}),V("Hmmss",0,0,function(){return""+this.hours()+ee(this.minutes(),2)+ee(this.seconds(),2)});function WKe(v,O){V(v,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),O)})}WKe("a",!0),WKe("A",!1),Cr("hour","h"),le("hour",13);function KKe(v,O){return O._meridiemParse}Qe("a",KKe),Qe("A",KKe),Qe("H",Wn),Qe("h",Wn),Qe("k",Wn),Qe("HH",Wn,Hi),Qe("hh",Wn,Hi),Qe("kk",Wn,Hi),Qe("hmm",EA),Qe("hmmss",FN),Qe("Hmm",EA),Qe("Hmmss",FN),Kn(["H","HH"],rc),Kn(["k","kk"],function(v,O,A){var R=ye(v);O[rc]=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[rc]=ye(v),h(A).bigHour=!0}),Kn("hmm",function(v,O,A){var R=v.length-2;O[rc]=ye(v.substr(0,R)),O[Eb]=ye(v.substr(R)),h(A).bigHour=!0}),Kn("hmmss",function(v,O,A){var R=v.length-4,$=v.length-2;O[rc]=ye(v.substr(0,R)),O[Eb]=ye(v.substr(R,2)),O[QO]=ye(v.substr($)),h(A).bigHour=!0}),Kn("Hmm",function(v,O,A){var R=v.length-2;O[rc]=ye(v.substr(0,R)),O[Eb]=ye(v.substr(R))}),Kn("Hmmss",function(v,O,A){var R=v.length-4,$=v.length-2;O[rc]=ye(v.substr(0,R)),O[Eb]=ye(v.substr(R,2)),O[QO]=ye(v.substr($))});function dbr(v){return(v+"").toLowerCase().charAt(0)==="p"}var fbr=/[ap]\.?m?\.?/i,pbr=ze("Hours",!0);function mbr(v,O,A){return v>11?A?"pm":"PM":A?"am":"AM"}var GKe={calendar:U,longDateFormat:de,invalidDate:ae,ordinal:Ae,dayOfMonthOrdinalParse:ke,relativeTime:jr,months:Tyr,monthsShort:kKe,week:zyr,weekdays:Gyr,weekdaysMin:Jyr,weekdaysShort:VKe,meridiemParse:fbr},ka={},YV={},XV;function hbr(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 JKe(v){return v&&v.toLowerCase().replace("_","-")}function gbr(v){for(var O=0,A,R,$,te;O<v.length;){for(te=JKe(v[O]).split("-"),A=te.length,R=JKe(v[O+1]),R=R?R.split("-"):null;A>0;){if($=hX(te.slice(0,A).join("-")),$)return $;if(R&&R.length>=A&&hbr(te,R)>=A-1)break;A--}O++}return XV}function ybr(v){return v.match("^[^/\\\\]*$")!=null}function hX(v){var O=null,A;if(ka[v]===void 0&&typeof JB<"u"&&JB&&JB.exports&&ybr(v))try{O=XV._abbr,A=require,A("./locale/"+v),TA(O)}catch{ka[v]=null}return ka[v]}function TA(v,O){var A;return v&&(s(O)?A=tE(v):A=owe(v,O),A?XV=A:typeof console<"u"&&console.warn&&console.warn("Locale "+v+" not found. Did you forget to load it?")),XV._abbr}function owe(v,O){if(O!==null){var A,R=GKe;if(O.abbr=v,ka[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=ka[v]._config;else if(O.parentLocale!=null)if(ka[O.parentLocale]!=null)R=ka[O.parentLocale]._config;else if(A=hX(O.parentLocale),A!=null)R=A._config;else return YV[O.parentLocale]||(YV[O.parentLocale]=[]),YV[O.parentLocale].push({name:v,config:O}),null;return ka[v]=new F(k(R,O)),YV[v]&&YV[v].forEach(function($){owe($.name,$.config)}),TA(v),ka[v]}else return delete ka[v],null}function bbr(v,O){if(O!=null){var A,R,$=GKe;ka[v]!=null&&ka[v].parentLocale!=null?ka[v].set(k(ka[v]._config,O)):(R=hX(v),R!=null&&($=R._config),O=k($,O),R==null&&(O.abbr=v),A=new F(O),A.parentLocale=ka[v],ka[v]=A),TA(v)}else ka[v]!=null&&(ka[v].parentLocale!=null?(ka[v]=ka[v].parentLocale,v===TA()&&TA(v)):ka[v]!=null&&delete ka[v]);return ka[v]}function tE(v){var O;if(v&&v._locale&&v._locale._abbr&&(v=v._locale._abbr),!v)return XV;if(!n(v)){if(O=hX(v),O)return O;v=[v]}return gbr(v)}function _br(){return K(ka)}function iwe(v){var O,A=v._a;return A&&h(v).overflow===-2&&(O=A[XO]<0||A[XO]>11?XO:A[hv]<1||A[hv]>pX(A[wf],A[XO])?hv:A[rc]<0||A[rc]>24||A[rc]===24&&(A[Eb]!==0||A[QO]!==0||A[kN]!==0)?rc:A[Eb]<0||A[Eb]>59?Eb:A[QO]<0||A[QO]>59?QO:A[kN]<0||A[kN]>999?kN:-1,h(v)._overflowDayOfYear&&(O<wf||O>hv)&&(O=hv),h(v)._overflowWeeks&&O===-1&&(O=Oyr),h(v)._overflowWeekday&&O===-1&&(O=Eyr),h(v).overflow=O),v}var 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=/^\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)?)?$/,xbr=/Z|[+-]\d\d(?::?\d\d)?/,gX=[["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]],awe=[["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/]],Sbr=/^\/?Date\((-?\d+)/i,Cbr=/^(?:(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}))$/,Obr={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 ZKe(v){var O,A,R=v._i,$=vbr.exec(R)||wbr.exec(R),te,we,pr,Tn,Vi=gX.length,bp=awe.length;if($){for(h(v).iso=!0,O=0,A=Vi;O<A;O++)if(gX[O][1].exec($[1])){we=gX[O][0],te=gX[O][2]!==!1;break}if(we==null){v._isValid=!1;return}if($[3]){for(O=0,A=bp;O<A;O++)if(awe[O][1].exec($[3])){pr=($[2]||" ")+awe[O][0];break}if(pr==null){v._isValid=!1;return}}if(!te&&pr!=null){v._isValid=!1;return}if($[4])if(xbr.exec($[4]))Tn="Z";else{v._isValid=!1;return}v._f=we+(pr||"")+(Tn||""),uwe(v)}else v._isValid=!1}function Ebr(v,O,A,R,$,te){var we=[Pbr(v),kKe.indexOf(O),parseInt(A,10),parseInt(R,10),parseInt($,10)];return te&&we.push(parseInt(te,10)),we}function Pbr(v){var O=parseInt(v,10);return O<=49?2e3+O:O<=999?1900+O:O}function Tbr(v){return v.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Abr(v,O,A){if(v){var R=VKe.indexOf(v),$=new Date(O[0],O[1],O[2]).getDay();if(R!==$)return h(A).weekdayMismatch=!0,A._isValid=!1,!1}return!0}function Ibr(v,O,A){if(v)return Obr[v];if(O)return 0;var R=parseInt(A,10),$=R%100,te=(R-$)/100;return te*60+$}function YKe(v){var O=Cbr.exec(Tbr(v._i)),A;if(O){if(A=Ebr(O[4],O[3],O[2],O[5],O[6],O[7]),!Abr(O[1],A,v))return;v._a=A,v._tzm=Ibr(O[8],O[9],O[10]),v._d=JV.apply(null,v._a),v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),h(v).rfc2822=!0}else v._isValid=!1}function Mbr(v){var O=Sbr.exec(v._i);if(O!==null){v._d=new Date(+O[1]);return}if(ZKe(v),v._isValid===!1)delete v._isValid;else return;if(YKe(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 rB(v,O,A){return v??O??A}function Rbr(v){var O=new Date(e.now());return v._useUTC?[O.getUTCFullYear(),O.getUTCMonth(),O.getUTCDate()]:[O.getFullYear(),O.getMonth(),O.getDate()]}function swe(v){var O,A,R=[],$,te,we;if(!v._d){for($=Rbr(v),v._w&&v._a[hv]==null&&v._a[XO]==null&&Nbr(v),v._dayOfYear!=null&&(we=rB(v._a[wf],$[wf]),(v._dayOfYear>GV(we)||v._dayOfYear===0)&&(h(v)._overflowDayOfYear=!0),A=JV(we,0,v._dayOfYear),v._a[XO]=A.getUTCMonth(),v._a[hv]=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[rc]===24&&v._a[Eb]===0&&v._a[QO]===0&&v._a[kN]===0&&(v._nextDay=!0,v._a[rc]=0),v._d=(v._useUTC?JV:$yr).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[rc]=24),v._w&&typeof v._w.d<"u"&&v._w.d!==te&&(h(v).weekdayMismatch=!0)}}function Nbr(v){var O,A,R,$,te,we,pr,Tn,Vi;O=v._w,O.GG!=null||O.W!=null||O.E!=null?(te=1,we=4,A=rB(O.GG,v._a[wf],ZV(ba(),1,4).year),R=rB(O.W,1),$=rB(O.E,1),($<1||$>7)&&(Tn=!0)):(te=v._locale._week.dow,we=v._locale._week.doy,Vi=ZV(ba(),te,we),A=rB(O.gg,v._a[wf],Vi.year),R=rB(O.w,Vi.week),O.d!=null?($=O.d,($<0||$>6)&&(Tn=!0)):O.e!=null?($=O.e+te,(O.e<0||O.e>6)&&(Tn=!0)):$=te),R<1||R>eE(A,te,we)?h(v)._overflowWeeks=!0:Tn!=null?h(v)._overflowWeekday=!0:(pr=HKe(A,R,$,te,we),v._a[wf]=pr.year,v._dayOfYear=pr.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function uwe(v){if(v._f===e.ISO_8601){ZKe(v);return}if(v._f===e.RFC_2822){YKe(v);return}v._a=[],h(v).empty=!0;var O=""+v._i,A,R,$,te,we,pr=O.length,Tn=0,Vi,bp;for($=Z(v._f,v._locale).match(L)||[],bp=$.length,A=0;A<bp;A++)te=$[A],R=(O.match(yp(te,v))||[])[0],R&&(we=O.substr(0,O.indexOf(R)),we.length>0&&h(v).unusedInput.push(we),O=O.slice(O.indexOf(R)+R.length),Tn+=R.length),W[te]?(R?h(v).empty=!1:h(v).unusedTokens.push(te),KV(te,R,v)):v._strict&&!R&&h(v).unusedTokens.push(te);h(v).charsLeftOver=pr-Tn,O.length>0&&h(v).unusedInput.push(O),v._a[rc]<=12&&h(v).bigHour===!0&&v._a[rc]>0&&(h(v).bigHour=void 0),h(v).parsedDateParts=v._a.slice(0),h(v).meridiem=v._meridiem,v._a[rc]=jbr(v._locale,v._a[rc],v._meridiem),Vi=h(v).era,Vi!==null&&(v._a[wf]=v._locale.erasConvertYear(Vi,v._a[wf])),swe(v),iwe(v)}function jbr(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 Dbr(v){var O,A,R,$,te,we,pr=!1,Tn=v._f.length;if(Tn===0){h(v).invalidFormat=!0,v._d=new Date(NaN);return}for($=0;$<Tn;$++)te=0,we=!1,O=S({},v),v._useUTC!=null&&(O._useUTC=v._useUTC),O._f=v._f[$],uwe(O),g(O)&&(we=!0),te+=h(O).charsLeftOver,te+=h(O).unusedTokens.length*10,h(O).score=te,pr?te<R&&(R=te,A=O):(R==null||te<R||we)&&(R=te,A=O,we&&(pr=!0));d(v,A||O)}function Lbr(v){if(!v._d){var O=Ze(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)}),swe(v)}}function Fbr(v){var O=new C(iwe(XKe(v)));return O._nextDay&&(O.add(1,"d"),O._nextDay=void 0),O}function XKe(v){var O=v._i,A=v._f;return v._locale=v._locale||tE(v._l),O===null||A===void 0&&O===""?y({nullInput:!0}):(typeof O=="string"&&(v._i=O=v._locale.preparse(O)),E(O)?new C(iwe(O)):(l(O)?v._d=O:n(A)?Dbr(v):A?uwe(v):kbr(v),g(v)||(v._d=null),v))}function kbr(v){var O=v._i;s(O)?v._d=new Date(e.now()):l(O)?v._d=new Date(O.valueOf()):typeof O=="string"?Mbr(v):n(O)?(v._a=c(O.slice(0),function(A){return parseInt(A,10)}),swe(v)):o(O)?Lbr(v):u(O)?v._d=new Date(O):e.createFromInputFallback(v)}function QKe(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,Fbr(te)}function ba(v,O,A,R){return QKe(v,O,A,R,!1)}var $br=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=ba.apply(null,arguments);return this.isValid()&&v.isValid()?v<this?this:v:y()}),Bbr=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=ba.apply(null,arguments);return this.isValid()&&v.isValid()?v>this?this:v:y()});function eGe(v,O){var A,R;if(O.length===1&&n(O[0])&&(O=O[0]),!O.length)return ba();for(A=O[0],R=1;R<O.length;++R)(!O[R].isValid()||O[R][v](A))&&(A=O[R]);return A}function zbr(){var v=[].slice.call(arguments,0);return eGe("isBefore",v)}function Ubr(){var v=[].slice.call(arguments,0);return eGe("isAfter",v)}var qbr=function(){return Date.now?Date.now():+new Date},QV=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Hbr(v){var O,A=!1,R,$=QV.length;for(O in v)if(i(v,O)&&!(Js.call(QV,O)!==-1&&(v[O]==null||!isNaN(v[O]))))return!1;for(R=0;R<$;++R)if(v[QV[R]]){if(A)return!1;parseFloat(v[QV[R]])!==ye(v[QV[R]])&&(A=!0)}return!0}function Vbr(){return this._isValid}function Wbr(){return Pb(NaN)}function yX(v){var O=Ze(v),A=O.year||0,R=O.quarter||0,$=O.month||0,te=O.week||O.isoWeek||0,we=O.day||0,pr=O.hour||0,Tn=O.minute||0,Vi=O.second||0,bp=O.millisecond||0;this._isValid=Hbr(O),this._milliseconds=+bp+Vi*1e3+Tn*6e4+pr*1e3*60*60,this._days=+we+te*7,this._months=+$+R*3+A*12,this._data={},this._locale=tE(),this._bubble()}function bX(v){return v instanceof yX}function lwe(v){return v<0?Math.round(-1*v)*-1:Math.round(v)}function Kbr(v,O,A){var R=Math.min(v.length,O.length),$=Math.abs(v.length-O.length),te=0,we;for(we=0;we<R;we++)(A&&v[we]!==O[we]||!A&&ye(v[we])!==ye(O[we]))&&te++;return te+$}function tGe(v,O){V(v,0,0,function(){var A=this.utcOffset(),R="+";return A<0&&(A=-A,R="-"),R+ee(~~(A/60),2)+O+ee(~~A%60,2)})}tGe("Z",":"),tGe("ZZ",""),Qe("Z",Gs),Qe("ZZ",Gs),Kn(["Z","ZZ"],function(v,O,A){A._useUTC=!0,A._tzm=cwe(Gs,v)});var Gbr=/([\+\-]|\d\d)/gi;function cwe(v,O){var A=(O||"").match(v),R,$,te;return A===null?null:(R=A[A.length-1]||[],$=(R+"").match(Gbr)||["-",0,0],te=+($[1]*60)+ye($[2]),te===0?0:$[0]==="+"?te:-te)}function dwe(v,O){var A,R;return O._isUTC?(A=O.clone(),R=(E(v)||l(v)?v.valueOf():ba(v).valueOf())-A.valueOf(),A._d.setTime(A._d.valueOf()+R),e.updateOffset(A,!1),A):ba(v).local()}function fwe(v){return-Math.round(v._d.getTimezoneOffset())}e.updateOffset=function(){};function Jbr(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=cwe(Gs,v),v===null)return this}else Math.abs(v)<16&&!A&&(v=v*60);return!this._isUTC&&O&&($=fwe(this)),this._offset=v,this._isUTC=!0,$!=null&&this.add($,"m"),R!==v&&(!O||this._changeInProgress?iGe(this,Pb(v-R,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?R:fwe(this)}function Zbr(v,O){return v!=null?(typeof v!="string"&&(v=-v),this.utcOffset(v,O),this):-this.utcOffset()}function Ybr(v){return this.utcOffset(0,v)}function Xbr(v){return this._isUTC&&(this.utcOffset(0,v),this._isUTC=!1,v&&this.subtract(fwe(this),"m")),this}function Qbr(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var v=cwe(vf,this._i);v!=null?this.utcOffset(v):this.utcOffset(0,!0)}return this}function e_r(v){return this.isValid()?(v=v?ba(v).utcOffset():0,(this.utcOffset()-v)%60===0):!1}function t_r(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function r_r(){if(!s(this._isDSTShifted))return this._isDSTShifted;var v={},O;return S(v,this),v=XKe(v),v._a?(O=v._isUTC?f(v._a):ba(v._a),this._isDSTShifted=this.isValid()&&Kbr(v._a,O.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function n_r(){return this.isValid()?!this._isUTC:!1}function o_r(){return this.isValid()?this._isUTC:!1}function rGe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var i_r=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,a_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 Pb(v,O){var A=v,R=null,$,te,we;return bX(v)?A={ms:v._milliseconds,d:v._days,M:v._months}:u(v)||!isNaN(+v)?(A={},O?A[O]=+v:A.milliseconds=+v):(R=i_r.exec(v))?($=R[1]==="-"?-1:1,A={y:0,d:ye(R[hv])*$,h:ye(R[rc])*$,m:ye(R[Eb])*$,s:ye(R[QO])*$,ms:ye(lwe(R[kN]*1e3))*$}):(R=a_r.exec(v))?($=R[1]==="-"?-1:1,A={y:$N(R[2],$),M:$N(R[3],$),w:$N(R[4],$),d:$N(R[5],$),h:$N(R[6],$),m:$N(R[7],$),s:$N(R[8],$)}):A==null?A={}:typeof A=="object"&&("from"in A||"to"in A)&&(we=s_r(ba(A.from),ba(A.to)),A={},A.ms=we.milliseconds,A.M=we.months),te=new yX(A),bX(v)&&i(v,"_locale")&&(te._locale=v._locale),bX(v)&&i(v,"_isValid")&&(te._isValid=v._isValid),te}Pb.fn=yX.prototype,Pb.invalid=Wbr;function $N(v,O){var A=v&&parseFloat(v.replace(",","."));return(isNaN(A)?0:A)*O}function nGe(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 s_r(v,O){var A;return v.isValid()&&O.isValid()?(O=dwe(O,v),v.isBefore(O)?A=nGe(v,O):(A=nGe(O,v),A.milliseconds=-A.milliseconds,A.months=-A.months),A):{milliseconds:0,months:0}}function oGe(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),$=Pb(A,R),iGe(this,$,v),this}}function iGe(v,O,A,R){var $=O._milliseconds,te=lwe(O._days),we=lwe(O._months);v.isValid()&&(R=R??!0,we&&BKe(v,hr(v,"Month")+we*A),te&&Ii(v,"Date",hr(v,"Date")+te*A),$&&v._d.setTime(v._d.valueOf()+$*A),R&&e.updateOffset(v,te||we))}var u_r=oGe(1,"add"),l_r=oGe(-1,"subtract");function aGe(v){return typeof v=="string"||v instanceof String}function c_r(v){return E(v)||l(v)||aGe(v)||u(v)||f_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,we=R.length;for($=0;$<we;$+=1)te=R[$],A=A||i(v,te);return O&&A}function f_r(v){var O=n(v),A=!1;return O&&(A=v.filter(function(R){return!u(R)&&aGe(v)}).length===0),O&&A}function p_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 m_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 h_r(v,O){arguments.length===1&&(arguments[0]?c_r(arguments[0])?(v=arguments[0],O=void 0):p_r(arguments[0])&&(O=arguments[0],v=void 0):(v=void 0,O=void 0));var A=v||ba(),R=dwe(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,ba(A)))}function g_r(){return new C(this)}function y_r(v,O){var A=E(v)?v:ba(v);return this.isValid()&&A.isValid()?(O=Me(O)||"millisecond",O==="millisecond"?this.valueOf()>A.valueOf():A.valueOf()<this.clone().startOf(O).valueOf()):!1}function b_r(v,O){var A=E(v)?v:ba(v);return this.isValid()&&A.isValid()?(O=Me(O)||"millisecond",O==="millisecond"?this.valueOf()<A.valueOf():this.clone().endOf(O).valueOf()<A.valueOf()):!1}function __r(v,O,A,R){var $=E(v)?v:ba(v),te=E(O)?O:ba(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 v_r(v,O){var A=E(v)?v:ba(v),R;return this.isValid()&&A.isValid()?(O=Me(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 w_r(v,O){return this.isSame(v,O)||this.isAfter(v,O)}function x_r(v,O){return this.isSame(v,O)||this.isBefore(v,O)}function S_r(v,O,A){var R,$,te;if(!this.isValid())return NaN;if(R=dwe(v,this),!R.isValid())return NaN;switch($=(R.utcOffset()-this.utcOffset())*6e4,O=Me(O),O){case"year":te=_X(this,R)/12;break;case"month":te=_X(this,R);break;case"quarter":te=_X(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:be(te)}function _X(v,O){if(v.date()<O.date())return-_X(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 C_r(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function O_r(v){if(!this.isValid())return null;var O=v!==!0,A=O?this.clone().utc():this;return A.year()<0||A.year()>9999?G(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",G(A,"Z")):G(A,O?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function E_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 P_r(v){v||(v=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var O=G(this,v);return this.localeData().postformat(O)}function T_r(v,O){return this.isValid()&&(E(v)&&v.isValid()||ba(v).isValid())?Pb({to:this,from:v}).locale(this.locale()).humanize(!O):this.localeData().invalidDate()}function A_r(v){return this.from(ba(),v)}function I_r(v,O){return this.isValid()&&(E(v)&&v.isValid()||ba(v).isValid())?Pb({from:this,to:v}).locale(this.locale()).humanize(!O):this.localeData().invalidDate()}function M_r(v){return this.to(ba(),v)}function sGe(v){var O;return v===void 0?this._locale._abbr:(O=tE(v),O!=null&&(this._locale=O),this)}var uGe=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 lGe(){return this._locale}var vX=1e3,nB=60*vX,wX=60*nB,cGe=(365*400+97)*24*wX;function oB(v,O){return(v%O+O)%O}function dGe(v,O,A){return v<100&&v>=0?new Date(v+400,O,A)-cGe:new Date(v,O,A).valueOf()}function fGe(v,O,A){return v<100&&v>=0?Date.UTC(v+400,O,A)-cGe:Date.UTC(v,O,A)}function R_r(v){var O,A;if(v=Me(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(A=this._isUTC?fGe:dGe,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-=oB(O+(this._isUTC?0:this.utcOffset()*nB),wX);break;case"minute":O=this._d.valueOf(),O-=oB(O,nB);break;case"second":O=this._d.valueOf(),O-=oB(O,vX);break}return this._d.setTime(O),e.updateOffset(this,!0),this}function N_r(v){var O,A;if(v=Me(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(A=this._isUTC?fGe:dGe,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+=wX-oB(O+(this._isUTC?0:this.utcOffset()*nB),wX)-1;break;case"minute":O=this._d.valueOf(),O+=nB-oB(O,nB)-1;break;case"second":O=this._d.valueOf(),O+=vX-oB(O,vX)-1;break}return this._d.setTime(O),e.updateOffset(this,!0),this}function j_r(){return this._d.valueOf()-(this._offset||0)*6e4}function D_r(){return Math.floor(this.valueOf()/1e3)}function L_r(){return new Date(this.valueOf())}function F_r(){var v=this;return[v.year(),v.month(),v.date(),v.hour(),v.minute(),v.second(),v.millisecond()]}function k_r(){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 $_r(){return this.isValid()?this.toISOString():null}function B_r(){return g(this)}function z_r(){return d({},h(this))}function U_r(){return h(this).overflow}function q_r(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}V("N",0,0,"eraAbbr"),V("NN",0,0,"eraAbbr"),V("NNN",0,0,"eraAbbr"),V("NNNN",0,0,"eraName"),V("NNNNN",0,0,"eraNarrow"),V("y",["y",1],"yo","eraYear"),V("y",["yy",2],0,"eraYear"),V("y",["yyy",3],0,"eraYear"),V("y",["yyyy",4],0,"eraYear"),Qe("N",pwe),Qe("NN",pwe),Qe("NNN",pwe),Qe("NNNN",evr),Qe("NNNNN",tvr),Kn(["N","NN","NNN","NNNN","NNNNN"],function(v,O,A,R){var $=A._locale.erasParse(v,R,A._strict);$?h(A).era=$:h(A).invalidEra=v}),Qe("y",ns),Qe("yy",ns),Qe("yyy",ns),Qe("yyyy",ns),Qe("yo",rvr),Kn(["y","yy","yyy","yyyy"],wf),Kn(["yo"],function(v,O,A,R){var $;A._locale._eraYearOrdinalRegex&&($=v.match(A._locale._eraYearOrdinalRegex)),A._locale.eraYearOrdinalParse?O[wf]=A._locale.eraYearOrdinalParse(v,$):O[wf]=parseInt(v,10)});function H_r(v,O){var A,R,$,te=this._eras||tE("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 V_r(v,O,A){var R,$,te=this.eras(),we,pr,Tn;for(v=v.toUpperCase(),R=0,$=te.length;R<$;++R)if(we=te[R].name.toUpperCase(),pr=te[R].abbr.toUpperCase(),Tn=te[R].narrow.toUpperCase(),A)switch(O){case"N":case"NN":case"NNN":if(pr===v)return te[R];break;case"NNNN":if(we===v)return te[R];break;case"NNNNN":if(Tn===v)return te[R];break}else if([we,pr,Tn].indexOf(v)>=0)return te[R]}function W_r(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 K_r(){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 G_r(){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 J_r(){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 Z_r(){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 Y_r(v){return i(this,"_erasNameRegex")||mwe.call(this),v?this._erasNameRegex:this._erasRegex}function X_r(v){return i(this,"_erasAbbrRegex")||mwe.call(this),v?this._erasAbbrRegex:this._erasRegex}function Q_r(v){return i(this,"_erasNarrowRegex")||mwe.call(this),v?this._erasNarrowRegex:this._erasRegex}function pwe(v,O){return O.erasAbbrRegex(v)}function evr(v,O){return O.erasNameRegex(v)}function tvr(v,O){return O.erasNarrowRegex(v)}function rvr(v,O){return O._eraYearOrdinalRegex||ns}function mwe(){var v=[],O=[],A=[],R=[],$,te,we=this.eras();for($=0,te=we.length;$<te;++$)O.push(tc(we[$].name)),v.push(tc(we[$].abbr)),A.push(tc(we[$].narrow)),R.push(tc(we[$].name)),R.push(tc(we[$].abbr)),R.push(tc(we[$].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")}V(0,["gg",2],0,function(){return this.weekYear()%100}),V(0,["GG",2],0,function(){return this.isoWeekYear()%100});function xX(v,O){V(0,[v,v.length],0,O)}xX("gggg","weekYear"),xX("ggggg","weekYear"),xX("GGGG","isoWeekYear"),xX("GGGGG","isoWeekYear"),Cr("weekYear","gg"),Cr("isoWeekYear","GG"),le("weekYear",1),le("isoWeekYear",1),Qe("G",hp),Qe("g",hp),Qe("GG",Wn,Hi),Qe("gg",Wn,Hi),Qe("GGGG",Is,yd),Qe("gggg",Is,yd),Qe("GGGGG",hu,_f),Qe("ggggg",hu,_f),Ob(["gggg","ggggg","GGGG","GGGGG"],function(v,O,A,R){O[R.substr(0,2)]=ye(v)}),Ob(["gg","GG"],function(v,O,A,R){O[R]=e.parseTwoDigitYear(v)});function nvr(v){return pGe.call(this,v,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function ovr(v){return pGe.call(this,v,this.isoWeek(),this.isoWeekday(),1,4)}function ivr(){return eE(this.year(),1,4)}function avr(){return eE(this.isoWeekYear(),1,4)}function svr(){var v=this.localeData()._week;return eE(this.year(),v.dow,v.doy)}function uvr(){var v=this.localeData()._week;return eE(this.weekYear(),v.dow,v.doy)}function pGe(v,O,A,R,$){var te;return v==null?ZV(this,R,$).year:(te=eE(v,R,$),O>te&&(O=te),lvr.call(this,v,O,A,R,$))}function lvr(v,O,A,R,$){var te=HKe(v,O,A,R,$),we=JV(te.year,0,te.dayOfYear);return this.year(we.getUTCFullYear()),this.month(we.getUTCMonth()),this.date(we.getUTCDate()),this}V("Q",0,"Qo","quarter"),Cr("quarter","Q"),le("quarter",7),Qe("Q",mp),Kn("Q",function(v,O){O[XO]=(ye(v)-1)*3});function cvr(v){return v==null?Math.ceil((this.month()+1)/3):this.month((v-1)*3+this.month()%3)}V("D",["DD",2],"Do","date"),Cr("date","D"),le("date",9),Qe("D",Wn),Qe("DD",Wn,Hi),Qe("Do",function(v,O){return v?O._dayOfMonthOrdinalParse||O._ordinalParse:O._dayOfMonthOrdinalParseLenient}),Kn(["D","DD"],hv),Kn("Do",function(v,O){O[hv]=ye(v.match(Wn)[0])});var mGe=ze("Date",!0);V("DDD",["DDDD",3],"DDDo","dayOfYear"),Cr("dayOfYear","DDD"),le("dayOfYear",4),Qe("DDD",PA),Qe("DDDD",gd),Kn(["DDD","DDDD"],function(v,O,A){A._dayOfYear=ye(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")}V("m",["mm",2],0,"minute"),Cr("minute","m"),le("minute",14),Qe("m",Wn),Qe("mm",Wn,Hi),Kn(["m","mm"],Eb);var fvr=ze("Minutes",!1);V("s",["ss",2],0,"second"),Cr("second","s"),le("second",15),Qe("s",Wn),Qe("ss",Wn,Hi),Kn(["s","ss"],QO);var pvr=ze("Seconds",!1);V("S",0,0,function(){return~~(this.millisecond()/100)}),V(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,function(){return this.millisecond()*10}),V(0,["SSSSS",5],0,function(){return this.millisecond()*100}),V(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),V(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),V(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),V(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Cr("millisecond","ms"),le("millisecond",16),Qe("S",PA,mp),Qe("SS",PA,Hi),Qe("SSS",PA,gd);var AA,hGe;for(AA="SSSS";AA.length<=9;AA+="S")Qe(AA,ns);function mvr(v,O){O[kN]=ye(("0."+v)*1e3)}for(AA="S";AA.length<=9;AA+="S")Kn(AA,mvr);hGe=ze("Milliseconds",!1),V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");function hvr(){return this._isUTC?"UTC":""}function gvr(){return this._isUTC?"Coordinated Universal Time":""}var Ge=C.prototype;Ge.add=u_r,Ge.calendar=h_r,Ge.clone=g_r,Ge.diff=S_r,Ge.endOf=N_r,Ge.format=P_r,Ge.from=T_r,Ge.fromNow=A_r,Ge.to=I_r,Ge.toNow=M_r,Ge.get=_i,Ge.invalidAt=U_r,Ge.isAfter=y_r,Ge.isBefore=b_r,Ge.isBetween=__r,Ge.isSame=v_r,Ge.isSameOrAfter=w_r,Ge.isSameOrBefore=x_r,Ge.isValid=B_r,Ge.lang=uGe,Ge.locale=sGe,Ge.localeData=lGe,Ge.max=Bbr,Ge.min=$br,Ge.parsingFlags=z_r,Ge.set=bf,Ge.startOf=R_r,Ge.subtract=l_r,Ge.toArray=F_r,Ge.toObject=k_r,Ge.toDate=L_r,Ge.toISOString=O_r,Ge.inspect=E_r,typeof Symbol<"u"&&Symbol.for!=null&&(Ge[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ge.toJSON=$_r,Ge.toString=C_r,Ge.unix=D_r,Ge.valueOf=j_r,Ge.creationData=q_r,Ge.eraName=K_r,Ge.eraNarrow=G_r,Ge.eraAbbr=J_r,Ge.eraYear=Z_r,Ge.year=qKe,Ge.isLeapYear=kyr,Ge.weekYear=nvr,Ge.isoWeekYear=ovr,Ge.quarter=Ge.quarters=cvr,Ge.month=zKe,Ge.daysInMonth=Dyr,Ge.week=Ge.weeks=Hyr,Ge.isoWeek=Ge.isoWeeks=Vyr,Ge.weeksInYear=svr,Ge.weeksInWeekYear=uvr,Ge.isoWeeksInYear=ivr,Ge.isoWeeksInISOWeekYear=avr,Ge.date=mGe,Ge.day=Ge.days=obr,Ge.weekday=ibr,Ge.isoWeekday=abr,Ge.dayOfYear=dvr,Ge.hour=Ge.hours=pbr,Ge.minute=Ge.minutes=fvr,Ge.second=Ge.seconds=pvr,Ge.millisecond=Ge.milliseconds=hGe,Ge.utcOffset=Jbr,Ge.utc=Ybr,Ge.local=Xbr,Ge.parseZone=Qbr,Ge.hasAlignedHourOffset=e_r,Ge.isDST=t_r,Ge.isLocal=n_r,Ge.isUtcOffset=o_r,Ge.isUtc=rGe,Ge.isUTC=rGe,Ge.zoneAbbr=hvr,Ge.zoneName=gvr,Ge.dates=T("dates accessor is deprecated. Use date instead.",mGe),Ge.months=T("months accessor is deprecated. Use month instead",zKe),Ge.years=T("years accessor is deprecated. Use year instead",qKe),Ge.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Zbr),Ge.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",r_r);function yvr(v){return ba(v*1e3)}function bvr(){return ba.apply(null,arguments).parseZone()}function gGe(v){return v}var Bo=F.prototype;Bo.calendar=X,Bo.longDateFormat=pe,Bo.invalidDate=Te,Bo.ordinal=Ot,Bo.preparse=gGe,Bo.postformat=gGe,Bo.relativeTime=Mr,Bo.pastFuture=Vn,Bo.set=D,Bo.eras=H_r,Bo.erasParse=V_r,Bo.erasConvertYear=W_r,Bo.erasAbbrRegex=X_r,Bo.erasNameRegex=Y_r,Bo.erasNarrowRegex=Q_r,Bo.months=Myr,Bo.monthsShort=Ryr,Bo.monthsParse=jyr,Bo.monthsRegex=Fyr,Bo.monthsShortRegex=Lyr,Bo.week=Byr,Bo.firstDayOfYear=qyr,Bo.firstDayOfWeek=Uyr,Bo.weekdays=Qyr,Bo.weekdaysMin=tbr,Bo.weekdaysShort=ebr,Bo.weekdaysParse=nbr,Bo.weekdaysRegex=sbr,Bo.weekdaysShortRegex=ubr,Bo.weekdaysMinRegex=lbr,Bo.isPM=dbr,Bo.meridiem=mbr;function SX(v,O,A,R){var $=tE(),te=f().set(R,O);return $[A](te,v)}function yGe(v,O,A){if(u(v)&&(O=v,v=void 0),v=v||"",O!=null)return SX(v,O,A,"month");var R,$=[];for(R=0;R<12;R++)$[R]=SX(v,R,A,"month");return $}function hwe(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 $=tE(),te=v?$._week.dow:0,we,pr=[];if(A!=null)return SX(O,(A+te)%7,R,"day");for(we=0;we<7;we++)pr[we]=SX(O,(we+te)%7,R,"day");return pr}function _vr(v,O){return yGe(v,O,"months")}function vvr(v,O){return yGe(v,O,"monthsShort")}function wvr(v,O,A){return hwe(v,O,A,"weekdays")}function xvr(v,O,A){return hwe(v,O,A,"weekdaysShort")}function Svr(v,O,A){return hwe(v,O,A,"weekdaysMin")}TA("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=ye(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.",TA),e.langData=T("moment.langData is deprecated. Use moment.localeData instead.",tE);var rE=Math.abs;function Cvr(){var v=this._data;return this._milliseconds=rE(this._milliseconds),this._days=rE(this._days),this._months=rE(this._months),v.milliseconds=rE(v.milliseconds),v.seconds=rE(v.seconds),v.minutes=rE(v.minutes),v.hours=rE(v.hours),v.months=rE(v.months),v.years=rE(v.years),this}function bGe(v,O,A,R){var $=Pb(O,A);return v._milliseconds+=R*$._milliseconds,v._days+=R*$._days,v._months+=R*$._months,v._bubble()}function Ovr(v,O){return bGe(this,v,O,1)}function Evr(v,O){return bGe(this,v,O,-1)}function _Ge(v){return v<0?Math.floor(v):Math.ceil(v)}function Pvr(){var v=this._milliseconds,O=this._days,A=this._months,R=this._data,$,te,we,pr,Tn;return v>=0&&O>=0&&A>=0||v<=0&&O<=0&&A<=0||(v+=_Ge(gwe(A)+O)*864e5,O=0,A=0),R.milliseconds=v%1e3,$=be(v/1e3),R.seconds=$%60,te=be($/60),R.minutes=te%60,we=be(te/60),R.hours=we%24,O+=be(we/24),Tn=be(vGe(O)),A+=Tn,O-=_Ge(gwe(Tn)),pr=be(A/12),A%=12,R.days=O,R.months=A,R.years=pr,this}function vGe(v){return v*4800/146097}function gwe(v){return v*146097/4800}function Tvr(v){if(!this.isValid())return NaN;var O,A,R=this._milliseconds;if(v=Me(v),v==="month"||v==="quarter"||v==="year")switch(O=this._days+R/864e5,A=this._months+vGe(O),v){case"month":return A;case"quarter":return A/3;case"year":return A/12}else switch(O=this._days+Math.round(gwe(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 Avr(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+ye(this._months/12)*31536e6:NaN}function nE(v){return function(){return this.as(v)}}var Ivr=nE("ms"),Mvr=nE("s"),Rvr=nE("m"),Nvr=nE("h"),jvr=nE("d"),Dvr=nE("w"),Lvr=nE("M"),Fvr=nE("Q"),kvr=nE("y");function $vr(){return Pb(this)}function Bvr(v){return v=Me(v),this.isValid()?this[v+"s"]():NaN}function BN(v){return function(){return this.isValid()?this._data[v]:NaN}}var zvr=BN("milliseconds"),Uvr=BN("seconds"),qvr=BN("minutes"),Hvr=BN("hours"),Vvr=BN("days"),Wvr=BN("months"),Kvr=BN("years");function Gvr(){return be(this.days()/7)}var oE=Math.round,iB={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Jvr(v,O,A,R,$){return $.relativeTime(O||1,!!A,v,R)}function Zvr(v,O,A,R){var $=Pb(v).abs(),te=oE($.as("s")),we=oE($.as("m")),pr=oE($.as("h")),Tn=oE($.as("d")),Vi=oE($.as("M")),bp=oE($.as("w")),iE=oE($.as("y")),IA=te<=A.ss&&["s",te]||te<A.s&&["ss",te]||we<=1&&["m"]||we<A.m&&["mm",we]||pr<=1&&["h"]||pr<A.h&&["hh",pr]||Tn<=1&&["d"]||Tn<A.d&&["dd",Tn];return A.w!=null&&(IA=IA||bp<=1&&["w"]||bp<A.w&&["ww",bp]),IA=IA||Vi<=1&&["M"]||Vi<A.M&&["MM",Vi]||iE<=1&&["y"]||["yy",iE],IA[2]=O,IA[3]=+v>0,IA[4]=R,Jvr.apply(null,IA)}function Yvr(v){return v===void 0?oE:typeof v=="function"?(oE=v,!0):!1}function Xvr(v,O){return iB[v]===void 0?!1:O===void 0?iB[v]:(iB[v]=O,v==="s"&&(iB.ss=O-1),!0)}function Qvr(v,O){if(!this.isValid())return this.localeData().invalidDate();var A=!1,R=iB,$,te;return typeof v=="object"&&(O=v,v=!1),typeof v=="boolean"&&(A=v),typeof O=="object"&&(R=Object.assign({},iB,O),O.s!=null&&O.ss==null&&(R.ss=O.s-1)),$=this.localeData(),te=Zvr(this,!A,R,$),A&&(te=$.pastFuture(+this,te)),$.postformat(te)}var ywe=Math.abs;function aB(v){return(v>0)-(v<0)||+v}function CX(){if(!this.isValid())return this.localeData().invalidDate();var v=ywe(this._milliseconds)/1e3,O=ywe(this._days),A=ywe(this._months),R,$,te,we,pr=this.asSeconds(),Tn,Vi,bp,iE;return pr?(R=be(v/60),$=be(R/60),v%=60,R%=60,te=be(A/12),A%=12,we=v?v.toFixed(3).replace(/\.?0+$/,""):"",Tn=pr<0?"-":"",Vi=aB(this._months)!==aB(pr)?"-":"",bp=aB(this._days)!==aB(pr)?"-":"",iE=aB(this._milliseconds)!==aB(pr)?"-":"",Tn+"P"+(te?Vi+te+"Y":"")+(A?Vi+A+"M":"")+(O?bp+O+"D":"")+($||R||v?"T":"")+($?iE+$+"H":"")+(R?iE+R+"M":"")+(v?iE+we+"S":"")):"P0D"}var xo=yX.prototype;xo.isValid=Vbr,xo.abs=Cvr,xo.add=Ovr,xo.subtract=Evr,xo.as=Tvr,xo.asMilliseconds=Ivr,xo.asSeconds=Mvr,xo.asMinutes=Rvr,xo.asHours=Nvr,xo.asDays=jvr,xo.asWeeks=Dvr,xo.asMonths=Lvr,xo.asQuarters=Fvr,xo.asYears=kvr,xo.valueOf=Avr,xo._bubble=Pvr,xo.clone=$vr,xo.get=Bvr,xo.milliseconds=zvr,xo.seconds=Uvr,xo.minutes=qvr,xo.hours=Hvr,xo.days=Vvr,xo.weeks=Gvr,xo.months=Wvr,xo.years=Kvr,xo.humanize=Qvr,xo.toISOString=CX,xo.toString=CX,xo.toJSON=CX,xo.locale=sGe,xo.localeData=lGe,xo.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",CX),xo.lang=uGe,V("X",0,0,"unix"),V("x",0,0,"valueOf"),Qe("x",hp),Qe("X",cm),Kn("X",function(v,O,A){A._d=new Date(parseFloat(v)*1e3)}),Kn("x",function(v,O,A){A._d=new Date(ye(v))});return e.version="2.29.4",r(ba),e.fn=Ge,e.min=zbr,e.max=Ubr,e.now=qbr,e.utc=f,e.unix=yvr,e.months=_vr,e.isDate=l,e.locale=TA,e.invalid=y,e.duration=Pb,e.isMoment=E,e.weekdays=wvr,e.parseZone=bvr,e.localeData=tE,e.isDuration=bX,e.monthsShort=vvr,e.weekdaysMin=Svr,e.defineLocale=owe,e.updateLocale=bbr,e.locales=_br,e.weekdaysShort=xvr,e.normalizeUnits=Me,e.relativeTimeRounding=Yvr,e.relativeTimeThreshold=Xvr,e.calendarFormat=m_r,e.prototype=Ge,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 Eet={};os(Eet,{CustomError:()=>rn,TimeoutError:()=>a8});var rn,a8,xE=b(()=>{rn=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},a8=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function Pet(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function eTr(t){let e=Pet(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function Tet(t){let e=Pet(t);return eTr(t)?HSe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:HSe.UNKNOWN_ERROR)}function ZB(t){return t.replace(/^#/,"").trim().toLowerCase()}function Tj(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(ZB(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(ZB(i))}):typeof n=="string"&&o.add(ZB(n))),Array.from(o)}function Aet(t,e,r){if(e.length===0)return[];e=e.map(i=>ZB(i));let n=r&&r.length>0?r:KSe(t,"/"),o=[];for(let i of n){let a=Tj(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function GSe(t){let e=(0,WSe.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()}:tu(new Date)}async function YB(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function bee(t){return t.basename}function JSe(t){return t?t.extension==="md"||t.extension==="pdf"||t.extension==="canvas":!1}function jh(t){return t==="copilot_plus"||t==="project"}function XB(t,e){return t?t.extension==="md"||t.extension==="canvas"?!0:jh(e):!1}function Met(t,e){return!t||!e?!1:t.includes(VSe)&&e.includes(VSe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function QB(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 Jg(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 Nh.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(ZSe(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 ZSe(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function Ret(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function Net(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function jet(t){return YSe.test(t)}function XSe(t){let e=t.match(YSe);return e?e[0]:null}function _ee(t){let e=t.matchAll(new RegExp(YSe,"g"));return Array.from(e,r=>r[0])}async function _u(t,e={}){let r=new Headers(e.headers),n=Object.fromEntries(r.entries());delete n["content-length"],B("==== safeFetch method request ====");let o=e.method?.toUpperCase()||"POST",a=await(0,Nh.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(HSe.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:nTr(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 nTr(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function eo(t,e=!1){return t instanceof Error?t.message+`
${t?.cause?"more message: "+t.cause.message:""}
${e?t.stack:""}`:JSON.stringify(t)}function s8(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function vee(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 SE(t){let e=rz[t];return{...e,label:e.label||t}}function Mp(t,e){let r=rz[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function wee(t){let e=t;return e=Aj(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 u8(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Nh.Notice("No active leaf found.");return}if(r.view instanceof Nh.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Nh.MarkdownView)){new Nh.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=wee(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new Nh.Notice("Message inserted into the active note.")}function xee(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function See(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 Det(){try{return{version:(await(0,Nh.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 l8(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 oTr(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function ez(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=l8(e),n=oTr(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function eI(t,e="system"){return l8(t)?"human":e}function QSe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(rz).filter(([e])=>!t.includes(e)).map(([e])=>e)}function tz(t,e){let r=!!QSe().find(i=>i===t.provider),n=OE[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 iTr(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function Aj(t){let r=iTr(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function Let(){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 Cee(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(xE(),Eet)),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 eCe(){let t=app.workspace.getActiveViewOfType(Nh.MarkdownView);return t?t.getState().source===!0:!0}var WSe,Nh,HSe,KSe,tTr,rTr,Iet,tu,YSe,ir=b(()=>{vu();or();Gt();WSe=j(Oet()),Nh=require("obsidian"),HSe={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}`};KSe=(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})};tTr=t=>t.last.bound.modelName||t.last.bound.model,rTr=t=>t.last.bound.retriever!==void 0,Iet=t=>tTr(t)||rTr(t),tu=(t,e="local")=>{let r=(0,WSe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};YSe=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var nz,tCe,c8,vu=b(()=>{Db();ZA();Pm();YQe();ir();nz=class nz{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=Li.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return nz.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=nz.instances.get("llm_chain");return r||(r=nz.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=Af.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=Af.fromTemplate(`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`),d=g=>g.map(_=>`Human: ${_[0]}
Assistant: ${_[1]}`).join(`
`),f=Li.from([{question:g=>(n&&console.log("Input Question: ",g.question),g.question),chat_history:g=>{let y=d(g.chat_history);return n&&console.log("Formatted Chat History: ",y),y}},u,o,new uee,g=>{let y=Aj(g);return n&&console.log("Standalone Question: ",y),y}]),p=async g=>(r(g),ESe(g)),h=Li.from([{context:i.pipe(p),question:new Lo,system_message:()=>a},c,o]);return f.pipe(h)}};nz.instances=new Map;tCe=nz,c8=tCe});var d8=b(()=>{});var tI,Ns,Fo,Zg,Fet,ket,Cet,Bet,f8,Tm,p8,Ij,m8,rCe,Mj,nCe,oCe,oz,Iv,EE,Rf,CE,rI,Av,QA,Pj,VSe,rz,OE,zet,pn,Oee,Yg,iz,bu,Xg,or=b(()=>{zN();vu();d8();tI="https://api.brevilabs.com/v1",Ns="copilot-chat-view",Fo="user",Zg="ai",Fet="copilot-conversations",ket="copilot-custom-prompts",Cet=`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.`,Bet=`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.
`,f8="note_context",Tm="selected_text",p8="variable",Ij="variable_note",m8="embedded_pdf",rCe="retrieved_document",Mj=6e3,nCe=.4,oCe=448e3,oz=3e4,Iv={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},EE={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},Rf={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},CE=(h=>(h.OPENAI="openai",h.OPENAI_FORMAT="3rd party (openai-format)",h.AZURE_OPENAI="azure openai",h.ANTHROPIC="anthropic",h.COHEREAI="cohereai",h.GOOGLE="google",h.XAI="xai",h.OPENROUTERAI="openrouterai",h.GROQ="groq",h.OLLAMA="ollama",h.LM_STUDIO="lm-studio",h.COPILOT_PLUS="copilot-plus",h.MISTRAL="mistralai",h.DEEPSEEK="deepseek",h))(CE||{}),rI={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},Av=[{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:"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"]}],QA=(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))(QA||{}),Pj=[{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}],VSe="nomic-embed-text",rz={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:""}},OE={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},zet=["NEVER","ON STARTUP","ON MODE SWITCH"],pn={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"},Oee={[pn.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[pn.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[pn.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[pn.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[pn.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[pn.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[pn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[pn.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[pn.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[pn.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[pn.LIST_INDEXED_FILES]:"List all indexed files (debug)",[pn.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[pn.NEW_CHAT]:"New Copilot Chat",[pn.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[pn.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[pn.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[pn.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[pn.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[pn.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[pn.ADD_CUSTOM_COMMAND]:"Add new custom command",[pn.APPLY_CUSTOM_COMMAND]:"Apply custom command"},Yg={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},iz={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.`},bu={userId:dm(),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:Rf.TEMPERATURE,maxTokens:Rf.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:Fet,defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:ket,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:`${Fet},${ket}`,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:15,groqApiKey:"",activeModels:Av,activeEmbeddingModels:Pj,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:Yg.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:Rf.REASONING_EFFORT,verbosity:Rf.VERBOSITY},Xg={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var aCe=x(Eee=>{"use strict";Eee.byteLength=sTr;Eee.toByteArray=lTr;Eee.fromByteArray=fTr;var Mv=[],Qg=[],aTr=typeof Uint8Array<"u"?Uint8Array:Array,iCe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rj=0,Uet=iCe.length;Rj<Uet;++Rj)Mv[Rj]=iCe[Rj],Qg[iCe.charCodeAt(Rj)]=Rj;var Rj,Uet;Qg[45]=62;Qg[95]=63;function qet(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 sTr(t){var e=qet(t),r=e[0],n=e[1];return(r+n)*3/4-n}function uTr(t,e,r){return(e+r)*3/4-r}function lTr(t){var e,r=qet(t),n=r[0],o=r[1],i=new aTr(uTr(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Qg[t.charCodeAt(u)]<<18|Qg[t.charCodeAt(u+1)]<<12|Qg[t.charCodeAt(u+2)]<<6|Qg[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Qg[t.charCodeAt(u)]<<2|Qg[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Qg[t.charCodeAt(u)]<<10|Qg[t.charCodeAt(u+1)]<<4|Qg[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function cTr(t){return Mv[t>>18&63]+Mv[t>>12&63]+Mv[t>>6&63]+Mv[t&63]}function dTr(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(cTr(n));return o.join("")}function fTr(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(dTr(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(Mv[e>>2]+Mv[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(Mv[e>>10]+Mv[e>>4&63]+Mv[e<<2&63]+"=")),o.join("")}});var Het=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,h=n?1:-1,m=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+=h,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=h,a/=256,l-=8);t[r+p-h]|=m*128}});var Im=x(lz=>{"use strict";var uCe=aCe(),sz=Het(),Vet=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;lz.Buffer=Se;lz.SlowBuffer=bTr;lz.INSPECT_MAX_BYTES=50;var Pee=2147483647;lz.kMaxLength=Pee;Se.TYPED_ARRAY_SUPPORT=pTr();!Se.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 pTr(){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(Se.prototype,"parent",{enumerable:!0,get:function(){if(Se.isBuffer(this))return this.buffer}});Object.defineProperty(Se.prototype,"offset",{enumerable:!0,get:function(){if(Se.isBuffer(this))return this.byteOffset}});function PE(t){if(t>Pee)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,Se.prototype),e}function Se(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 fCe(t)}return Jet(t,e,r)}Se.poolSize=8192;function Jet(t,e,r){if(typeof t=="string")return hTr(t,e);if(ArrayBuffer.isView(t))return gTr(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(Rv(t,ArrayBuffer)||t&&Rv(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Rv(t,SharedArrayBuffer)||t&&Rv(t.buffer,SharedArrayBuffer)))return cCe(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 Se.from(n,e,r);let o=yTr(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return Se.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)}Se.from=function(t,e,r){return Jet(t,e,r)};Object.setPrototypeOf(Se.prototype,Uint8Array.prototype);Object.setPrototypeOf(Se,Uint8Array);function Zet(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 mTr(t,e,r){return Zet(t),t<=0?PE(t):e!==void 0?typeof r=="string"?PE(t).fill(e,r):PE(t).fill(e):PE(t)}Se.alloc=function(t,e,r){return mTr(t,e,r)};function fCe(t){return Zet(t),PE(t<0?0:pCe(t)|0)}Se.allocUnsafe=function(t){return fCe(t)};Se.allocUnsafeSlow=function(t){return fCe(t)};function hTr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Se.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Yet(t,e)|0,n=PE(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function lCe(t){let e=t.length<0?0:pCe(t.length)|0,r=PE(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function gTr(t){if(Rv(t,Uint8Array)){let e=new Uint8Array(t);return cCe(e.buffer,e.byteOffset,e.byteLength)}return lCe(t)}function cCe(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,Se.prototype),n}function yTr(t){if(Se.isBuffer(t)){let e=pCe(t.length)|0,r=PE(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||hCe(t.length)?PE(0):lCe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return lCe(t.data)}function pCe(t){if(t>=Pee)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Pee.toString(16)+" bytes");return t|0}function bTr(t){return+t!=t&&(t=0),Se.alloc(+t)}Se.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==Se.prototype};Se.compare=function(e,r){if(Rv(e,Uint8Array)&&(e=Se.from(e,e.offset,e.byteLength)),Rv(r,Uint8Array)&&(r=Se.from(r,r.offset,r.byteLength)),!Se.isBuffer(e)||!Se.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};Se.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}};Se.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Se.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=Se.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(Rv(a,Uint8Array))i+a.length>o.length?(Se.isBuffer(a)||(a=Se.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(Se.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function Yet(t,e){if(Se.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Rv(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 dCe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return att(t).length;default:if(o)return n?-1:dCe(t).length;e=(""+e).toLowerCase(),o=!0}}Se.byteLength=Yet;function _Tr(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 ATr(this,e,r);case"utf8":case"utf-8":return Qet(this,e,r);case"ascii":return PTr(this,e,r);case"latin1":case"binary":return TTr(this,e,r);case"base64":return OTr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ITr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}Se.prototype._isBuffer=!0;function Nj(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}Se.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)Nj(this,r,r+1);return this};Se.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)Nj(this,r,r+3),Nj(this,r+1,r+2);return this};Se.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)Nj(this,r,r+7),Nj(this,r+1,r+6),Nj(this,r+2,r+5),Nj(this,r+3,r+4);return this};Se.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Qet(this,0,e):_Tr.apply(this,arguments)};Se.prototype.toLocaleString=Se.prototype.toString;Se.prototype.equals=function(e){if(!Se.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:Se.compare(this,e)===0};Se.prototype.inspect=function(){let e="",r=lz.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Vet&&(Se.prototype[Vet]=Se.prototype.inspect);Se.prototype.compare=function(e,r,n,o,i){if(Rv(e,Uint8Array)&&(e=Se.from(e,e.offset,e.byteLength)),!Se.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 Xet(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,hCe(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=Se.from(e,n)),Se.isBuffer(e))return e.length===0?-1:Wet(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):Wet(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Wet(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}Se.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};Se.prototype.indexOf=function(e,r,n){return Xet(this,e,r,n,!0)};Se.prototype.lastIndexOf=function(e,r,n){return Xet(this,e,r,n,!1)};function vTr(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(hCe(s))return a;t[r+a]=s}return a}function wTr(t,e,r,n){return Tee(dCe(e,t.length-r),t,r,n)}function xTr(t,e,r,n){return Tee(jTr(e),t,r,n)}function STr(t,e,r,n){return Tee(att(e),t,r,n)}function CTr(t,e,r,n){return Tee(DTr(e,t.length-r),t,r,n)}Se.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 vTr(this,e,r,n);case"utf8":case"utf-8":return wTr(this,e,r,n);case"ascii":case"latin1":case"binary":return xTr(this,e,r,n);case"base64":return STr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return CTr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};Se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function OTr(t,e,r){return e===0&&r===t.length?uCe.fromByteArray(t):uCe.fromByteArray(t.slice(e,r))}function Qet(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 ETr(n)}var Ket=4096;function ETr(t){let e=t.length;if(e<=Ket)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Ket));return r}function PTr(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 TTr(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 ATr(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+=LTr[t[i]];return o}function ITr(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}Se.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,Se.prototype),o};function Lc(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")}Se.prototype.readUintLE=Se.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lc(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};Se.prototype.readUintBE=Se.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lc(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};Se.prototype.readUint8=Se.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lc(e,1,this.length),this[e]};Se.prototype.readUint16LE=Se.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lc(e,2,this.length),this[e]|this[e+1]<<8};Se.prototype.readUint16BE=Se.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lc(e,2,this.length),this[e]<<8|this[e+1]};Se.prototype.readUint32LE=Se.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lc(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};Se.prototype.readUint32BE=Se.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lc(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};Se.prototype.readBigUInt64LE=nI(function(e){e=e>>>0,uz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&h8(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))});Se.prototype.readBigUInt64BE=nI(function(e){e=e>>>0,uz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&h8(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)});Se.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lc(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};Se.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lc(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};Se.prototype.readInt8=function(e,r){return e=e>>>0,r||Lc(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};Se.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lc(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};Se.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lc(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};Se.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lc(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};Se.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lc(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};Se.prototype.readBigInt64LE=nI(function(e){e=e>>>0,uz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&h8(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)});Se.prototype.readBigInt64BE=nI(function(e){e=e>>>0,uz(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&h8(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)});Se.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Lc(e,4,this.length),sz.read(this,e,!0,23,4)};Se.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lc(e,4,this.length),sz.read(this,e,!1,23,4)};Se.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lc(e,8,this.length),sz.read(this,e,!0,52,8)};Se.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lc(e,8,this.length),sz.read(this,e,!1,52,8)};function Am(t,e,r,n,o,i){if(!Se.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")}Se.prototype.writeUintLE=Se.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;Am(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};Se.prototype.writeUintBE=Se.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;Am(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};Se.prototype.writeUint8=Se.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Am(this,e,r,1,255,0),this[r]=e&255,r+1};Se.prototype.writeUint16LE=Se.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Am(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};Se.prototype.writeUint16BE=Se.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Am(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};Se.prototype.writeUint32LE=Se.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Am(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};Se.prototype.writeUint32BE=Se.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Am(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 ett(t,e,r,n,o){itt(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 ttt(t,e,r,n,o){itt(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}Se.prototype.writeBigUInt64LE=nI(function(e,r=0){return ett(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Se.prototype.writeBigUInt64BE=nI(function(e,r=0){return ttt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Se.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Am(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};Se.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Am(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};Se.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Am(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};Se.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Am(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};Se.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Am(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};Se.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Am(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};Se.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Am(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};Se.prototype.writeBigInt64LE=nI(function(e,r=0){return ett(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Se.prototype.writeBigInt64BE=nI(function(e,r=0){return ttt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rtt(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 ntt(t,e,r,n,o){return e=+e,r=r>>>0,o||rtt(t,e,r,4,34028234663852886e22,-34028234663852886e22),sz.write(t,e,r,n,23,4),r+4}Se.prototype.writeFloatLE=function(e,r,n){return ntt(this,e,r,!0,n)};Se.prototype.writeFloatBE=function(e,r,n){return ntt(this,e,r,!1,n)};function ott(t,e,r,n,o){return e=+e,r=r>>>0,o||rtt(t,e,r,8,17976931348623157e292,-17976931348623157e292),sz.write(t,e,r,n,52,8),r+8}Se.prototype.writeDoubleLE=function(e,r,n){return ott(this,e,r,!0,n)};Se.prototype.writeDoubleBE=function(e,r,n){return ott(this,e,r,!1,n)};Se.prototype.copy=function(e,r,n,o){if(!Se.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};Se.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"&&!Se.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=Se.isBuffer(e)?e:Se.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 az={};function mCe(t,e,r){az[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}`}}}mCe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);mCe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);mCe("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=Get(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=Get(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function Get(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 MTr(t,e,r){uz(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&h8(e,t.length-(r+1))}function itt(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 az.ERR_OUT_OF_RANGE("value",s,t)}MTr(n,o,i)}function uz(t,e){if(typeof t!="number")throw new az.ERR_INVALID_ARG_TYPE(e,"number",t)}function h8(t,e,r){throw Math.floor(t)!==t?(uz(t,r),new az.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new az.ERR_BUFFER_OUT_OF_BOUNDS:new az.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var RTr=/[^+/0-9A-Za-z-_]/g;function NTr(t){if(t=t.split("=")[0],t=t.trim().replace(RTr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function dCe(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 jTr(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function DTr(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 att(t){return uCe.toByteArray(NTr(t))}function Tee(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 Rv(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function hCe(t){return t!==t}var LTr=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 nI(t){return typeof BigInt>"u"?FTr:t}function FTr(){throw new Error("BigInt not supported")}});function g8(){return utt.Platform.isDesktop&&Aee||(Aee=require("electron")?.remote?.safeStorage),Aee}async function vCe(){return await crypto.subtle.importKey("raw",kTr,Iee.name,!1,["encrypt","decrypt"])}async function ltt(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 gCe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await gCe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await gCe(n.apiKey||"")})))),e}async function gCe(t){if(!t||t.startsWith(wCe))return t;ctt(t)&&(t=t.replace(Mee,""));try{if(g8()?.isEncryptionAvailable()){let o=g8().encryptString(t);return bCe+o.toString("base64")}let e=await vCe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Iee,e,r);return _Ce+BTr(n)}catch(e){return console.error("Encryption failed:",e),t}}async function So(t){if(!t||$Tr(t))return t;if(ctt(t))return t.replace(Mee,"");if(t.startsWith(bCe)){let r=t.replace(bCe,""),n=yCe.Buffer.from(r,"base64");return g8().decryptString(n)}if(t.startsWith(_Ce)){let r=t.replace(_Ce,""),n=await vCe(),o=stt(r),i=await crypto.subtle.decrypt(Iee,n,o);return new TextDecoder().decode(i)}let e=t.replace(wCe,"");try{if(g8()?.isEncryptionAvailable())try{let i=yCe.Buffer.from(e,"base64");return g8().decryptString(i)}catch{}let r=await vCe(),n=stt(e),o=await crypto.subtle.decrypt(Iee,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function $Tr(t){return!t.startsWith(wCe)&&!t.startsWith(Mee)}function ctt(t){return t.startsWith(Mee)}function BTr(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 stt(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 yCe,utt,Aee,bCe,_Ce,wCe,Mee,kTr,Iee,jj=b(()=>{yCe=j(Im()),utt=require("obsidian"),Aee=null;bCe="enc_desk_",_Ce="enc_web_",wCe="enc_",Mee="dec_",kTr=new TextEncoder().encode("obsidian-copilot-v1"),Iee={name:"AES-GCM",iv:new Uint8Array(12)}});function mtt(t){Ki.set(Nee,t)}function Dee(){return Ki.get(Nee)}function htt(t){return Ki.sub(Nee,t)}function oI(){return GB(Nee,{store:Ki})}function ey(){return Ki.get(jee)}function Dj(t){Ki.set(jee,t)}function gtt(t){return Ki.sub(jee,t)}function Rp(){return GB(jee,{store:Ki})}function Lj(t){Ki.set(Ree,t)}function wu(){return Ki.get(Ree)}function cz(t){return Ki.sub(Ree,()=>{t(Ki.get(Ree))})}function TE(t){Ki.set(ptt,t)}function Lee(){return GB(ptt,{store:Ki})}function Fj(){return ey()==="project"}function SCe(t){Ki.set(xCe,t)}function kj(){return Ki.get(xCe)}function ytt(t){let e=kj();SCe([...e,t])}function btt(t){let e=kj();SCe(e.filter(r=>r.id!==t))}function _tt(){SCe([])}function vtt(){return GB(xCe,{store:Ki})}function wtt(t){Ki.set(y8,t)}function Nv(t,e){Ki.set(y8,r=>({...r,[t]:e(r[t])}))}function Fee(){return GB(y8,{store:Ki})}var dtt,Nee,ftt,jee,Ree,ptt,y8,xCe,ua=b(()=>{vu();bt();o8();dtt=Rh(null),Nee=Rh(t=>{let e=t(dtt);return e!==null?e:t(XA).defaultModelKey},(t,e,r)=>{e(dtt,r)}),ftt=Rh(null),jee=Rh(t=>{let e=t(ftt);return e!==null?e:t(XA).defaultChainType},(t,e,r)=>{e(ftt,r)}),Ree=Rh(null),ptt=Rh(!1),y8=Rh({success:[],failed:[],processingFiles:[],total:[]}),xCe=Rh([])});var Mtt=x(la=>{"use strict";function PCe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<kee(o,e))t[n]=e,t[r]=o,r=n;else break e}}function Lb(t){return t.length===0?null:t[0]}function Bee(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>kee(s,r))u<o&&0>kee(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>kee(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function kee(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(xtt=performance,la.unstable_now=function(){return xtt.now()}):(CCe=Date,Stt=CCe.now(),la.unstable_now=function(){return CCe.now()-Stt});var xtt,CCe,Stt,jv=[],iI=[],zTr=1,ty=null,Nf=3,zee=!1,$j=!1,_8=!1,Ett=typeof setTimeout=="function"?setTimeout:null,Ptt=typeof clearTimeout=="function"?clearTimeout:null,Ctt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function TCe(t){for(var e=Lb(iI);e!==null;){if(e.callback===null)Bee(iI);else if(e.startTime<=t)Bee(iI),e.sortIndex=e.expirationTime,PCe(jv,e);else break;e=Lb(iI)}}function ACe(t){if(_8=!1,TCe(t),!$j)if(Lb(jv)!==null)$j=!0,MCe(ICe);else{var e=Lb(iI);e!==null&&RCe(ACe,e.startTime-t)}}function ICe(t,e){$j=!1,_8&&(_8=!1,Ptt(v8),v8=-1),zee=!0;var r=Nf;try{for(TCe(e),ty=Lb(jv);ty!==null&&(!(ty.expirationTime>e)||t&&!Itt());){var n=ty.callback;if(typeof n=="function"){ty.callback=null,Nf=ty.priorityLevel;var o=n(ty.expirationTime<=e);e=la.unstable_now(),typeof o=="function"?ty.callback=o:ty===Lb(jv)&&Bee(jv),TCe(e)}else Bee(jv);ty=Lb(jv)}if(ty!==null)var i=!0;else{var a=Lb(iI);a!==null&&RCe(ACe,a.startTime-e),i=!1}return i}finally{ty=null,Nf=r,zee=!1}}var Uee=!1,$ee=null,v8=-1,Ttt=5,Att=-1;function Itt(){return!(la.unstable_now()-Att<Ttt)}function OCe(){if($ee!==null){var t=la.unstable_now();Att=t;var e=!0;try{e=$ee(!0,t)}finally{e?b8():(Uee=!1,$ee=null)}}else Uee=!1}var b8;typeof Ctt=="function"?b8=function(){Ctt(OCe)}:typeof MessageChannel<"u"?(ECe=new MessageChannel,Ott=ECe.port2,ECe.port1.onmessage=OCe,b8=function(){Ott.postMessage(null)}):b8=function(){Ett(OCe,0)};var ECe,Ott;function MCe(t){$ee=t,Uee||(Uee=!0,b8())}function RCe(t,e){v8=Ett(function(){t(la.unstable_now())},e)}la.unstable_IdlePriority=5;la.unstable_ImmediatePriority=1;la.unstable_LowPriority=4;la.unstable_NormalPriority=3;la.unstable_Profiling=null;la.unstable_UserBlockingPriority=2;la.unstable_cancelCallback=function(t){t.callback=null};la.unstable_continueExecution=function(){$j||zee||($j=!0,MCe(ICe))};la.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"):Ttt=0<t?Math.floor(1e3/t):5};la.unstable_getCurrentPriorityLevel=function(){return Nf};la.unstable_getFirstCallbackNode=function(){return Lb(jv)};la.unstable_next=function(t){switch(Nf){case 1:case 2:case 3:var e=3;break;default:e=Nf}var r=Nf;Nf=e;try{return t()}finally{Nf=r}};la.unstable_pauseExecution=function(){};la.unstable_requestPaint=function(){};la.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Nf;Nf=t;try{return e()}finally{Nf=r}};la.unstable_scheduleCallback=function(t,e,r){var n=la.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:zTr++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,PCe(iI,t),Lb(jv)===null&&t===Lb(iI)&&(_8?(Ptt(v8),v8=-1):_8=!0,RCe(ACe,r-n))):(t.sortIndex=o,PCe(jv,t),$j||zee||($j=!0,MCe(ICe))),t};la.unstable_shouldYield=Itt;la.unstable_wrapCallback=function(t){var e=Nf;return function(){var r=Nf;Nf=e;try{return t.apply(this,arguments)}finally{Nf=r}}}});var Ntt=x((Iso,Rtt)=>{"use strict";Rtt.exports=Mtt()});var $ot=x(Bh=>{"use strict";var Brt=Y(),kh=Ntt();function We(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 zrt=new Set,U8={};function Xj(t,e){Mz(t,e),Mz(t+"Capture",e)}function Mz(t,e){for(U8[t]=e,t=0;t<e.length;t++)zrt.add(e[t])}var jE=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tOe=Object.prototype.hasOwnProperty,UTr=/^[: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]*$/,jtt={},Dtt={};function qTr(t){return tOe.call(Dtt,t)?!0:tOe.call(jtt,t)?!1:UTr.test(t)?Dtt[t]=!0:(jtt[t]=!0,!1)}function HTr(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 VTr(t,e,r,n){if(e===null||typeof e>"u"||HTr(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 Dp(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 Dp(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 Dp(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Td[t]=new Dp(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Td[t]=new Dp(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 Dp(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Td[t]=new Dp(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Td[t]=new Dp(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Td[t]=new Dp(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Td[t]=new Dp(t,5,!1,t.toLowerCase(),null,!1,!1)});var KOe=/[\-:]([a-z])/g;function GOe(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(KOe,GOe);Td[e]=new Dp(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(KOe,GOe);Td[e]=new Dp(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(KOe,GOe);Td[e]=new Dp(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Td[t]=new Dp(t,1,!1,t.toLowerCase(),null,!1,!1)});Td.xlinkHref=new Dp("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Td[t]=new Dp(t,1,!1,t.toLowerCase(),null,!0,!0)});function JOe(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")&&(VTr(e,r,o,n)&&(r=null),n||o===null?qTr(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 kE=Brt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,qee=Symbol.for("react.element"),pz=Symbol.for("react.portal"),mz=Symbol.for("react.fragment"),ZOe=Symbol.for("react.strict_mode"),rOe=Symbol.for("react.profiler"),Urt=Symbol.for("react.provider"),qrt=Symbol.for("react.context"),YOe=Symbol.for("react.forward_ref"),nOe=Symbol.for("react.suspense"),oOe=Symbol.for("react.suspense_list"),XOe=Symbol.for("react.memo"),sI=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var Hrt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var Ltt=Symbol.iterator;function w8(t){return t===null||typeof t!="object"?null:(t=Ltt&&t[Ltt]||t["@@iterator"],typeof t=="function"?t:null)}var us=Object.assign,NCe;function A8(t){if(NCe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);NCe=e&&e[1]||""}return`
`+NCe+t}var jCe=!1;function DCe(t,e){if(!t||jCe)return"";jCe=!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{jCe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?A8(t):""}function WTr(t){switch(t.tag){case 5:return A8(t.type);case 16:return A8("Lazy");case 13:return A8("Suspense");case 19:return A8("SuspenseList");case 0:case 2:case 15:return t=DCe(t.type,!1),t;case 11:return t=DCe(t.type.render,!1),t;case 1:return t=DCe(t.type,!0),t;default:return""}}function iOe(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 mz:return"Fragment";case pz:return"Portal";case rOe:return"Profiler";case ZOe:return"StrictMode";case nOe:return"Suspense";case oOe:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case qrt:return(t.displayName||"Context")+".Consumer";case Urt:return(t._context.displayName||"Context")+".Provider";case YOe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case XOe:return e=t.displayName||null,e!==null?e:iOe(t.type)||"Memo";case sI:e=t._payload,t=t._init;try{return iOe(t(e))}catch{}}return null}function KTr(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 iOe(e);case 8:return e===ZOe?"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 wI(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Vrt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GTr(t){var e=Vrt(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 Hee(t){t._valueTracker||(t._valueTracker=GTr(t))}function Wrt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=Vrt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function bte(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 aOe(t,e){var r=e.checked;return us({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Ftt(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=wI(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 Krt(t,e){e=e.checked,e!=null&&JOe(t,"checked",e,!1)}function sOe(t,e){Krt(t,e);var r=wI(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")?uOe(t,e.type,r):e.hasOwnProperty("defaultValue")&&uOe(t,e.type,wI(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function ktt(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 uOe(t,e,r){(e!=="number"||bte(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var I8=Array.isArray;function Oz(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=""+wI(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 lOe(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(We(91));return us({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function $tt(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(We(92));if(I8(r)){if(1<r.length)throw Error(We(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:wI(r)}}function Grt(t,e){var r=wI(e.value),n=wI(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 Btt(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Jrt(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 cOe(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Jrt(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Vee,Zrt=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(Vee=Vee||document.createElement("div"),Vee.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Vee.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function q8(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var N8={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},JTr=["Webkit","ms","Moz","O"];Object.keys(N8).forEach(function(t){JTr.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),N8[e]=N8[t]})});function Yrt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||N8.hasOwnProperty(t)&&N8[t]?(""+e).trim():e+"px"}function Xrt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=Yrt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var ZTr=us({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 dOe(t,e){if(e){if(ZTr[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(We(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(We(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(We(61))}if(e.style!=null&&typeof e.style!="object")throw Error(We(62))}}function fOe(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 pOe=null;function QOe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var mOe=null,Ez=null,Pz=null;function ztt(t){if(t=s5(t)){if(typeof mOe!="function")throw Error(We(280));var e=t.stateNode;e&&(e=Wte(e),mOe(t.stateNode,t.type,e))}}function Qrt(t){Ez?Pz?Pz.push(t):Pz=[t]:Ez=t}function ent(){if(Ez){var t=Ez,e=Pz;if(Pz=Ez=null,ztt(t),e)for(t=0;t<e.length;t++)ztt(e[t])}}function tnt(t,e){return t(e)}function rnt(){}var LCe=!1;function nnt(t,e,r){if(LCe)return t(e,r);LCe=!0;try{return tnt(t,e,r)}finally{LCe=!1,(Ez!==null||Pz!==null)&&(rnt(),ent())}}function H8(t,e){var r=t.stateNode;if(r===null)return null;var n=Wte(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(We(231,e,typeof r));return r}var hOe=!1;if(jE)try{dz={},Object.defineProperty(dz,"passive",{get:function(){hOe=!0}}),window.addEventListener("test",dz,dz),window.removeEventListener("test",dz,dz)}catch{hOe=!1}var dz;function YTr(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 j8=!1,_te=null,vte=!1,gOe=null,XTr={onError:function(t){j8=!0,_te=t}};function QTr(t,e,r,n,o,i,a,s,u){j8=!1,_te=null,YTr.apply(XTr,arguments)}function eAr(t,e,r,n,o,i,a,s,u){if(QTr.apply(this,arguments),j8){if(j8){var l=_te;j8=!1,_te=null}else throw Error(We(198));vte||(vte=!0,gOe=l)}}function Qj(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 ont(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 Utt(t){if(Qj(t)!==t)throw Error(We(188))}function tAr(t){var e=t.alternate;if(!e){if(e=Qj(t),e===null)throw Error(We(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 Utt(o),t;if(i===n)return Utt(o),e;i=i.sibling}throw Error(We(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(We(189))}}if(r.alternate!==n)throw Error(We(190))}if(r.tag!==3)throw Error(We(188));return r.stateNode.current===r?t:e}function int(t){return t=tAr(t),t!==null?ant(t):null}function ant(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=ant(t);if(e!==null)return e;t=t.sibling}return null}var snt=kh.unstable_scheduleCallback,qtt=kh.unstable_cancelCallback,rAr=kh.unstable_shouldYield,nAr=kh.unstable_requestPaint,ru=kh.unstable_now,oAr=kh.unstable_getCurrentPriorityLevel,eEe=kh.unstable_ImmediatePriority,unt=kh.unstable_UserBlockingPriority,wte=kh.unstable_NormalPriority,iAr=kh.unstable_LowPriority,lnt=kh.unstable_IdlePriority,Ute=null,kv=null;function aAr(t){if(kv&&typeof kv.onCommitFiberRoot=="function")try{kv.onCommitFiberRoot(Ute,t,void 0,(t.current.flags&128)===128)}catch{}}var zb=Math.clz32?Math.clz32:lAr,sAr=Math.log,uAr=Math.LN2;function lAr(t){return t>>>=0,t===0?32:31-(sAr(t)/uAr|0)|0}var Wee=64,Kee=4194304;function M8(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 xte(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=M8(s):(i&=a,i!==0&&(n=M8(i)))}else a=r&~o,a!==0?n=M8(a):i!==0&&(n=M8(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-zb(e),o=1<<r,n|=t[r],e&=~o;return n}function cAr(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 dAr(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-zb(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=cAr(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function yOe(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function cnt(){var t=Wee;return Wee<<=1,(Wee&4194240)===0&&(Wee=64),t}function FCe(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function i5(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-zb(e),t[e]=r}function fAr(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-zb(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function tEe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-zb(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var Fi=0;function dnt(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var fnt,rEe,pnt,mnt,hnt,bOe=!1,Gee=[],pI=null,mI=null,hI=null,V8=new Map,W8=new Map,lI=[],pAr="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 Htt(t,e){switch(t){case"focusin":case"focusout":pI=null;break;case"dragenter":case"dragleave":mI=null;break;case"mouseover":case"mouseout":hI=null;break;case"pointerover":case"pointerout":V8.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":W8.delete(e.pointerId)}}function x8(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=s5(e),e!==null&&rEe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function mAr(t,e,r,n,o){switch(e){case"focusin":return pI=x8(pI,t,e,r,n,o),!0;case"dragenter":return mI=x8(mI,t,e,r,n,o),!0;case"mouseover":return hI=x8(hI,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return V8.set(i,x8(V8.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,W8.set(i,x8(W8.get(i)||null,t,e,r,n,o)),!0}return!1}function gnt(t){var e=Uj(t.target);if(e!==null){var r=Qj(e);if(r!==null){if(e=r.tag,e===13){if(e=ont(r),e!==null){t.blockedOn=e,hnt(t.priority,function(){pnt(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 ute(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=_Oe(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);pOe=n,r.target.dispatchEvent(n),pOe=null}else return e=s5(r),e!==null&&rEe(e),t.blockedOn=r,!1;e.shift()}return!0}function Vtt(t,e,r){ute(t)&&r.delete(e)}function hAr(){bOe=!1,pI!==null&&ute(pI)&&(pI=null),mI!==null&&ute(mI)&&(mI=null),hI!==null&&ute(hI)&&(hI=null),V8.forEach(Vtt),W8.forEach(Vtt)}function S8(t,e){t.blockedOn===e&&(t.blockedOn=null,bOe||(bOe=!0,kh.unstable_scheduleCallback(kh.unstable_NormalPriority,hAr)))}function K8(t){function e(o){return S8(o,t)}if(0<Gee.length){S8(Gee[0],t);for(var r=1;r<Gee.length;r++){var n=Gee[r];n.blockedOn===t&&(n.blockedOn=null)}}for(pI!==null&&S8(pI,t),mI!==null&&S8(mI,t),hI!==null&&S8(hI,t),V8.forEach(e),W8.forEach(e),r=0;r<lI.length;r++)n=lI[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<lI.length&&(r=lI[0],r.blockedOn===null);)gnt(r),r.blockedOn===null&&lI.shift()}var Tz=kE.ReactCurrentBatchConfig,Ste=!0;function gAr(t,e,r,n){var o=Fi,i=Tz.transition;Tz.transition=null;try{Fi=1,nEe(t,e,r,n)}finally{Fi=o,Tz.transition=i}}function yAr(t,e,r,n){var o=Fi,i=Tz.transition;Tz.transition=null;try{Fi=4,nEe(t,e,r,n)}finally{Fi=o,Tz.transition=i}}function nEe(t,e,r,n){if(Ste){var o=_Oe(t,e,r,n);if(o===null)HCe(t,e,n,Cte,r),Htt(t,n);else if(mAr(o,t,e,r,n))n.stopPropagation();else if(Htt(t,n),e&4&&-1<pAr.indexOf(t)){for(;o!==null;){var i=s5(o);if(i!==null&&fnt(i),i=_Oe(t,e,r,n),i===null&&HCe(t,e,n,Cte,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else HCe(t,e,n,null,r)}}var Cte=null;function _Oe(t,e,r,n){if(Cte=null,t=QOe(n),t=Uj(t),t!==null)if(e=Qj(t),e===null)t=null;else if(r=e.tag,r===13){if(t=ont(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 Cte=t,null}function ynt(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(oAr()){case eEe:return 1;case unt:return 4;case wte:case iAr:return 16;case lnt:return 536870912;default:return 16}default:return 16}}var dI=null,oEe=null,lte=null;function bnt(){if(lte)return lte;var t,e=oEe,r=e.length,n,o="value"in dI?dI.value:dI.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 lte=o.slice(t,1<n?1-n:void 0)}function cte(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 Jee(){return!0}function Wtt(){return!1}function $h(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)?Jee:Wtt,this.isPropagationStopped=Wtt,this}return us(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=Jee)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Jee)},persist:function(){},isPersistent:Jee}),e}var kz={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},iEe=$h(kz),a5=us({},kz,{view:0,detail:0}),bAr=$h(a5),kCe,$Ce,C8,qte=us({},a5,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:aEe,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!==C8&&(C8&&t.type==="mousemove"?(kCe=t.screenX-C8.screenX,$Ce=t.screenY-C8.screenY):$Ce=kCe=0,C8=t),kCe)},movementY:function(t){return"movementY"in t?t.movementY:$Ce}}),Ktt=$h(qte),_Ar=us({},qte,{dataTransfer:0}),vAr=$h(_Ar),wAr=us({},a5,{relatedTarget:0}),BCe=$h(wAr),xAr=us({},kz,{animationName:0,elapsedTime:0,pseudoElement:0}),SAr=$h(xAr),CAr=us({},kz,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),OAr=$h(CAr),EAr=us({},kz,{data:0}),Gtt=$h(EAr),PAr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TAr={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"},AAr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IAr(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=AAr[t])?!!e[t]:!1}function aEe(){return IAr}var MAr=us({},a5,{key:function(t){if(t.key){var e=PAr[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=cte(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?TAr[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:aEe,charCode:function(t){return t.type==="keypress"?cte(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?cte(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),RAr=$h(MAr),NAr=us({},qte,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jtt=$h(NAr),jAr=us({},a5,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:aEe}),DAr=$h(jAr),LAr=us({},kz,{propertyName:0,elapsedTime:0,pseudoElement:0}),FAr=$h(LAr),kAr=us({},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}),$Ar=$h(kAr),BAr=[9,13,27,32],sEe=jE&&"CompositionEvent"in window,D8=null;jE&&"documentMode"in document&&(D8=document.documentMode);var zAr=jE&&"TextEvent"in window&&!D8,_nt=jE&&(!sEe||D8&&8<D8&&11>=D8),Ztt=" ",Ytt=!1;function vnt(t,e){switch(t){case"keyup":return BAr.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wnt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var hz=!1;function UAr(t,e){switch(t){case"compositionend":return wnt(e);case"keypress":return e.which!==32?null:(Ytt=!0,Ztt);case"textInput":return t=e.data,t===Ztt&&Ytt?null:t;default:return null}}function qAr(t,e){if(hz)return t==="compositionend"||!sEe&&vnt(t,e)?(t=bnt(),lte=oEe=dI=null,hz=!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 _nt&&e.locale!=="ko"?null:e.data;default:return null}}var HAr={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 Xtt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!HAr[t.type]:e==="textarea"}function xnt(t,e,r,n){Qrt(n),e=Ote(e,"onChange"),0<e.length&&(r=new iEe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var L8=null,G8=null;function VAr(t){Nnt(t,0)}function Hte(t){var e=bz(t);if(Wrt(e))return t}function WAr(t,e){if(t==="change")return e}var Snt=!1;jE&&(jE?(Yee="oninput"in document,Yee||(zCe=document.createElement("div"),zCe.setAttribute("oninput","return;"),Yee=typeof zCe.oninput=="function"),Zee=Yee):Zee=!1,Snt=Zee&&(!document.documentMode||9<document.documentMode));var Zee,Yee,zCe;function Qtt(){L8&&(L8.detachEvent("onpropertychange",Cnt),G8=L8=null)}function Cnt(t){if(t.propertyName==="value"&&Hte(G8)){var e=[];xnt(e,G8,t,QOe(t)),nnt(VAr,e)}}function KAr(t,e,r){t==="focusin"?(Qtt(),L8=e,G8=r,L8.attachEvent("onpropertychange",Cnt)):t==="focusout"&&Qtt()}function GAr(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Hte(G8)}function JAr(t,e){if(t==="click")return Hte(e)}function ZAr(t,e){if(t==="input"||t==="change")return Hte(e)}function YAr(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var qb=typeof Object.is=="function"?Object.is:YAr;function J8(t,e){if(qb(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(!tOe.call(e,o)||!qb(t[o],e[o]))return!1}return!0}function ert(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function trt(t,e){var r=ert(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=ert(r)}}function Ont(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Ont(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Ent(){for(var t=window,e=bte();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=bte(t.document)}return e}function uEe(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 XAr(t){var e=Ent(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Ont(r.ownerDocument.documentElement,r)){if(n!==null&&uEe(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=trt(r,i);var a=trt(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 QAr=jE&&"documentMode"in document&&11>=document.documentMode,gz=null,vOe=null,F8=null,wOe=!1;function rrt(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;wOe||gz==null||gz!==bte(n)||(n=gz,"selectionStart"in n&&uEe(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}),F8&&J8(F8,n)||(F8=n,n=Ote(vOe,"onSelect"),0<n.length&&(e=new iEe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=gz)))}function Xee(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var yz={animationend:Xee("Animation","AnimationEnd"),animationiteration:Xee("Animation","AnimationIteration"),animationstart:Xee("Animation","AnimationStart"),transitionend:Xee("Transition","TransitionEnd")},UCe={},Pnt={};jE&&(Pnt=document.createElement("div").style,"AnimationEvent"in window||(delete yz.animationend.animation,delete yz.animationiteration.animation,delete yz.animationstart.animation),"TransitionEvent"in window||delete yz.transitionend.transition);function Vte(t){if(UCe[t])return UCe[t];if(!yz[t])return t;var e=yz[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in Pnt)return UCe[t]=e[r];return t}var Tnt=Vte("animationend"),Ant=Vte("animationiteration"),Int=Vte("animationstart"),Mnt=Vte("transitionend"),Rnt=new Map,nrt="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 SI(t,e){Rnt.set(t,e),Xj(e,[t])}for(Qee=0;Qee<nrt.length;Qee++)ete=nrt[Qee],ort=ete.toLowerCase(),irt=ete[0].toUpperCase()+ete.slice(1),SI(ort,"on"+irt);var ete,ort,irt,Qee;SI(Tnt,"onAnimationEnd");SI(Ant,"onAnimationIteration");SI(Int,"onAnimationStart");SI("dblclick","onDoubleClick");SI("focusin","onFocus");SI("focusout","onBlur");SI(Mnt,"onTransitionEnd");Mz("onMouseEnter",["mouseout","mouseover"]);Mz("onMouseLeave",["mouseout","mouseover"]);Mz("onPointerEnter",["pointerout","pointerover"]);Mz("onPointerLeave",["pointerout","pointerover"]);Xj("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Xj("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Xj("onBeforeInput",["compositionend","keypress","textInput","paste"]);Xj("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Xj("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Xj("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var R8="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(R8));function art(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,eAr(n,e,void 0,t),t.currentTarget=null}function Nnt(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;art(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;art(o,s,l),i=u}}}if(vte)throw t=gOe,vte=!1,gOe=null,t}function xa(t,e){var r=e[EOe];r===void 0&&(r=e[EOe]=new Set);var n=t+"__bubble";r.has(n)||(jnt(e,t,2,!1),r.add(n))}function qCe(t,e,r){var n=0;e&&(n|=4),jnt(r,t,n,e)}var tte="_reactListening"+Math.random().toString(36).slice(2);function Z8(t){if(!t[tte]){t[tte]=!0,zrt.forEach(function(r){r!=="selectionchange"&&(eIr.has(r)||qCe(r,!1,t),qCe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[tte]||(e[tte]=!0,qCe("selectionchange",!1,e))}}function jnt(t,e,r,n){switch(ynt(e)){case 1:var o=gAr;break;case 4:o=yAr;break;default:o=nEe}r=o.bind(null,e,r,t),o=void 0,!hOe||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 HCe(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=Uj(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}nnt(function(){var l=i,c=QOe(r),d=[];e:{var f=Rnt.get(t);if(f!==void 0){var p=iEe,h=t;switch(t){case"keypress":if(cte(r)===0)break e;case"keydown":case"keyup":p=RAr;break;case"focusin":h="focus",p=BCe;break;case"focusout":h="blur",p=BCe;break;case"beforeblur":case"afterblur":p=BCe;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=Ktt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=vAr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=DAr;break;case Tnt:case Ant:case Int:p=SAr;break;case Mnt:p=FAr;break;case"scroll":p=bAr;break;case"wheel":p=$Ar;break;case"copy":case"cut":case"paste":p=OAr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Jtt}var m=(e&4)!==0,g=!m&&t==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var _=l,w;_!==null;){w=_;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,y!==null&&(S=H8(_,y),S!=null&&m.push(Y8(_,S,w)))),g)break;_=_.return}0<m.length&&(f=new p(f,h,null,r,c),d.push({event:f,listeners:m}))}}if((e&7)===0){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==pOe&&(h=r.relatedTarget||r.fromElement)&&(Uj(h)||h[DE]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=r.relatedTarget||r.toElement,p=l,h=h?Uj(h):null,h!==null&&(g=Qj(h),h!==g||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=l),p!==h)){if(m=Ktt,S="onMouseLeave",y="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(m=Jtt,S="onPointerLeave",y="onPointerEnter",_="pointer"),g=p==null?f:bz(p),w=h==null?f:bz(h),f=new m(S,_+"leave",p,r,c),f.target=g,f.relatedTarget=w,S=null,Uj(c)===l&&(m=new m(y,_+"enter",h,r,c),m.target=w,m.relatedTarget=g,S=m),g=S,p&&h)t:{for(m=p,y=h,_=0,w=m;w;w=fz(w))_++;for(w=0,S=y;S;S=fz(S))w++;for(;0<_-w;)m=fz(m),_--;for(;0<w-_;)y=fz(y),w--;for(;_--;){if(m===y||y!==null&&m===y.alternate)break t;m=fz(m),y=fz(y)}m=null}else m=null;p!==null&&srt(d,f,p,m,!1),h!==null&&g!==null&&srt(d,g,h,m,!0)}}e:{if(f=l?bz(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=WAr;else if(Xtt(f))if(Snt)C=ZAr;else{C=GAr;var E=KAr}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=JAr);if(C&&(C=C(t,l))){xnt(d,C,r,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&uOe(f,"number",f.value)}switch(E=l?bz(l):window,t){case"focusin":(Xtt(E)||E.contentEditable==="true")&&(gz=E,vOe=l,F8=null);break;case"focusout":F8=vOe=gz=null;break;case"mousedown":wOe=!0;break;case"contextmenu":case"mouseup":case"dragend":wOe=!1,rrt(d,r,c);break;case"selectionchange":if(QAr)break;case"keydown":case"keyup":rrt(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 hz?vnt(t,r)&&(T="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(_nt&&r.locale!=="ko"&&(hz||T!=="onCompositionStart"?T==="onCompositionEnd"&&hz&&(P=bnt()):(dI=c,oEe="value"in dI?dI.value:dI.textContent,hz=!0)),E=Ote(l,T),0<E.length&&(T=new Gtt(T,t,null,r,c),d.push({event:T,listeners:E}),P?T.data=P:(P=wnt(r),P!==null&&(T.data=P)))),(P=zAr?UAr(t,r):qAr(t,r))&&(l=Ote(l,"onBeforeInput"),0<l.length&&(c=new Gtt("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=P))}Nnt(d,e)})}function Y8(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Ote(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=H8(t,r),i!=null&&n.unshift(Y8(t,i,o)),i=H8(t,e),i!=null&&n.push(Y8(t,i,o))),t=t.return}return n}function fz(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function srt(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=H8(r,i),u!=null&&a.unshift(Y8(r,u,s))):o||(u=H8(r,i),u!=null&&a.push(Y8(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var tIr=/\r\n?/g,rIr=/\u0000|\uFFFD/g;function urt(t){return(typeof t=="string"?t:""+t).replace(tIr,`
`).replace(rIr,"")}function rte(t,e,r){if(e=urt(e),urt(t)!==e&&r)throw Error(We(425))}function Ete(){}var xOe=null,SOe=null;function COe(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 OOe=typeof setTimeout=="function"?setTimeout:void 0,nIr=typeof clearTimeout=="function"?clearTimeout:void 0,lrt=typeof Promise=="function"?Promise:void 0,oIr=typeof queueMicrotask=="function"?queueMicrotask:typeof lrt<"u"?function(t){return lrt.resolve(null).then(t).catch(iIr)}:OOe;function iIr(t){setTimeout(function(){throw t})}function VCe(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),K8(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);K8(e)}function gI(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 crt(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 $z=Math.random().toString(36).slice(2),Fv="__reactFiber$"+$z,X8="__reactProps$"+$z,DE="__reactContainer$"+$z,EOe="__reactEvents$"+$z,aIr="__reactListeners$"+$z,sIr="__reactHandles$"+$z;function Uj(t){var e=t[Fv];if(e)return e;for(var r=t.parentNode;r;){if(e=r[DE]||r[Fv]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=crt(t);t!==null;){if(r=t[Fv])return r;t=crt(t)}return e}t=r,r=t.parentNode}return null}function s5(t){return t=t[Fv]||t[DE],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function bz(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(We(33))}function Wte(t){return t[X8]||null}var POe=[],_z=-1;function CI(t){return{current:t}}function Sa(t){0>_z||(t.current=POe[_z],POe[_z]=null,_z--)}function ca(t,e){_z++,POe[_z]=t.current,t.current=e}var xI={},Ff=CI(xI),Nm=CI(!1),Kj=xI;function Rz(t,e){var r=t.type.contextTypes;if(!r)return xI;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 jm(t){return t=t.childContextTypes,t!=null}function Pte(){Sa(Nm),Sa(Ff)}function drt(t,e,r){if(Ff.current!==xI)throw Error(We(168));ca(Ff,e),ca(Nm,r)}function Dnt(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(We(108,KTr(t)||"Unknown",o));return us({},r,n)}function Tte(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||xI,Kj=Ff.current,ca(Ff,t),ca(Nm,Nm.current),!0}function frt(t,e,r){var n=t.stateNode;if(!n)throw Error(We(169));r?(t=Dnt(t,e,Kj),n.__reactInternalMemoizedMergedChildContext=t,Sa(Nm),Sa(Ff),ca(Ff,t)):Sa(Nm),ca(Nm,r)}var IE=null,Kte=!1,WCe=!1;function Lnt(t){IE===null?IE=[t]:IE.push(t)}function uIr(t){Kte=!0,Lnt(t)}function OI(){if(!WCe&&IE!==null){WCe=!0;var t=0,e=Fi;try{var r=IE;for(Fi=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}IE=null,Kte=!1}catch(o){throw IE!==null&&(IE=IE.slice(t+1)),snt(eEe,OI),o}finally{Fi=e,WCe=!1}}return null}var vz=[],wz=0,Ate=null,Ite=0,ry=[],ny=0,Gj=null,ME=1,RE="";function Bj(t,e){vz[wz++]=Ite,vz[wz++]=Ate,Ate=t,Ite=e}function Fnt(t,e,r){ry[ny++]=ME,ry[ny++]=RE,ry[ny++]=Gj,Gj=t;var n=ME;t=RE;var o=32-zb(n)-1;n&=~(1<<o),r+=1;var i=32-zb(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,ME=1<<32-zb(e)+o|r<<o|n,RE=i+t}else ME=1<<i|r<<o|n,RE=t}function lEe(t){t.return!==null&&(Bj(t,1),Fnt(t,1,0))}function cEe(t){for(;t===Ate;)Ate=vz[--wz],vz[wz]=null,Ite=vz[--wz],vz[wz]=null;for(;t===Gj;)Gj=ry[--ny],ry[ny]=null,RE=ry[--ny],ry[ny]=null,ME=ry[--ny],ry[ny]=null}var Fh=null,Lh=null,Ba=!1,Bb=null;function knt(t,e){var r=oy(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 prt(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,Fh=t,Lh=gI(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Fh=t,Lh=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=Gj!==null?{id:ME,overflow:RE}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=oy(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Fh=t,Lh=null,!0):!1;default:return!1}}function TOe(t){return(t.mode&1)!==0&&(t.flags&128)===0}function AOe(t){if(Ba){var e=Lh;if(e){var r=e;if(!prt(t,e)){if(TOe(t))throw Error(We(418));e=gI(r.nextSibling);var n=Fh;e&&prt(t,e)?knt(n,r):(t.flags=t.flags&-4097|2,Ba=!1,Fh=t)}}else{if(TOe(t))throw Error(We(418));t.flags=t.flags&-4097|2,Ba=!1,Fh=t}}}function mrt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Fh=t}function nte(t){if(t!==Fh)return!1;if(!Ba)return mrt(t),Ba=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!COe(t.type,t.memoizedProps)),e&&(e=Lh)){if(TOe(t))throw $nt(),Error(We(418));for(;e;)knt(t,e),e=gI(e.nextSibling)}if(mrt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(We(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Lh=gI(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Lh=null}}else Lh=Fh?gI(t.stateNode.nextSibling):null;return!0}function $nt(){for(var t=Lh;t;)t=gI(t.nextSibling)}function Nz(){Lh=Fh=null,Ba=!1}function dEe(t){Bb===null?Bb=[t]:Bb.push(t)}var lIr=kE.ReactCurrentBatchConfig;function kb(t,e){if(t&&t.defaultProps){e=us({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var Mte=CI(null),Rte=null,xz=null,fEe=null;function pEe(){fEe=xz=Rte=null}function mEe(t){var e=Mte.current;Sa(Mte),t._currentValue=e}function IOe(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 Az(t,e){Rte=t,fEe=xz=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(Rm=!0),t.firstContext=null)}function ay(t){var e=t._currentValue;if(fEe!==t)if(t={context:t,memoizedValue:e,next:null},xz===null){if(Rte===null)throw Error(We(308));xz=t,Rte.dependencies={lanes:0,firstContext:t}}else xz=xz.next=t;return e}var qj=null;function hEe(t){qj===null?qj=[t]:qj.push(t)}function Bnt(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,hEe(e)):(r.next=o.next,o.next=r),e.interleaved=r,LE(t,n)}function LE(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 uI=!1;function gEe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function znt(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 NE(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function yI(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,LE(t,r)}return o=n.interleaved,o===null?(e.next=e,hEe(n)):(e.next=o.next,o.next=e),n.interleaved=e,LE(t,r)}function dte(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,tEe(t,r)}}function hrt(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 Nte(t,e,r,n){var o=t.updateQueue;uI=!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 h=t,m=s;switch(f=e,p=r,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=us({},d,f);break e;case 2:uI=!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);Zj|=a,t.lanes=a,t.memoizedState=d}}function grt(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(We(191,o));o.call(n)}}}var Unt=new Brt.Component().refs;function MOe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:us({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Gte={isMounted:function(t){return(t=t._reactInternals)?Qj(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=jp(),o=_I(t),i=NE(n,o);i.payload=e,r!=null&&(i.callback=r),e=yI(t,i,o),e!==null&&(Ub(e,t,o,n),dte(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=jp(),o=_I(t),i=NE(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=yI(t,i,o),e!==null&&(Ub(e,t,o,n),dte(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=jp(),n=_I(t),o=NE(r,n);o.tag=2,e!=null&&(o.callback=e),e=yI(t,o,n),e!==null&&(Ub(e,t,n,r),dte(e,t,n))}};function yrt(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?!J8(r,n)||!J8(o,i):!0}function qnt(t,e,r){var n=!1,o=xI,i=e.contextType;return typeof i=="object"&&i!==null?i=ay(i):(o=jm(e)?Kj:Ff.current,n=e.contextTypes,i=(n=n!=null)?Rz(t,o):xI),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Gte,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function brt(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&&Gte.enqueueReplaceState(e,e.state,null)}function ROe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=Unt,gEe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=ay(i):(i=jm(e)?Kj:Ff.current,o.context=Rz(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(MOe(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&&Gte.enqueueReplaceState(o,o.state,null),Nte(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function O8(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(We(309));var n=r.stateNode}if(!n)throw Error(We(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===Unt&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(We(284));if(!r._owner)throw Error(We(290,t))}return t}function ote(t,e){throw t=Object.prototype.toString.call(e),Error(We(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function _rt(t){var e=t._init;return e(t._payload)}function Hnt(t){function e(y,_){if(t){var w=y.deletions;w===null?(y.deletions=[_],y.flags|=16):w.push(_)}}function r(y,_){if(!t)return null;for(;_!==null;)e(y,_),_=_.sibling;return null}function n(y,_){for(y=new Map;_!==null;)_.key!==null?y.set(_.key,_):y.set(_.index,_),_=_.sibling;return y}function o(y,_){return y=vI(y,_),y.index=0,y.sibling=null,y}function i(y,_,w){return y.index=w,t?(w=y.alternate,w!==null?(w=w.index,w<_?(y.flags|=2,_):w):(y.flags|=2,_)):(y.flags|=1048576,_)}function a(y){return t&&y.alternate===null&&(y.flags|=2),y}function s(y,_,w,S){return _===null||_.tag!==6?(_=QCe(w,y.mode,S),_.return=y,_):(_=o(_,w),_.return=y,_)}function u(y,_,w,S){var C=w.type;return C===mz?c(y,_,w.props.children,S,w.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===sI&&_rt(C)===_.type)?(S=o(_,w.props),S.ref=O8(y,_,w),S.return=y,S):(S=yte(w.type,w.key,w.props,null,y.mode,S),S.ref=O8(y,_,w),S.return=y,S)}function l(y,_,w,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==w.containerInfo||_.stateNode.implementation!==w.implementation?(_=eOe(w,y.mode,S),_.return=y,_):(_=o(_,w.children||[]),_.return=y,_)}function c(y,_,w,S,C){return _===null||_.tag!==7?(_=Wj(w,y.mode,S,C),_.return=y,_):(_=o(_,w),_.return=y,_)}function d(y,_,w){if(typeof _=="string"&&_!==""||typeof _=="number")return _=QCe(""+_,y.mode,w),_.return=y,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case qee:return w=yte(_.type,_.key,_.props,null,y.mode,w),w.ref=O8(y,null,_),w.return=y,w;case pz:return _=eOe(_,y.mode,w),_.return=y,_;case sI:var S=_._init;return d(y,S(_._payload),w)}if(I8(_)||w8(_))return _=Wj(_,y.mode,w,null),_.return=y,_;ote(y,_)}return null}function f(y,_,w,S){var C=_!==null?_.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:s(y,_,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case qee:return w.key===C?u(y,_,w,S):null;case pz:return w.key===C?l(y,_,w,S):null;case sI:return C=w._init,f(y,_,C(w._payload),S)}if(I8(w)||w8(w))return C!==null?null:c(y,_,w,S,null);ote(y,w)}return null}function p(y,_,w,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(w)||null,s(_,y,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case qee:return y=y.get(S.key===null?w:S.key)||null,u(_,y,S,C);case pz:return y=y.get(S.key===null?w:S.key)||null,l(_,y,S,C);case sI:var E=S._init;return p(y,_,w,E(S._payload),C)}if(I8(S)||w8(S))return y=y.get(w)||null,c(_,y,S,C,null);ote(_,S)}return null}function h(y,_,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(y,P,w[T],S);if(N===null){P===null&&(P=I);break}t&&P&&N.alternate===null&&e(y,P),_=i(N,_,T),E===null?C=N:E.sibling=N,E=N,P=I}if(T===w.length)return r(y,P),Ba&&Bj(y,T),C;if(P===null){for(;T<w.length;T++)P=d(y,w[T],S),P!==null&&(_=i(P,_,T),E===null?C=P:E.sibling=P,E=P);return Ba&&Bj(y,T),C}for(P=n(y,P);T<w.length;T++)I=p(P,y,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(y,M)}),Ba&&Bj(y,T),C}function m(y,_,w,S){var C=w8(w);if(typeof C!="function")throw Error(We(150));if(w=C.call(w),w==null)throw Error(We(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(y,P,N.value,S);if(M===null){P===null&&(P=I);break}t&&P&&M.alternate===null&&e(y,P),_=i(M,_,T),E===null?C=M:E.sibling=M,E=M,P=I}if(N.done)return r(y,P),Ba&&Bj(y,T),C;if(P===null){for(;!N.done;T++,N=w.next())N=d(y,N.value,S),N!==null&&(_=i(N,_,T),E===null?C=N:E.sibling=N,E=N);return Ba&&Bj(y,T),C}for(P=n(y,P);!N.done;T++,N=w.next())N=p(P,y,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(y,D)}),Ba&&Bj(y,T),C}function g(y,_,w,S){if(typeof w=="object"&&w!==null&&w.type===mz&&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===mz){if(E.tag===7){r(y,E.sibling),_=o(E,w.props.children),_.return=y,y=_;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===sI&&_rt(C)===E.type){r(y,E.sibling),_=o(E,w.props),_.ref=O8(y,E,w),_.return=y,y=_;break e}r(y,E);break}else e(y,E);E=E.sibling}w.type===mz?(_=Wj(w.props.children,y.mode,S,w.key),_.return=y,y=_):(S=yte(w.type,w.key,w.props,null,y.mode,S),S.ref=O8(y,_,w),S.return=y,y=S)}return a(y);case pz:e:{for(E=w.key;_!==null;){if(_.key===E)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(y,_.sibling),_=o(_,w.children||[]),_.return=y,y=_;break e}else{r(y,_);break}else e(y,_);_=_.sibling}_=eOe(w,y.mode,S),_.return=y,y=_}return a(y);case sI:return E=w._init,g(y,_,E(w._payload),S)}if(I8(w))return h(y,_,w,S);if(w8(w))return m(y,_,w,S);ote(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(y,_.sibling),_=o(_,w),_.return=y,y=_):(r(y,_),_=QCe(w,y.mode,S),_.return=y,y=_),a(y)):r(y,_)}return g}var jz=Hnt(!0),Vnt=Hnt(!1),u5={},$v=CI(u5),Q8=CI(u5),e5=CI(u5);function Hj(t){if(t===u5)throw Error(We(174));return t}function yEe(t,e){switch(ca(e5,e),ca(Q8,t),ca($v,u5),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:cOe(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=cOe(e,t)}Sa($v),ca($v,e)}function Dz(){Sa($v),Sa(Q8),Sa(e5)}function Wnt(t){Hj(e5.current);var e=Hj($v.current),r=cOe(e,t.type);e!==r&&(ca(Q8,t),ca($v,r))}function bEe(t){Q8.current===t&&(Sa($v),Sa(Q8))}var as=CI(0);function jte(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 KCe=[];function _Ee(){for(var t=0;t<KCe.length;t++)KCe[t]._workInProgressVersionPrimary=null;KCe.length=0}var fte=kE.ReactCurrentDispatcher,GCe=kE.ReactCurrentBatchConfig,Jj=0,ss=null,sc=null,Fc=null,Dte=!1,k8=!1,t5=0,cIr=0;function jf(){throw Error(We(321))}function vEe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!qb(t[r],e[r]))return!1;return!0}function wEe(t,e,r,n,o,i){if(Jj=i,ss=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,fte.current=t===null||t.memoizedState===null?mIr:hIr,t=r(n,o),k8){i=0;do{if(k8=!1,t5=0,25<=i)throw Error(We(301));i+=1,Fc=sc=null,e.updateQueue=null,fte.current=gIr,t=r(n,o)}while(k8)}if(fte.current=Lte,e=sc!==null&&sc.next!==null,Jj=0,Fc=sc=ss=null,Dte=!1,e)throw Error(We(300));return t}function xEe(){var t=t5!==0;return t5=0,t}function Lv(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fc===null?ss.memoizedState=Fc=t:Fc=Fc.next=t,Fc}function sy(){if(sc===null){var t=ss.alternate;t=t!==null?t.memoizedState:null}else t=sc.next;var e=Fc===null?ss.memoizedState:Fc.next;if(e!==null)Fc=e,sc=t;else{if(t===null)throw Error(We(310));sc=t,t={memoizedState:sc.memoizedState,baseState:sc.baseState,baseQueue:sc.baseQueue,queue:sc.queue,next:null},Fc===null?ss.memoizedState=Fc=t:Fc=Fc.next=t}return Fc}function r5(t,e){return typeof e=="function"?e(t):e}function JCe(t){var e=sy(),r=e.queue;if(r===null)throw Error(We(311));r.lastRenderedReducer=t;var n=sc,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((Jj&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,ss.lanes|=c,Zj|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,qb(n,e.memoizedState)||(Rm=!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,ss.lanes|=i,Zj|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function ZCe(t){var e=sy(),r=e.queue;if(r===null)throw Error(We(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);qb(i,e.memoizedState)||(Rm=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function Knt(){}function Gnt(t,e){var r=ss,n=sy(),o=e(),i=!qb(n.memoizedState,o);if(i&&(n.memoizedState=o,Rm=!0),n=n.queue,SEe(Ynt.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||Fc!==null&&Fc.memoizedState.tag&1){if(r.flags|=2048,n5(9,Znt.bind(null,r,n,o,e),void 0,null),kc===null)throw Error(We(349));(Jj&30)!==0||Jnt(r,e,o)}return o}function Jnt(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=ss.updateQueue,e===null?(e={lastEffect:null,stores:null},ss.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Znt(t,e,r,n){e.value=r,e.getSnapshot=n,Xnt(e)&&Qnt(t)}function Ynt(t,e,r){return r(function(){Xnt(e)&&Qnt(t)})}function Xnt(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!qb(t,r)}catch{return!0}}function Qnt(t){var e=LE(t,1);e!==null&&Ub(e,t,1,-1)}function vrt(t){var e=Lv();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r5,lastRenderedState:t},e.queue=t,t=t.dispatch=pIr.bind(null,ss,t),[e.memoizedState,t]}function n5(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=ss.updateQueue,e===null?(e={lastEffect:null,stores:null},ss.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 eot(){return sy().memoizedState}function pte(t,e,r,n){var o=Lv();ss.flags|=t,o.memoizedState=n5(1|e,r,void 0,n===void 0?null:n)}function Jte(t,e,r,n){var o=sy();n=n===void 0?null:n;var i=void 0;if(sc!==null){var a=sc.memoizedState;if(i=a.destroy,n!==null&&vEe(n,a.deps)){o.memoizedState=n5(e,r,i,n);return}}ss.flags|=t,o.memoizedState=n5(1|e,r,i,n)}function wrt(t,e){return pte(8390656,8,t,e)}function SEe(t,e){return Jte(2048,8,t,e)}function tot(t,e){return Jte(4,2,t,e)}function rot(t,e){return Jte(4,4,t,e)}function not(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 oot(t,e,r){return r=r!=null?r.concat([t]):null,Jte(4,4,not.bind(null,e,t),r)}function CEe(){}function iot(t,e){var r=sy();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&vEe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function aot(t,e){var r=sy();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&vEe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function sot(t,e,r){return(Jj&21)===0?(t.baseState&&(t.baseState=!1,Rm=!0),t.memoizedState=r):(qb(r,e)||(r=cnt(),ss.lanes|=r,Zj|=r,t.baseState=!0),e)}function dIr(t,e){var r=Fi;Fi=r!==0&&4>r?r:4,t(!0);var n=GCe.transition;GCe.transition={};try{t(!1),e()}finally{Fi=r,GCe.transition=n}}function uot(){return sy().memoizedState}function fIr(t,e,r){var n=_I(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},lot(t))cot(e,r);else if(r=Bnt(t,e,r,n),r!==null){var o=jp();Ub(r,t,n,o),dot(r,e,n)}}function pIr(t,e,r){var n=_I(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(lot(t))cot(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,qb(s,a)){var u=e.interleaved;u===null?(o.next=o,hEe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=Bnt(t,e,o,n),r!==null&&(o=jp(),Ub(r,t,n,o),dot(r,e,n))}}function lot(t){var e=t.alternate;return t===ss||e!==null&&e===ss}function cot(t,e){k8=Dte=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function dot(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,tEe(t,r)}}var Lte={readContext:ay,useCallback:jf,useContext:jf,useEffect:jf,useImperativeHandle:jf,useInsertionEffect:jf,useLayoutEffect:jf,useMemo:jf,useReducer:jf,useRef:jf,useState:jf,useDebugValue:jf,useDeferredValue:jf,useTransition:jf,useMutableSource:jf,useSyncExternalStore:jf,useId:jf,unstable_isNewReconciler:!1},mIr={readContext:ay,useCallback:function(t,e){return Lv().memoizedState=[t,e===void 0?null:e],t},useContext:ay,useEffect:wrt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,pte(4194308,4,not.bind(null,e,t),r)},useLayoutEffect:function(t,e){return pte(4194308,4,t,e)},useInsertionEffect:function(t,e){return pte(4,2,t,e)},useMemo:function(t,e){var r=Lv();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Lv();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=fIr.bind(null,ss,t),[n.memoizedState,t]},useRef:function(t){var e=Lv();return t={current:t},e.memoizedState=t},useState:vrt,useDebugValue:CEe,useDeferredValue:function(t){return Lv().memoizedState=t},useTransition:function(){var t=vrt(!1),e=t[0];return t=dIr.bind(null,t[1]),Lv().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ss,o=Lv();if(Ba){if(r===void 0)throw Error(We(407));r=r()}else{if(r=e(),kc===null)throw Error(We(349));(Jj&30)!==0||Jnt(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,wrt(Ynt.bind(null,n,i,t),[t]),n.flags|=2048,n5(9,Znt.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=Lv(),e=kc.identifierPrefix;if(Ba){var r=RE,n=ME;r=(n&~(1<<32-zb(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=t5++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=cIr++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},hIr={readContext:ay,useCallback:iot,useContext:ay,useEffect:SEe,useImperativeHandle:oot,useInsertionEffect:tot,useLayoutEffect:rot,useMemo:aot,useReducer:JCe,useRef:eot,useState:function(){return JCe(r5)},useDebugValue:CEe,useDeferredValue:function(t){var e=sy();return sot(e,sc.memoizedState,t)},useTransition:function(){var t=JCe(r5)[0],e=sy().memoizedState;return[t,e]},useMutableSource:Knt,useSyncExternalStore:Gnt,useId:uot,unstable_isNewReconciler:!1},gIr={readContext:ay,useCallback:iot,useContext:ay,useEffect:SEe,useImperativeHandle:oot,useInsertionEffect:tot,useLayoutEffect:rot,useMemo:aot,useReducer:ZCe,useRef:eot,useState:function(){return ZCe(r5)},useDebugValue:CEe,useDeferredValue:function(t){var e=sy();return sc===null?e.memoizedState=t:sot(e,sc.memoizedState,t)},useTransition:function(){var t=ZCe(r5)[0],e=sy().memoizedState;return[t,e]},useMutableSource:Knt,useSyncExternalStore:Gnt,useId:uot,unstable_isNewReconciler:!1};function Lz(t,e){try{var r="",n=e;do r+=WTr(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 YCe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function NOe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var yIr=typeof WeakMap=="function"?WeakMap:Map;function fot(t,e,r){r=NE(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){kte||(kte=!0,qOe=n),NOe(t,e)},r}function pot(t,e,r){r=NE(-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(){NOe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){NOe(t,e),typeof n!="function"&&(bI===null?bI=new Set([this]):bI.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function xrt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new yIr;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=MIr.bind(null,t,e,r),e.then(t,t))}function Srt(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 Crt(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=NE(-1,1),e.tag=2,yI(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var bIr=kE.ReactCurrentOwner,Rm=!1;function Np(t,e,r,n){e.child=t===null?Vnt(e,null,r,n):jz(e,t.child,r,n)}function Ort(t,e,r,n,o){r=r.render;var i=e.ref;return Az(e,o),n=wEe(t,e,r,n,i,o),r=xEe(),t!==null&&!Rm?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,FE(t,e,o)):(Ba&&r&&lEe(e),e.flags|=1,Np(t,e,n,o),e.child)}function Ert(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!REe(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=yte(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:J8,r(a,n)&&t.ref===e.ref)return FE(t,e,o)}return e.flags|=1,t=vI(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(J8(i,n)&&t.ref===e.ref)if(Rm=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(Rm=!0);else return e.lanes=t.lanes,FE(t,e,o)}return jOe(t,e,r,n,o)}function hot(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},ca(Cz,Dh),Dh|=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,ca(Cz,Dh),Dh|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,ca(Cz,Dh),Dh|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,ca(Cz,Dh),Dh|=n;return Np(t,e,o,r),e.child}function got(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function jOe(t,e,r,n,o){var i=jm(r)?Kj:Ff.current;return i=Rz(e,i),Az(e,o),r=wEe(t,e,r,n,i,o),n=xEe(),t!==null&&!Rm?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,FE(t,e,o)):(Ba&&n&&lEe(e),e.flags|=1,Np(t,e,r,o),e.child)}function Prt(t,e,r,n,o){if(jm(r)){var i=!0;Tte(e)}else i=!1;if(Az(e,o),e.stateNode===null)mte(t,e),qnt(e,r,n),ROe(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=ay(l):(l=jm(r)?Kj:Ff.current,l=Rz(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)&&brt(e,a,n,l),uI=!1;var f=e.memoizedState;a.state=f,Nte(e,n,a,o),u=e.memoizedState,s!==n||f!==u||Nm.current||uI?(typeof c=="function"&&(MOe(e,r,c,n),u=e.memoizedState),(s=uI||yrt(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,znt(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:kb(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=ay(u):(u=jm(r)?Kj:Ff.current,u=Rz(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)&&brt(e,a,n,u),uI=!1,f=e.memoizedState,a.state=f,Nte(e,n,a,o);var h=e.memoizedState;s!==d||f!==h||Nm.current||uI?(typeof p=="function"&&(MOe(e,r,p,n),h=e.memoizedState),(l=uI||yrt(e,r,l,n,f,h,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,h,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,h,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=h),a.props=n,a.state=h,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 DOe(t,e,r,n,i,o)}function DOe(t,e,r,n,o,i){got(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&frt(e,r,!1),FE(t,e,i);n=e.stateNode,bIr.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=jz(e,t.child,null,i),e.child=jz(e,null,s,i)):Np(t,e,s,i),e.memoizedState=n.state,o&&frt(e,r,!0),e.child}function yot(t){var e=t.stateNode;e.pendingContext?drt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&drt(t,e.context,!1),yEe(t,e.containerInfo)}function Trt(t,e,r,n,o){return Nz(),dEe(o),e.flags|=256,Np(t,e,r,n),e.child}var LOe={dehydrated:null,treeContext:null,retryLane:0};function FOe(t){return{baseLanes:t,cachePool:null,transitions:null}}function bot(t,e,r){var n=e.pendingProps,o=as.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),ca(as,o&1),t===null)return AOe(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=Xte(a,n,0,null),t=Wj(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=FOe(r),e.memoizedState=LOe,t):OEe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return _Ir(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=vI(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=vI(s,i):(i=Wj(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?FOe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=LOe,n}return i=t.child,t=i.sibling,n=vI(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 OEe(t,e){return e=Xte({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ite(t,e,r,n){return n!==null&&dEe(n),jz(e,t.child,null,r),t=OEe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function _Ir(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=YCe(Error(We(422))),ite(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=Xte({mode:"visible",children:n.children},o,0,null),i=Wj(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&jz(e,t.child,null,a),e.child.memoizedState=FOe(a),e.memoizedState=LOe,i);if((e.mode&1)===0)return ite(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(We(419)),n=YCe(i,n,void 0),ite(t,e,a,n)}if(s=(a&t.childLanes)!==0,Rm||s){if(n=kc,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,LE(t,o),Ub(n,t,o,-1))}return MEe(),n=YCe(Error(We(421))),ite(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=RIr.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Lh=gI(o.nextSibling),Fh=e,Ba=!0,Bb=null,t!==null&&(ry[ny++]=ME,ry[ny++]=RE,ry[ny++]=Gj,ME=t.id,RE=t.overflow,Gj=e),e=OEe(e,n.children),e.flags|=4096,e)}function Art(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),IOe(t.return,e,r)}function XCe(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 _ot(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Np(t,e,n.children,r),n=as.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&&Art(t,r,e);else if(t.tag===19)Art(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(ca(as,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&&jte(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),XCe(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&&jte(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}XCe(e,!0,r,null,i);break;case"together":XCe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function mte(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function FE(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Zj|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(We(153));if(e.child!==null){for(t=e.child,r=vI(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=vI(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function vIr(t,e,r){switch(e.tag){case 3:yot(e),Nz();break;case 5:Wnt(e);break;case 1:jm(e.type)&&Tte(e);break;case 4:yEe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;ca(Mte,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(ca(as,as.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?bot(t,e,r):(ca(as,as.current&1),t=FE(t,e,r),t!==null?t.sibling:null);ca(as,as.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return _ot(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ca(as,as.current),n)break;return null;case 22:case 23:return e.lanes=0,hot(t,e,r)}return FE(t,e,r)}var vot,kOe,wot,xot;vot=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}};kOe=function(){};wot=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,Hj($v.current);var i=null;switch(r){case"input":o=aOe(t,o),n=aOe(t,n),i=[];break;case"select":o=us({},o,{value:void 0}),n=us({},n,{value:void 0}),i=[];break;case"textarea":o=lOe(t,o),n=lOe(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Ete)}dOe(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"&&(U8.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"&&(U8.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)}};xot=function(t,e,r,n){r!==n&&(e.flags|=4)};function E8(t,e){if(!Ba)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 Df(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 wIr(t,e,r){var n=e.pendingProps;switch(cEe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Df(e),null;case 1:return jm(e.type)&&Pte(),Df(e),null;case 3:return n=e.stateNode,Dz(),Sa(Nm),Sa(Ff),_Ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(nte(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,Bb!==null&&(WOe(Bb),Bb=null))),kOe(t,e),Df(e),null;case 5:bEe(e);var o=Hj(e5.current);if(r=e.type,t!==null&&e.stateNode!=null)wot(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(We(166));return Df(e),null}if(t=Hj($v.current),nte(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[Fv]=e,n[X8]=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<R8.length;o++)xa(R8[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":Ftt(n,i),xa("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},xa("invalid",n);break;case"textarea":$tt(n,i),xa("invalid",n)}dOe(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&&rte(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&rte(n.textContent,s,t),o=["children",""+s]):U8.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&xa("scroll",n)}switch(r){case"input":Hee(n),ktt(n,i,!0);break;case"textarea":Hee(n),Btt(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Ete)}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=Jrt(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[Fv]=e,t[X8]=n,vot(t,e,!1,!1),e.stateNode=t;e:{switch(a=fOe(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<R8.length;o++)xa(R8[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":Ftt(t,n),o=aOe(t,n),xa("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=us({},n,{value:void 0}),xa("invalid",t);break;case"textarea":$tt(t,n),o=lOe(t,n),xa("invalid",t);break;default:o=n}dOe(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?Xrt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Zrt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&q8(t,u):typeof u=="number"&&q8(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(U8.hasOwnProperty(i)?u!=null&&i==="onScroll"&&xa("scroll",t):u!=null&&JOe(t,i,u,a))}switch(r){case"input":Hee(t),ktt(t,n,!1);break;case"textarea":Hee(t),Btt(t);break;case"option":n.value!=null&&t.setAttribute("value",""+wI(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Oz(t,!!n.multiple,i,!1):n.defaultValue!=null&&Oz(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Ete)}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 Df(e),null;case 6:if(t&&e.stateNode!=null)xot(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(We(166));if(r=Hj(e5.current),Hj($v.current),nte(e)){if(n=e.stateNode,r=e.memoizedProps,n[Fv]=e,(i=n.nodeValue!==r)&&(t=Fh,t!==null))switch(t.tag){case 3:rte(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&rte(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Fv]=e,e.stateNode=n}return Df(e),null;case 13:if(Sa(as),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ba&&Lh!==null&&(e.mode&1)!==0&&(e.flags&128)===0)$nt(),Nz(),e.flags|=98560,i=!1;else if(i=nte(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(We(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(We(317));i[Fv]=e}else Nz(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Df(e),i=!1}else Bb!==null&&(WOe(Bb),Bb=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||(as.current&1)!==0?uc===0&&(uc=3):MEe())),e.updateQueue!==null&&(e.flags|=4),Df(e),null);case 4:return Dz(),kOe(t,e),t===null&&Z8(e.stateNode.containerInfo),Df(e),null;case 10:return mEe(e.type._context),Df(e),null;case 17:return jm(e.type)&&Pte(),Df(e),null;case 19:if(Sa(as),i=e.memoizedState,i===null)return Df(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)E8(i,!1);else{if(uc!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=jte(t),a!==null){for(e.flags|=128,E8(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 ca(as,as.current&1|2),e.child}t=t.sibling}i.tail!==null&&ru()>Fz&&(e.flags|=128,n=!0,E8(i,!1),e.lanes=4194304)}else{if(!n)if(t=jte(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),E8(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ba)return Df(e),null}else 2*ru()-i.renderingStartTime>Fz&&r!==1073741824&&(e.flags|=128,n=!0,E8(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=ru(),e.sibling=null,r=as.current,ca(as,n?r&1|2:r&1),e):(Df(e),null);case 22:case 23:return IEe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(Dh&1073741824)!==0&&(Df(e),e.subtreeFlags&6&&(e.flags|=8192)):Df(e),null;case 24:return null;case 25:return null}throw Error(We(156,e.tag))}function xIr(t,e){switch(cEe(e),e.tag){case 1:return jm(e.type)&&Pte(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Dz(),Sa(Nm),Sa(Ff),_Ee(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return bEe(e),null;case 13:if(Sa(as),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(We(340));Nz()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Sa(as),null;case 4:return Dz(),null;case 10:return mEe(e.type._context),null;case 22:case 23:return IEe(),null;case 24:return null;default:return null}}var ate=!1,Lf=!1,SIr=typeof WeakSet=="function"?WeakSet:Set,It=null;function Sz(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){js(t,e,n)}else r.current=null}function $Oe(t,e,r){try{r()}catch(n){js(t,e,n)}}var Irt=!1;function CIr(t,e){if(xOe=Ste,t=Ent(),uEe(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(SOe={focusedElem:t,selectionRange:r},Ste=!1,It=e;It!==null;)if(e=It,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,It=t;else for(;It!==null;){e=It;try{var h=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,g=h.memoizedState,y=e.stateNode,_=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:kb(e.type,m),g);y.__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(We(163))}}catch(S){js(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,It=t;break}It=e.return}return h=Irt,Irt=!1,h}function $8(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&&$Oe(e,r,i)}o=o.next}while(o!==n)}}function Zte(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 BOe(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 Sot(t){var e=t.alternate;e!==null&&(t.alternate=null,Sot(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Fv],delete e[X8],delete e[EOe],delete e[aIr],delete e[sIr])),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 Cot(t){return t.tag===5||t.tag===3||t.tag===4}function Mrt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Cot(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 zOe(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=Ete));else if(n!==4&&(t=t.child,t!==null))for(zOe(t,e,r),t=t.sibling;t!==null;)zOe(t,e,r),t=t.sibling}function UOe(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(UOe(t,e,r),t=t.sibling;t!==null;)UOe(t,e,r),t=t.sibling}var Ed=null,$b=!1;function aI(t,e,r){for(r=r.child;r!==null;)Oot(t,e,r),r=r.sibling}function Oot(t,e,r){if(kv&&typeof kv.onCommitFiberUnmount=="function")try{kv.onCommitFiberUnmount(Ute,r)}catch{}switch(r.tag){case 5:Lf||Sz(r,e);case 6:var n=Ed,o=$b;Ed=null,aI(t,e,r),Ed=n,$b=o,Ed!==null&&($b?(t=Ed,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Ed.removeChild(r.stateNode));break;case 18:Ed!==null&&($b?(t=Ed,r=r.stateNode,t.nodeType===8?VCe(t.parentNode,r):t.nodeType===1&&VCe(t,r),K8(t)):VCe(Ed,r.stateNode));break;case 4:n=Ed,o=$b,Ed=r.stateNode.containerInfo,$b=!0,aI(t,e,r),Ed=n,$b=o;break;case 0:case 11:case 14:case 15:if(!Lf&&(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)&&$Oe(r,e,a),o=o.next}while(o!==n)}aI(t,e,r);break;case 1:if(!Lf&&(Sz(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){js(r,e,s)}aI(t,e,r);break;case 21:aI(t,e,r);break;case 22:r.mode&1?(Lf=(n=Lf)||r.memoizedState!==null,aI(t,e,r),Lf=n):aI(t,e,r);break;default:aI(t,e,r)}}function Rrt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new SIr),e.forEach(function(n){var o=NIr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Fb(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,$b=!1;break e;case 3:Ed=s.stateNode.containerInfo,$b=!0;break e;case 4:Ed=s.stateNode.containerInfo,$b=!0;break e}s=s.return}if(Ed===null)throw Error(We(160));Oot(i,a,o),Ed=null,$b=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){js(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Eot(e,t),e=e.sibling}function Eot(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Fb(e,t),Dv(t),n&4){try{$8(3,t,t.return),Zte(3,t)}catch(m){js(t,t.return,m)}try{$8(5,t,t.return)}catch(m){js(t,t.return,m)}}break;case 1:Fb(e,t),Dv(t),n&512&&r!==null&&Sz(r,r.return);break;case 5:if(Fb(e,t),Dv(t),n&512&&r!==null&&Sz(r,r.return),t.flags&32){var o=t.stateNode;try{q8(o,"")}catch(m){js(t,t.return,m)}}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&&Krt(o,i),fOe(s,a);var l=fOe(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?Xrt(o,d):c==="dangerouslySetInnerHTML"?Zrt(o,d):c==="children"?q8(o,d):JOe(o,c,d,l)}switch(s){case"input":sOe(o,i);break;case"textarea":Grt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Oz(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Oz(o,!!i.multiple,i.defaultValue,!0):Oz(o,!!i.multiple,i.multiple?[]:"",!1))}o[X8]=i}catch(m){js(t,t.return,m)}}break;case 6:if(Fb(e,t),Dv(t),n&4){if(t.stateNode===null)throw Error(We(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(m){js(t,t.return,m)}}break;case 3:if(Fb(e,t),Dv(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{K8(e.containerInfo)}catch(m){js(t,t.return,m)}break;case 4:Fb(e,t),Dv(t);break;case 13:Fb(e,t),Dv(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(TEe=ru())),n&4&&Rrt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(Lf=(l=Lf)||c,Fb(e,t),Lf=l):Fb(e,t),Dv(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(It=t,c=t.child;c!==null;){for(d=It=c;It!==null;){switch(f=It,p=f.child,f.tag){case 0:case 11:case 14:case 15:$8(4,f,f.return);break;case 1:Sz(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(m){js(n,r,m)}}break;case 5:Sz(f,f.return);break;case 22:if(f.memoizedState!==null){jrt(d);continue}}p!==null?(p.return=f,It=p):jrt(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=Yrt("display",a))}catch(m){js(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){js(t,t.return,m)}}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:Fb(e,t),Dv(t),n&4&&Rrt(t);break;case 21:break;default:Fb(e,t),Dv(t)}}function Dv(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(Cot(r)){var n=r;break e}r=r.return}throw Error(We(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(q8(o,""),n.flags&=-33);var i=Mrt(t);UOe(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=Mrt(t);zOe(t,s,a);break;default:throw Error(We(161))}}catch(u){js(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function OIr(t,e,r){It=t,Pot(t,e,r)}function Pot(t,e,r){for(var n=(t.mode&1)!==0;It!==null;){var o=It,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||ate;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||Lf;s=ate;var l=Lf;if(ate=a,(Lf=u)&&!l)for(It=o;It!==null;)a=It,u=a.child,a.tag===22&&a.memoizedState!==null?Drt(o):u!==null?(u.return=a,It=u):Drt(o);for(;i!==null;)It=i,Pot(i,e,r),i=i.sibling;It=o,ate=s,Lf=l}Nrt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,It=i):Nrt(t,e,r)}}function Nrt(t){for(;It!==null;){var e=It;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:Lf||Zte(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Lf)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:kb(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&grt(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}grt(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&&K8(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(We(163))}Lf||e.flags&512&&BOe(e)}catch(f){js(e,e.return,f)}}if(e===t){It=null;break}if(r=e.sibling,r!==null){r.return=e.return,It=r;break}It=e.return}}function jrt(t){for(;It!==null;){var e=It;if(e===t){It=null;break}var r=e.sibling;if(r!==null){r.return=e.return,It=r;break}It=e.return}}function Drt(t){for(;It!==null;){var e=It;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Zte(4,e)}catch(u){js(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){js(e,o,u)}}var i=e.return;try{BOe(e)}catch(u){js(e,i,u)}break;case 5:var a=e.return;try{BOe(e)}catch(u){js(e,a,u)}}}catch(u){js(e,e.return,u)}if(e===t){It=null;break}var s=e.sibling;if(s!==null){s.return=e.return,It=s;break}It=e.return}}var EIr=Math.ceil,Fte=kE.ReactCurrentDispatcher,EEe=kE.ReactCurrentOwner,iy=kE.ReactCurrentBatchConfig,ko=0,kc=null,xu=null,Pd=0,Dh=0,Cz=CI(0),uc=0,o5=null,Zj=0,Yte=0,PEe=0,B8=null,Mm=null,TEe=0,Fz=1/0,AE=null,kte=!1,qOe=null,bI=null,ste=!1,fI=null,$te=0,z8=0,HOe=null,hte=-1,gte=0;function jp(){return(ko&6)!==0?ru():hte!==-1?hte:hte=ru()}function _I(t){return(t.mode&1)===0?1:(ko&2)!==0&&Pd!==0?Pd&-Pd:lIr.transition!==null?(gte===0&&(gte=cnt()),gte):(t=Fi,t!==0||(t=window.event,t=t===void 0?16:ynt(t.type)),t)}function Ub(t,e,r,n){if(50<z8)throw z8=0,HOe=null,Error(We(185));i5(t,r,n),((ko&2)===0||t!==kc)&&(t===kc&&((ko&2)===0&&(Yte|=r),uc===4&&cI(t,Pd)),Dm(t,n),r===1&&ko===0&&(e.mode&1)===0&&(Fz=ru()+500,Kte&&OI()))}function Dm(t,e){var r=t.callbackNode;dAr(t,e);var n=xte(t,t===kc?Pd:0);if(n===0)r!==null&&qtt(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&qtt(r),e===1)t.tag===0?uIr(Lrt.bind(null,t)):Lnt(Lrt.bind(null,t)),oIr(function(){(ko&6)===0&&OI()}),r=null;else{switch(dnt(n)){case 1:r=eEe;break;case 4:r=unt;break;case 16:r=wte;break;case 536870912:r=lnt;break;default:r=wte}r=Dot(r,Tot.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function Tot(t,e){if(hte=-1,gte=0,(ko&6)!==0)throw Error(We(327));var r=t.callbackNode;if(Iz()&&t.callbackNode!==r)return null;var n=xte(t,t===kc?Pd:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=Bte(t,n);else{e=n;var o=ko;ko|=2;var i=Iot();(kc!==t||Pd!==e)&&(AE=null,Fz=ru()+500,Vj(t,e));do try{AIr();break}catch(s){Aot(t,s)}while(!0);pEe(),Fte.current=i,ko=o,xu!==null?e=0:(kc=null,Pd=0,e=uc)}if(e!==0){if(e===2&&(o=yOe(t),o!==0&&(n=o,e=VOe(t,o))),e===1)throw r=o5,Vj(t,0),cI(t,n),Dm(t,ru()),r;if(e===6)cI(t,n);else{if(o=t.current.alternate,(n&30)===0&&!PIr(o)&&(e=Bte(t,n),e===2&&(i=yOe(t),i!==0&&(n=i,e=VOe(t,i))),e===1))throw r=o5,Vj(t,0),cI(t,n),Dm(t,ru()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(We(345));case 2:zj(t,Mm,AE);break;case 3:if(cI(t,n),(n&130023424)===n&&(e=TEe+500-ru(),10<e)){if(xte(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){jp(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=OOe(zj.bind(null,t,Mm,AE),e);break}zj(t,Mm,AE);break;case 4:if(cI(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-zb(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=ru()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*EIr(n/1960))-n,10<n){t.timeoutHandle=OOe(zj.bind(null,t,Mm,AE),n);break}zj(t,Mm,AE);break;case 5:zj(t,Mm,AE);break;default:throw Error(We(329))}}}return Dm(t,ru()),t.callbackNode===r?Tot.bind(null,t):null}function VOe(t,e){var r=B8;return t.current.memoizedState.isDehydrated&&(Vj(t,e).flags|=256),t=Bte(t,e),t!==2&&(e=Mm,Mm=r,e!==null&&WOe(e)),t}function WOe(t){Mm===null?Mm=t:Mm.push.apply(Mm,t)}function PIr(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(!qb(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 cI(t,e){for(e&=~PEe,e&=~Yte,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-zb(e),n=1<<r;t[r]=-1,e&=~n}}function Lrt(t){if((ko&6)!==0)throw Error(We(327));Iz();var e=xte(t,0);if((e&1)===0)return Dm(t,ru()),null;var r=Bte(t,e);if(t.tag!==0&&r===2){var n=yOe(t);n!==0&&(e=n,r=VOe(t,n))}if(r===1)throw r=o5,Vj(t,0),cI(t,e),Dm(t,ru()),r;if(r===6)throw Error(We(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,zj(t,Mm,AE),Dm(t,ru()),null}function AEe(t,e){var r=ko;ko|=1;try{return t(e)}finally{ko=r,ko===0&&(Fz=ru()+500,Kte&&OI())}}function Yj(t){fI!==null&&fI.tag===0&&(ko&6)===0&&Iz();var e=ko;ko|=1;var r=iy.transition,n=Fi;try{if(iy.transition=null,Fi=1,t)return t()}finally{Fi=n,iy.transition=r,ko=e,(ko&6)===0&&OI()}}function IEe(){Dh=Cz.current,Sa(Cz)}function Vj(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,nIr(r)),xu!==null)for(r=xu.return;r!==null;){var n=r;switch(cEe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Pte();break;case 3:Dz(),Sa(Nm),Sa(Ff),_Ee();break;case 5:bEe(n);break;case 4:Dz();break;case 13:Sa(as);break;case 19:Sa(as);break;case 10:mEe(n.type._context);break;case 22:case 23:IEe()}r=r.return}if(kc=t,xu=t=vI(t.current,null),Pd=Dh=e,uc=0,o5=null,PEe=Yte=Zj=0,Mm=B8=null,qj!==null){for(e=0;e<qj.length;e++)if(r=qj[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}qj=null}return t}function Aot(t,e){do{var r=xu;try{if(pEe(),fte.current=Lte,Dte){for(var n=ss.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Dte=!1}if(Jj=0,Fc=sc=ss=null,k8=!1,t5=0,EEe.current=null,r===null||r.return===null){uc=1,o5=e,xu=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=Srt(a);if(p!==null){p.flags&=-257,Crt(p,a,s,i,e),p.mode&1&&xrt(i,l,e),e=p,u=l;var h=e.updateQueue;if(h===null){var m=new Set;m.add(u),e.updateQueue=m}else h.add(u);break e}else{if((e&1)===0){xrt(i,l,e),MEe();break e}u=Error(We(426))}}else if(Ba&&s.mode&1){var g=Srt(a);if(g!==null){(g.flags&65536)===0&&(g.flags|=256),Crt(g,a,s,i,e),dEe(Lz(u,s));break e}}i=u=Lz(u,s),uc!==4&&(uc=2),B8===null?B8=[i]:B8.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=fot(i,u,e);hrt(i,y);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"&&(bI===null||!bI.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=pot(i,s,e);hrt(i,S);break e}}i=i.return}while(i!==null)}Rot(r)}catch(C){e=C,xu===r&&r!==null&&(xu=r=r.return);continue}break}while(!0)}function Iot(){var t=Fte.current;return Fte.current=Lte,t===null?Lte:t}function MEe(){(uc===0||uc===3||uc===2)&&(uc=4),kc===null||(Zj&268435455)===0&&(Yte&268435455)===0||cI(kc,Pd)}function Bte(t,e){var r=ko;ko|=2;var n=Iot();(kc!==t||Pd!==e)&&(AE=null,Vj(t,e));do try{TIr();break}catch(o){Aot(t,o)}while(!0);if(pEe(),ko=r,Fte.current=n,xu!==null)throw Error(We(261));return kc=null,Pd=0,uc}function TIr(){for(;xu!==null;)Mot(xu)}function AIr(){for(;xu!==null&&!rAr();)Mot(xu)}function Mot(t){var e=jot(t.alternate,t,Dh);t.memoizedProps=t.pendingProps,e===null?Rot(t):xu=e,EEe.current=null}function Rot(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=wIr(r,e,Dh),r!==null){xu=r;return}}else{if(r=xIr(r,e),r!==null){r.flags&=32767,xu=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{uc=6,xu=null;return}}if(e=e.sibling,e!==null){xu=e;return}xu=e=t}while(e!==null);uc===0&&(uc=5)}function zj(t,e,r){var n=Fi,o=iy.transition;try{iy.transition=null,Fi=1,IIr(t,e,r,n)}finally{iy.transition=o,Fi=n}return null}function IIr(t,e,r,n){do Iz();while(fI!==null);if((ko&6)!==0)throw Error(We(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(We(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(fAr(t,i),t===kc&&(xu=kc=null,Pd=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||ste||(ste=!0,Dot(wte,function(){return Iz(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=iy.transition,iy.transition=null;var a=Fi;Fi=1;var s=ko;ko|=4,EEe.current=null,CIr(t,r),Eot(r,t),XAr(SOe),Ste=!!xOe,SOe=xOe=null,t.current=r,OIr(r,t,o),nAr(),ko=s,Fi=a,iy.transition=i}else t.current=r;if(ste&&(ste=!1,fI=t,$te=o),i=t.pendingLanes,i===0&&(bI=null),aAr(r.stateNode,n),Dm(t,ru()),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(kte)throw kte=!1,t=qOe,qOe=null,t;return($te&1)!==0&&t.tag!==0&&Iz(),i=t.pendingLanes,(i&1)!==0?t===HOe?z8++:(z8=0,HOe=t):z8=0,OI(),null}function Iz(){if(fI!==null){var t=dnt($te),e=iy.transition,r=Fi;try{if(iy.transition=null,Fi=16>t?16:t,fI===null)var n=!1;else{if(t=fI,fI=null,$te=0,(ko&6)!==0)throw Error(We(331));var o=ko;for(ko|=4,It=t.current;It!==null;){var i=It,a=i.child;if((It.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(It=l;It!==null;){var c=It;switch(c.tag){case 0:case 11:case 15:$8(8,c,i)}var d=c.child;if(d!==null)d.return=c,It=d;else for(;It!==null;){c=It;var f=c.sibling,p=c.return;if(Sot(c),c===l){It=null;break}if(f!==null){f.return=p,It=f;break}It=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(m!==null)}}It=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,It=a;else e:for(;It!==null;){if(i=It,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:$8(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,It=y;break e}It=i.return}}var _=t.current;for(It=_;It!==null;){a=It;var w=a.child;if((a.subtreeFlags&2064)!==0&&w!==null)w.return=a,It=w;else e:for(a=_;It!==null;){if(s=It,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:Zte(9,s)}}catch(C){js(s,s.return,C)}if(s===a){It=null;break e}var S=s.sibling;if(S!==null){S.return=s.return,It=S;break e}It=s.return}}if(ko=o,OI(),kv&&typeof kv.onPostCommitFiberRoot=="function")try{kv.onPostCommitFiberRoot(Ute,t)}catch{}n=!0}return n}finally{Fi=r,iy.transition=e}}return!1}function Frt(t,e,r){e=Lz(r,e),e=fot(t,e,1),t=yI(t,e,1),e=jp(),t!==null&&(i5(t,1,e),Dm(t,e))}function js(t,e,r){if(t.tag===3)Frt(t,t,r);else for(;e!==null;){if(e.tag===3){Frt(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(bI===null||!bI.has(n))){t=Lz(r,t),t=pot(e,t,1),e=yI(e,t,1),t=jp(),e!==null&&(i5(e,1,t),Dm(e,t));break}}e=e.return}}function MIr(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=jp(),t.pingedLanes|=t.suspendedLanes&r,kc===t&&(Pd&r)===r&&(uc===4||uc===3&&(Pd&130023424)===Pd&&500>ru()-TEe?Vj(t,0):PEe|=r),Dm(t,e)}function Not(t,e){e===0&&((t.mode&1)===0?e=1:(e=Kee,Kee<<=1,(Kee&130023424)===0&&(Kee=4194304)));var r=jp();t=LE(t,e),t!==null&&(i5(t,e,r),Dm(t,r))}function RIr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Not(t,r)}function NIr(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(We(314))}n!==null&&n.delete(e),Not(t,r)}var jot;jot=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Nm.current)Rm=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Rm=!1,vIr(t,e,r);Rm=(t.flags&131072)!==0}else Rm=!1,Ba&&(e.flags&1048576)!==0&&Fnt(e,Ite,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;mte(t,e),t=e.pendingProps;var o=Rz(e,Ff.current);Az(e,r),o=wEe(null,e,n,t,o,r);var i=xEe();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,jm(n)?(i=!0,Tte(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,gEe(e),o.updater=Gte,e.stateNode=o,o._reactInternals=e,ROe(e,n,t,r),e=DOe(null,e,n,!0,i,r)):(e.tag=0,Ba&&i&&lEe(e),Np(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(mte(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=DIr(n),t=kb(n,t),o){case 0:e=jOe(null,e,n,t,r);break e;case 1:e=Prt(null,e,n,t,r);break e;case 11:e=Ort(null,e,n,t,r);break e;case 14:e=Ert(null,e,n,kb(n.type,t),r);break e}throw Error(We(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:kb(n,o),jOe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:kb(n,o),Prt(t,e,n,o,r);case 3:e:{if(yot(e),t===null)throw Error(We(387));n=e.pendingProps,i=e.memoizedState,o=i.element,znt(t,e),Nte(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=Lz(Error(We(423)),e),e=Trt(t,e,n,r,o);break e}else if(n!==o){o=Lz(Error(We(424)),e),e=Trt(t,e,n,r,o);break e}else for(Lh=gI(e.stateNode.containerInfo.firstChild),Fh=e,Ba=!0,Bb=null,r=Vnt(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Nz(),n===o){e=FE(t,e,r);break e}Np(t,e,n,r)}e=e.child}return e;case 5:return Wnt(e),t===null&&AOe(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,COe(n,o)?a=null:i!==null&&COe(n,i)&&(e.flags|=32),got(t,e),Np(t,e,a,r),e.child;case 6:return t===null&&AOe(e),null;case 13:return bot(t,e,r);case 4:return yEe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=jz(e,null,n,r):Np(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:kb(n,o),Ort(t,e,n,o,r);case 7:return Np(t,e,e.pendingProps,r),e.child;case 8:return Np(t,e,e.pendingProps.children,r),e.child;case 12:return Np(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,ca(Mte,n._currentValue),n._currentValue=a,i!==null)if(qb(i.value,a)){if(i.children===o.children&&!Nm.current){e=FE(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=NE(-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),IOe(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(We(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),IOe(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}Np(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,Az(e,r),o=ay(o),n=n(o),e.flags|=1,Np(t,e,n,r),e.child;case 14:return n=e.type,o=kb(n,e.pendingProps),o=kb(n.type,o),Ert(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:kb(n,o),mte(t,e),e.tag=1,jm(n)?(t=!0,Tte(e)):t=!1,Az(e,r),qnt(e,n,o),ROe(e,n,o,r),DOe(null,e,n,!0,t,r);case 19:return _ot(t,e,r);case 22:return hot(t,e,r)}throw Error(We(156,e.tag))};function Dot(t,e){return snt(t,e)}function jIr(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 oy(t,e,r,n){return new jIr(t,e,r,n)}function REe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function DIr(t){if(typeof t=="function")return REe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===YOe)return 11;if(t===XOe)return 14}return 2}function vI(t,e){var r=t.alternate;return r===null?(r=oy(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 yte(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")REe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case mz:return Wj(r.children,o,i,e);case ZOe:a=8,o|=8;break;case rOe:return t=oy(12,r,e,o|2),t.elementType=rOe,t.lanes=i,t;case nOe:return t=oy(13,r,e,o),t.elementType=nOe,t.lanes=i,t;case oOe:return t=oy(19,r,e,o),t.elementType=oOe,t.lanes=i,t;case Hrt:return Xte(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Urt:a=10;break e;case qrt:a=9;break e;case YOe:a=11;break e;case XOe:a=14;break e;case sI:a=16,n=null;break e}throw Error(We(130,t==null?t:typeof t,""))}return e=oy(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function Wj(t,e,r,n){return t=oy(7,t,n,e),t.lanes=r,t}function Xte(t,e,r,n){return t=oy(22,t,n,e),t.elementType=Hrt,t.lanes=r,t.stateNode={isHidden:!1},t}function QCe(t,e,r){return t=oy(6,t,null,e),t.lanes=r,t}function eOe(t,e,r){return e=oy(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function LIr(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=FCe(0),this.expirationTimes=FCe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=FCe(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function NEe(t,e,r,n,o,i,a,s,u){return t=new LIr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=oy(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},gEe(i),t}function FIr(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pz,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Lot(t){if(!t)return xI;t=t._reactInternals;e:{if(Qj(t)!==t||t.tag!==1)throw Error(We(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(jm(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(We(171))}if(t.tag===1){var r=t.type;if(jm(r))return Dnt(t,r,e)}return e}function Fot(t,e,r,n,o,i,a,s,u){return t=NEe(r,n,!0,t,o,i,a,s,u),t.context=Lot(null),r=t.current,n=jp(),o=_I(r),i=NE(n,o),i.callback=e??null,yI(r,i,o),t.current.lanes=o,i5(t,o,n),Dm(t,n),t}function Qte(t,e,r,n){var o=e.current,i=jp(),a=_I(o);return r=Lot(r),e.context===null?e.context=r:e.pendingContext=r,e=NE(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=yI(o,e,a),t!==null&&(Ub(t,o,a,i),dte(t,o,a)),a}function zte(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 krt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function jEe(t,e){krt(t,e),(t=t.alternate)&&krt(t,e)}function kIr(){return null}var kot=typeof reportError=="function"?reportError:function(t){console.error(t)};function DEe(t){this._internalRoot=t}ere.prototype.render=DEe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(We(409));Qte(t,e,null,null)};ere.prototype.unmount=DEe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Yj(function(){Qte(null,t,null,null)}),e[DE]=null}};function ere(t){this._internalRoot=t}ere.prototype.unstable_scheduleHydration=function(t){if(t){var e=mnt();t={blockedOn:null,target:t,priority:e};for(var r=0;r<lI.length&&e!==0&&e<lI[r].priority;r++);lI.splice(r,0,t),r===0&&gnt(t)}};function LEe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function tre(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function $rt(){}function $Ir(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=zte(a);i.call(l)}}var a=Fot(e,n,t,0,null,!1,!1,"",$rt);return t._reactRootContainer=a,t[DE]=a.current,Z8(t.nodeType===8?t.parentNode:t),Yj(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=zte(u);s.call(l)}}var u=NEe(t,0,!1,null,null,!1,!1,"",$rt);return t._reactRootContainer=u,t[DE]=u.current,Z8(t.nodeType===8?t.parentNode:t),Yj(function(){Qte(e,u,r,n)}),u}function rre(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=zte(a);s.call(u)}}Qte(e,a,t,o)}else a=$Ir(r,e,t,o,n);return zte(a)}fnt=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=M8(e.pendingLanes);r!==0&&(tEe(e,r|1),Dm(e,ru()),(ko&6)===0&&(Fz=ru()+500,OI()))}break;case 13:Yj(function(){var n=LE(t,1);if(n!==null){var o=jp();Ub(n,t,1,o)}}),jEe(t,1)}};rEe=function(t){if(t.tag===13){var e=LE(t,134217728);if(e!==null){var r=jp();Ub(e,t,134217728,r)}jEe(t,134217728)}};pnt=function(t){if(t.tag===13){var e=_I(t),r=LE(t,e);if(r!==null){var n=jp();Ub(r,t,e,n)}jEe(t,e)}};mnt=function(){return Fi};hnt=function(t,e){var r=Fi;try{return Fi=t,e()}finally{Fi=r}};mOe=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=Wte(n);if(!o)throw Error(We(90));Wrt(n),sOe(n,o)}}}break;case"textarea":Grt(t,r);break;case"select":e=r.value,e!=null&&Oz(t,!!r.multiple,e,!1)}};tnt=AEe;rnt=Yj;var BIr={usingClientEntryPoint:!1,Events:[s5,bz,Wte,Qrt,ent,AEe]},P8={findFiberByHostInstance:Uj,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},zIr={bundleType:P8.bundleType,version:P8.version,rendererPackageName:P8.rendererPackageName,rendererConfig:P8.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:kE.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=int(t),t===null?null:t.stateNode},findFiberByHostInstance:P8.findFiberByHostInstance||kIr,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(T8=__REACT_DEVTOOLS_GLOBAL_HOOK__,!T8.isDisabled&&T8.supportsFiber))try{Ute=T8.inject(zIr),kv=T8}catch{}var T8;Bh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=BIr;Bh.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!LEe(e))throw Error(We(200));return FIr(t,e,null,r)};Bh.createRoot=function(t,e){if(!LEe(t))throw Error(We(299));var r=!1,n="",o=kot;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=NEe(t,1,!1,null,null,r,!1,n,o),t[DE]=e.current,Z8(t.nodeType===8?t.parentNode:t),new DEe(e)};Bh.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(We(188)):(t=Object.keys(t).join(","),Error(We(268,t)));return t=int(e),t=t===null?null:t.stateNode,t};Bh.flushSync=function(t){return Yj(t)};Bh.hydrate=function(t,e,r){if(!tre(e))throw Error(We(200));return rre(null,t,e,!0,r)};Bh.hydrateRoot=function(t,e,r){if(!LEe(t))throw Error(We(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=kot;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=Fot(e,null,t,1,r??null,o,!1,i,a),t[DE]=e.current,Z8(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 ere(e)};Bh.render=function(t,e,r){if(!tre(e))throw Error(We(200));return rre(null,t,e,!1,r)};Bh.unmountComponentAtNode=function(t){if(!tre(t))throw Error(We(40));return t._reactRootContainer?(Yj(function(){rre(null,null,t,!1,function(){t._reactRootContainer=null,t[DE]=null})}),!0):!1};Bh.unstable_batchedUpdates=AEe;Bh.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!tre(r))throw Error(We(200));if(t==null||t._reactInternals===void 0)throw Error(We(38));return rre(t,e,r,!1,n)};Bh.version="18.2.0-next-9e3b772b8-20220608"});var za=x((Rso,zot)=>{"use strict";function Bot(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Bot)}catch(t){console.error(t)}}Bot(),zot.exports=$ot()});var $c=x(FEe=>{"use strict";var Uot=za();FEe.createRoot=Uot.createRoot,FEe.hydrateRoot=Uot.hydrateRoot;var Nso});function qot(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Hot(...t){return e=>{let r=!1,n=t.map(o=>{let i=qot(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():qot(t[o],null)}}}}var UIr,Vot=b(()=>{UIr=j(Y(),1)});var Kot=x(nre=>{"use strict";var qIr=Y(),HIr=Symbol.for("react.element"),VIr=Symbol.for("react.fragment"),WIr=Object.prototype.hasOwnProperty,KIr=qIr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,GIr={key:!0,ref:!0,__self:!0,__source:!0};function Wot(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)WIr.call(e,n)&&!GIr.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:HIr,type:t,key:i,ref:a,props:o,_owner:KIr.current}}nre.Fragment=VIr;nre.jsx=Wot;nre.jsxs=Wot});var st=x((Fso,Got)=>{"use strict";Got.exports=Kot()});function kf(t){let e=JIr(t),r=lc.forwardRef((n,o)=>{let{children:i,...a}=n,s=lc.Children.toArray(i),u=s.find(ZIr);if(u){let l=u.props.children,c=s.map(d=>d===u?lc.Children.count(l)>1?lc.Children.only(null):lc.isValidElement(l)?l.props.children:null:d);return(0,Bz.jsx)(e,{...a,ref:o,children:lc.isValidElement(l)?lc.cloneElement(l,void 0,c):null})}return(0,Bz.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function JIr(t){let e=lc.forwardRef((r,n)=>{let{children:o,...i}=r;if(lc.isValidElement(o)){let a=XIr(o),s=YIr(i,o.props);return o.type!==lc.Fragment&&(s.ref=n?Hot(n,a):a),lc.cloneElement(o,s)}return lc.Children.count(o)>1?lc.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function Yot(t){let e=({children:r})=>(0,Bz.jsx)(Bz.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Zot,e}function ZIr(t){return lc.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Zot}function YIr(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 XIr(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 lc,Bz,Jot,Zot,Bv=b(()=>{lc=j(Y(),1);Vot();Bz=j(st(),1);Jot=kf("Slot");Zot=Symbol("radix.slottable")});function Xot(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=Xot(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function ore(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=Xot(t))&&(n&&(n+=" "),n+=e);return n}var kEe=b(()=>{});var Qot,eit,zz,ire=b(()=>{kEe();Qot=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eit=ore,zz=(t,e)=>r=>{var n;if(e?.variants==null)return eit(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=Qot(c)||Qot(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(h=>{let[m,g]=h;return Array.isArray(g)?g.includes({...i,...s}[m]):{...i,...s}[m]===g})?[...l,d,f]:l},[]);return eit(t,a,u,r?.class,r?.className)}});function cMr(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=sit(e))&&(n&&(n+=" "),n+=r);return n}function nit(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=sMr(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=lMr(u,r);return o(u,c),c}return function(){return i(cMr.apply(null,arguments))}}var zEe,QIr,iit,tit,eMr,tMr,BEe,rit,rMr,nMr,oMr,ait,iMr,aMr,sMr,uMr,lMr,sit,Ca,uit,dMr,fMr,pMr,mMr,hMr,gMr,yMr,$E,EI,Uz,$Ee,l5,bMr,wn,PI,_Mr,vMr,wMr,xMr,SMr,CMr,c5,qz,OMr,lit,EMr,PMr,oit,TMr,d5,AMr,IMr,cit,dit=b(()=>{zEe="-",QIr=t=>{let e=tMr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(zEe);return s[0]===""&&s.length!==1&&s.shift(),iit(s,e)||eMr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},iit=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?iit(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(zEe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},tit=/^\[(.+)\]$/,eMr=t=>{if(tit.test(t)){let e=tit.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},tMr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return nMr(Object.entries(t.classGroups),r).forEach(([i,a])=>{BEe(a,n,i,e)}),n},BEe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:rit(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(rMr(o)){BEe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{BEe(a,rit(e,i),r,n)})})},rit=(t,e)=>{let r=t;return e.split(zEe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},rMr=t=>t.isThemeGetter,nMr=(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,oMr=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)}}},ait="!",iMr=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 g=0;g<s.length;g++){let y=s[g];if(l===0){if(y===o&&(n||s.slice(g,g+i)===e)){u.push(s.slice(c,g)),c=g+i;continue}if(y==="/"){d=g;continue}}y==="["?l++:y==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(ait),h=p?f.substring(1):f,m=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:m}};return r?s=>r({className:s,parseClassName:a}):a},aMr=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},sMr=t=>({cache:oMr(t.cacheSize),parseClassName:iMr(t),...QIr(t)}),uMr=/\s+/,lMr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(uMr),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),h=!!p,m=n(h?f.substring(0,p):f);if(!m){if(!h){s=l+(s.length>0?" "+s:s);continue}if(m=n(f),!m){s=l+(s.length>0?" "+s:s);continue}h=!1}let g=aMr(c).join(":"),y=d?g+ait:g,_=y+m;if(i.includes(_))continue;i.push(_);let w=o(m,h);for(let S=0;S<w.length;++S){let C=w[S];i.push(y+C)}s=l+(s.length>0?" "+s:s)}return s};sit=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=sit(t[n]))&&(r&&(r+=" "),r+=e);return r};Ca=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},uit=/^\[(?:([a-z-]+):)?(.+)\]$/i,dMr=/^\d+\/\d+$/,fMr=new Set(["px","full","screen"]),pMr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mMr=/\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$/,hMr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,gMr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yMr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$E=t=>Uz(t)||fMr.has(t)||dMr.test(t),EI=t=>qz(t,"length",OMr),Uz=t=>!!t&&!Number.isNaN(Number(t)),$Ee=t=>qz(t,"number",Uz),l5=t=>!!t&&Number.isInteger(Number(t)),bMr=t=>t.endsWith("%")&&Uz(t.slice(0,-1)),wn=t=>uit.test(t),PI=t=>pMr.test(t),_Mr=new Set(["length","size","percentage"]),vMr=t=>qz(t,_Mr,lit),wMr=t=>qz(t,"position",lit),xMr=new Set(["image","url"]),SMr=t=>qz(t,xMr,PMr),CMr=t=>qz(t,"",EMr),c5=()=>!0,qz=(t,e,r)=>{let n=uit.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},OMr=t=>mMr.test(t)&&!hMr.test(t),lit=()=>!1,EMr=t=>gMr.test(t),PMr=t=>yMr.test(t),oit=()=>{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"),h=Ca("gradientColorStopPositions"),m=Ca("inset"),g=Ca("margin"),y=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",wn,e],D=()=>[wn,e],k=()=>["",$E,EI],F=()=>["auto",Uz,wn],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",wn],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[Uz,wn];return{cacheSize:500,separator:":",theme:{colors:[c5],spacing:[$E,EI],blur:["none","",PI,wn],brightness:z(),borderColor:[t],borderRadius:["none","","full",PI,wn],borderSpacing:D(),borderWidth:k(),contrast:z(),grayscale:L(),hueRotate:z(),invert:L(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[bMr,EI],inset:M(),margin:M(),opacity:z(),padding:D(),saturate:z(),scale:z(),sepia:L(),skew:z(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",wn]}],container:["container"],columns:[{columns:[PI]}],"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:[...K(),wn]}],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:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",l5,wn]}],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",wn]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",l5,wn]}],"grid-cols":[{"grid-cols":[c5]}],"col-start-end":[{col:["auto",{span:["full",l5,wn]},wn]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[c5]}],"row-start-end":[{row:["auto",{span:[l5,wn]},wn]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",wn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",wn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ee()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ee(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ee(),"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:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"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",wn,e]}],"min-w":[{"min-w":[wn,e,"min","max","fit"]}],"max-w":[{"max-w":[wn,e,"none","full","min","max","fit","prose",{screen:[PI]},PI]}],h:[{h:[wn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[wn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[wn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[wn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",PI,EI]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$Ee]}],"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",wn]}],"line-clamp":[{"line-clamp":["none",Uz,$Ee]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",$E,wn]}],"list-image":[{"list-image":["none",wn]}],"list-style-type":[{list:["none","disc","decimal",wn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",$E,EI]}],"underline-offset":[{"underline-offset":["auto",$E,wn]}],"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",wn]}],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",wn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...K(),wMr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",vMr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},SMr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"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":[y]}],"border-style":[{border:[...U(),"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":[y]}],"divide-style":[{divide:U()}],"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:["",...U()]}],"outline-offset":[{"outline-offset":[$E,wn]}],"outline-w":[{outline:[$E,EI]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[$E,EI]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",PI,CMr]}],"shadow-color":[{shadow:[c5]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",PI,wn]}],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":[y]}],"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",wn]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",wn]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",wn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[l5,wn]}],"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",wn]}],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",wn]}],"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",wn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[$E,EI,$Ee]}],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"]}}},TMr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{d5(t,"cacheSize",e),d5(t,"prefix",r),d5(t,"separator",n),d5(t,"experimentalParseClassName",o);for(let s in a)AMr(t[s],a[s]);for(let s in i)IMr(t[s],i[s]);return t},d5=(t,e,r)=>{r!==void 0&&(t[e]=r)},AMr=(t,e)=>{if(e)for(let r in e)d5(t,r,e[r])},IMr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},cit=(t,...e)=>typeof t=="function"?nit(oit,t,...e):nit(()=>TMr(oit(),t),...e)});function me(...t){return MMr(ore(t))}var MMr,xn=b(()=>{kEe();dit();MMr=cit({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 are,RMr,he,po=b(()=>{are=j(Y());Bv();ire();xn();RMr=zz("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"}}),he=are.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>are.createElement(n?Jot:"button",{className:me(RMr({variant:e,size:r,className:t})),ref:i,...o}));he.displayName="Button"});var fit,sre,UEe=b(()=>{fit=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sre=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var pit,mit=b(()=>{pit={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 f5,hit,git=b(()=>{f5=j(Y());mit();UEe();hit=(0,f5.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,f5.createElement)("svg",{ref:u,...pit,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:sre("lucide",o),...s},[...a.map(([l,c])=>(0,f5.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var ure,ge,vt=b(()=>{ure=j(Y());UEe();git();ge=(t,e)=>{let r=(0,ure.forwardRef)(({className:n,...o},i)=>(0,ure.createElement)(hit,{ref:i,iconNode:e,className:sre(`lucide-${fit(t)}`,n),...o}));return r.displayName=`${t}`,r}});var Hz,yit=b(()=>{vt();Hz=ge("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var p5,bit=b(()=>{vt();p5=ge("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var eD,_it=b(()=>{vt();eD=ge("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 Vz,vit=b(()=>{vt();Vz=ge("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 ls,wit=b(()=>{vt();ls=ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var ki,xit=b(()=>{vt();ki=ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var Lm,Sit=b(()=>{vt();Lm=ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var Hb,Cit=b(()=>{vt();Hb=ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var zv,Oit=b(()=>{vt();zv=ge("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 TI,Eit=b(()=>{vt();TI=ge("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 m5,Pit=b(()=>{vt();m5=ge("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 $i,Tit=b(()=>{vt();$i=ge("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 zh,Ait=b(()=>{vt();zh=ge("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var AI,Iit=b(()=>{vt();AI=ge("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var II,Mit=b(()=>{vt();II=ge("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 h5,Rit=b(()=>{vt();h5=ge("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var g5,Nit=b(()=>{vt();g5=ge("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 MI,jit=b(()=>{vt();MI=ge("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 Uh,Dit=b(()=>{vt();Uh=ge("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 Vb,Lit=b(()=>{vt();Vb=ge("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var y5,Fit=b(()=>{vt();y5=ge("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 BE,kit=b(()=>{vt();BE=ge("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 b5,$it=b(()=>{vt();b5=ge("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 zE,Bit=b(()=>{vt();zE=ge("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 RI,zit=b(()=>{vt();RI=ge("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 tD,Uit=b(()=>{vt();tD=ge("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 _5,qit=b(()=>{vt();_5=ge("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 UE,Hit=b(()=>{vt();UE=ge("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 v5,Vit=b(()=>{vt();v5=ge("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 w5,Wit=b(()=>{vt();w5=ge("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 x5,Kit=b(()=>{vt();x5=ge("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 S5,Git=b(()=>{vt();S5=ge("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 Fm,Jit=b(()=>{vt();Fm=ge("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 C5,Zit=b(()=>{vt();C5=ge("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 O5,Yit=b(()=>{vt();O5=ge("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 uy,Xit=b(()=>{vt();uy=ge("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 Wb,Qit=b(()=>{vt();Wb=ge("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 Uv,eat=b(()=>{vt();Uv=ge("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 E5,tat=b(()=>{vt();E5=ge("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 P5,rat=b(()=>{vt();P5=ge("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 qv,nat=b(()=>{vt();qv=ge("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])});var T5,oat=b(()=>{vt();T5=ge("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 rD,iat=b(()=>{vt();rD=ge("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 qE,aat=b(()=>{vt();qE=ge("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 nu,sat=b(()=>{vt();nu=ge("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var A5,uat=b(()=>{vt();A5=ge("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 Wz,lat=b(()=>{vt();Wz=ge("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 Hv,cat=b(()=>{vt();Hv=ge("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 qh,dat=b(()=>{vt();qh=ge("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 Kz,fat=b(()=>{vt();Kz=ge("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 Gz,pat=b(()=>{vt();Gz=ge("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 Hh,mat=b(()=>{vt();Hh=ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var I5,hat=b(()=>{vt();I5=ge("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 Vv,gat=b(()=>{vt();Vv=ge("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 M5,yat=b(()=>{vt();M5=ge("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 R5,bat=b(()=>{vt();R5=ge("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 nD,_at=b(()=>{vt();nD=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var $f,vat=b(()=>{vt();$f=ge("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 HE,wat=b(()=>{vt();HE=ge("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 km,xat=b(()=>{vt();km=ge("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 NI,Sat=b(()=>{vt();NI=ge("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 N5,Cat=b(()=>{vt();N5=ge("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 Vh,Oat=b(()=>{vt();Vh=ge("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 Lp,Eat=b(()=>{vt();Lp=ge("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 j5,Pat=b(()=>{vt();j5=ge("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])});var VE,Tat=b(()=>{vt();VE=ge("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 vi,Aat=b(()=>{vt();vi=ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var D5,Iat=b(()=>{vt();D5=ge("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 L5,Mat=b(()=>{vt();L5=ge("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 un=b(()=>{Oit();Eit();Tit();Ait();Iit();Mit();Bit();zit();sat();cat();dat();vat();wat();xat();Eat();yit();bit();_it();vit();wit();xit();Sit();Cit();Pit();Rit();Nit();jit();Dit();Lit();Fit();kit();$it();Uit();qit();Hit();Vit();Wit();Kit();Git();Jit();Zit();Yit();Xit();Qit();eat();tat();rat();nat();oat();iat();aat();uat();lat();fat();pat();mat();hat();gat();yat();bat();_at();Sat();Cat();Oat();Pat();Tat();Aat();Iat();Mat();});function NMr({onCancel:t}){let e=oe(),r=qEe(e.defaultModelKey)&&qEe(e.embeddingModelKey);return Wv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Wv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Wv.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&Wv.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.")),Wv.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Wv.default.createElement(he,{variant:"ghost",onClick:t},"Close"),Wv.default.createElement(he,{variant:"default",onClick:()=>{oD(EE.EXPIRED_MODAL)}},"Renew Now ",Wv.default.createElement(tD,{className:"tw-size-4"}))))}var Wv,Rat,Nat,lre,jat=b(()=>{Wv=j(Y()),Rat=require("obsidian"),Nat=j($c());po();ly();or();un();bt();lre=class extends Rat.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,Nat.createRoot)(e);let r=()=>{this.close()};this.root.render(Wv.default.createElement(NMr,{onCancel:r}))}onClose(){this.root.unmount()}}});var Dat=x(cre=>{"use strict";Object.defineProperty(cre,"__esModule",{value:!0});cre.V2ChatStreamRequestCitationMode=void 0;cre.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var Lat=x(dre=>{"use strict";Object.defineProperty(dre,"__esModule",{value:!0});dre.V2ChatRequestCitationMode=void 0;dre.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var kat=x(Fat=>{"use strict";Object.defineProperty(Fat,"__esModule",{value:!0})});var Bat=x($at=>{"use strict";Object.defineProperty($at,"__esModule",{value:!0})});var Uat=x(zat=>{"use strict";Object.defineProperty(zat,"__esModule",{value:!0})});var Hat=x(qat=>{"use strict";Object.defineProperty(qat,"__esModule",{value:!0})});var Wat=x(Vat=>{"use strict";Object.defineProperty(Vat,"__esModule",{value:!0})});var Gat=x(Kat=>{"use strict";Object.defineProperty(Kat,"__esModule",{value:!0})});var Zat=x(Jat=>{"use strict";Object.defineProperty(Jat,"__esModule",{value:!0})});var Xat=x(Yat=>{"use strict";Object.defineProperty(Yat,"__esModule",{value:!0})});var est=x(Qat=>{"use strict";Object.defineProperty(Qat,"__esModule",{value:!0})});var rst=x(tst=>{"use strict";Object.defineProperty(tst,"__esModule",{value:!0})});var ost=x(nst=>{"use strict";Object.defineProperty(nst,"__esModule",{value:!0})});var ast=x(ist=>{"use strict";Object.defineProperty(ist,"__esModule",{value:!0})});var ust=x(sst=>{"use strict";Object.defineProperty(sst,"__esModule",{value:!0})});var cst=x(lst=>{"use strict";Object.defineProperty(lst,"__esModule",{value:!0})});var fst=x(dst=>{"use strict";Object.defineProperty(dst,"__esModule",{value:!0})});var mst=x(pst=>{"use strict";Object.defineProperty(pst,"__esModule",{value:!0})});var gst=x(hst=>{"use strict";Object.defineProperty(hst,"__esModule",{value:!0})});var bst=x(yst=>{"use strict";Object.defineProperty(yst,"__esModule",{value:!0})});var vst=x(_st=>{"use strict";Object.defineProperty(_st,"__esModule",{value:!0})});var xst=x(wst=>{"use strict";Object.defineProperty(wst,"__esModule",{value:!0})});var Cst=x(Sst=>{"use strict";Object.defineProperty(Sst,"__esModule",{value:!0})});var Est=x(Ost=>{"use strict";Object.defineProperty(Ost,"__esModule",{value:!0})});var Tst=x(Pst=>{"use strict";Object.defineProperty(Pst,"__esModule",{value:!0})});var Ast=x(fre=>{"use strict";Object.defineProperty(fre,"__esModule",{value:!0});fre.ChatFinishReason=void 0;fre.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});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 Vst=x(Hst=>{"use strict";Object.defineProperty(Hst,"__esModule",{value:!0})});var Kst=x(Wst=>{"use strict";Object.defineProperty(Wst,"__esModule",{value:!0})});var Jst=x(Gst=>{"use strict";Object.defineProperty(Gst,"__esModule",{value:!0})});var Yst=x(Zst=>{"use strict";Object.defineProperty(Zst,"__esModule",{value:!0})});var Qst=x(Xst=>{"use strict";Object.defineProperty(Xst,"__esModule",{value:!0})});var tut=x(eut=>{"use strict";Object.defineProperty(eut,"__esModule",{value:!0})});var nut=x(rut=>{"use strict";Object.defineProperty(rut,"__esModule",{value:!0})});var iut=x(out=>{"use strict";Object.defineProperty(out,"__esModule",{value:!0})});var sut=x(aut=>{"use strict";Object.defineProperty(aut,"__esModule",{value:!0})});var lut=x(uut=>{"use strict";Object.defineProperty(uut,"__esModule",{value:!0})});var dut=x(cut=>{"use strict";Object.defineProperty(cut,"__esModule",{value:!0})});var put=x(fut=>{"use strict";Object.defineProperty(fut,"__esModule",{value:!0})});var hut=x(mut=>{"use strict";Object.defineProperty(mut,"__esModule",{value:!0})});var yut=x(gut=>{"use strict";Object.defineProperty(gut,"__esModule",{value:!0})});var _ut=x(but=>{"use strict";Object.defineProperty(but,"__esModule",{value:!0})});var wut=x(vut=>{"use strict";Object.defineProperty(vut,"__esModule",{value:!0})});var Sut=x(xut=>{"use strict";Object.defineProperty(xut,"__esModule",{value:!0})});var Out=x(Cut=>{"use strict";Object.defineProperty(Cut,"__esModule",{value:!0})});var Put=x(Eut=>{"use strict";Object.defineProperty(Eut,"__esModule",{value:!0})});var Aut=x(Tut=>{"use strict";Object.defineProperty(Tut,"__esModule",{value:!0})});var Mut=x(Iut=>{"use strict";Object.defineProperty(Iut,"__esModule",{value:!0})});var Nut=x(Rut=>{"use strict";Object.defineProperty(Rut,"__esModule",{value:!0})});var Dut=x(jut=>{"use strict";Object.defineProperty(jut,"__esModule",{value:!0})});var Fut=x(Lut=>{"use strict";Object.defineProperty(Lut,"__esModule",{value:!0})});var $ut=x(kut=>{"use strict";Object.defineProperty(kut,"__esModule",{value:!0})});var zut=x(But=>{"use strict";Object.defineProperty(But,"__esModule",{value:!0})});var HEe=x(jt=>{"use strict";var jMr=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]}),Zt=jt&&jt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jMr(e,t,r)};Object.defineProperty(jt,"__esModule",{value:!0});Zt(Dat(),jt);Zt(Lat(),jt);Zt(kat(),jt);Zt(Bat(),jt);Zt(Uat(),jt);Zt(Hat(),jt);Zt(Wat(),jt);Zt(Gat(),jt);Zt(Zat(),jt);Zt(Xat(),jt);Zt(est(),jt);Zt(rst(),jt);Zt(ost(),jt);Zt(ast(),jt);Zt(ust(),jt);Zt(cst(),jt);Zt(fst(),jt);Zt(mst(),jt);Zt(gst(),jt);Zt(bst(),jt);Zt(vst(),jt);Zt(xst(),jt);Zt(Cst(),jt);Zt(Est(),jt);Zt(Tst(),jt);Zt(Ast(),jt);Zt(Mst(),jt);Zt(Nst(),jt);Zt(Dst(),jt);Zt(Fst(),jt);Zt($st(),jt);Zt(zst(),jt);Zt(qst(),jt);Zt(Vst(),jt);Zt(Kst(),jt);Zt(Jst(),jt);Zt(Yst(),jt);Zt(Qst(),jt);Zt(tut(),jt);Zt(nut(),jt);Zt(iut(),jt);Zt(sut(),jt);Zt(lut(),jt);Zt(dut(),jt);Zt(put(),jt);Zt(hut(),jt);Zt(yut(),jt);Zt(_ut(),jt);Zt(wut(),jt);Zt(Sut(),jt);Zt(Out(),jt);Zt(Put(),jt);Zt(Aut(),jt);Zt(Mut(),jt);Zt(Nut(),jt);Zt(Dut(),jt);Zt(Fut(),jt);Zt($ut(),jt);Zt(zut(),jt)});var VEe=x(Uut=>{"use strict";Object.defineProperty(Uut,"__esModule",{value:!0})});var qut=x(iD=>{"use strict";var DMr=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]}),LMr=iD&&iD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DMr(e,t,r)};Object.defineProperty(iD,"__esModule",{value:!0});LMr(VEe(),iD)});var Vut=x(jI=>{"use strict";var FMr=jI&&jI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hut=jI&&jI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&FMr(e,t,r)};Object.defineProperty(jI,"__esModule",{value:!0});Hut(HEe(),jI);Hut(qut(),jI)});var Wut=x(pre=>{"use strict";Object.defineProperty(pre,"__esModule",{value:!0});pre.CreateEmbedJobRequestTruncate=void 0;pre.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var WEe=x(aD=>{"use strict";var kMr=aD&&aD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Mr=aD&&aD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kMr(e,t,r)};Object.defineProperty(aD,"__esModule",{value:!0});$Mr(Wut(),aD)});var KEe=x(Kut=>{"use strict";Object.defineProperty(Kut,"__esModule",{value:!0})});var Gut=x(sD=>{"use strict";var BMr=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]}),zMr=sD&&sD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BMr(e,t,r)};Object.defineProperty(sD,"__esModule",{value:!0});zMr(KEe(),sD)});var Zut=x(DI=>{"use strict";var UMr=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]}),Jut=DI&&DI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UMr(e,t,r)};Object.defineProperty(DI,"__esModule",{value:!0});Jut(WEe(),DI);Jut(Gut(),DI)});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 olt=x(nlt=>{"use strict";Object.defineProperty(nlt,"__esModule",{value:!0})});var alt=x(ilt=>{"use strict";Object.defineProperty(ilt,"__esModule",{value:!0})});var GEe=x(Kb=>{"use strict";var qMr=Kb&&Kb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F5=Kb&&Kb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qMr(e,t,r)};Object.defineProperty(Kb,"__esModule",{value:!0});F5(Xut(),Kb);F5(elt(),Kb);F5(rlt(),Kb);F5(olt(),Kb);F5(alt(),Kb)});var JEe=x(slt=>{"use strict";Object.defineProperty(slt,"__esModule",{value:!0})});var ult=x(uD=>{"use strict";var HMr=uD&&uD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VMr=uD&&uD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&HMr(e,t,r)};Object.defineProperty(uD,"__esModule",{value:!0});VMr(JEe(),uD)});var clt=x(LI=>{"use strict";var WMr=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]}),llt=LI&&LI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&WMr(e,t,r)};Object.defineProperty(LI,"__esModule",{value:!0});llt(GEe(),LI);llt(ult(),LI)});var dlt=x(mre=>{"use strict";Object.defineProperty(mre,"__esModule",{value:!0});mre.BaseType=void 0;mre.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var flt=x(hre=>{"use strict";Object.defineProperty(hre,"__esModule",{value:!0});hre.Strategy=void 0;hre.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var mlt=x(plt=>{"use strict";Object.defineProperty(plt,"__esModule",{value:!0})});var glt=x(hlt=>{"use strict";Object.defineProperty(hlt,"__esModule",{value:!0})});var blt=x(ylt=>{"use strict";Object.defineProperty(ylt,"__esModule",{value:!0})});var vlt=x(_lt=>{"use strict";Object.defineProperty(_lt,"__esModule",{value:!0})});var wlt=x(gre=>{"use strict";Object.defineProperty(gre,"__esModule",{value:!0});gre.Status=void 0;gre.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 Slt=x(xlt=>{"use strict";Object.defineProperty(xlt,"__esModule",{value:!0})});var Olt=x(Clt=>{"use strict";Object.defineProperty(Clt,"__esModule",{value:!0})});var Plt=x(Elt=>{"use strict";Object.defineProperty(Elt,"__esModule",{value:!0})});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 Flt=x(Llt=>{"use strict";Object.defineProperty(Llt,"__esModule",{value:!0})});var $lt=x(klt=>{"use strict";Object.defineProperty(klt,"__esModule",{value:!0})});var zlt=x(Blt=>{"use strict";Object.defineProperty(Blt,"__esModule",{value:!0})});var ZEe=x(cs=>{"use strict";var KMr=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]}),Ad=cs&&cs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KMr(e,t,r)};Object.defineProperty(cs,"__esModule",{value:!0});Ad(dlt(),cs);Ad(flt(),cs);Ad(mlt(),cs);Ad(glt(),cs);Ad(blt(),cs);Ad(vlt(),cs);Ad(wlt(),cs);Ad(Slt(),cs);Ad(Olt(),cs);Ad(Plt(),cs);Ad(Alt(),cs);Ad(Mlt(),cs);Ad(Nlt(),cs);Ad(Dlt(),cs);Ad(Flt(),cs);Ad($lt(),cs);Ad(zlt(),cs)});var Ult=x(lD=>{"use strict";var GMr=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]}),JMr=lD&&lD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GMr(e,t,r)};Object.defineProperty(lD,"__esModule",{value:!0});JMr(ZEe(),lD)});var Hlt=x(Wh=>{"use strict";var qlt=Wh&&Wh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZMr=Wh&&Wh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YMr=Wh&&Wh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qlt(e,t,r);return ZMr(e,t),e},XMr=Wh&&Wh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qlt(e,t,r)};Object.defineProperty(Wh,"__esModule",{value:!0});Wh.finetuning=void 0;Wh.finetuning=YMr(Ult());XMr(ZEe(),Wh)});var YEe=x(Vlt=>{"use strict";Object.defineProperty(Vlt,"__esModule",{value:!0})});var Wlt=x(cD=>{"use strict";var QMr=cD&&cD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=cD&&cD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QMr(e,t,r)};Object.defineProperty(cD,"__esModule",{value:!0});eRr(YEe(),cD)});var Glt=x(FI=>{"use strict";var tRr=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]}),Klt=FI&&FI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tRr(e,t,r)};Object.defineProperty(FI,"__esModule",{value:!0});Klt(Hlt(),FI);Klt(Wlt(),FI)});var XEe=x(Jlt=>{"use strict";Object.defineProperty(Jlt,"__esModule",{value:!0})});var Zlt=x(dD=>{"use strict";var rRr=dD&&dD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=dD&&dD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rRr(e,t,r)};Object.defineProperty(dD,"__esModule",{value:!0});nRr(XEe(),dD)});var Ylt=x(fD=>{"use strict";var oRr=fD&&fD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iRr=fD&&fD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oRr(e,t,r)};Object.defineProperty(fD,"__esModule",{value:!0});iRr(Zlt(),fD)});var QEe=x(Xlt=>{"use strict";Object.defineProperty(Xlt,"__esModule",{value:!0})});var Qlt=x(pD=>{"use strict";var aRr=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]}),sRr=pD&&pD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aRr(e,t,r)};Object.defineProperty(pD,"__esModule",{value:!0});sRr(QEe(),pD)});var ect=x(mD=>{"use strict";var uRr=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]}),lRr=mD&&mD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uRr(e,t,r)};Object.defineProperty(mD,"__esModule",{value:!0});lRr(Qlt(),mD)});var rct=x(wi=>{"use strict";var tct=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]}),cRr=wi&&wi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jz=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)&&tct(e,t,r);return cRr(e,t),e},WE=wi&&wi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tct(e,t,r)};Object.defineProperty(wi,"__esModule",{value:!0});wi.models=wi.connectors=wi.finetuning=wi.datasets=wi.embedJobs=wi.v2=void 0;wi.v2=Jz(Vut());WE(HEe(),wi);wi.embedJobs=Jz(Zut());WE(WEe(),wi);wi.datasets=Jz(clt());WE(GEe(),wi);wi.finetuning=Jz(Glt());wi.connectors=Jz(Ylt());wi.models=Jz(ect());WE(VEe(),wi);WE(KEe(),wi);WE(JEe(),wi);WE(XEe(),wi);WE(QEe(),wi);WE(YEe(),wi)});var nct=x(yre=>{"use strict";Object.defineProperty(yre,"__esModule",{value:!0});yre.ChatStreamRequestPromptTruncation=void 0;yre.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var oct=x(bre=>{"use strict";Object.defineProperty(bre,"__esModule",{value:!0});bre.ChatStreamRequestCitationQuality=void 0;bre.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var act=x(ict=>{"use strict";Object.defineProperty(ict,"__esModule",{value:!0})});var sct=x(_re=>{"use strict";Object.defineProperty(_re,"__esModule",{value:!0});_re.ChatStreamRequestSafetyMode=void 0;_re.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var lct=x(uct=>{"use strict";Object.defineProperty(uct,"__esModule",{value:!0})});var dct=x(cct=>{"use strict";Object.defineProperty(cct,"__esModule",{value:!0})});var pct=x(fct=>{"use strict";Object.defineProperty(fct,"__esModule",{value:!0})});var hct=x(mct=>{"use strict";Object.defineProperty(mct,"__esModule",{value:!0})});var yct=x(gct=>{"use strict";Object.defineProperty(gct,"__esModule",{value:!0})});var bct=x(vre=>{"use strict";Object.defineProperty(vre,"__esModule",{value:!0});vre.ChatRequestPromptTruncation=void 0;vre.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var _ct=x(wre=>{"use strict";Object.defineProperty(wre,"__esModule",{value:!0});wre.ChatRequestCitationQuality=void 0;wre.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var wct=x(vct=>{"use strict";Object.defineProperty(vct,"__esModule",{value:!0})});var xct=x(xre=>{"use strict";Object.defineProperty(xre,"__esModule",{value:!0});xre.ChatRequestSafetyMode=void 0;xre.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var Sct=x(Sre=>{"use strict";Object.defineProperty(Sre,"__esModule",{value:!0});Sre.GenerateStreamRequestTruncate=void 0;Sre.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Cct=x(Cre=>{"use strict";Object.defineProperty(Cre,"__esModule",{value:!0});Cre.GenerateStreamRequestReturnLikelihoods=void 0;Cre.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Oct=x(Ore=>{"use strict";Object.defineProperty(Ore,"__esModule",{value:!0});Ore.GenerateRequestTruncate=void 0;Ore.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Ect=x(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.GenerateRequestReturnLikelihoods=void 0;Ere.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Pct=x(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.EmbedRequestTruncate=void 0;Pre.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Act=x(Tct=>{"use strict";Object.defineProperty(Tct,"__esModule",{value:!0})});var Mct=x(Ict=>{"use strict";Object.defineProperty(Ict,"__esModule",{value:!0})});var Nct=x(Rct=>{"use strict";Object.defineProperty(Rct,"__esModule",{value:!0})});var Dct=x(jct=>{"use strict";Object.defineProperty(jct,"__esModule",{value:!0})});var Fct=x(Lct=>{"use strict";Object.defineProperty(Lct,"__esModule",{value:!0})});var kct=x(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.ClassifyRequestTruncate=void 0;Tre.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Bct=x($ct=>{"use strict";Object.defineProperty($ct,"__esModule",{value:!0})});var zct=x(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.ClassifyResponseClassificationsItemClassificationType=void 0;Are.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var qct=x(Uct=>{"use strict";Object.defineProperty(Uct,"__esModule",{value:!0})});var Vct=x(Hct=>{"use strict";Object.defineProperty(Hct,"__esModule",{value:!0})});var Wct=x(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.SummarizeRequestLength=void 0;Ire.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var Kct=x(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.SummarizeRequestFormat=void 0;Mre.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var Gct=x(Rre=>{"use strict";Object.defineProperty(Rre,"__esModule",{value:!0});Rre.SummarizeRequestExtractiveness=void 0;Rre.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});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 edt=x(Qct=>{"use strict";Object.defineProperty(Qct,"__esModule",{value:!0})});var rdt=x(tdt=>{"use strict";Object.defineProperty(tdt,"__esModule",{value:!0})});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 udt=x(sdt=>{"use strict";Object.defineProperty(sdt,"__esModule",{value:!0})});var cdt=x(ldt=>{"use strict";Object.defineProperty(ldt,"__esModule",{value:!0})});var fdt=x(ddt=>{"use strict";Object.defineProperty(ddt,"__esModule",{value:!0})});var mdt=x(pdt=>{"use strict";Object.defineProperty(pdt,"__esModule",{value:!0})});var gdt=x(hdt=>{"use strict";Object.defineProperty(hdt,"__esModule",{value:!0})});var bdt=x(ydt=>{"use strict";Object.defineProperty(ydt,"__esModule",{value:!0})});var vdt=x(_dt=>{"use strict";Object.defineProperty(_dt,"__esModule",{value:!0})});var xdt=x(wdt=>{"use strict";Object.defineProperty(wdt,"__esModule",{value:!0})});var Cdt=x(Sdt=>{"use strict";Object.defineProperty(Sdt,"__esModule",{value:!0})});var Edt=x(Odt=>{"use strict";Object.defineProperty(Odt,"__esModule",{value:!0})});var Tdt=x(Pdt=>{"use strict";Object.defineProperty(Pdt,"__esModule",{value:!0})});var Idt=x(Adt=>{"use strict";Object.defineProperty(Adt,"__esModule",{value:!0})});var Rdt=x(Mdt=>{"use strict";Object.defineProperty(Mdt,"__esModule",{value:!0})});var jdt=x(Ndt=>{"use strict";Object.defineProperty(Ndt,"__esModule",{value:!0})});var Ddt=x(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.FinishReason=void 0;Nre.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});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 Ydt=x(Zdt=>{"use strict";Object.defineProperty(Zdt,"__esModule",{value:!0})});var Qdt=x(Xdt=>{"use strict";Object.defineProperty(Xdt,"__esModule",{value:!0})});var tft=x(eft=>{"use strict";Object.defineProperty(eft,"__esModule",{value:!0})});var nft=x(rft=>{"use strict";Object.defineProperty(rft,"__esModule",{value:!0})});var ift=x(oft=>{"use strict";Object.defineProperty(oft,"__esModule",{value:!0})});var aft=x(jre=>{"use strict";Object.defineProperty(jre,"__esModule",{value:!0});jre.ChatStreamEndEventFinishReason=void 0;jre.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});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 xft=x(wft=>{"use strict";Object.defineProperty(wft,"__esModule",{value:!0})});var Cft=x(Sft=>{"use strict";Object.defineProperty(Sft,"__esModule",{value:!0})});var Eft=x(Oft=>{"use strict";Object.defineProperty(Oft,"__esModule",{value:!0})});var Tft=x(Pft=>{"use strict";Object.defineProperty(Pft,"__esModule",{value:!0})});var Ift=x(Aft=>{"use strict";Object.defineProperty(Aft,"__esModule",{value:!0})});var Rft=x(Mft=>{"use strict";Object.defineProperty(Mft,"__esModule",{value:!0})});var jft=x(Nft=>{"use strict";Object.defineProperty(Nft,"__esModule",{value:!0})});var Lft=x(Dft=>{"use strict";Object.defineProperty(Dft,"__esModule",{value:!0})});var kft=x(Fft=>{"use strict";Object.defineProperty(Fft,"__esModule",{value:!0})});var Bft=x($ft=>{"use strict";Object.defineProperty($ft,"__esModule",{value:!0})});var Uft=x(zft=>{"use strict";Object.defineProperty(zft,"__esModule",{value:!0})});var Hft=x(qft=>{"use strict";Object.defineProperty(qft,"__esModule",{value:!0})});var Wft=x(Vft=>{"use strict";Object.defineProperty(Vft,"__esModule",{value:!0})});var Kft=x(Dre=>{"use strict";Object.defineProperty(Dre,"__esModule",{value:!0});Dre.EmbedInputType=void 0;Dre.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var Gft=x(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});Lre.EmbeddingType=void 0;Lre.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var Zft=x(Jft=>{"use strict";Object.defineProperty(Jft,"__esModule",{value:!0})});var Xft=x(Yft=>{"use strict";Object.defineProperty(Yft,"__esModule",{value:!0})});var ept=x(Qft=>{"use strict";Object.defineProperty(Qft,"__esModule",{value:!0})});var tpt=x(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.EmbedJobStatus=void 0;Fre.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var rpt=x(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.EmbedJobTruncate=void 0;kre.EmbedJobTruncate={Start:"START",End:"END"}});var opt=x(npt=>{"use strict";Object.defineProperty(npt,"__esModule",{value:!0})});var apt=x(ipt=>{"use strict";Object.defineProperty(ipt,"__esModule",{value:!0})});var upt=x(spt=>{"use strict";Object.defineProperty(spt,"__esModule",{value:!0})});var cpt=x(lpt=>{"use strict";Object.defineProperty(lpt,"__esModule",{value:!0})});var fpt=x(dpt=>{"use strict";Object.defineProperty(dpt,"__esModule",{value:!0})});var ppt=x($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.DatasetValidationStatus=void 0;$re.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var mpt=x(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.DatasetType=void 0;Bre.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 gpt=x(hpt=>{"use strict";Object.defineProperty(hpt,"__esModule",{value:!0})});var bpt=x(ypt=>{"use strict";Object.defineProperty(ypt,"__esModule",{value:!0})});var vpt=x(_pt=>{"use strict";Object.defineProperty(_pt,"__esModule",{value:!0})});var xpt=x(wpt=>{"use strict";Object.defineProperty(wpt,"__esModule",{value:!0})});var Cpt=x(Spt=>{"use strict";Object.defineProperty(Spt,"__esModule",{value:!0})});var Ept=x(Opt=>{"use strict";Object.defineProperty(Opt,"__esModule",{value:!0})});var Tpt=x(Ppt=>{"use strict";Object.defineProperty(Ppt,"__esModule",{value:!0})});var Ipt=x(Apt=>{"use strict";Object.defineProperty(Apt,"__esModule",{value:!0})});var Rpt=x(Mpt=>{"use strict";Object.defineProperty(Mpt,"__esModule",{value:!0})});var jpt=x(Npt=>{"use strict";Object.defineProperty(Npt,"__esModule",{value:!0})});var Lpt=x(Dpt=>{"use strict";Object.defineProperty(Dpt,"__esModule",{value:!0})});var kpt=x(Fpt=>{"use strict";Object.defineProperty(Fpt,"__esModule",{value:!0})});var $pt=x(zre=>{"use strict";Object.defineProperty(zre,"__esModule",{value:!0});zre.ConnectorAuthStatus=void 0;zre.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});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 Wpt=x(Ure=>{"use strict";Object.defineProperty(Ure,"__esModule",{value:!0});Ure.AuthTokenType=void 0;Ure.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var Gpt=x(Kpt=>{"use strict";Object.defineProperty(Kpt,"__esModule",{value:!0})});var Zpt=x(Jpt=>{"use strict";Object.defineProperty(Jpt,"__esModule",{value:!0})});var Xpt=x(Ypt=>{"use strict";Object.defineProperty(Ypt,"__esModule",{value:!0})});var emt=x(Qpt=>{"use strict";Object.defineProperty(Qpt,"__esModule",{value:!0})});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 imt=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 smt=x(amt=>{"use strict";Object.defineProperty(amt,"__esModule",{value:!0})});var lmt=x(umt=>{"use strict";Object.defineProperty(umt,"__esModule",{value:!0})});var cmt=x(_e=>{"use strict";var dRr=_e&&_e.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oe=_e&&_e.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dRr(e,t,r)};Object.defineProperty(_e,"__esModule",{value:!0});Oe(nct(),_e);Oe(oct(),_e);Oe(act(),_e);Oe(sct(),_e);Oe(lct(),_e);Oe(dct(),_e);Oe(pct(),_e);Oe(hct(),_e);Oe(yct(),_e);Oe(bct(),_e);Oe(_ct(),_e);Oe(wct(),_e);Oe(xct(),_e);Oe(Sct(),_e);Oe(Cct(),_e);Oe(Oct(),_e);Oe(Ect(),_e);Oe(Pct(),_e);Oe(Act(),_e);Oe(Mct(),_e);Oe(Nct(),_e);Oe(Dct(),_e);Oe(Fct(),_e);Oe(kct(),_e);Oe(Bct(),_e);Oe(zct(),_e);Oe(qct(),_e);Oe(Vct(),_e);Oe(Wct(),_e);Oe(Kct(),_e);Oe(Gct(),_e);Oe(Zct(),_e);Oe(Xct(),_e);Oe(edt(),_e);Oe(rdt(),_e);Oe(odt(),_e);Oe(adt(),_e);Oe(udt(),_e);Oe(cdt(),_e);Oe(fdt(),_e);Oe(mdt(),_e);Oe(gdt(),_e);Oe(bdt(),_e);Oe(vdt(),_e);Oe(xdt(),_e);Oe(Cdt(),_e);Oe(Edt(),_e);Oe(Tdt(),_e);Oe(Idt(),_e);Oe(Rdt(),_e);Oe(jdt(),_e);Oe(Ddt(),_e);Oe(Fdt(),_e);Oe($dt(),_e);Oe(zdt(),_e);Oe(qdt(),_e);Oe(Vdt(),_e);Oe(Kdt(),_e);Oe(Jdt(),_e);Oe(Ydt(),_e);Oe(Qdt(),_e);Oe(tft(),_e);Oe(nft(),_e);Oe(ift(),_e);Oe(aft(),_e);Oe(uft(),_e);Oe(cft(),_e);Oe(fft(),_e);Oe(mft(),_e);Oe(gft(),_e);Oe(bft(),_e);Oe(vft(),_e);Oe(xft(),_e);Oe(Cft(),_e);Oe(Eft(),_e);Oe(Tft(),_e);Oe(Ift(),_e);Oe(Rft(),_e);Oe(jft(),_e);Oe(Lft(),_e);Oe(kft(),_e);Oe(Bft(),_e);Oe(Uft(),_e);Oe(Hft(),_e);Oe(Wft(),_e);Oe(Kft(),_e);Oe(Gft(),_e);Oe(Zft(),_e);Oe(Xft(),_e);Oe(ept(),_e);Oe(tpt(),_e);Oe(rpt(),_e);Oe(opt(),_e);Oe(apt(),_e);Oe(upt(),_e);Oe(cpt(),_e);Oe(fpt(),_e);Oe(ppt(),_e);Oe(mpt(),_e);Oe(gpt(),_e);Oe(bpt(),_e);Oe(vpt(),_e);Oe(xpt(),_e);Oe(Cpt(),_e);Oe(Ept(),_e);Oe(Tpt(),_e);Oe(Ipt(),_e);Oe(Rpt(),_e);Oe(jpt(),_e);Oe(Lpt(),_e);Oe(kpt(),_e);Oe($pt(),_e);Oe(zpt(),_e);Oe(qpt(),_e);Oe(Vpt(),_e);Oe(Wpt(),_e);Oe(Gpt(),_e);Oe(Zpt(),_e);Oe(Xpt(),_e);Oe(emt(),_e);Oe(rmt(),_e);Oe(omt(),_e);Oe(imt(),_e);Oe(smt(),_e);Oe(lmt(),_e)});var dmt=x(Hre=>{"use strict";Object.defineProperty(Hre,"__esModule",{value:!0});Hre.CohereError=void 0;var ePe=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(fRr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};Hre.CohereError=ePe;function fRr({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 fmt=x(Vre=>{"use strict";Object.defineProperty(Vre,"__esModule",{value:!0});Vre.CohereTimeoutError=void 0;var tPe=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};Vre.CohereTimeoutError=tPe});var ou=x(Zz=>{"use strict";Object.defineProperty(Zz,"__esModule",{value:!0});Zz.CohereTimeoutError=Zz.CohereError=void 0;var pRr=dmt();Object.defineProperty(Zz,"CohereError",{enumerable:!0,get:function(){return pRr.CohereError}});var mRr=fmt();Object.defineProperty(Zz,"CohereTimeoutError",{enumerable:!0,get:function(){return mRr.CohereTimeoutError}})});var pmt=x(Kv=>{"use strict";var hRr=Kv&&Kv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gRr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRr=Kv&&Kv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hRr(e,t,r);return gRr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.BadRequestError=void 0;var bRr=yRr(ou()),rPe=class t extends bRr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};Kv.BadRequestError=rPe});var mmt=x(Gv=>{"use strict";var _Rr=Gv&&Gv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vRr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wRr=Gv&&Gv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Rr(e,t,r);return vRr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.UnauthorizedError=void 0;var xRr=wRr(ou()),nPe=class t extends xRr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};Gv.UnauthorizedError=nPe});var hmt=x(Jv=>{"use strict";var SRr=Jv&&Jv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CRr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ORr=Jv&&Jv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SRr(e,t,r);return CRr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.ForbiddenError=void 0;var ERr=ORr(ou()),oPe=class t extends ERr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};Jv.ForbiddenError=oPe});var gmt=x(Zv=>{"use strict";var PRr=Zv&&Zv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TRr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ARr=Zv&&Zv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PRr(e,t,r);return TRr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.NotFoundError=void 0;var IRr=ARr(ou()),iPe=class t extends IRr.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};Zv.NotFoundError=iPe});var ymt=x(Yv=>{"use strict";var MRr=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]}),RRr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NRr=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)&&MRr(e,t,r);return RRr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.UnprocessableEntityError=void 0;var jRr=NRr(ou()),aPe=class t extends jRr.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};Yv.UnprocessableEntityError=aPe});var bmt=x(Xv=>{"use strict";var DRr=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]}),LRr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FRr=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)&&DRr(e,t,r);return LRr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.TooManyRequestsError=void 0;var kRr=FRr(ou()),sPe=class t extends kRr.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};Xv.TooManyRequestsError=sPe});var _mt=x(Qv=>{"use strict";var $Rr=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]}),BRr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zRr=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)&&$Rr(e,t,r);return BRr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ClientClosedRequestError=void 0;var URr=zRr(ou()),uPe=class t extends URr.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};Qv.ClientClosedRequestError=uPe});var vmt=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]}),HRr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VRr=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 HRr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.InternalServerError=void 0;var WRr=VRr(ou()),lPe=class t extends WRr.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};ew.InternalServerError=lPe});var wmt=x(tw=>{"use strict";var KRr=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]}),GRr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JRr=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)&&KRr(e,t,r);return GRr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.NotImplementedError=void 0;var ZRr=JRr(ou()),cPe=class t extends ZRr.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};tw.NotImplementedError=cPe});var xmt=x(rw=>{"use strict";var YRr=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]}),XRr=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QRr=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)&&YRr(e,t,r);return XRr(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.ServiceUnavailableError=void 0;var e1r=QRr(ou()),dPe=class t extends e1r.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};rw.ServiceUnavailableError=dPe});var Smt=x(nw=>{"use strict";var t1r=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]}),r1r=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n1r=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)&&t1r(e,t,r);return r1r(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.GatewayTimeoutError=void 0;var o1r=n1r(ou()),fPe=class t extends o1r.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};nw.GatewayTimeoutError=fPe});var Cmt=x(Id=>{"use strict";var i1r=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]}),Gb=Id&&Id.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&i1r(e,t,r)};Object.defineProperty(Id,"__esModule",{value:!0});Gb(pmt(),Id);Gb(mmt(),Id);Gb(hmt(),Id);Gb(gmt(),Id);Gb(ymt(),Id);Gb(bmt(),Id);Gb(_mt(),Id);Gb(vmt(),Id);Gb(wmt(),Id);Gb(xmt(),Id);Gb(Smt(),Id)});var Emt=x(Omt=>{"use strict";Object.defineProperty(Omt,"__esModule",{value:!0})});var Pmt=x(hD=>{"use strict";var a1r=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]}),s1r=hD&&hD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&a1r(e,t,r)};Object.defineProperty(hD,"__esModule",{value:!0});s1r(Emt(),hD)});var KE=x(ow=>{"use strict";var u1r=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]}),Wre=ow&&ow.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&u1r(e,t,r)};Object.defineProperty(ow,"__esModule",{value:!0});Wre(rct(),ow);Wre(cmt(),ow);Wre(Cmt(),ow);Wre(Pmt(),ow)});var hPe={};os(hPe,{__addDisposableResource:()=>Gmt,__assign:()=>Kre,__asyncDelegator:()=>Bmt,__asyncGenerator:()=>$mt,__asyncValues:()=>zmt,__await:()=>Yz,__awaiter:()=>Nmt,__classPrivateFieldGet:()=>Vmt,__classPrivateFieldIn:()=>Kmt,__classPrivateFieldSet:()=>Wmt,__createBinding:()=>Jre,__decorate:()=>Imt,__disposeResources:()=>Jmt,__esDecorate:()=>l1r,__exportStar:()=>Dmt,__extends:()=>Tmt,__generator:()=>jmt,__importDefault:()=>Hmt,__importStar:()=>qmt,__makeTemplateObject:()=>Umt,__metadata:()=>Rmt,__param:()=>Mmt,__propKey:()=>d1r,__read:()=>mPe,__rest:()=>Amt,__runInitializers:()=>c1r,__setFunctionName:()=>f1r,__spread:()=>Lmt,__spreadArray:()=>kmt,__spreadArrays:()=>Fmt,__values:()=>Gre,default:()=>h1r});function Tmt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pPe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Amt(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 Imt(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 Mmt(t,e){return function(r,n){e(r,n,t)}}function l1r(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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 h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function c1r(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 d1r(t){return typeof t=="symbol"?t:"".concat(t)}function f1r(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 Rmt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Nmt(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 Dmt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jre(e,t,r)}function Gre(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 mPe(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 Lmt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(mPe(arguments[e]));return t}function Fmt(){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 kmt(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 Yz(t){return this instanceof Yz?(this.v=t,this):new Yz(t)}function $mt(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(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(g,y){i.push([p,m,g,y])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof Yz?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,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Bmt(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:Yz(t[o](a)),done:!1}:i?i(a):a}:i}}function zmt(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 Gre=="function"?Gre(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 Umt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function qmt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jre(e,t,r);return p1r(e,t),e}function Hmt(t){return t&&t.__esModule?t:{default:t}}function Vmt(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 Wmt(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 Kmt(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 Gmt(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 Jmt(t){function e(i){t.error=t.hasError?new m1r(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 pPe,Kre,Jre,p1r,m1r,h1r,gPe=b(()=>{pPe=function(t,e){return pPe=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])},pPe(t,e)};Kre=function(){return Kre=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},Kre.apply(this,arguments)};Jre=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};p1r=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};m1r=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};h1r={__extends:Tmt,__assign:Kre,__rest:Amt,__decorate:Imt,__param:Mmt,__metadata:Rmt,__awaiter:Nmt,__generator:jmt,__createBinding:Jre,__exportStar:Dmt,__values:Gre,__read:mPe,__spread:Lmt,__spreadArrays:Fmt,__spreadArray:kmt,__await:Yz,__asyncGenerator:$mt,__asyncDelegator:Bmt,__asyncValues:zmt,__makeTemplateObject:Umt,__importStar:qmt,__importDefault:Hmt,__classPrivateFieldGet:Vmt,__classPrivateFieldSet:Wmt,__classPrivateFieldIn:Kmt,__addDisposableResource:Gmt,__disposeResources:Jmt}});var yPe=x(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.MAX_HASHABLE_LENGTH=cy.INIT=cy.KEY=cy.DIGEST_LENGTH=cy.BLOCK_SIZE=void 0;cy.BLOCK_SIZE=64;cy.DIGEST_LENGTH=32;cy.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]);cy.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];cy.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var Zmt=x(Zre=>{"use strict";Object.defineProperty(Zre,"__esModule",{value:!0});Zre.RawSha256=void 0;var dy=yPe(),g1r=function(){function t(){this.state=Int32Array.from(dy.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>dy.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===dy.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%dy.BLOCK_SIZE>=dy.BLOCK_SIZE-8){for(var o=this.bufferLength;o<dy.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<dy.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(dy.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(dy.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(dy.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<dy.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],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var m=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(m+this.temp[f-16]|0)}var g=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(dy.KEY[f]+this.temp[f]|0)|0)|0,y=((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+g|0,s=a,a=i,i=o,o=g+y|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}();Zre.RawSha256=g1r});var Qmt=x((zgo,Xmt)=>{var Yre=Object.defineProperty,y1r=Object.getOwnPropertyDescriptor,b1r=Object.getOwnPropertyNames,_1r=Object.prototype.hasOwnProperty,v1r=(t,e)=>Yre(t,"name",{value:e,configurable:!0}),w1r=(t,e)=>{for(var r in e)Yre(t,r,{get:e[r],enumerable:!0})},x1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b1r(e))!_1r.call(t,o)&&o!==r&&Yre(t,o,{get:()=>e[o],enumerable:!(n=y1r(e,o))||n.enumerable});return t},S1r=t=>x1r(Yre({},"__esModule",{value:!0}),t),Ymt={};w1r(Ymt,{isArrayBuffer:()=>C1r});Xmt.exports=S1r(Ymt);var C1r=v1r(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var nht=x((Ugo,rht)=>{var Xre=Object.defineProperty,O1r=Object.getOwnPropertyDescriptor,E1r=Object.getOwnPropertyNames,P1r=Object.prototype.hasOwnProperty,eht=(t,e)=>Xre(t,"name",{value:e,configurable:!0}),T1r=(t,e)=>{for(var r in e)Xre(t,r,{get:e[r],enumerable:!0})},A1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E1r(e))!P1r.call(t,o)&&o!==r&&Xre(t,o,{get:()=>e[o],enumerable:!(n=O1r(e,o))||n.enumerable});return t},I1r=t=>A1r(Xre({},"__esModule",{value:!0}),t),tht={};T1r(tht,{fromArrayBuffer:()=>R1r,fromString:()=>N1r});rht.exports=I1r(tht);var M1r=Qmt(),bPe=Im(),R1r=eht((t,e=0,r=t.byteLength-e)=>{if(!(0,M1r.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return bPe.Buffer.from(t,e,r)},"fromArrayBuffer"),N1r=eht((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?bPe.Buffer.from(t,e):bPe.Buffer.from(t)},"fromString")});var uht=x((qgo,sht)=>{var Qre=Object.defineProperty,j1r=Object.getOwnPropertyDescriptor,D1r=Object.getOwnPropertyNames,L1r=Object.prototype.hasOwnProperty,_Pe=(t,e)=>Qre(t,"name",{value:e,configurable:!0}),F1r=(t,e)=>{for(var r in e)Qre(t,r,{get:e[r],enumerable:!0})},k1r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of D1r(e))!L1r.call(t,o)&&o!==r&&Qre(t,o,{get:()=>e[o],enumerable:!(n=j1r(e,o))||n.enumerable});return t},$1r=t=>k1r(Qre({},"__esModule",{value:!0}),t),oht={};F1r(oht,{fromUtf8:()=>aht,toUint8Array:()=>B1r,toUtf8:()=>z1r});sht.exports=$1r(oht);var iht=nht(),aht=_Pe(t=>{let e=(0,iht.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),B1r=_Pe(t=>typeof t=="string"?aht(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),z1r=_Pe(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,iht.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var lht=x(ene=>{"use strict";Object.defineProperty(ene,"__esModule",{value:!0});ene.convertToBuffer=void 0;var U1r=uht(),q1r=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:U1r.fromUtf8;function H1r(t){return t instanceof Uint8Array?t:typeof t=="string"?q1r(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}ene.convertToBuffer=H1r});var cht=x(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.isEmptyData=void 0;function V1r(t){return typeof t=="string"?t.length===0:t.byteLength===0}tne.isEmptyData=V1r});var dht=x(rne=>{"use strict";Object.defineProperty(rne,"__esModule",{value:!0});rne.numToUint8=void 0;function W1r(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}rne.numToUint8=W1r});var fht=x(nne=>{"use strict";Object.defineProperty(nne,"__esModule",{value:!0});nne.uint32ArrayFrom=void 0;function K1r(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)}nne.uint32ArrayFrom=K1r});var one=x(iw=>{"use strict";Object.defineProperty(iw,"__esModule",{value:!0});iw.uint32ArrayFrom=iw.numToUint8=iw.isEmptyData=iw.convertToBuffer=void 0;var G1r=lht();Object.defineProperty(iw,"convertToBuffer",{enumerable:!0,get:function(){return G1r.convertToBuffer}});var J1r=cht();Object.defineProperty(iw,"isEmptyData",{enumerable:!0,get:function(){return J1r.isEmptyData}});var Z1r=dht();Object.defineProperty(iw,"numToUint8",{enumerable:!0,get:function(){return Z1r.numToUint8}});var Y1r=fht();Object.defineProperty(iw,"uint32ArrayFrom",{enumerable:!0,get:function(){return Y1r.uint32ArrayFrom}})});var mht=x(sne=>{"use strict";Object.defineProperty(sne,"__esModule",{value:!0});sne.Sha256=void 0;var pht=(gPe(),Nc(hPe)),ane=yPe(),ine=Zmt(),vPe=one(),X1r=function(){function t(e){this.secret=e,this.hash=new ine.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,vPe.isEmptyData)(e)||this.error))try{this.hash.update((0,vPe.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 pht.__awaiter(this,void 0,void 0,function(){return pht.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new ine.RawSha256,this.secret){this.outer=new ine.RawSha256;var e=Q1r(this.secret),r=new Uint8Array(ane.BLOCK_SIZE);r.set(e);for(var n=0;n<ane.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}();sne.Sha256=X1r;function Q1r(t){var e=(0,vPe.convertToBuffer)(t);if(e.byteLength>ane.BLOCK_SIZE){var r=new ine.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(ane.BLOCK_SIZE);return n.set(e),n}});var xPe=x(wPe=>{"use strict";Object.defineProperty(wPe,"__esModule",{value:!0});var eNr=(gPe(),Nc(hPe));eNr.__exportStar(mht(),wPe)});var hht=b(()=>{});var ght=b(()=>{});var yht=b(()=>{});var gD,k5=b(()=>{gD=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 cc,bht=b(()=>{k5();cc=class t extends gD{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var _ht=b(()=>{k5()});var vht=b(()=>{k5()});var wht=b(()=>{});var xht,Sht=b(()=>{xht=(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 GE=b(()=>{bht();k5();_ht();vht();wht();Sht()});function une(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 SPe=b(()=>{});var Cht=b(()=>{});var Oht=b(()=>{Cht()});var Eht=b(()=>{});var Pht,Tht=b(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(Pht||(Pht={}))});var CPe,Aht=b(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(CPe||(CPe={}))});var Iht=b(()=>{});var Mht=b(()=>{});var Rht=b(()=>{});var Nht=b(()=>{});var jht=b(()=>{Tht();Aht();Iht();Mht();Rht();Nht()});var Dht=b(()=>{});var Lht=b(()=>{});var Fht=b(()=>{});var kht=b(()=>{});var $ht=b(()=>{});var Bht=b(()=>{});var zht=b(()=>{});var Uht=b(()=>{$ht();Bht();zht()});var qht=b(()=>{});var Hht=b(()=>{});var Xz,Vht=b(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(Xz||(Xz={}))});var Wht=b(()=>{});var Kht=b(()=>{});var Ght=b(()=>{});var Jht=b(()=>{});var Zht=b(()=>{});var Yht=b(()=>{Wht();Kht();Ght();Jht();Zht()});var Xht=b(()=>{});var Qz,OPe=b(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Qz||(Qz={}))});var Qht=b(()=>{OPe()});var egt=b(()=>{});var tgt=b(()=>{Qht();egt();OPe()});var Kh,rgt=b(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Kh||(Kh={}))});var ngt=b(()=>{});var ogt=b(()=>{});var igt=b(()=>{});var agt=b(()=>{});var sgt=b(()=>{});var ugt=b(()=>{ogt();igt();agt();sgt()});var lgt=b(()=>{});var eU,cgt=b(()=>{eU="__smithy_context"});var dgt=b(()=>{});var fgt,pgt=b(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(fgt||(fgt={}))});var mgt=b(()=>{});var hgt=b(()=>{});var ggt=b(()=>{});var ygt=b(()=>{});var bgt=b(()=>{});var _gt=b(()=>{});var vgt=b(()=>{});var wgt=b(()=>{});var xgt=b(()=>{});var Sgt,Cgt=b(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(Sgt||(Sgt={}))});var Ogt=b(()=>{});var Egt=b(()=>{});var Pgt=b(()=>{});var Tgt=b(()=>{});var Agt=b(()=>{});var Igt=b(()=>{});var Su=b(()=>{Eht();jht();Dht();Lht();Fht();kht();Uht();qht();Hht();Vht();Yht();Xht();tgt();rgt();ngt();ugt();lgt();cgt();dgt();pgt();mgt();hgt();ggt();ygt();bgt();_gt();vgt();wgt();xgt();Cgt();Ogt();Egt();Pgt();Tgt();Agt();Igt()});var Mgt=b(()=>{Su()});var Rgt=b(()=>{});var Ngt=b(()=>{});function tNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var lne,jgt=b(()=>{lne=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=tNr(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 Dgt=b(()=>{});var Lgt=b(()=>{});var Fgt=b(()=>{});var kgt=b(()=>{Oht();Mgt();Rgt();Ngt();jgt();Dgt();Lgt();Fgt()});var rNr,nNr,cne,EPe=b(()=>{kgt();rNr=t=>e=>async r=>{if(!lne.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)},nNr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},cne=t=>({applyToStack:e=>{e.add(rNr(t),nNr)}})});var oNr,iNr,dne,$gt=b(()=>{oNr=()=>(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}},iNr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},dne=t=>({applyToStack:e=>{e.add(oNr(),iNr)}})});var PPe=b(()=>{$gt()});var Bgt=b(()=>{});var zgt=b(()=>{Bgt()});var Ugt=b(()=>{Su()});var qgt=b(()=>{});var Hgt=b(()=>{});function aNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var fne,Vgt=b(()=>{fne=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=aNr(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 Wgt=b(()=>{});var Kgt=b(()=>{});var Ggt=b(()=>{});var Jgt=b(()=>{zgt();Ugt();qgt();Hgt();Vgt();Wgt();Kgt();Ggt()});var Zgt,sNr,uNr,lNr,cNr,pne,TPe=b(()=>{Jgt();Zgt="X-Amzn-Trace-Id",sNr="AWS_LAMBDA_FUNCTION_NAME",uNr="_X_AMZN_TRACE_ID",lNr=t=>e=>async r=>{let{request:n}=r;if(!fne.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(Zgt))return e(r);let o=process.env[sNr],i=process.env[uNr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[Zgt]=i),e({...r,request:n})},cNr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},pne=t=>({applyToStack:e=>{e.add(lNr(t),cNr)}})});function mne(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var Ygt=b(()=>{});var dNr,$5,APe=b(()=>{dNr=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}$"),$5=t=>dNr.test(t)||t.startsWith("[")&&t.endsWith("]")});var fNr,B5,IPe=b(()=>{fNr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),B5=(t,e=!1)=>{if(!e)return fNr.test(t);let r=t.split(".");for(let n of r)if(!B5(n))return!1;return!0}});var JE,hne=b(()=>{JE={}});var ZE,Xgt=b(()=>{ZE="endpoints"});function fy(t){return typeof t!="object"||t==null?t:"ref"in t?`$${fy(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(fy).join(", ")})`:JSON.stringify(t,null,2)}var Qgt=b(()=>{});var z5=b(()=>{Xgt();Qgt()});var da,eyt=b(()=>{da=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var tyt=b(()=>{});var ryt=b(()=>{});var nyt=b(()=>{});var oyt=b(()=>{});var iyt=b(()=>{});var ayt=b(()=>{});var py=b(()=>{eyt();tyt();ryt();nyt();oyt();iyt();ayt()});var syt,uyt=b(()=>{syt=(t,e)=>t===e});var lyt,cyt=b(()=>{py();lyt=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 da(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new da(`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 gne,dyt=b(()=>{py();cyt();gne=(t,e)=>lyt(e).reduce((r,n)=>{if(typeof r!="object")throw new da(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var fyt,pyt=b(()=>{fyt=t=>t!=null});var myt,hyt=b(()=>{myt=t=>!t});var MPe,gyt,yyt=b(()=>{Su();APe();MPe={[Xz.HTTP]:80,[Xz.HTTPS]:443},gyt=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:h="",path:m="",query:g={}}=t,y=new URL(`${h}//${f}${p?`:${p}`:""}${m}`);return y.search=Object.entries(g).map(([_,w])=>`${_}=${w}`).join("&"),y}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(Xz).includes(u))return null;let l=$5(o),c=r.includes(`${n}:${MPe[u]}`)||typeof t=="string"&&t.includes(`${n}:${MPe[u]}`),d=`${n}${c?`:${MPe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var byt,_yt=b(()=>{byt=(t,e)=>t===e});var vyt,wyt=b(()=>{vyt=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var xyt,Syt=b(()=>{xyt=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var RPe=b(()=>{uyt();dyt();pyt();IPe();hyt();yyt();_yt();wyt();Syt()});var Cyt,Oyt=b(()=>{RPe();Cyt={booleanEquals:syt,getAttr:gne,isSet:fyt,isValidHostLabel:B5,not:myt,parseURL:gyt,stringEquals:byt,substring:vyt,uriEncode:xyt}});var yne,NPe=b(()=>{RPe();yne=(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(gne(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var Eyt,Pyt=b(()=>{Eyt=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var kI,U5=b(()=>{py();jPe();NPe();Pyt();kI=(t,e,r)=>{if(typeof t=="string")return yne(t,r);if(t.fn)return bne(t,r);if(t.ref)return Eyt(t,r);throw new da(`'${e}': ${String(t)} is not a string, function or reference.`)}});var bne,jPe=b(()=>{hne();Oyt();U5();bne=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:kI(i,"arg",r)),o=t.split(".");return o[0]in JE&&o[1]!=null?JE[o[0]][o[1]](...n):Cyt[t](...n)}});var Tyt,Ayt=b(()=>{z5();py();jPe();Tyt=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new da(`'${t}' is already defined in Reference Record.`);let n=bne(e,r);return r.logger?.debug?.(`${ZE} evaluateCondition: ${fy(e)} = ${fy(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var tU,_ne=b(()=>{z5();Ayt();tU=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=Tyt(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${ZE} assign: ${i.name} := ${fy(i.value)}`))}return{result:!0,referenceRecord:r}}});var Iyt,Myt=b(()=>{py();U5();Iyt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=kI(i,"Header value entry",e);if(typeof a!="string")throw new da(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var DPe,Ryt=b(()=>{py();NPe();LPe();DPe=(t,e)=>{if(Array.isArray(t))return t.map(r=>DPe(r,e));switch(typeof t){case"string":return yne(t,e);case"object":if(t===null)throw new da(`Unexpected endpoint property: ${t}`);return vne(t,e);case"boolean":return t;default:throw new da(`Unexpected endpoint property type: ${typeof t}`)}}});var vne,LPe=b(()=>{Ryt();vne=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:DPe(o,e)}),{})});var Nyt,jyt=b(()=>{py();U5();Nyt=(t,e)=>{let r=kI(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 da(`Endpoint URL must be a string, got ${typeof r}`)}});var Dyt,Lyt=b(()=>{z5();_ne();Myt();LPe();jyt();Dyt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=tU(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${ZE} Resolving endpoint from template: ${fy(n)}`),{...l!=null&&{headers:Iyt(l,a)},...u!=null&&{properties:vne(u,a)},url:Nyt(s,a)}}});var Fyt,kyt=b(()=>{py();_ne();U5();Fyt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=tU(r,e);if(o)throw new da(kI(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var $yt,Byt=b(()=>{_ne();FPe();$yt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=tU(r,e);if(o)return wne(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var wne,FPe=b(()=>{py();Lyt();kyt();Byt();wne=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=Dyt(r,e);if(n)return n}else if(r.type==="error")Fyt(r,e);else if(r.type==="tree"){let n=$yt(r,e);if(n)return n}else throw new da(`Unknown endpoint rule: ${r}`);throw new da("Rules evaluation failed")}});var zyt=b(()=>{hne();FPe()});var q5,Uyt=b(()=>{z5();py();zyt();q5=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${ZE} Initial EndpointParams: ${fy(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 da(`Missing required parameter: '${l}'`);let u=wne(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?.(`${ZE} Resolved endpoint: ${fy(u)}`),u}});var $I=b(()=>{APe();IPe();hne();Uyt();py()});var kPe=b(()=>{$I()});var $Pe,qyt=b(()=>{$I();kPe();$Pe=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!$Pe(r))return!1;return!0}return!(!B5(t)||t.length<3||t.length>63||t!==t.toLowerCase()||$5(t))}});var Hyt,pNr,Vyt,Wyt=b(()=>{Hyt=":",pNr="/",Vyt=t=>{let e=t.split(Hyt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(Hyt)==="")return null;let u=s.map(l=>l.split(pNr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var Gyt,Kyt=b(()=>{Gyt={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 hNr,gNr,Jyt,Zyt,BPe=b(()=>{Kyt();hNr=Gyt,gNr="",Jyt=t=>{let{partitions:e}=hNr;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}},Zyt=()=>gNr});var H5,Yyt=b(()=>{$I();qyt();Wyt();BPe();H5={isVirtualHostableS3Bucket:$Pe,parseArn:Vyt,partition:Jyt};JE.aws=H5});var Xyt=b(()=>{$I()});var Qyt=b(()=>{$I()});var ebt=b(()=>{});var tbt=b(()=>{});var rbt=b(()=>{});var nbt=b(()=>{});var obt=b(()=>{});var ibt=b(()=>{Qyt();ebt();tbt();rbt();nbt();obt()});var xne=b(()=>{Yyt();BPe();kPe();Xyt();ibt()});var abt=b(()=>{});var sbt=b(()=>{abt()});var ubt=b(()=>{Su()});var lbt=b(()=>{});var cbt=b(()=>{});function yNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Sne,dbt=b(()=>{Sne=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=yNr(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 fbt=b(()=>{});var pbt=b(()=>{});var mbt=b(()=>{});var hbt=b(()=>{sbt();ubt();lbt();cbt();dbt();fbt();pbt();mbt()});var zPe,Cne,UPe,One,gbt,ybt,qPe,bbt=b(()=>{zPe="user-agent",Cne="x-amz-user-agent",UPe=" ",One="/",gbt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ybt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,qPe="-"});var bNr,HPe,_Nr,Ene,_bt=b(()=>{xne();hbt();bbt();bNr=t=>(e,r)=>async n=>{let{request:o}=n;if(!Sne.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(HPe)||[],s=(await t.defaultUserAgentProvider()).map(HPe),u=t?.customUserAgent?.map(HPe)||[],l=Zyt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(UPe),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(UPe);return t.runtime!=="browser"?(d&&(i[Cne]=i[Cne]?`${i[zPe]} ${d}`:d),i[zPe]=c):i[Cne]=c,e({...n,request:o})},HPe=t=>{let e=t[0].split(One).map(a=>a.replace(gbt,qPe)).join(One),r=t[1]?.replace(ybt,qPe),n=e.indexOf(One),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}`}},"")},_Nr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ene=t=>({applyToStack:e=>{e.add(bNr(t),_Nr)}})});var VPe=b(()=>{Ygt();_bt()});var vbt=b(()=>{});var wbt=b(()=>{});var Pne,xbt=b(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(Pne||(Pne={}))});var WPe=b(()=>{vbt();wbt();xbt()});var Tne,Sbt=b(()=>{WPe();Tne=!1});var Ane,Cbt=b(()=>{WPe();Ane=!1});var aw,Obt=b(()=>{Su();aw=t=>t[eU]||(t[eU]={})});var Bf,Ebt=b(()=>{Bf=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Jb=b(()=>{Obt();Ebt()});var Pbt=b(()=>{Jb()});var Tbt=b(()=>{});var Abt=b(()=>{Jb();Tbt()});var Ibt=b(()=>{Sbt();Cbt();Pbt();Abt()});var Mbt=b(()=>{});var Ine,KPe=b(()=>{Ine=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var GPe,Rbt=b(()=>{KPe();GPe=t=>Ine(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var Mne,Nbt=b(()=>{Rbt();KPe();Mne=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return GPe(e);let n=await e();return GPe(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return Ine(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var jbt=b(()=>{Mbt();Nbt()});var Dbt=b(()=>{});var Lbt=b(()=>{});var Fbt=b(()=>{});var kbt=b(()=>{});var $bt=b(()=>{});var Bbt=b(()=>{});var zbt=b(()=>{Fbt();kbt();$bt();Bbt()});var Ubt=b(()=>{Dbt();Lbt();zbt()});var V5=b(()=>{Ibt();jbt();Ubt()});function wNr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var JPe,Rne=b(()=>{Su();Jb();JPe=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=wNr(t.httpAuthSchemes),s=aw(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 qbt,xNr,SNr,CNr,ONr,ENr,Hbt=b(()=>{qbt=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),ENr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!ONr(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},xNr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,SNr=/(\d+\.){3}\d+/,CNr=/\.\./,ONr=t=>xNr.test(t)&&!SNr.test(t)&&!CNr.test(t),ENr=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 Vbt=b(()=>{Hbt()});var Wbt,Kbt=b(()=>{Wbt=(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 Gbt,Jbt=b(()=>{Gbt=async t=>{}});function Zbt(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 Ybt=b(()=>{});var BI,Nne=b(()=>{Ybt();BI=t=>{if(typeof t=="string")return BI(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=Zbt(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var jne,Dne=b(()=>{Nne();jne=t=>typeof t=="object"?"url"in t?BI(t.url):t:BI(t)});var Xbt,PNr,ZPe=b(()=>{Vbt();Kbt();Jbt();Dne();Xbt=async(t,e,r,n)=>{if(!r.endpoint){let a=await Gbt(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(jne(a)))}let o=await PNr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},PNr=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 Wbt(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 qbt(n),n}});var Qbt=b(()=>{ZPe();Dne()});var e_t,YPe=b(()=>{Jb();ZPe();e_t=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await Xbt(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=aw(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 t_t,XPe=b(()=>{t_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 r_t,QPe=b(()=>{r_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 zt(t,e,r){return{applyToStack:n=>{n.add(t_t(t,r),TNr),n.add(r_t(t,e),W5)}}}var TNr,W5,n_t=b(()=>{XPe();QPe();TNr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},W5={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var Co=b(()=>{XPe();n_t();QPe()});var eTe,Ut,o_t=b(()=>{Co();YPe();eTe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:W5.name},Ut=(t,e)=>({applyToStack:r=>{r.addRelativeTo(e_t({config:t,instructions:e}),eTe)}})});var Lne,i_t=b(()=>{Jb();Dne();Lne=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>jne(await Bf(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:Bf(t.useDualstackEndpoint??!1),useFipsEndpoint:Bf(t.useFipsEndpoint??!1)}}});var a_t=b(()=>{});var mo=b(()=>{Qbt();YPe();o_t();i_t();a_t()});var ANr,Fne,s_t=b(()=>{mo();Rne();ANr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:eTe.name},Fne=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(JPe(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),ANr)}})});var OSo,u_t=b(()=>{Co();Rne();OSo={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:W5.name}});var l_t=b(()=>{Rne();s_t();u_t()});var c_t=b(()=>{});var d_t=b(()=>{c_t()});var f_t=b(()=>{Su()});var p_t=b(()=>{});var m_t=b(()=>{});function INr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var yD,h_t=b(()=>{yD=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=INr(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 g_t=b(()=>{});var y_t=b(()=>{});var b_t=b(()=>{});var K5=b(()=>{d_t();f_t();p_t();m_t();h_t();g_t();y_t();b_t()});var MNr,RNr,__t,tTe=b(()=>{K5();Su();Jb();MNr=t=>e=>{throw e},RNr=(t,e)=>{},__t=t=>(e,r)=>async n=>{if(!yD.isInstance(n.request))return e(n);let i=aw(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||MNr)(a));return(u.successHandler||RNr)(l.response,a),l}});var Zb,sw,G5,kne=b(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Zb||(Zb={}));sw=3,G5=Zb.STANDARD});var v_t,w_t,x_t,S_t,C_t=b(()=>{v_t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],w_t=["TimeoutError","RequestTimeout","RequestTimeoutException"],x_t=[500,502,503,504],S_t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var NNr,rU,$ne,O_t,J5=b(()=>{C_t();NNr=t=>t.$metadata?.clockSkewCorrected,rU=t=>t.$metadata?.httpStatusCode===429||v_t.includes(t.name)||t.$retryable?.throttling==!0,$ne=t=>NNr(t)||w_t.includes(t.name)||S_t.includes(t?.code||"")||x_t.includes(t.$metadata?.httpStatusCode||0),O_t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!$ne(t)}return!1}});var Z5,rTe=b(()=>{J5();Z5=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(),rU(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 Bne,zne,nU=b(()=>{Bne="amz-sdk-invocation-id",zne="amz-sdk-request"});var E_t,P_t=b(()=>{nU();E_t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var nTe,T_t=b(()=>{nU();nTe=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var bD,qne=b(()=>{kne();nU();P_t();T_t();bD=class{constructor(e){this.maxAttempts=e,this.mode=Zb.STANDARD,this.capacity=500,this.retryBackoffStrategy=E_t(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return nTe({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,nTe({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 ${sw}`),sw}}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 Hne,N_t=b(()=>{kne();rTe();qne();Hne=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Zb.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new Z5,this.standardRetryStrategy=new bD(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(()=>{nU();qne()});var D_t=b(()=>{});var uw=b(()=>{N_t();j_t();rTe();qne();kne();nU();D_t()});var L_t=b(()=>{});var F_t=b(()=>{L_t()});var k_t=b(()=>{Su()});var $_t=b(()=>{});var B_t=b(()=>{});function jNr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var iU,z_t=b(()=>{iU=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=jNr(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 Y5,U_t=b(()=>{Y5=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 q_t=b(()=>{});var H_t=b(()=>{});var Vne=b(()=>{F_t();k_t();$_t();B_t();z_t();U_t();q_t();H_t()});var V_t=b(()=>{uw()});var iTe=b(()=>{uw()});var aTe=b(()=>{J5()});var sTe,uTe=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 lTe=b(()=>{Vne();J5();uw();V_t();iTe();aTe();uTe()});var W_t=b(()=>{uw();lTe()});var Wne,K_t=b(()=>{Jb();uw();Wne=t=>{let{retryStrategy:e}=t,r=Bf(t.maxAttempts??sw);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await Bf(t.retryMode)()===Zb.ADAPTIVE?new Hne(r):new bD(r))}}});var G_t=b(()=>{Vne();uw()});var zI,J_t=b(()=>{zI=class{trace(){}debug(){}info(){}warn(){}error(){}}});var _D,UI,aU,Z_t,Y_t,X_t=b(()=>{_D=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},UI=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,aU=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>Z_t[p.step]-Z_t[f.step]||Y_t[p.priority||"normal"]-Y_t[f.priority||"normal"]),i=d=>{let f=!1,p=h=>{let m=_D(h.name,h.aliases);if(m.includes(d)){f=!0;for(let g of m)n.delete(g);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=h=>{if(h.middleware===d){f=!0;for(let m of _D(h.name,h.aliases))n.delete(m);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=[],h={};return t.forEach(g=>{let y={...g,before:[],after:[]};for(let _ of _D(y.name,y.aliases))h[_]=y;f.push(y)}),e.forEach(g=>{let y={...g,before:[],after:[]};for(let _ of _D(y.name,y.aliases))h[_]=y;p.push(y)}),p.forEach(g=>{if(g.toMiddleware){let y=h[g.toMiddleware];if(y===void 0){if(d)return;throw new Error(`${g.toMiddleware} is not found when adding ${UI(g.name,g.aliases)} middleware ${g.relation} ${g.toMiddleware}`)}g.relation==="after"&&y.after.push(g),g.relation==="before"&&y.before.push(g)}}),o(f).map(u).reduce((g,y)=>(g.push(...y),g),[])},c={add:(d,f={})=>{let{name:p,override:h,aliases:m}=f,g={step:"initialize",priority:"normal",middleware:d,...f},y=_D(p,m);if(y.length>0){if(y.some(_=>n.has(_))){if(!h)throw new Error(`Duplicate middleware name '${UI(p,m)}'`);for(let _ of y){let w=t.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let S=t[w];if(S.step!==g.step||g.priority!==S.priority)throw new Error(`"${UI(S.name,S.aliases)}" middleware with ${S.priority} priority in ${S.step} step cannot be overridden by "${UI(p,m)}" middleware with ${g.priority} priority in ${g.step} step.`);t.splice(w,1)}}for(let _ of y)n.add(_)}t.push(g)},addRelativeTo:(d,f)=>{let{name:p,override:h,aliases:m}=f,g={middleware:d,...f},y=_D(p,m);if(y.length>0){if(y.some(_=>n.has(_))){if(!h)throw new Error(`Duplicate middleware name '${UI(p,m)}'`);for(let _ of y){let w=e.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let S=e[w];if(S.toMiddleware!==g.toMiddleware||S.relation!==g.relation)throw new Error(`"${UI(S.name,S.aliases)}" middleware ${S.relation} "${S.toMiddleware}" middleware cannot be overridden by "${UI(p,m)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);e.splice(w,1)}}for(let _ of y)n.add(_)}e.push(g)},clone:()=>s(aU()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=h=>{let{tags:m,name:g,aliases:y}=h;if(m&&m.includes(d)){let _=_D(g,y);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(aU());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 UI(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(h=>h.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},Z_t={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Y_t={high:3,normal:2,low:1}});var cTe=b(()=>{X_t()});var vD,Q_t=b(()=>{cTe();vD=class{constructor(e){this.middlewareStack=aU(),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 YE,wD,qI,xD,evt,dTe=b(()=>{YE={},wD=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);YE[n]=t,wD[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;YE[n]=o,wD[o]=n}for(let t=0;t<10;t++){YE[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;YE[e]=r,wD[r]=e}YE["+"]=62;wD[62]="+";YE["/"]=63;wD[63]="/";qI=6,xD=8,evt=63});var HI,tvt=b(()=>{dTe();HI=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 YE))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=YE[t[l]]<<(c-l)*qI,a+=qI}else i>>=qI;let s=o/4*3;i>>=a%xD;let u=Math.floor(a/xD);for(let l=0;l<u;l++){let c=(u-l-1)*xD;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var fTe,pTe=b(()=>{fTe=t=>new TextEncoder().encode(t)});var rvt=b(()=>{pTe()});var nvt=b(()=>{});var ovt=b(()=>{pTe();rvt();nvt()});function VI(t){let e;typeof t=="string"?e=fTe(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)*xD,s+=xD;let u=Math.ceil(s/qI);a<<=u*qI-s;for(let l=1;l<=u;l++){let c=(u-l)*qI;o+=wD[(a&evt<<c)>>c]}o+="==".slice(0,4-u)}return o}var ivt=b(()=>{ovt();dTe()});var sU=b(()=>{tvt();ivt()});var mTe,hTe=b(()=>{mTe=t=>new TextEncoder().encode(t)});var avt=b(()=>{hTe()});var Kne,svt=b(()=>{Kne=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 gTe=b(()=>{hTe();avt();svt()});function uvt(t,e="utf-8"){return e==="base64"?VI(t):Kne(t)}function lvt(t,e){return e==="base64"?XE.mutate(HI(t)):XE.mutate(mTe(t))}var cvt=b(()=>{sU();gTe();yTe()});var XE,yTe=b(()=>{cvt();XE=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return lvt(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 uvt(this,e)}}});var dvt=b(()=>{});var fvt=b(()=>{});var pvt=b(()=>{fvt()});var mvt=b(()=>{Su()});var hvt=b(()=>{});var gvt=b(()=>{});var yvt=b(()=>{});var X5,bvt=b(()=>{X5=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 _vt=b(()=>{});var vvt=b(()=>{});var wvt=b(()=>{pvt();mvt();hvt();gvt();yvt();bvt();_vt();vvt()});var my,DNr,bTe=b(()=>{my=t=>encodeURIComponent(t).replace(/[!'()*]/g,DNr),DNr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var xvt=b(()=>{bTe()});var Gne=b(()=>{bTe();xvt()});function Svt(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=my(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${my(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${my(n)}`),e.push(o)}}return e.join("&")}var Cvt=b(()=>{Gne()});function Ovt(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 Evt=b(()=>{});var _Te,WI,Pvt=b(()=>{wvt();Cvt();Evt();_Te={supported:void 0},WI=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)),_Te.supported===void 0&&(_Te.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 y=new Error("Request aborted");return y.name="AbortError",Promise.reject(y)}let a=e.path,s=Svt(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let y=e.username??"",_=e.password??"";u=`${y}:${_}@`}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),_Te.supported&&(p.keepalive=o);let h=()=>{},m=new Request(d,p),g=[fetch(m).then(y=>{let _=y.headers,w={};for(let C of _.entries())w[C[0]]=C[1];return y.body!=null?{response:new X5({headers:w,reason:y.statusText,statusCode:y.status,body:y.body})}:y.blob().then(C=>({response:new X5({headers:w,reason:y.statusText,statusCode:y.status,body:C})}))}),Ovt(n)];return r&&g.push(new Promise((y,_)=>{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}),h=()=>S.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(g).finally(h)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function LNr(t){let e=await kNr(t),r=HI(e);return new Uint8Array(r)}async function FNr(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 kNr(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 uU,Tvt=b(()=>{sU();uU=t=>typeof Blob=="function"&&t instanceof Blob?LNr(t):FNr(t)});var Q5=b(()=>{Pvt();Tvt()});function Ivt(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Avt[t[r]];return e}var Avt,$Nr,Mvt=b(()=>{Avt={},$Nr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Avt[t]=e,$Nr[e]=t}});var vTe,wTe=b(()=>{vTe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var Rvt,jvt,Nvt,Dvt=b(()=>{Q5();sU();Mvt();gTe();wTe();Rvt="The stream has already been transformed.",jvt=t=>{if(!Nvt(t)&&!vTe(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(Rvt);return e=!0,await uU(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 VI(i);if(o==="hex")return Ivt(i);if(o===void 0||o==="utf8"||o==="utf-8")return Kne(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(Rvt);if(e=!0,Nvt(t))return n(t);if(vTe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Nvt=t=>typeof Blob=="function"&&t instanceof Blob});var Lvt=b(()=>{});var Fvt=b(()=>{});var xTe=b(()=>{yTe();dvt();Dvt();Lvt();Fvt();wTe()});var KI,kvt=b(()=>{xTe();KI=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return XE.mutate(t);if(!t)return XE.mutate(new Uint8Array);let r=e.streamCollector(t);return XE.mutate(await r)}});var Mt,STe,$vt=b(()=>{cTe();Su();Mt=class{constructor(){this.middlewareStack=aU()}static classBuilder(){return new STe}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let g of o.bind(this)(d,e,r,n))this.middlewareStack.use(g);let f=e.concat(this.middlewareStack),{logger:p}=r,h={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[eU]:{commandInstance:this,...l},...c},{requestHandler:m}=r;return f.resolve(g=>m.handle(g.request,n||{}),h)}},STe=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 Mt{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 Jne,Bvt=b(()=>{Jne="***SensitiveInformation***"});var Zne,zvt=b(()=>{Zne=(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 SD,BNr,Uvt,zNr,qvt,Hvt,Vvt,CTe,UNr,lU,Mn,Wvt,Kvt,qNr,eW,tW,OTe,Gvt,Jvt,Zvt,ETe=b(()=>{SD=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Zvt.warn(Jvt(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},BNr=Math.ceil(34028234663852886e22),Uvt=t=>{let e=SD(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>BNr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},zNr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},qvt=t=>CTe(t,32),Hvt=t=>CTe(t,16),Vvt=t=>CTe(t,8),CTe=(t,e)=>{let r=zNr(t);if(r!==void 0&&UNr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},UNr=(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]}},lU=(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},Mn=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Zvt.warn(Jvt(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},Wvt=t=>SD(typeof t=="string"?eW(t):t),Kvt=t=>Uvt(typeof t=="string"?eW(t):t),qNr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,eW=t=>{let e=t.match(qNr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},tW=t=>qvt(typeof t=="string"?eW(t):t),OTe=t=>Hvt(typeof t=="string"?eW(t):t),Gvt=t=>Vvt(typeof t=="string"?eW(t):t),Jvt=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),Zvt={warn:console.warn}});var HNr,VNr,Yvt,WNr,Xvt,_Po,vPo,wPo,Yne,Qvt,xPo,KNr,GNr,JNr,CD,ZNr,YNr,PTe,ewt=b(()=>{ETe();HNr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],VNr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Yvt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=VNr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=OTe(PTe(n)),d=CD(o,"month",1,12),f=CD(i,"day",1,31);return Qvt(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},WNr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Xvt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=WNr.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=OTe(PTe(n)),f=CD(o,"month",1,12),p=CD(i,"day",1,31),h=Qvt(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&h.setTime(h.getTime()-YNr(c)),h},_Po=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$/),vPo=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$/),wPo=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})$/),Yne=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Wvt(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))},Qvt=(t,e,r,n)=>{let o=e-1;return GNr(t,o,r),new Date(Date.UTC(t,o,r,CD(n.hours,"hour",0,23),CD(n.minutes,"minute",0,59),CD(n.seconds,"seconds",0,60),ZNr(n.fractionalMilliseconds)))},xPo=50*365*24*60*60*1e3,KNr=[31,28,31,30,31,30,31,31,30,31,30,31],GNr=(t,e,r)=>{let n=KNr[e];if(e===1&&JNr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${HNr[e]} in ${t}: ${r}`)},JNr=t=>t%4===0&&(t%100!==0||t%400===0),CD=(t,e,r,n)=>{let o=Gvt(PTe(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},ZNr=t=>t==null?0:Kvt("0."+t)*1e3,YNr=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},PTe=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var cU,ds,TTe=b(()=>{cU=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}},ds=(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 XNr,Xne,QNr,twt=b(()=>{TTe();XNr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=QNr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw ds(a,e)},Xne=t=>({output:e,parsedBody:r,errorCode:n})=>{XNr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},QNr=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 Qne,rwt=b(()=>{Qne=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 nwt=b(()=>{});var owt,iwt,awt=b(()=>{Su();owt=t=>{let e=[];for(let r in Qz){let n=Qz[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}}},iwt=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var swt,uwt,lwt=b(()=>{swt=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},uwt=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var eoe,toe,cwt=b(()=>{awt();lwt();eoe=t=>({...owt(t),...swt(t)}),toe=t=>({...iwt(t),...uwt(t)})});var dwt=b(()=>{cwt()});function roe(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var ATe=b(()=>{});var fwt=b(()=>{});var ITe,pwt=b(()=>{ITe=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]=ITe(t[r]));return t}});var MTe,mwt=b(()=>{MTe=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};MTe.prototype=Object.create(String.prototype,{constructor:{value:MTe,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(MTe,String)});var rW,ejr,tjr,rjr,hwt=b(()=>{rW=(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=tjr,u=rjr,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)}},tjr=t=>t!=null,rjr=t=>t});var gwt=b(()=>{ATe()});var ywt=b(()=>{});var gr,bwt=b(()=>{gr=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(gr);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=gr(t[r]));return e}return t}});var _wt=b(()=>{});var yr=b(()=>{J_t();Q_t();kvt();$vt();Bvt();zvt();ewt();twt();rwt();nwt();dwt();TTe();ATe();fwt();pwt();mwt();hwt();ETe();gwt();ywt();bwt();_wt()});var vwt,wwt=b(()=>{vwt=t=>t?.body instanceof ReadableStream});var njr,ojr,ijr,ajr,RTe,noe,sjr,xwt=b(()=>{Vne();J5();yr();uw();zN();wwt();uTe();njr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(ojr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=iU.isInstance(c);for(d&&(c.headers[Bne]=dm());;)try{d&&(c.headers[zne]=`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=ijr(f);if(s=sTe(f),d&&vwt(c))throw(r.logger instanceof zI?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 h=a.getRetryDelay();l+=h,await new Promise(m=>setTimeout(m,h))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},ojr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",ijr=t=>{let e={error:t,errorType:ajr(t)},r=sjr(t.$response);return r&&(e.retryAfterHint=r),e},ajr=t=>rU(t)?"THROTTLING":$ne(t)?"TRANSIENT":O_t(t)?"SERVER_ERROR":"CLIENT_ERROR",RTe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},noe=t=>({applyToStack:e=>{e.add(njr(t),RTe)}}),sjr=t=>{if(!Y5.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 ooe=b(()=>{W_t();lTe();K_t();iTe();G_t();aTe();xwt()});var ujr,ioe,Swt=b(()=>{ooe();tTe();ujr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:RTe.name},ioe=t=>({applyToStack:e=>{e.addRelativeTo(__t(t),ujr)}})});var Cwt=b(()=>{tTe();Swt()});var dU,Owt=b(()=>{dU=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 Ewt=b(()=>{K5();Su()});var Pwt=b(()=>{K5()});var fU,Twt=b(()=>{fU=class{async sign(e,r,n){return e}}});var Awt=b(()=>{Ewt();Pwt();Twt()});var ljr,Iwt,NTe,Mwt,Rwt=b(()=>{ljr=t=>e=>NTe(e)&&e.expiration.getTime()-Date.now()<t,Iwt=ljr(3e5),NTe=t=>t.expiration!==void 0,Mwt=(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 Nwt=b(()=>{Owt();Awt();Rwt()});var jwt=b(()=>{Su()});var pU,Dwt=b(()=>{pU=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Lwt=b(()=>{K5();yr()});function jTe(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 cjr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=djr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var cjr,djr,Fwt=b(()=>{cjr=async(t,e,r,...n)=>await e.send(new t(r),...n);djr=(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 GI=b(()=>{l_t();Cwt();Nwt();jwt();Dwt();Lwt();Fwt()});var kwt=b(()=>{});var $wt=b(()=>{kwt()});var Bwt=b(()=>{Su()});var zwt=b(()=>{});var Uwt=b(()=>{});function fjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var aoe,qwt=b(()=>{aoe=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=fjr(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 Hwt=b(()=>{});var Vwt=b(()=>{});var Wwt=b(()=>{});var Kwt=b(()=>{$wt();Bwt();zwt();Uwt();qwt();Hwt();Vwt();Wwt()});function pjr(t){return e=>async r=>{let n=r.request;if(aoe.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Gwt)===-1)try{let a=t(o);n.headers={...n.headers,[Gwt]:String(a)}}catch{}}return e({...r,request:n})}}var Gwt,mjr,soe,DTe=b(()=>{Kwt();Gwt="content-length";mjr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},soe=t=>({applyToStack:e=>{e.add(pjr(t.bodyLengthChecker),mjr)}})});var Jwt=b(()=>{});var Zwt=b(()=>{Jwt()});var Ywt=b(()=>{});var Xwt=b(()=>{Ywt()});var Qwt=b(()=>{Su()});var e0t=b(()=>{});var t0t=b(()=>{});function hjr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var JI,r0t=b(()=>{JI=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=hjr(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 uoe,n0t=b(()=>{uoe=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 o0t=b(()=>{});var i0t=b(()=>{});var nW=b(()=>{Xwt();Qwt();e0t();t0t();r0t();n0t();o0t();i0t()});var LTe,a0t=b(()=>{nW();LTe=t=>uoe.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var loe,FTe=b(()=>{loe=t=>new Date(Date.now()+t)});var s0t,u0t=b(()=>{FTe();s0t=(t,e)=>Math.abs(loe(e).getTime()-t)>=3e5});var kTe,l0t=b(()=>{u0t();kTe=(t,e)=>{let r=Date.parse(t);return s0t(r,e)?r-Date.now():e}});var c0t=b(()=>{a0t();FTe();l0t()});var oW,d0t,OD,f0t=b(()=>{nW();c0t();oW=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},d0t=async t=>{let e=oW("context",t.context),r=oW("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await oW("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},OD=class{async sign(e,r,n){if(!JI.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await d0t(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:loe(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??LTe(r.$response);if(n){let o=oW("config",e.config),i=o.systemClockOffset;o.systemClockOffset=kTe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=LTe(e);if(n){let o=oW("config",r.config);o.systemClockOffset=kTe(n,o.systemClockOffset)}}}});var p0t=b(()=>{GI();GE()});function h0t(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 $Te)e[r/2]=$Te[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function Yb(t){let e="";for(let r=0;r<t.byteLength;r++)e+=m0t[t[r]];return e}var m0t,$Te,iW=b(()=>{m0t={},$Te={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),m0t[t]=e,$Te[e]=t}});var aW,BTe=b(()=>{aW=t=>new TextEncoder().encode(t)});var ZI,g0t=b(()=>{BTe();ZI=t=>typeof t=="string"?aW(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var y0t=b(()=>{});var sW=b(()=>{BTe();g0t();y0t()});var b0t,_0t,zTe,v0t,w0t,UTe,qTe,HTe,VTe,gjr,x0t,S0t,uW,C0t,O0t,E0t,P0t,coe,T0t,A0t,I0t,WTe,M0t,ED=b(()=>{b0t="X-Amz-Algorithm",_0t="X-Amz-Credential",zTe="X-Amz-Date",v0t="X-Amz-SignedHeaders",w0t="X-Amz-Expires",UTe="X-Amz-Signature",qTe="X-Amz-Security-Token",HTe="authorization",VTe=zTe.toLowerCase(),gjr="date",x0t=[HTe,VTe,gjr],S0t=UTe.toLowerCase(),uW="x-amz-content-sha256",C0t=qTe.toLowerCase(),O0t={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},E0t=/^proxy-/,P0t=/^sec-/,coe="AWS4-HMAC-SHA256",T0t="AWS4-HMAC-SHA256-PAYLOAD",A0t="UNSIGNED-PAYLOAD",I0t=50,WTe="aws4_request",M0t=60*60*24*7});var doe,KTe,foe,N0t,R0t,GTe=b(()=>{iW();sW();ED();doe={},KTe=[],foe=(t,e,r)=>`${t}/${e}/${r}/${WTe}`,N0t=async(t,e,r,n,o)=>{let i=await R0t(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Yb(i)}:${e.sessionToken}`;if(a in doe)return doe[a];for(KTe.push(a);KTe.length>I0t;)delete doe[KTe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,WTe])s=await R0t(t,s,u);return doe[a]=s},R0t=(t,e,r)=>{let n=new t(e);return n.update(ZI(r)),n.digest()}});var poe,JTe=b(()=>{ED();poe=({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 O0t||e?.has(i)||E0t.test(i)||P0t.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var ZTe,YTe=b(()=>{Gne();ED();ZTe=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===S0t)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${my(n)}=${my(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${my(n)}=${my(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var j0t,D0t=b(()=>{j0t=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var lW,XTe=b(()=>{D0t();iW();sW();ED();lW=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===uW)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||j0t(e)){let n=new r;return n.update(ZI(e)),Yb(await n.digest())}return A0t}});function F0t(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var moe,L0t,yjr,QTe,k0t=b(()=>{iW();sW();moe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=aW(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=aW(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(QTe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!yjr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(h0t(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"})(L0t||(L0t={}));yjr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,QTe=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&&F0t(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&F0t(e),parseInt(Yb(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var $0t,B0t=b(()=>{$0t=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var eAe,tAe=b(()=>{nW();eAe=(t,e={})=>{let{headers:r,query:n={}}=JI.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 hoe,rAe=b(()=>{nW();ED();hoe=t=>{t=JI.clone(t);for(let e of Object.keys(t.headers))x0t.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var z0t,bjr,U0t=b(()=>{z0t=t=>bjr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),bjr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var cW,goe,q0t,H0t=b(()=>{iW();Jb();Gne();sW();ED();GTe();JTe();YTe();XTe();k0t();B0t();tAe();rAe();U0t();cW=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new moe,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Bf(n),this.credentialProvider=Bf(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}=goe(n);if(o>M0t)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=foe(p,d,l??this.service),m=eAe(hoe(e),{unhoistableHeaders:a});c.sessionToken&&(m.query[qTe]=c.sessionToken),m.query[b0t]=coe,m.query[_0t]=`${c.accessKeyId}/${h}`,m.query[zTe]=f,m.query[w0t]=o.toString(10);let g=poe(m,i,s);return m.query[v0t]=q0t(g),m.query[UTe]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,g,await lW(e,this.sha256))),m}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}=goe(n),c=foe(u,s,a??this.service),d=await lW({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Yb(await f.digest()),h=[T0t,l,c,o,p,d].join(`
`);return this.signString(h,{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}=goe(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(ZI(e)),Yb(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=hoe(e),{longDate:c,shortDate:d}=goe(r),f=foe(d,u,a??this.service);l.headers[VTe]=c,s.sessionToken&&(l.headers[C0t]=s.sessionToken);let p=await lW(l,this.sha256);!$0t(uW,l.headers)&&this.applyChecksum&&(l.headers[uW]=p);let h=poe(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[HTe]=`${coe} Credential=${s.accessKeyId}/${f}, SignedHeaders=${q0t(h)}, Signature=${m}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${ZTe(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(ZI(n));let i=await o.digest();return`${coe}
${e}
${r}
${Yb(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 my(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(ZI(i)),Yb(await a.digest())}getSigningKey(e,r,n,o){return N0t(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")}},goe=t=>{let e=z0t(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},q0t=t=>Object.keys(t).sort().join(";")});var V0t=b(()=>{H0t();JTe();YTe();XTe();tAe();rAe();GTe()});var yoe,W0t=b(()=>{GI();V0t();yoe=t=>{let e;t.credentials&&(e=Mwt(t.credentials,Iwt,NTe)),e||(t.credentialDefaultProvider?e=pU(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=pU(t.signer):t.regionInfoProvider?i=()=>pU(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 pU(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 K0t=b(()=>{f0t();p0t();W0t()});var G0t=b(()=>{K0t()});var J0t=b(()=>{});var Z0t=b(()=>{yr()});var boe,nAe=b(()=>{yr();boe=(t,e)=>KI(t,e).then(r=>e.utf8Encoder(r))});var iu,Y0t,X0t,Q0t=b(()=>{nAe();iu=(t,e)=>boe(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{}}),Y0t=async(t,e)=>{let r=await iu(t,e);return r.message=r.message??r.Message,r},X0t=(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 _oe=x(QE=>{"use strict";var ext=":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",_jr=ext+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",txt="["+ext+"]["+_jr+"]*",vjr=new RegExp("^"+txt+"$"),wjr=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},xjr=function(t){let e=vjr.exec(t);return!(e===null||typeof e>"u")};QE.isExist=function(t){return typeof t<"u"};QE.isEmptyObject=function(t){return Object.keys(t).length===0};QE.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]]}};QE.getValue=function(t){return QE.isExist(t)?t:""};QE.isName=xjr;QE.getAllMatches=wjr;QE.nameRegexp=txt});var iAe=x(axt=>{"use strict";var oAe=_oe(),Sjr={allowBooleanAttributes:!1,unpairedTags:[]};axt.validate=function(t,e){e=Object.assign({},Sjr,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=nxt(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=oxt(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--),!Mjr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",au("InvalidTag",d,Fp(t,i))}let l=Ejr(t,i);if(l===!1)return au("InvalidAttr","Attributes for '"+u+"' have open quote.",Fp(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=ixt(c,e);if(f===!0)n=!0;else return au(f.err.code,f.err.msg,Fp(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return au("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Fp(t,a));if(r.length===0)return au("InvalidTag","Closing tag '"+u+"' has not been opened.",Fp(t,a));{let d=r.pop();if(u!==d.tagName){let f=Fp(t,d.tagStartPos);return au("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",Fp(t,a))}r.length==0&&(o=!0)}}else return au("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Fp(t,i));else{let d=ixt(c,e);if(d!==!0)return au(d.err.code,d.err.msg,Fp(t,i-c.length+d.err.line));if(o===!0)return au("InvalidXml","Multiple possible root nodes found.",Fp(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=oxt(t,i);continue}else if(t[i+1]==="?"){if(i=nxt(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=Ajr(t,i);if(d==-1)return au("InvalidChar","char '&' is not expected.",Fp(t,i));i=d}else if(o===!0&&!rxt(t[i]))return au("InvalidXml","Extra text at the end",Fp(t,i));t[i]==="<"&&i--}}else{if(rxt(t[i]))continue;return au("InvalidChar","char '"+t[i]+"' is not expected.",Fp(t,i))}if(n){if(r.length==1)return au("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Fp(t,r[0].tagStartPos));if(r.length>0)return au("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return au("InvalidXml","Start tag expected.",1);return!0};function rxt(t){return t===" "||t===" "||t===`
`||t==="\r"}function nxt(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 au("InvalidXml","XML declaration allowed only at the start of the document.",Fp(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function oxt(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 Cjr='"',Ojr="'";function Ejr(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===Cjr||t[e]===Ojr)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 Pjr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function ixt(t,e){let r=oAe.getAllMatches(t,Pjr),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return au("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",dW(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return au("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",dW(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return au("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",dW(r[o]));let i=r[o][2];if(!Ijr(i))return au("InvalidAttr","Attribute '"+i+"' is an invalid name.",dW(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return au("InvalidAttr","Attribute '"+i+"' is repeated.",dW(r[o]))}return!0}function Tjr(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 Ajr(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Tjr(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 au(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function Ijr(t){return oAe.isName(t)}function Mjr(t){return oAe.isName(t)}function Fp(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function dW(t){return t.startIndex+t[1].length}});var uxt=x(aAe=>{var sxt={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}},Rjr=function(t){return Object.assign({},sxt,t)};aAe.buildOptions=Rjr;aAe.defaultOptions=sxt});var cxt=x((WMo,lxt)=>{"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})}};lxt.exports=sAe});var fxt=x((KMo,dxt)=>{var Njr=_oe();function jjr(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&&Fjr(t,e))e+=7,[entityName,val,e]=Djr(t,e+1),val.indexOf("&")===-1&&(r[zjr(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&kjr(t,e))e+=8;else if(o&&$jr(t,e))e+=8;else if(o&&Bjr(t,e))e+=9;else if(Ljr)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 Djr(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 Ljr(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Fjr(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 kjr(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 $jr(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 Bjr(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 zjr(t){if(Njr.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}dxt.exports=jjr});var mxt=x((GMo,pxt)=>{var Ujr=/^[-+]?0x[a-fA-F0-9]+$/,qjr=/^([\-\+])?(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 Hjr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Vjr(t,e={}){if(e=Object.assign({},Hjr,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&&Ujr.test(r))return Number.parseInt(r,16);{let n=qjr.exec(r);if(n){let o=n[1],i=n[2],a=Wjr(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 Wjr(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}pxt.exports=Vjr});var yxt=x((JMo,gxt)=>{"use strict";var hxt=_oe(),fW=cxt(),Kjr=fxt(),Gjr=mxt(),uAe=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=Jjr,this.parseXml=eDr,this.parseTextData=Zjr,this.resolveNameSpace=Yjr,this.buildAttributesMap=Qjr,this.isItStopNode=oDr,this.replaceEntitiesValue=rDr,this.readStopNodeData=aDr,this.saveTextToParentTag=nDr,this.addChild=tDr}};function Jjr(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 Zjr(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?cAe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?cAe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Yjr(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 Xjr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Qjr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=hxt.getAllMatches(t,Xjr),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]=cAe(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 fW("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=PD(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=lAe(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 fW(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=PD(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=Kjr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=PD(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=lAe(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 h="";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 g=this.readStopNodeData(t,l,f+1);if(!g)throw new Error(`Unexpected end of ${l}`);i=g.i,h=g.tagContent}let m=new fW(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),h&&(h=this.parseTextData(h,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),m.add(this.options.textNodeName,h),this.addChild(r,m,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 h=new fW(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),o=o.substr(0,o.lastIndexOf("."))}else{let h=new fW(u);this.tagsNodeStack.push(r),u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,h,o),r=h}n="",i=f}}else n+=t[i];return e.child};function tDr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var rDr=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 nDr(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 oDr(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 iDr(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 PD(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function lAe(t,e,r,n=">"){let o=iDr(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 aDr(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=PD(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=PD(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=PD(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=PD(t,"]]>",r,"StopNode is not closed.")-2;else{let i=lAe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function cAe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Gjr(t,r)}else return hxt.isExist(t)?t:""}gxt.exports=uAe});var vxt=x(_xt=>{"use strict";function sDr(t,e){return bxt(t,e)}function bxt(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=uDr(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=bxt(a[s],e,u),c=cDr(l,e);a[":@"]?lDr(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 uDr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function lDr(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 cDr(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))}_xt.prettify=sDr});var xxt=x((YMo,wxt)=>{var{buildOptions:dDr}=uxt(),fDr=yxt(),{prettify:pDr}=vxt(),mDr=iAe(),dAe=class{constructor(e){this.externalEntities={},this.options=dDr(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=mDr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new fDr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:pDr(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}};wxt.exports=dAe});var Pxt=x((XMo,Ext)=>{var hDr=`
`;function gDr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=hDr),Cxt(t,e,"",r)}function Cxt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=yDr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let h=s[u];bDr(l,e)||(h=e.tagValueProcessor(u,h),h=Oxt(h,e)),i&&(o+=n),o+=h,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 h=Sxt(s[":@"],e),m=u==="?xml"?"":n,g=s[u][0][e.textNodeName];g=g.length!==0?" "+g:"",o+=m+`<${u}${g}${h}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=Sxt(s[":@"],e),f=n+`<${u}${d}`,p=Cxt(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 yDr(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 Sxt(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=Oxt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function bDr(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 Oxt(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}Ext.exports=gDr});var Axt=x((QMo,Txt)=>{"use strict";var _Dr=Pxt(),vDr={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 YI(t){this.options=Object.assign({},vDr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=SDr),this.processTextOrObjNode=wDr,this.options.format?(this.indentate=xDr,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}YI.prototype.build=function(t){return this.options.preserveOrder?_Dr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};YI.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}};YI.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 wDr(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)}YI.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}};YI.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};YI.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}};YI.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 xDr(t){return this.options.indentBy.repeat(t)}function SDr(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}Txt.exports=YI});var Mxt=x((eRo,Ixt)=>{"use strict";var CDr=iAe(),ODr=xxt(),EDr=Axt();Ixt.exports={XMLParser:ODr,XMLValidator:CDr,XMLBuilder:EDr}});var Rxt,lw,Nxt,jxt=b(()=>{yr();Rxt=j(Mxt());nAe();lw=(t,e)=>boe(t,e).then(r=>{if(r.length){let n=new Rxt.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]),ITe(s)}return{}}),Nxt=async(t,e)=>{let r=await lw(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var Dxt=b(()=>{J0t();Z0t();Q0t();jxt()});var TD=b(()=>{Zwt();G0t();Dxt()});function PDr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function voe(t){return{schemeId:"smithy.api#noAuth"}}var Lxt,Fxt,kxt,fAe=b(()=>{TD();Jb();Lxt=async(t,e,r)=>({operation:aw(e).operation,region:await Bf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Fxt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(voe(t));break}case"GetId":{e.push(voe(t));break}case"GetOpenIdToken":{e.push(voe(t));break}case"UnlinkIdentity":{e.push(voe(t));break}default:e.push(PDr(t))}return e},kxt=t=>({...yoe(t)})});var $xt,Hr,Oa=b(()=>{$xt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Hr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var zxt,Bxt=b(()=>{zxt={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 pAe,mAe,Uxt,qxt=b(()=>{pAe={name:"SHA-256"},mAe={name:"HMAC",hash:pAe},Uxt=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 mU(){return typeof window<"u"?window:typeof self<"u"?self:ADr}var ADr,hAe=b(()=>{ADr={}});var hU,gAe,yAe=b(()=>{hU=j(one());qxt();hAe();gAe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,hU.isEmptyData)(e)){var r=(0,hU.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 mU().crypto.subtle.sign(mAe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,hU.isEmptyData)(this.toHash)?Promise.resolve(Uxt):Promise.resolve().then(function(){return mU().crypto.subtle.digest(pAe,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){mU().crypto.subtle.importKey("raw",(0,hU.convertToBuffer)(e.secret),mAe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function Hxt(t){if(MDr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return RDr(e)}return!1}function MDr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function RDr(t){return t&&IDr.every(function(e){return typeof t[e]=="function"})}var IDr,Vxt=b(()=>{IDr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var Wxt=b(()=>{Vxt()});var Kxt,Gxt,woe,Jxt=b(()=>{yAe();Kxt=j(xPe());Wxt();hAe();Gxt=j(one()),woe=function(){function t(e){Hxt(mU())?this.hash=new gAe(e):this.hash=new Kxt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Gxt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var bAe=b(()=>{Jxt();yAe()});var vAe=x((pW,_Ae)=>{(function(t,e){typeof pW=="object"&&typeof _Ae=="object"?_Ae.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(h){var m=d-i.getVersionPrecision(h),g=h+new Array(m+1).join(".0");return i.map(g.split("."),function(y){return new Array(20-y.length).join("0")+y}).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 h=d[s];typeof h=="object"&&h!==null&&Object.keys(h).forEach(function(m){l[m]=h[m]})};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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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(h){if(typeof h.test=="function")return h.test(f);if(h.test instanceof Array)return h.test.some(function(m){return f.test(m)});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,h={},m=0,g={},y=0;if(Object.keys(f).forEach(function(I){var N=f[I];typeof N=="string"?(g[I]=N,y+=1):typeof N=="object"&&(h[I]=N,m+=1)}),m>0){var _=Object.keys(h),w=s.default.find(_,function(I){return p.isOS(I)});if(w){var S=this.satisfies(h[w]);if(S!==void 0)return S}var C=s.default.find(_,function(I){return p.isPlatform(I)});if(C){var E=this.satisfies(h[C]);if(E!==void 0)return E}}if(y>0){var P=Object.keys(g),T=s.default.find(P,function(I){return p.isBrowser(I,!0)});if(T!==void 0)return this.compareVersion(g[T])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var h=this.getBrowserName().toLowerCase(),m=f.toLowerCase(),g=s.default.getBrowserTypeByAlias(m);return p&&g&&(m=g.toLowerCase()),m===h},d.compareVersion=function(f){var p=[0],h=f,m=!1,g=this.getBrowserVersion();if(typeof g=="string")return f[0]===">"||f[0]==="<"?(h=f.substr(1),f[1]==="="?(m=!0,h=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?h=f.substr(1):f[0]==="~"&&(m=!0,h=f.substr(1)),p.indexOf(s.default.compareVersions(g,h,m))>-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(h){return p.is(h)})},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 Zxt,xoe,wAe=b(()=>{Zxt=j(vAe()),xoe=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Zxt.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 Yxt=b(()=>{});var Soe,Xxt=b(()=>{Soe=t=>()=>Promise.reject(t)});var xAe=b(()=>{Yxt();Xxt()});var Qxt,Coe,eSt=b(()=>{Qxt=typeof TextEncoder=="function"?new TextEncoder:null,Coe=t=>{if(typeof t=="string"){if(Qxt)return Qxt.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 SAe=b(()=>{eSt()});var CAe,OAe=b(()=>{CAe=t=>new TextEncoder().encode(t)});var tSt=b(()=>{OAe()});var rSt,nSt=b(()=>{rSt=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 oSt=b(()=>{OAe();tSt();nSt()});var mSt,dw,fw,yU,iSt,hW,gU,mW,eP,EAe,aSt,sSt,uSt,hSt,gSt,cw,lSt,cSt,dSt,fSt,pSt,NDr,ySt,bSt=b(()=>{mSt="required",dw="fn",fw="argv",yU="ref",iSt="isSet",hW="booleanEquals",gU="error",mW="endpoint",eP="tree",EAe="PartitionResult",aSt={[mSt]:!1,type:"String"},sSt={[mSt]:!0,default:!1,type:"Boolean"},uSt={[yU]:"Endpoint"},hSt={[dw]:hW,[fw]:[{[yU]:"UseFIPS"},!0]},gSt={[dw]:hW,[fw]:[{[yU]:"UseDualStack"},!0]},cw={},lSt={[dw]:"getAttr",[fw]:[{[yU]:EAe},"supportsFIPS"]},cSt={[dw]:hW,[fw]:[!0,{[dw]:"getAttr",[fw]:[{[yU]:EAe},"supportsDualStack"]}]},dSt=[hSt],fSt=[gSt],pSt=[{[yU]:"Region"}],NDr={version:"1.0",parameters:{Region:aSt,UseDualStack:sSt,UseFIPS:sSt,Endpoint:aSt},rules:[{conditions:[{[dw]:iSt,[fw]:[uSt]}],rules:[{conditions:dSt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:gU},{conditions:fSt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:gU},{endpoint:{url:uSt,properties:cw,headers:cw},type:mW}],type:eP},{conditions:[{[dw]:iSt,[fw]:pSt}],rules:[{conditions:[{[dw]:"aws.partition",[fw]:pSt,assign:EAe}],rules:[{conditions:[hSt,gSt],rules:[{conditions:[{[dw]:hW,[fw]:[!0,lSt]},cSt],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:cw,headers:cw},type:mW}],type:eP},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:gU}],type:eP},{conditions:dSt,rules:[{conditions:[{[dw]:hW,[fw]:[lSt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:cw,headers:cw},type:mW}],type:eP},{error:"FIPS is enabled but this partition does not support FIPS",type:gU}],type:eP},{conditions:fSt,rules:[{conditions:[cSt],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:cw,headers:cw},type:mW}],type:eP},{error:"DualStack is enabled but this partition does not support DualStack",type:gU}],type:eP},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:cw,headers:cw},type:mW}],type:eP}],type:eP},{error:"Invalid Configuration: Missing Region",type:gU}]},ySt=NDr});var _St,vSt=b(()=>{xne();$I();bSt();_St=(t,e={})=>q5(ySt,{endpointParams:t,logger:e.logger});JE.aws=H5});var wSt,xSt=b(()=>{TD();GI();yr();Nne();sU();oSt();fAe();vSt();wSt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??HI,base64Encoder:t?.base64Encoder??VI,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??_St,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Fxt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new OD},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new fU}],logger:t?.logger??new zI,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??BI,utf8Decoder:t?.utf8Decoder??CAe,utf8Encoder:t?.utf8Encoder??rSt})});var SSt,CSt=b(()=>{SSt=["in-region","cross-region","mobile","standard","legacy"]});var OSt,Ooe,jDr,ESt=b(()=>{GE();OSt=j(vAe());CSt();Ooe=({defaultsMode:t}={})=>xht(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(jDr()?"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 ${SSt.join(", ")}, got ${e}`)}}),jDr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?OSt.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var PAe=b(()=>{ESt()});var PSt,TSt=b(()=>{Bxt();bAe();wAe();V5();Q5();xAe();SAe();uw();xSt();yr();PAe();PSt=t=>{let e=Ooe(t),r=()=>e().then(Qne),n=wSt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Coe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??xoe({serviceId:n.serviceId,clientVersion:zxt.version}),maxAttempts:t?.maxAttempts??sw,region:t?.region??Soe("Region is missing"),requestHandler:WI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||G5),sha256:t?.sha256??woe,streamCollector:t?.streamCollector??uU,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Tne)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Ane))}}});var Eoe,Poe,ASt=b(()=>{Eoe=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}}},Poe=t=>({region:t.region()})});var ISt=b(()=>{});var TAe=b(()=>{});var MSt=b(()=>{TAe()});var RSt=b(()=>{MSt();TAe()});var NSt=b(()=>{ISt();RSt()});var AAe=b(()=>{ASt();NSt()});var jSt,DSt,LSt=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()}}},DSt=t=>({httpHandler:t.httpHandler()})});var FSt=b(()=>{LSt()});var kSt=b(()=>{Su()});var $St=b(()=>{});var BSt=b(()=>{});function LDr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Toe,zSt=b(()=>{Toe=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=LDr(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 USt=b(()=>{});var qSt=b(()=>{});var HSt=b(()=>{});var IAe=b(()=>{FSt();kSt();$St();BSt();zSt();USt();qSt();HSt()});var VSt,WSt,KSt=b(()=>{VSt=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}}},WSt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Aoe,GSt,JSt=b(()=>{AAe();IAe();yr();KSt();Aoe=t=>t,GSt=(t,e)=>{let r={...Aoe(Eoe(t)),...Aoe(eoe(t)),...Aoe(jSt(t)),...Aoe(VSt(t))};return e.forEach(n=>n.configure(r)),{...t,...Poe(r),...toe(r),...DSt(r),...WSt(r)}}});var XI,Ioe=b(()=>{EPe();PPe();TPe();VPe();V5();GI();DTe();mo();ooe();yr();fAe();Oa();TSt();JSt();XI=class extends vD{constructor(...[e]){let r=PSt(e||{}),n=$xt(r),o=mne(n),i=Wne(o),a=Mne(i),s=a,u=Lne(s),l=kxt(u),c=GSt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(Ene(this.config)),this.middlewareStack.use(noe(this.config)),this.middlewareStack.use(soe(this.config)),this.middlewareStack.use(cne(this.config)),this.middlewareStack.use(dne(this.config)),this.middlewareStack.use(pne(this.config)),this.middlewareStack.use(Fne(this.config,{httpAuthSchemeParametersProvider:Lxt,identityProviderConfigProvider:async d=>new dU({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(ioe(this.config))}destroy(){super.destroy()}}});var zf,MAe=b(()=>{yr();zf=class t extends cU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Moe,Roe,Noe,joe,Doe,Loe,Foe,koe,$oe,Boe,zoe,RAe=b(()=>{MAe();Moe=class t extends zf{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},Roe=class t extends zf{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Noe=class t extends zf{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},joe=class t extends zf{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Doe=class t extends zf{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Loe=class t extends zf{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Foe=class t extends zf{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},koe=class t extends zf{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},$oe=class t extends zf{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Boe=class t extends zf{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},zoe=class t extends zf{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function ms(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var ZSt,YSt,XSt,QSt,eCt,tCt,rCt,nCt,oCt,iCt,aCt,sCt,uCt,lCt,cCt,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,fs,kDr,$Dr,BDr,zDr,UDr,qDr,HDr,VDr,WDr,KDr,GDr,JDr,ZDr,YDr,UCt,XDr,Oo,QDr,ps,Ua=b(()=>{TD();IAe();yr();MAe();RAe();ZSt=async(t,e)=>{let r=ms("CreateIdentityPool"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},YSt=async(t,e)=>{let r=ms("DeleteIdentities"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},XSt=async(t,e)=>{let r=ms("DeleteIdentityPool"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},QSt=async(t,e)=>{let r=ms("DescribeIdentity"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},eCt=async(t,e)=>{let r=ms("DescribeIdentityPool"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},tCt=async(t,e)=>{let r=ms("GetCredentialsForIdentity"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},rCt=async(t,e)=>{let r=ms("GetId"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},nCt=async(t,e)=>{let r=ms("GetIdentityPoolRoles"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},oCt=async(t,e)=>{let r=ms("GetOpenIdToken"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},iCt=async(t,e)=>{let r=ms("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},aCt=async(t,e)=>{let r=ms("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},sCt=async(t,e)=>{let r=ms("ListIdentities"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},uCt=async(t,e)=>{let r=ms("ListIdentityPools"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},lCt=async(t,e)=>{let r=ms("ListTagsForResource"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},cCt=async(t,e)=>{let r=ms("LookupDeveloperIdentity"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},dCt=async(t,e)=>{let r=ms("MergeDeveloperIdentities"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},fCt=async(t,e)=>{let r=ms("SetIdentityPoolRoles"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},pCt=async(t,e)=>{let r=ms("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},mCt=async(t,e)=>{let r=ms("TagResource"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},hCt=async(t,e)=>{let r=ms("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},gCt=async(t,e)=>{let r=ms("UnlinkIdentity"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},yCt=async(t,e)=>{let r=ms("UntagResource"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},bCt=async(t,e)=>{let r=ms("UpdateIdentityPool"),n;return n=JSON.stringify(gr(t)),ps(e,r,"/",void 0,n)},_Ct=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},vCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},wCt=async(t,e)=>t.statusCode>=300?fs(t,e):(await KI(t.body,e),{$metadata:Oo(t)}),xCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=UCt(r,e),{$metadata:Oo(t),...n}},SCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},CCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=ZDr(r,e),{$metadata:Oo(t),...n}},OCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},ECt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},PCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},TCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},ACt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},ICt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=XDr(r,e),{$metadata:Oo(t),...n}},MCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},RCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},NCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},jCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},DCt=async(t,e)=>t.statusCode>=300?fs(t,e):(await KI(t.body,e),{$metadata:Oo(t)}),LCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},FCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},kCt=async(t,e)=>t.statusCode>=300?fs(t,e):(await KI(t.body,e),{$metadata:Oo(t)}),$Ct=async(t,e)=>t.statusCode>=300?fs(t,e):(await KI(t.body,e),{$metadata:Oo(t)}),BCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},zCt=async(t,e)=>{if(t.statusCode>=300)return fs(t,e);let r=await iu(t.body,e),n={};return n=gr(r),{$metadata:Oo(t),...n}},fs=async(t,e)=>{let r={...t,body:await Y0t(t.body,e)},n=X0t(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await zDr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await qDr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await HDr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await VDr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await WDr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await GDr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await KDr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await BDr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await UDr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await $Dr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await kDr(r,e);default:let o=r.body;return QDr({output:t,parsedBody:o,errorCode:n})}},kDr=async(t,e)=>{let r=t.body,n=gr(r),o=new zoe({$metadata:Oo(t),...n});return ds(o,r)},$Dr=async(t,e)=>{let r=t.body,n=gr(r),o=new Boe({$metadata:Oo(t),...n});return ds(o,r)},BDr=async(t,e)=>{let r=t.body,n=gr(r),o=new koe({$metadata:Oo(t),...n});return ds(o,r)},zDr=async(t,e)=>{let r=t.body,n=gr(r),o=new Moe({$metadata:Oo(t),...n});return ds(o,r)},UDr=async(t,e)=>{let r=t.body,n=gr(r),o=new $oe({$metadata:Oo(t),...n});return ds(o,r)},qDr=async(t,e)=>{let r=t.body,n=gr(r),o=new Roe({$metadata:Oo(t),...n});return ds(o,r)},HDr=async(t,e)=>{let r=t.body,n=gr(r),o=new Noe({$metadata:Oo(t),...n});return ds(o,r)},VDr=async(t,e)=>{let r=t.body,n=gr(r),o=new joe({$metadata:Oo(t),...n});return ds(o,r)},WDr=async(t,e)=>{let r=t.body,n=gr(r),o=new Doe({$metadata:Oo(t),...n});return ds(o,r)},KDr=async(t,e)=>{let r=t.body,n=gr(r),o=new Foe({$metadata:Oo(t),...n});return ds(o,r)},GDr=async(t,e)=>{let r=t.body,n=gr(r),o=new Loe({$metadata:Oo(t),...n});return ds(o,r)},JDr=(t,e)=>rW(t,{AccessKeyId:Mn,Expiration:r=>lU(Yne(SD(r))),SecretKey:Mn,SessionToken:Mn}),ZDr=(t,e)=>rW(t,{Credentials:r=>JDr(r,e),IdentityId:Mn}),YDr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>UCt(n,e)),UCt=(t,e)=>rW(t,{CreationDate:r=>lU(Yne(SD(r))),IdentityId:Mn,LastModifiedDate:r=>lU(Yne(SD(r))),Logins:gr}),XDr=(t,e)=>rW(t,{Identities:r=>YDr(r,e),IdentityPoolId:Mn,NextToken:Mn}),Oo=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"]}),QDr=Xne(zf),ps=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 Toe(l)}});var Uoe,NAe=b(()=>{mo();Co();yr();Oa();Ua();Uoe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(ZSt).de(_Ct).build(){}});var qoe,jAe=b(()=>{mo();Co();yr();Oa();Ua();qoe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(YSt).de(vCt).build(){}});var Hoe,DAe=b(()=>{mo();Co();yr();Oa();Ua();Hoe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(XSt).de(wCt).build(){}});var Voe,LAe=b(()=>{mo();Co();yr();Oa();Ua();Voe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(QSt).de(xCt).build(){}});var Woe,FAe=b(()=>{mo();Co();yr();Oa();Ua();Woe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(eCt).de(SCt).build(){}});var bU,kAe=b(()=>{mo();Co();yr();Oa();Ua();bU=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(tCt).de(CCt).build(){}});var _U,$Ae=b(()=>{mo();Co();yr();Oa();Ua();_U=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(rCt).de(OCt).build(){}});var Koe,BAe=b(()=>{mo();Co();yr();Oa();Ua();Koe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(nCt).de(ECt).build(){}});var Goe,zAe=b(()=>{mo();Co();yr();Oa();Ua();Goe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(oCt).de(PCt).build(){}});var Joe,UAe=b(()=>{mo();Co();yr();Oa();Ua();Joe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(iCt).de(TCt).build(){}});var Zoe,qAe=b(()=>{mo();Co();yr();Oa();Ua();Zoe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(aCt).de(ACt).build(){}});var Yoe,HAe=b(()=>{mo();Co();yr();Oa();Ua();Yoe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(sCt).de(ICt).build(){}});var vU,Xoe=b(()=>{mo();Co();yr();Oa();Ua();vU=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(uCt).de(MCt).build(){}});var Qoe,VAe=b(()=>{mo();Co();yr();Oa();Ua();Qoe=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(lCt).de(RCt).build(){}});var eie,WAe=b(()=>{mo();Co();yr();Oa();Ua();eie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(cCt).de(NCt).build(){}});var tie,KAe=b(()=>{mo();Co();yr();Oa();Ua();tie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(dCt).de(jCt).build(){}});var rie,GAe=b(()=>{mo();Co();yr();Oa();Ua();rie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(fCt).de(DCt).build(){}});var nie,JAe=b(()=>{mo();Co();yr();Oa();Ua();nie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(pCt).de(LCt).build(){}});var oie,ZAe=b(()=>{mo();Co();yr();Oa();Ua();oie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(mCt).de(FCt).build(){}});var iie,YAe=b(()=>{mo();Co();yr();Oa();Ua();iie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(hCt).de(kCt).build(){}});var aie,XAe=b(()=>{mo();Co();yr();Oa();Ua();aie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(gCt).de($Ct).build(){}});var sie,QAe=b(()=>{mo();Co();yr();Oa();Ua();sie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(yCt).de(BCt).build(){}});var uie,eIe=b(()=>{mo();Co();yr();Oa();Ua();uie=class extends Mt.classBuilder().ep({...Hr}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(bCt).de(zCt).build(){}});var eLr,tIe,qCt=b(()=>{yr();Ioe();NAe();jAe();DAe();LAe();FAe();kAe();$Ae();BAe();zAe();UAe();qAe();HAe();Xoe();VAe();WAe();KAe();GAe();JAe();ZAe();YAe();XAe();QAe();eIe();eLr={CreateIdentityPoolCommand:Uoe,DeleteIdentitiesCommand:qoe,DeleteIdentityPoolCommand:Hoe,DescribeIdentityCommand:Voe,DescribeIdentityPoolCommand:Woe,GetCredentialsForIdentityCommand:bU,GetIdCommand:_U,GetIdentityPoolRolesCommand:Koe,GetOpenIdTokenCommand:Goe,GetOpenIdTokenForDeveloperIdentityCommand:Joe,GetPrincipalTagAttributeMapCommand:Zoe,ListIdentitiesCommand:Yoe,ListIdentityPoolsCommand:vU,ListTagsForResourceCommand:Qoe,LookupDeveloperIdentityCommand:eie,MergeDeveloperIdentitiesCommand:tie,SetIdentityPoolRolesCommand:rie,SetPrincipalTagAttributeMapCommand:nie,TagResourceCommand:oie,UnlinkDeveloperIdentityCommand:iie,UnlinkIdentityCommand:aie,UntagResourceCommand:sie,UpdateIdentityPoolCommand:uie},tIe=class extends XI{};Zne(eLr,tIe)});var HCt=b(()=>{NAe();jAe();DAe();LAe();FAe();kAe();$Ae();BAe();zAe();UAe();qAe();HAe();Xoe();VAe();WAe();KAe();GAe();JAe();ZAe();YAe();XAe();QAe();eIe()});var VCt=b(()=>{});var pFo,WCt=b(()=>{GI();Ioe();Xoe();pFo=jTe(XI,vU,"NextToken","NextToken","MaxResults")});var KCt=b(()=>{VCt();WCt()});var GCt=b(()=>{RAe()});var JCt=b(()=>{Ioe();qCt();HCt();KCt();GCt()});var rIe={};os(rIe,{CognitoIdentityClient:()=>XI,GetCredentialsForIdentityCommand:()=>bU,GetIdCommand:()=>_U});var nIe=b(()=>{JCt()});function lie(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(nIe(),rIe)),{Credentials:{AccessKeyId:n=tLr(t.logger),Expiration:o,SecretKey:i=nLr(t.logger),SessionToken:a}=rLr(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 une(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function tLr(t){throw new cc("Response from Amazon Cognito contained no access key ID",{logger:t})}function rLr(t){throw new cc("Response from Amazon Cognito contained no credentials",{logger:t})}function nLr(t){throw new cc("Response from Amazon Cognito contained no secret key",{logger:t})}var oIe=b(()=>{GE();SPe()});var iIe,cie,ZCt=b(()=>{iIe="IdentityIds",cie=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(iIe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(iIe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(iIe)))}).catch(i=>{throw n.close(),i})})}}});var die,YCt=b(()=>{die=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 XCt(){return typeof self=="object"&&self.indexedDB?new cie:typeof window=="object"&&window.localStorage?window.localStorage:oLr}var oLr,QCt=b(()=>{ZCt();YCt();oLr=new die});function eOt({accountId:t,cache:e=XCt(),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(()=>(nIe(),rIe)),h=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),m=c&&await e.getItem(c);if(!m){let{IdentityId:g=iLr(u)}=await h.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await une(a):void 0}));m=g,c&&Promise.resolve(e.setItem(c,m)).catch(()=>{})}return d=lie({client:h,customRoleArn:o,logins:a,identityId:m}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function iLr(t){throw new cc("Response from Amazon Cognito contained no identity ID",{logger:t})}var tOt=b(()=>{GE();oIe();QCt();SPe()});var aIe=b(()=>{hht();ght();yht();oIe();tOt()});var aLr,rOt=b(()=>{aIe();aLr=t=>lie({...t})});var sLr,nOt=b(()=>{aIe();sLr=t=>eOt({...t})});var uLr,lLr,cLr,oOt,iOt=b(()=>{GE();uLr="169.254.170.2",lLr="169.254.170.23",cLr="[fd00:ec2::23]",oOt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===uLr||t.hostname===lLr||t.hostname===cLr)){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 cc(`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 aOt=b(()=>{});var sOt=b(()=>{aOt()});var uOt=b(()=>{Su()});var lOt=b(()=>{});var cOt=b(()=>{});function dLr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var fie,dOt=b(()=>{fie=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=dLr(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 fOt=b(()=>{});var pOt=b(()=>{});var mOt=b(()=>{});var hOt=b(()=>{sOt();uOt();lOt();cOt();dOt();fOt();pOt();mOt()});function gOt(t){return new fie({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 yOt(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 cc("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:Yvt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new cc(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new cc(`Server responded with status: ${t.statusCode}`,{logger:e})}var bOt=b(()=>{GE();hOt();yr();xTe()});var _Ot,vOt=b(()=>{_Ot=(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,wOt=b(()=>{Q5();GE();iOt();bOt();vOt();sIe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new cc("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);oOt(n,t.logger);let o=new WI;return _Ot(async()=>{let i=gOt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return yOt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var xOt=b(()=>{wOt()});function fLr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function SOt(t){return{schemeId:"smithy.api#noAuth"}}var COt,OOt,pLr,EOt,uIe=b(()=>{TD();Jb();gW();COt=async(t,e,r)=>({operation:aw(e).operation,region:await Bf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});OOt=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(SOt(t));break}case"AssumeRoleWithWebIdentity":{e.push(SOt(t));break}default:e.push(fLr(t))}return e},pLr=t=>({...t,stsClientCtor:hy}),EOt=t=>{let e=pLr(t);return{...yoe(e)}}});var POt,Uf,pw=b(()=>{POt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Uf={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 AOt,TOt=b(()=>{AOt={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 lIe,cIe=b(()=>{lIe=t=>new TextEncoder().encode(t)});var IOt=b(()=>{cIe()});var MOt,ROt=b(()=>{MOt=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 NOt=b(()=>{cIe();IOt();ROt()});var HOt,Sn,zo,Uo,eM,QI,Md,VOt,WOt,KOt,qa,jOt,mw,wU,fIe,DOt,dIe,GOt,LOt,Rd,FOt,JOt,ZOt,qf,Gh,kOt,YOt,XOt,$Ot,QOt,BOt,zOt,UOt,qOt,hLr,eEt,tEt=b(()=>{HOt="required",Sn="type",zo="fn",Uo="argv",eM="ref",QI="booleanEquals",Md="stringEquals",VOt="sigv4",WOt="sts",KOt="us-east-1",qa="endpoint",jOt="https://sts.{Region}.{PartitionResult#dnsSuffix}",mw="tree",wU="error",fIe="getAttr",DOt={[HOt]:!1,[Sn]:"String"},dIe={[HOt]:!0,default:!1,[Sn]:"Boolean"},GOt={[eM]:"Endpoint"},LOt={[zo]:"isSet",[Uo]:[{[eM]:"Region"}]},Rd={[eM]:"Region"},FOt={[zo]:"aws.partition",[Uo]:[Rd],assign:"PartitionResult"},JOt={[eM]:"UseFIPS"},ZOt={[eM]:"UseDualStack"},qf={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:VOt,signingName:WOt,signingRegion:KOt}]},headers:{}},Gh={},kOt={conditions:[{[zo]:Md,[Uo]:[Rd,"aws-global"]}],[qa]:qf,[Sn]:qa},YOt={[zo]:QI,[Uo]:[JOt,!0]},XOt={[zo]:QI,[Uo]:[ZOt,!0]},$Ot={[zo]:fIe,[Uo]:[{[eM]:"PartitionResult"},"supportsFIPS"]},QOt={[eM]:"PartitionResult"},BOt={[zo]:QI,[Uo]:[!0,{[zo]:fIe,[Uo]:[QOt,"supportsDualStack"]}]},zOt=[{[zo]:"isSet",[Uo]:[GOt]}],UOt=[YOt],qOt=[XOt],hLr={version:"1.0",parameters:{Region:DOt,UseDualStack:dIe,UseFIPS:dIe,Endpoint:DOt,UseGlobalEndpoint:dIe},rules:[{conditions:[{[zo]:QI,[Uo]:[{[eM]:"UseGlobalEndpoint"},!0]},{[zo]:"not",[Uo]:zOt},LOt,FOt,{[zo]:QI,[Uo]:[JOt,!1]},{[zo]:QI,[Uo]:[ZOt,!1]}],rules:[{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-northeast-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-south-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-southeast-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"ap-southeast-2"]}],endpoint:qf,[Sn]:qa},kOt,{conditions:[{[zo]:Md,[Uo]:[Rd,"ca-central-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-central-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-north-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-west-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-west-2"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"eu-west-3"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"sa-east-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,KOt]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"us-east-2"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"us-west-1"]}],endpoint:qf,[Sn]:qa},{conditions:[{[zo]:Md,[Uo]:[Rd,"us-west-2"]}],endpoint:qf,[Sn]:qa},{endpoint:{url:jOt,properties:{authSchemes:[{name:VOt,signingName:WOt,signingRegion:"{Region}"}]},headers:Gh},[Sn]:qa}],[Sn]:mw},{conditions:zOt,rules:[{conditions:UOt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Sn]:wU},{conditions:qOt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Sn]:wU},{endpoint:{url:GOt,properties:Gh,headers:Gh},[Sn]:qa}],[Sn]:mw},{conditions:[LOt],rules:[{conditions:[FOt],rules:[{conditions:[YOt,XOt],rules:[{conditions:[{[zo]:QI,[Uo]:[!0,$Ot]},BOt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gh,headers:Gh},[Sn]:qa}],[Sn]:mw},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Sn]:wU}],[Sn]:mw},{conditions:UOt,rules:[{conditions:[{[zo]:QI,[Uo]:[$Ot,!0]}],rules:[{conditions:[{[zo]:Md,[Uo]:[{[zo]:fIe,[Uo]:[QOt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Gh,headers:Gh},[Sn]:qa},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Gh,headers:Gh},[Sn]:qa}],[Sn]:mw},{error:"FIPS is enabled but this partition does not support FIPS",[Sn]:wU}],[Sn]:mw},{conditions:qOt,rules:[{conditions:[BOt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Gh,headers:Gh},[Sn]:qa}],[Sn]:mw},{error:"DualStack is enabled but this partition does not support DualStack",[Sn]:wU}],[Sn]:mw},kOt,{endpoint:{url:jOt,properties:Gh,headers:Gh},[Sn]:qa}],[Sn]:mw}],[Sn]:mw},{error:"Invalid Configuration: Missing Region",[Sn]:wU}]},eEt=hLr});var rEt,nEt=b(()=>{xne();$I();tEt();rEt=(t,e={})=>q5(eEt,{endpointParams:t,logger:e.logger});JE.aws=H5});var oEt,iEt=b(()=>{TD();GI();yr();Nne();sU();NOt();uIe();nEt();oEt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??HI,base64Encoder:t?.base64Encoder??VI,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??rEt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??OOt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new OD},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new fU}],logger:t?.logger??new zI,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??BI,utf8Decoder:t?.utf8Decoder??lIe,utf8Encoder:t?.utf8Encoder??MOt})});var aEt,sEt=b(()=>{TOt();bAe();wAe();V5();Q5();xAe();SAe();uw();iEt();yr();PAe();aEt=t=>{let e=Ooe(t),r=()=>e().then(Qne),n=oEt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Coe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??xoe({serviceId:n.serviceId,clientVersion:AOt.version}),maxAttempts:t?.maxAttempts??sw,region:t?.region??Soe("Region is missing"),requestHandler:WI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||G5),sha256:t?.sha256??woe,streamCollector:t?.streamCollector??uU,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Tne)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Ane))}}});var uEt,lEt,cEt=b(()=>{uEt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},lEt=t=>({httpHandler:t.httpHandler()})});var dEt=b(()=>{cEt()});var fEt=b(()=>{Su()});var pEt=b(()=>{});var mEt=b(()=>{});function gLr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var pie,hEt=b(()=>{pie=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=gLr(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 gEt=b(()=>{});var yEt=b(()=>{});var bEt=b(()=>{});var pIe=b(()=>{dEt();fEt();pEt();mEt();hEt();gEt();yEt();bEt()});var _Et,vEt,wEt=b(()=>{_Et=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}}},vEt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var mie,xEt,SEt=b(()=>{AAe();pIe();yr();wEt();mie=t=>t,xEt=(t,e)=>{let r={...mie(Eoe(t)),...mie(eoe(t)),...mie(uEt(t)),...mie(_Et(t))};return e.forEach(n=>n.configure(r)),{...t,...Poe(r),...toe(r),...lEt(r),...vEt(r)}}});var hy,gW=b(()=>{EPe();PPe();TPe();VPe();V5();GI();DTe();mo();ooe();yr();uIe();pw();sEt();SEt();hy=class extends vD{constructor(...[e]){let r=aEt(e||{}),n=POt(r),o=mne(n),i=Wne(o),a=Mne(i),s=a,u=Lne(s),l=EOt(u),c=xEt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(Ene(this.config)),this.middlewareStack.use(noe(this.config)),this.middlewareStack.use(soe(this.config)),this.middlewareStack.use(cne(this.config)),this.middlewareStack.use(dne(this.config)),this.middlewareStack.use(pne(this.config)),this.middlewareStack.use(Fne(this.config,{httpAuthSchemeParametersProvider:COt,identityProviderConfigProvider:async d=>new dU({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(ioe(this.config))}destroy(){super.destroy()}}});var kp,hie=b(()=>{yr();kp=class t extends cU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var yW,bW,_W,vW,wW,xW,SW,CW,xU,mIe,hIe,gIe,yIe,bIe,_Ie,vIe,tM=b(()=>{yr();hie();yW=class t extends kp{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bW=class t extends kp{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_W=class t extends kp{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},vW=class t extends kp{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},wW=class t extends kp{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},xW=class t extends kp{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},SW=class t extends kp{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},CW=class t extends kp{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},xU=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:Jne}}),mIe=t=>({...t,...t.Credentials&&{Credentials:xU(t.Credentials)}}),hIe=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:Jne}}),gIe=t=>({...t,...t.Credentials&&{Credentials:xU(t.Credentials)}}),yIe=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:Jne}}),bIe=t=>({...t,...t.Credentials&&{Credentials:xU(t.Credentials)}}),_Ie=t=>({...t,...t.Credentials&&{Credentials:xU(t.Credentials)}}),vIe=t=>({...t,...t.Credentials&&{Credentials:xU(t.Credentials)}})});var CEt,OEt,EEt,PEt,TEt,AEt,IEt,MEt,REt,NEt,jEt,DEt,LEt,FEt,kEt,$Et,rM,yLr,bLr,_Lr,vLr,wLr,xLr,SLr,CLr,OLr,ELr,PLr,TLr,ALr,ILr,MLr,RLr,gie,NLr,jLr,DLr,LLr,FLr,BEt,JIe,kLr,$Lr,BLr,OW,zLr,ULr,qLr,HLr,VLr,WLr,KLr,GLr,JLr,ZLr,YLr,XLr,QLr,eFr,Hf,tFr,nM,oM,iM,aM,SU,rFr,wIe,tP,nFr,oFr,CU,rP,OU,$p,xIe,iFr,SIe,Bp,CIe,OIe,EIe,PIe,TIe,aFr,sFr,uFr,lFr,AIe,IIe,MIe,RIe,gy,yy,NIe,jIe,DIe,LIe,by,FIe,nP,EU,kIe,$Ie,BIe,zIe,_y,PU,UIe,qIe,TU,AU,HIe,VIe,sM,WIe,KIe,GIe,Ha,uM,cFr,oP=b(()=>{TD();pIe();yr();tM();hie();CEt=async(t,e)=>{let r=oM,n;return n=uM({...OLr(t,e),[aM]:rFr,[sM]:iM}),nM(e,r,"/",void 0,n)},OEt=async(t,e)=>{let r=oM,n;return n=uM({...ELr(t,e),[aM]:nFr,[sM]:iM}),nM(e,r,"/",void 0,n)},EEt=async(t,e)=>{let r=oM,n;return n=uM({...PLr(t,e),[aM]:oFr,[sM]:iM}),nM(e,r,"/",void 0,n)},PEt=async(t,e)=>{let r=oM,n;return n=uM({...TLr(t,e),[aM]:iFr,[sM]:iM}),nM(e,r,"/",void 0,n)},TEt=async(t,e)=>{let r=oM,n;return n=uM({...ALr(t,e),[aM]:aFr,[sM]:iM}),nM(e,r,"/",void 0,n)},AEt=async(t,e)=>{let r=oM,n;return n=uM({...ILr(t,e),[aM]:sFr,[sM]:iM}),nM(e,r,"/",void 0,n)},IEt=async(t,e)=>{let r=oM,n;return n=uM({...MLr(t,e),[aM]:uFr,[sM]:iM}),nM(e,r,"/",void 0,n)},MEt=async(t,e)=>{let r=oM,n;return n=uM({...RLr(t,e),[aM]:lFr,[sM]:iM}),nM(e,r,"/",void 0,n)},REt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=kLr(r.AssumeRoleResult,e),{$metadata:Hf(t),...n}},NEt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=$Lr(r.AssumeRoleWithSAMLResult,e),{$metadata:Hf(t),...n}},jEt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=BLr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Hf(t),...n}},DEt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=zLr(r.DecodeAuthorizationMessageResult,e),{$metadata:Hf(t),...n}},LEt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=HLr(r.GetAccessKeyInfoResult,e),{$metadata:Hf(t),...n}},FEt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=VLr(r.GetCallerIdentityResult,e),{$metadata:Hf(t),...n}},kEt=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=WLr(r.GetFederationTokenResult,e),{$metadata:Hf(t),...n}},$Et=async(t,e)=>{if(t.statusCode>=300)return rM(t,e);let r=await lw(t.body,e),n={};return n=KLr(r.GetSessionTokenResult,e),{$metadata:Hf(t),...n}},rM=async(t,e)=>{let r={...t,body:await Nxt(t.body,e)},n=cFr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await yLr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await xLr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await SLr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await CLr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await _Lr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await wLr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await bLr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await vLr(r,e);default:let o=r.body;return tFr({output:t,parsedBody:o.Error,errorCode:n})}},yLr=async(t,e)=>{let r=t.body,n=ULr(r.Error,e),o=new yW({$metadata:Hf(t),...n});return ds(o,r)},bLr=async(t,e)=>{let r=t.body,n=GLr(r.Error,e),o=new SW({$metadata:Hf(t),...n});return ds(o,r)},_Lr=async(t,e)=>{let r=t.body,n=JLr(r.Error,e),o=new wW({$metadata:Hf(t),...n});return ds(o,r)},vLr=async(t,e)=>{let r=t.body,n=ZLr(r.Error,e),o=new CW({$metadata:Hf(t),...n});return ds(o,r)},wLr=async(t,e)=>{let r=t.body,n=YLr(r.Error,e),o=new xW({$metadata:Hf(t),...n});return ds(o,r)},xLr=async(t,e)=>{let r=t.body,n=XLr(r.Error,e),o=new bW({$metadata:Hf(t),...n});return ds(o,r)},SLr=async(t,e)=>{let r=t.body,n=QLr(r.Error,e),o=new _W({$metadata:Hf(t),...n});return ds(o,r)},CLr=async(t,e)=>{let r=t.body,n=eFr(r.Error,e),o=new vW({$metadata:Hf(t),...n});return ds(o,r)},OLr=(t,e)=>{let r={};if(t[nP]!=null&&(r[nP]=t[nP]),t[EU]!=null&&(r[EU]=t[EU]),t[yy]!=null){let n=gie(t[yy],e);t[yy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[gy]!=null&&(r[gy]=t[gy]),t[Bp]!=null&&(r[Bp]=t[Bp]),t[TU]!=null){let n=BEt(t[TU],e);t[TU]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[HIe]!=null){let n=FLr(t[HIe],e);t[HIe]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[OIe]!=null&&(r[OIe]=t[OIe]),t[PU]!=null&&(r[PU]=t[PU]),t[AU]!=null&&(r[AU]=t[AU]),t[_y]!=null&&(r[_y]=t[_y]),t[DIe]!=null){let n=DLr(t[DIe],e);t[DIe]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},ELr=(t,e)=>{let r={};if(t[nP]!=null&&(r[nP]=t[nP]),t[NIe]!=null&&(r[NIe]=t[NIe]),t[BIe]!=null&&(r[BIe]=t[BIe]),t[yy]!=null){let n=gie(t[yy],e);t[yy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[gy]!=null&&(r[gy]=t[gy]),t[Bp]!=null&&(r[Bp]=t[Bp]),r},PLr=(t,e)=>{let r={};if(t[nP]!=null&&(r[nP]=t[nP]),t[EU]!=null&&(r[EU]=t[EU]),t[KIe]!=null&&(r[KIe]=t[KIe]),t[LIe]!=null&&(r[LIe]=t[LIe]),t[yy]!=null){let n=gie(t[yy],e);t[yy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[gy]!=null&&(r[gy]=t[gy]),t[Bp]!=null&&(r[Bp]=t[Bp]),r},TLr=(t,e)=>{let r={};return t[EIe]!=null&&(r[EIe]=t[EIe]),r},ALr=(t,e)=>{let r={};return t[SU]!=null&&(r[SU]=t[SU]),r},ILr=(t,e)=>({}),MLr=(t,e)=>{let r={};if(t[MIe]!=null&&(r[MIe]=t[MIe]),t[gy]!=null&&(r[gy]=t[gy]),t[yy]!=null){let n=gie(t[yy],e);t[yy]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Bp]!=null&&(r[Bp]=t[Bp]),t[TU]!=null){let n=BEt(t[TU],e);t[TU]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},RLr=(t,e)=>{let r={};return t[Bp]!=null&&(r[Bp]=t[Bp]),t[PU]!=null&&(r[PU]=t[PU]),t[AU]!=null&&(r[AU]=t[AU]),r},gie=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=NLr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},NLr=(t,e)=>{let r={};return t[GIe]!=null&&(r[GIe]=t[GIe]),r},jLr=(t,e)=>{let r={};return t[jIe]!=null&&(r[jIe]=t[jIe]),t[xIe]!=null&&(r[xIe]=t[xIe]),r},DLr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=jLr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},LLr=(t,e)=>{let r={};return t[IIe]!=null&&(r[IIe]=t[IIe]),t[WIe]!=null&&(r[WIe]=t[WIe]),r},FLr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},BEt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=LLr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},JIe=(t,e)=>{let r={};return t[wIe]!=null&&(r[wIe]=Mn(t[wIe])),t[rP]!=null&&(r[rP]=Mn(t[rP])),r},kLr=(t,e)=>{let r={};return t[$p]!=null&&(r[$p]=OW(t[$p],e)),t[tP]!=null&&(r[tP]=JIe(t[tP],e)),t[by]!=null&&(r[by]=tW(t[by])),t[_y]!=null&&(r[_y]=Mn(t[_y])),r},$Lr=(t,e)=>{let r={};return t[$p]!=null&&(r[$p]=OW(t[$p],e)),t[tP]!=null&&(r[tP]=JIe(t[tP],e)),t[by]!=null&&(r[by]=tW(t[by])),t[kIe]!=null&&(r[kIe]=Mn(t[kIe])),t[UIe]!=null&&(r[UIe]=Mn(t[UIe])),t[AIe]!=null&&(r[AIe]=Mn(t[AIe])),t[OU]!=null&&(r[OU]=Mn(t[OU])),t[RIe]!=null&&(r[RIe]=Mn(t[RIe])),t[_y]!=null&&(r[_y]=Mn(t[_y])),r},BLr=(t,e)=>{let r={};return t[$p]!=null&&(r[$p]=OW(t[$p],e)),t[zIe]!=null&&(r[zIe]=Mn(t[zIe])),t[tP]!=null&&(r[tP]=JIe(t[tP],e)),t[by]!=null&&(r[by]=tW(t[by])),t[FIe]!=null&&(r[FIe]=Mn(t[FIe])),t[OU]!=null&&(r[OU]=Mn(t[OU])),t[_y]!=null&&(r[_y]=Mn(t[_y])),r},OW=(t,e)=>{let r={};return t[SU]!=null&&(r[SU]=Mn(t[SU])),t[$Ie]!=null&&(r[$Ie]=Mn(t[$Ie])),t[qIe]!=null&&(r[qIe]=Mn(t[qIe])),t[CIe]!=null&&(r[CIe]=lU(Xvt(t[CIe]))),r},zLr=(t,e)=>{let r={};return t[SIe]!=null&&(r[SIe]=Mn(t[SIe])),r},ULr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},qLr=(t,e)=>{let r={};return t[TIe]!=null&&(r[TIe]=Mn(t[TIe])),t[rP]!=null&&(r[rP]=Mn(t[rP])),r},HLr=(t,e)=>{let r={};return t[CU]!=null&&(r[CU]=Mn(t[CU])),r},VLr=(t,e)=>{let r={};return t[VIe]!=null&&(r[VIe]=Mn(t[VIe])),t[CU]!=null&&(r[CU]=Mn(t[CU])),t[rP]!=null&&(r[rP]=Mn(t[rP])),r},WLr=(t,e)=>{let r={};return t[$p]!=null&&(r[$p]=OW(t[$p],e)),t[PIe]!=null&&(r[PIe]=qLr(t[PIe],e)),t[by]!=null&&(r[by]=tW(t[by])),r},KLr=(t,e)=>{let r={};return t[$p]!=null&&(r[$p]=OW(t[$p],e)),r},GLr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},JLr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},ZLr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},YLr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},XLr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},QLr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},eFr=(t,e)=>{let r={};return t[Ha]!=null&&(r[Ha]=Mn(t[Ha])),r},Hf=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"]}),tFr=Xne(kp),nM=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 pie(l)},oM={"content-type":"application/x-www-form-urlencoded"},iM="2011-06-15",aM="Action",SU="AccessKeyId",rFr="AssumeRole",wIe="AssumedRoleId",tP="AssumedRoleUser",nFr="AssumeRoleWithSAML",oFr="AssumeRoleWithWebIdentity",CU="Account",rP="Arn",OU="Audience",$p="Credentials",xIe="ContextAssertion",iFr="DecodeAuthorizationMessage",SIe="DecodedMessage",Bp="DurationSeconds",CIe="Expiration",OIe="ExternalId",EIe="EncodedMessage",PIe="FederatedUser",TIe="FederatedUserId",aFr="GetAccessKeyInfo",sFr="GetCallerIdentity",uFr="GetFederationToken",lFr="GetSessionToken",AIe="Issuer",IIe="Key",MIe="Name",RIe="NameQualifier",gy="Policy",yy="PolicyArns",NIe="PrincipalArn",jIe="ProviderArn",DIe="ProvidedContexts",LIe="ProviderId",by="PackedPolicySize",FIe="Provider",nP="RoleArn",EU="RoleSessionName",kIe="Subject",$Ie="SecretAccessKey",BIe="SAMLAssertion",zIe="SubjectFromWebIdentityToken",_y="SourceIdentity",PU="SerialNumber",UIe="SubjectType",qIe="SessionToken",TU="Tags",AU="TokenCode",HIe="TransitiveTagKeys",VIe="UserId",sM="Version",WIe="Value",KIe="WebIdentityToken",GIe="arn",Ha="message",uM=t=>Object.entries(t).map(([e,r])=>roe(e)+"="+roe(r)).join("&"),cFr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var iP,yie=b(()=>{mo();Co();yr();pw();tM();oP();iP=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,mIe).ser(CEt).de(REt).build(){}});var EW,ZIe=b(()=>{mo();Co();yr();pw();tM();oP();EW=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(hIe,gIe).ser(OEt).de(NEt).build(){}});var AD,bie=b(()=>{mo();Co();yr();pw();tM();oP();AD=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(yIe,bIe).ser(EEt).de(jEt).build(){}});var PW,YIe=b(()=>{mo();Co();yr();pw();oP();PW=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(PEt).de(DEt).build(){}});var TW,XIe=b(()=>{mo();Co();yr();pw();oP();TW=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(TEt).de(LEt).build(){}});var AW,QIe=b(()=>{mo();Co();yr();pw();oP();AW=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(AEt).de(FEt).build(){}});var IW,eMe=b(()=>{mo();Co();yr();pw();tM();oP();IW=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,_Ie).ser(IEt).de(kEt).build(){}});var MW,tMe=b(()=>{mo();Co();yr();pw();tM();oP();MW=class extends Mt.classBuilder().ep({...Uf}).m(function(e,r,n,o){return[zt(n,this.serialize,this.deserialize),Ut(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,vIe).ser(MEt).de($Et).build(){}});var dFr,_ie,zEt=b(()=>{yr();yie();ZIe();bie();YIe();XIe();QIe();eMe();tMe();gW();dFr={AssumeRoleCommand:iP,AssumeRoleWithSAMLCommand:EW,AssumeRoleWithWebIdentityCommand:AD,DecodeAuthorizationMessageCommand:PW,GetAccessKeyInfoCommand:TW,GetCallerIdentityCommand:AW,GetFederationTokenCommand:IW,GetSessionTokenCommand:MW},_ie=class extends hy{};Zne(dFr,_ie)});var UEt=b(()=>{yie();ZIe();bie();YIe();XIe();QIe();eMe();tMe()});var qEt=b(()=>{tM()});var HEt,VEt,WEt,KEt,GEt,JEt,ZEt=b(()=>{yie();bie();HEt="us-east-1",VEt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},WEt=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)`,`${HEt} (STS default)`),n??o??HEt},KEt=(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 WEt(c,t?.parentClientConfig?.region,f),h=!JEt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:h?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new iP(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=VEt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},GEt=(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 WEt(u,t?.parentClientConfig?.region,c),f=!JEt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new AD(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=VEt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},JEt=t=>t?.metadata?.handlerProtocol==="h2"});var YEt,XEt,QEt,fFr,ePt=b(()=>{ZEt();gW();YEt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,XEt=(t={},e)=>KEt(t,YEt(hy,e)),QEt=(t={},e)=>GEt(t,YEt(hy,e)),fFr=t=>e=>t({roleAssumer:XEt(e),roleAssumerWithWebIdentity:QEt(e),...e})});var tPt={};os(tPt,{$Command:()=>Mt,AssumeRoleCommand:()=>iP,AssumeRoleResponseFilterSensitiveLog:()=>mIe,AssumeRoleWithSAMLCommand:()=>EW,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>hIe,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>gIe,AssumeRoleWithWebIdentityCommand:()=>AD,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>yIe,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>bIe,CredentialsFilterSensitiveLog:()=>xU,DecodeAuthorizationMessageCommand:()=>PW,ExpiredTokenException:()=>yW,GetAccessKeyInfoCommand:()=>TW,GetCallerIdentityCommand:()=>AW,GetFederationTokenCommand:()=>IW,GetFederationTokenResponseFilterSensitiveLog:()=>_Ie,GetSessionTokenCommand:()=>MW,GetSessionTokenResponseFilterSensitiveLog:()=>vIe,IDPCommunicationErrorException:()=>SW,IDPRejectedClaimException:()=>wW,InvalidAuthorizationMessageException:()=>CW,InvalidIdentityTokenException:()=>xW,MalformedPolicyDocumentException:()=>bW,PackedPolicyTooLargeException:()=>_W,RegionDisabledException:()=>vW,STS:()=>_ie,STSClient:()=>hy,STSServiceException:()=>kp,__Client:()=>vD,decorateDefaultCredentialProvider:()=>fFr,getDefaultRoleAssumer:()=>XEt,getDefaultRoleAssumerWithWebIdentity:()=>QEt});var rMe=b(()=>{gW();zEt();UEt();qEt();ePt();hie()});var rPt={};os(rPt,{AssumeRoleCommand:()=>iP,STSClient:()=>hy});var nPt=b(()=>{rMe()});var pFr,oPt=b(()=>{GE();pFr=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 cc("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(()=>(nPt(),rPt));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 cc(`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 iPt=b(()=>{});var aPt,sPt=b(()=>{aPt=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(()=>(rMe(),tPt));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 uPt=b(()=>{iPt();sPt()});var mFr,lPt=b(()=>{uPt();mFr=t=>aPt({...t})});var cPt={};os(cPt,{fromCognitoIdentity:()=>aLr,fromCognitoIdentityPool:()=>sLr,fromHttp:()=>sIe,fromTemporaryCredentials:()=>pFr,fromWebToken:()=>mFr});var dPt=b(()=>{rOt();nOt();xOt();oPt();lPt()});var ID={};os(ID,{__addDisposableResource:()=>RPt,__assign:()=>vie,__asyncDelegator:()=>CPt,__asyncGenerator:()=>SPt,__asyncValues:()=>OPt,__await:()=>IU,__awaiter:()=>yPt,__classPrivateFieldGet:()=>APt,__classPrivateFieldIn:()=>MPt,__classPrivateFieldSet:()=>IPt,__createBinding:()=>xie,__decorate:()=>mPt,__disposeResources:()=>NPt,__esDecorate:()=>hFr,__exportStar:()=>_Pt,__extends:()=>fPt,__generator:()=>bPt,__importDefault:()=>TPt,__importStar:()=>PPt,__makeTemplateObject:()=>EPt,__metadata:()=>gPt,__param:()=>hPt,__propKey:()=>yFr,__read:()=>oMe,__rest:()=>pPt,__runInitializers:()=>gFr,__setFunctionName:()=>bFr,__spread:()=>vPt,__spreadArray:()=>xPt,__spreadArrays:()=>wPt,__values:()=>wie,default:()=>wFr});function fPt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");nMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function pPt(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 mPt(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 hPt(t,e){return function(r,n){e(r,n,t)}}function hFr(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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 h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function gFr(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 yFr(t){return typeof t=="symbol"?t:"".concat(t)}function bFr(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 gPt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function yPt(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 bPt(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 _Pt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xie(e,t,r)}function wie(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 oMe(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 vPt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(oMe(arguments[e]));return t}function wPt(){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 xPt(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 IU(t){return this instanceof IU?(this.v=t,this):new IU(t)}function SPt(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(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(g,y){i.push([p,m,g,y])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof IU?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,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function CPt(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:IU(t[o](a)),done:!1}:i?i(a):a}:i}}function OPt(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 wie=="function"?wie(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 EPt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function PPt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xie(e,t,r);return _Fr(e,t),e}function TPt(t){return t&&t.__esModule?t:{default:t}}function APt(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 IPt(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 MPt(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 RPt(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 NPt(t){function e(i){t.error=t.hasError?new vFr(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 nMe,vie,xie,_Fr,vFr,wFr,MD=b(()=>{nMe=function(t,e){return nMe=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])},nMe(t,e)};vie=function(){return vie=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},vie.apply(this,arguments)};xie=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};_Fr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};vFr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};wFr={__extends:fPt,__assign:vie,__rest:pPt,__decorate:mPt,__param:hPt,__metadata:gPt,__awaiter:yPt,__generator:bPt,__createBinding:xie,__exportStar:_Pt,__values:wie,__read:oMe,__spread:vPt,__spreadArrays:wPt,__spreadArray:xPt,__await:IU,__asyncGenerator:SPt,__asyncDelegator:CPt,__asyncValues:OPt,__makeTemplateObject:EPt,__importStar:PPt,__importDefault:TPt,__classPrivateFieldGet:APt,__classPrivateFieldSet:IPt,__classPrivateFieldIn:MPt,__addDisposableResource:RPt,__disposeResources:NPt}});var DPt=x(jPt=>{"use strict";Object.defineProperty(jPt,"__esModule",{value:!0})});var LPt=x(RW=>{"use strict";Object.defineProperty(RW,"__esModule",{value:!0});RW.HttpAuthLocation=void 0;var xFr;(function(t){t.HEADER="header",t.QUERY="query"})(xFr=RW.HttpAuthLocation||(RW.HttpAuthLocation={}))});var kPt=x(FPt=>{"use strict";Object.defineProperty(FPt,"__esModule",{value:!0})});var BPt=x($Pt=>{"use strict";Object.defineProperty($Pt,"__esModule",{value:!0})});var UPt=x(zPt=>{"use strict";Object.defineProperty(zPt,"__esModule",{value:!0})});var HPt=x(qPt=>{"use strict";Object.defineProperty(qPt,"__esModule",{value:!0})});var WPt=x(VPt=>{"use strict";Object.defineProperty(VPt,"__esModule",{value:!0})});var GPt=x(KPt=>{"use strict";Object.defineProperty(KPt,"__esModule",{value:!0})});var ZPt=x(JPt=>{"use strict";Object.defineProperty(JPt,"__esModule",{value:!0})});var YPt=x(NW=>{"use strict";Object.defineProperty(NW,"__esModule",{value:!0});var iMe=(MD(),Nc(ID));iMe.__exportStar(WPt(),NW);iMe.__exportStar(GPt(),NW);iMe.__exportStar(ZPt(),NW)});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 rTt=x(jW=>{"use strict";Object.defineProperty(jW,"__esModule",{value:!0});jW.EndpointURLScheme=void 0;var SFr;(function(t){t.HTTP="http",t.HTTPS="https"})(SFr=jW.EndpointURLScheme||(jW.EndpointURLScheme={}))});var oTt=x(nTt=>{"use strict";Object.defineProperty(nTt,"__esModule",{value:!0})});var aTt=x(iTt=>{"use strict";Object.defineProperty(iTt,"__esModule",{value:!0})});var uTt=x(sTt=>{"use strict";Object.defineProperty(sTt,"__esModule",{value:!0})});var cTt=x(lTt=>{"use strict";Object.defineProperty(lTt,"__esModule",{value:!0})});var fTt=x(dTt=>{"use strict";Object.defineProperty(dTt,"__esModule",{value:!0})});var pTt=x(RD=>{"use strict";Object.defineProperty(RD,"__esModule",{value:!0});var DW=(MD(),Nc(ID));DW.__exportStar(oTt(),RD);DW.__exportStar(aTt(),RD);DW.__exportStar(uTt(),RD);DW.__exportStar(cTt(),RD);DW.__exportStar(fTt(),RD)});var hTt=x(mTt=>{"use strict";Object.defineProperty(mTt,"__esModule",{value:!0})});var gTt=x(LW=>{"use strict";Object.defineProperty(LW,"__esModule",{value:!0});LW.FieldPosition=void 0;var CFr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(CFr=LW.FieldPosition||(LW.FieldPosition={}))});var bTt=x(yTt=>{"use strict";Object.defineProperty(yTt,"__esModule",{value:!0})});var vTt=x(_Tt=>{"use strict";Object.defineProperty(_Tt,"__esModule",{value:!0})});var xTt=x(Sie=>{"use strict";Object.defineProperty(Sie,"__esModule",{value:!0});var wTt=(MD(),Nc(ID));wTt.__exportStar(bTt(),Sie);wTt.__exportStar(vTt(),Sie)});var CTt=x(STt=>{"use strict";Object.defineProperty(STt,"__esModule",{value:!0})});var ETt=x(OTt=>{"use strict";Object.defineProperty(OTt,"__esModule",{value:!0})});var TTt=x(PTt=>{"use strict";Object.defineProperty(PTt,"__esModule",{value:!0})});var ITt=x(ATt=>{"use strict";Object.defineProperty(ATt,"__esModule",{value:!0})});var RTt=x(MTt=>{"use strict";Object.defineProperty(MTt,"__esModule",{value:!0})});var jTt=x(NTt=>{"use strict";Object.defineProperty(NTt,"__esModule",{value:!0})});var LTt=x(DTt=>{"use strict";Object.defineProperty(DTt,"__esModule",{value:!0})});var kTt=x(FTt=>{"use strict";Object.defineProperty(FTt,"__esModule",{value:!0})});var BTt=x($Tt=>{"use strict";Object.defineProperty($Tt,"__esModule",{value:!0})});var UTt=x(zTt=>{"use strict";Object.defineProperty(zTt,"__esModule",{value:!0})});var HTt=x(qTt=>{"use strict";Object.defineProperty(qTt,"__esModule",{value:!0})});var WTt=x(VTt=>{"use strict";Object.defineProperty(VTt,"__esModule",{value:!0})});var GTt=x(KTt=>{"use strict";Object.defineProperty(KTt,"__esModule",{value:!0})});var JTt=x(FW=>{"use strict";Object.defineProperty(FW,"__esModule",{value:!0});FW.RequestHandlerProtocol=void 0;var OFr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(OFr=FW.RequestHandlerProtocol||(FW.RequestHandlerProtocol={}))});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 aAt=x(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});var $o=(MD(),Nc(ID));$o.__exportStar(DPt(),ho);$o.__exportStar(LPt(),ho);$o.__exportStar(kPt(),ho);$o.__exportStar(BPt(),ho);$o.__exportStar(UPt(),ho);$o.__exportStar(HPt(),ho);$o.__exportStar(YPt(),ho);$o.__exportStar(QPt(),ho);$o.__exportStar(tTt(),ho);$o.__exportStar(rTt(),ho);$o.__exportStar(pTt(),ho);$o.__exportStar(hTt(),ho);$o.__exportStar(gTt(),ho);$o.__exportStar(xTt(),ho);$o.__exportStar(CTt(),ho);$o.__exportStar(ETt(),ho);$o.__exportStar(TTt(),ho);$o.__exportStar(ITt(),ho);$o.__exportStar(RTt(),ho);$o.__exportStar(jTt(),ho);$o.__exportStar(LTt(),ho);$o.__exportStar(kTt(),ho);$o.__exportStar(BTt(),ho);$o.__exportStar(UTt(),ho);$o.__exportStar(HTt(),ho);$o.__exportStar(WTt(),ho);$o.__exportStar(GTt(),ho);$o.__exportStar(JTt(),ho);$o.__exportStar(YTt(),ho);$o.__exportStar(QTt(),ho);$o.__exportStar(tAt(),ho);$o.__exportStar(nAt(),ho);$o.__exportStar(iAt(),ho)});var sAt=x(Cie=>{"use strict";Object.defineProperty(Cie,"__esModule",{value:!0});Cie.Field=void 0;var EFr=aAt(),aMe=class{constructor({name:e,kind:r=EFr.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}};Cie.Field=aMe});var uAt=x(Oie=>{"use strict";Object.defineProperty(Oie,"__esModule",{value:!0});Oie.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)}};Oie.Fields=sMe});var cAt=x(lAt=>{"use strict";Object.defineProperty(lAt,"__esModule",{value:!0})});var dAt=x(Eie=>{"use strict";Object.defineProperty(Eie,"__esModule",{value:!0});Eie.HttpRequest=void 0;var uMe=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=PFr(e.query)),e}};Eie.HttpRequest=uMe;function PFr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var fAt=x(Pie=>{"use strict";Object.defineProperty(Pie,"__esModule",{value:!0});Pie.HttpResponse=void 0;var lMe=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"}};Pie.HttpResponse=lMe});var pAt=x(Tie=>{"use strict";Object.defineProperty(Tie,"__esModule",{value:!0});Tie.isValidHostname=void 0;function TFr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}Tie.isValidHostname=TFr});var hAt=x(mAt=>{"use strict";Object.defineProperty(mAt,"__esModule",{value:!0})});var gAt=x(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0});var ND=(MD(),Nc(ID));ND.__exportStar(sAt(),aP);ND.__exportStar(uAt(),aP);ND.__exportStar(cAt(),aP);ND.__exportStar(dAt(),aP);ND.__exportStar(fAt(),aP);ND.__exportStar(pAt(),aP);ND.__exportStar(hAt(),aP)});var yAt=x(cMe=>{"use strict";Object.defineProperty(cMe,"__esModule",{value:!0});var AFr=(MD(),Nc(ID));AFr.__exportStar(gAt(),cMe)});var jD={};os(jD,{__addDisposableResource:()=>kAt,__assign:()=>Aie,__asyncDelegator:()=>IAt,__asyncGenerator:()=>AAt,__asyncValues:()=>MAt,__await:()=>MU,__awaiter:()=>SAt,__classPrivateFieldGet:()=>DAt,__classPrivateFieldIn:()=>FAt,__classPrivateFieldSet:()=>LAt,__createBinding:()=>Mie,__decorate:()=>vAt,__disposeResources:()=>$At,__esDecorate:()=>IFr,__exportStar:()=>OAt,__extends:()=>bAt,__generator:()=>CAt,__importDefault:()=>jAt,__importStar:()=>NAt,__makeTemplateObject:()=>RAt,__metadata:()=>xAt,__param:()=>wAt,__propKey:()=>RFr,__read:()=>fMe,__rest:()=>_At,__runInitializers:()=>MFr,__setFunctionName:()=>NFr,__spread:()=>EAt,__spreadArray:()=>TAt,__spreadArrays:()=>PAt,__values:()=>Iie,default:()=>LFr});function bAt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");dMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function _At(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 vAt(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 wAt(t,e){return function(r,n){e(r,n,t)}}function IFr(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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 h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],h);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function MFr(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 RFr(t){return typeof t=="symbol"?t:"".concat(t)}function NFr(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 xAt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function SAt(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 CAt(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 OAt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mie(e,t,r)}function Iie(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 fMe(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 EAt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(fMe(arguments[e]));return t}function PAt(){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 TAt(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 MU(t){return this instanceof MU?(this.v=t,this):new MU(t)}function AAt(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(h){return Promise.resolve(h).then(p,d)}}function s(p,h){n[p]&&(o[p]=function(m){return new Promise(function(g,y){i.push([p,m,g,y])>1||u(p,m)})},h&&(o[p]=h(o[p])))}function u(p,h){try{l(n[p](h))}catch(m){f(i[0][3],m)}}function l(p){p.value instanceof MU?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,h){p(h),i.shift(),i.length&&u(i[0][0],i[0][1])}}function IAt(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:MU(t[o](a)),done:!1}:i?i(a):a}:i}}function MAt(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 Iie=="function"?Iie(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 RAt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function NAt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Mie(e,t,r);return jFr(e,t),e}function jAt(t){return t&&t.__esModule?t:{default:t}}function DAt(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 LAt(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 FAt(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 kAt(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 $At(t){function e(i){t.error=t.hasError?new DFr(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 dMe,Aie,Mie,jFr,DFr,LFr,DD=b(()=>{dMe=function(t,e){return dMe=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])},dMe(t,e)};Aie=function(){return Aie=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},Aie.apply(this,arguments)};Mie=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};jFr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};DFr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};LFr={__extends:bAt,__assign:Aie,__rest:_At,__decorate:vAt,__param:wAt,__metadata:xAt,__awaiter:SAt,__generator:CAt,__createBinding:Mie,__exportStar:OAt,__values:Iie,__read:fMe,__spread:EAt,__spreadArrays:PAt,__spreadArray:TAt,__await:MU,__asyncGenerator:AAt,__asyncDelegator:IAt,__asyncValues:MAt,__makeTemplateObject:RAt,__importStar:NAt,__importDefault:jAt,__classPrivateFieldGet:DAt,__classPrivateFieldSet:LAt,__classPrivateFieldIn:FAt,__addDisposableResource:kAt,__disposeResources:$At}});var gMe={};os(gMe,{__assign:()=>mMe,__asyncDelegator:()=>JFr,__asyncGenerator:()=>GFr,__asyncValues:()=>ZFr,__await:()=>kW,__awaiter:()=>UFr,__classPrivateFieldGet:()=>ekr,__classPrivateFieldSet:()=>tkr,__createBinding:()=>HFr,__decorate:()=>$Fr,__exportStar:()=>VFr,__extends:()=>FFr,__generator:()=>qFr,__importDefault:()=>QFr,__importStar:()=>XFr,__makeTemplateObject:()=>YFr,__metadata:()=>zFr,__param:()=>BFr,__read:()=>BAt,__rest:()=>kFr,__spread:()=>WFr,__spreadArrays:()=>KFr,__values:()=>hMe});function FFr(t,e){pMe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function kFr(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 $Fr(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 BFr(t,e){return function(r,n){e(r,n,t)}}function zFr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function UFr(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 qFr(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 HFr(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function VFr(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function hMe(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 BAt(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 WFr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(BAt(arguments[e]));return t}function KFr(){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 kW(t){return this instanceof kW?(this.v=t,this):new kW(t)}function GFr(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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof kW?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 JFr(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:kW(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function ZFr(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 hMe=="function"?hMe(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 YFr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function XFr(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 QFr(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 tkr(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 pMe,mMe,yMe=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)n.hasOwnProperty(o)&&(r[o]=n[o])},pMe(t,e)};mMe=function(){return mMe=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},mMe.apply(this,arguments)}});var zAt=x(RU=>{"use strict";Object.defineProperty(RU,"__esModule",{value:!0});RU.toUtf8=RU.fromUtf8=void 0;var rkr=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)};RU.fromUtf8=rkr;var nkr=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};RU.toUtf8=nkr});var UAt=x(NU=>{"use strict";Object.defineProperty(NU,"__esModule",{value:!0});NU.toUtf8=NU.fromUtf8=void 0;function okr(t){return new TextEncoder().encode(t)}NU.fromUtf8=okr;function ikr(t){return new TextDecoder("utf-8").decode(t)}NU.toUtf8=ikr});var VAt=x(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});jU.toUtf8=jU.fromUtf8=void 0;var qAt=zAt(),HAt=UAt(),akr=t=>typeof TextEncoder=="function"?(0,HAt.fromUtf8)(t):(0,qAt.fromUtf8)(t);jU.fromUtf8=akr;var skr=t=>typeof TextDecoder=="function"?(0,HAt.toUtf8)(t):(0,qAt.toUtf8)(t);jU.toUtf8=skr});var WAt=x(Rie=>{"use strict";Object.defineProperty(Rie,"__esModule",{value:!0});Rie.convertToBuffer=void 0;var ukr=VAt(),lkr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:ukr.fromUtf8;function ckr(t){return t instanceof Uint8Array?t:typeof t=="string"?lkr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Rie.convertToBuffer=ckr});var KAt=x(Nie=>{"use strict";Object.defineProperty(Nie,"__esModule",{value:!0});Nie.isEmptyData=void 0;function dkr(t){return typeof t=="string"?t.length===0:t.byteLength===0}Nie.isEmptyData=dkr});var GAt=x(jie=>{"use strict";Object.defineProperty(jie,"__esModule",{value:!0});jie.numToUint8=void 0;function fkr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}jie.numToUint8=fkr});var JAt=x(Die=>{"use strict";Object.defineProperty(Die,"__esModule",{value:!0});Die.uint32ArrayFrom=void 0;function pkr(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)}Die.uint32ArrayFrom=pkr});var bMe=x(hw=>{"use strict";Object.defineProperty(hw,"__esModule",{value:!0});hw.uint32ArrayFrom=hw.numToUint8=hw.isEmptyData=hw.convertToBuffer=void 0;var mkr=WAt();Object.defineProperty(hw,"convertToBuffer",{enumerable:!0,get:function(){return mkr.convertToBuffer}});var hkr=KAt();Object.defineProperty(hw,"isEmptyData",{enumerable:!0,get:function(){return hkr.isEmptyData}});var gkr=GAt();Object.defineProperty(hw,"numToUint8",{enumerable:!0,get:function(){return gkr.numToUint8}});var ykr=JAt();Object.defineProperty(hw,"uint32ArrayFrom",{enumerable:!0,get:function(){return ykr.uint32ArrayFrom}})});var XAt=x(Lie=>{"use strict";Object.defineProperty(Lie,"__esModule",{value:!0});Lie.AwsCrc32=void 0;var ZAt=(yMe(),Nc(gMe)),_Me=bMe(),YAt=Fie(),bkr=function(){function t(){this.crc32=new YAt.Crc32}return t.prototype.update=function(e){(0,_Me.isEmptyData)(e)||this.crc32.update((0,_Me.convertToBuffer)(e))},t.prototype.digest=function(){return ZAt.__awaiter(this,void 0,void 0,function(){return ZAt.__generator(this,function(e){return[2,(0,_Me.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new YAt.Crc32},t}();Lie.AwsCrc32=bkr});var Fie=x(lM=>{"use strict";Object.defineProperty(lM,"__esModule",{value:!0});lM.AwsCrc32=lM.Crc32=lM.crc32=void 0;var _kr=(yMe(),Nc(gMe)),vkr=bMe();function wkr(t){return new QAt().update(t).digest()}lM.crc32=wkr;var QAt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=_kr.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^Skr[(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}();lM.Crc32=QAt;var xkr=[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],Skr=(0,vkr.uint32ArrayFrom)(xkr),Ckr=XAt();Object.defineProperty(lM,"AwsCrc32",{enumerable:!0,get:function(){return Ckr.AwsCrc32}})});var LU=x(DU=>{"use strict";Object.defineProperty(DU,"__esModule",{value:!0});DU.toHex=DU.fromHex=void 0;var eIt={},vMe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),eIt[t]=e,vMe[e]=t}function Okr(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 vMe)e[r/2]=vMe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}DU.fromHex=Okr;function Ekr(t){let e="";for(let r=0;r<t.byteLength;r++)e+=eIt[t[r]];return e}DU.toHex=Ekr});var xMe=x(kie=>{"use strict";Object.defineProperty(kie,"__esModule",{value:!0});kie.Int64=void 0;var Pkr=LU(),wMe=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&&tIt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&tIt(e),parseInt((0,Pkr.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};kie.Int64=wMe;function tIt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var OMe=x($ie=>{"use strict";Object.defineProperty($ie,"__esModule",{value:!0});$ie.HeaderMarshaller=void 0;var FU=LU(),SMe=xMe(),CMe=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(SMe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!Lkr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,FU.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:nIt,value:!0};break;case 1:r[i]={type:nIt,value:!1};break;case 2:r[i]={type:Tkr,value:e.getInt8(n++)};break;case 3:r[i]={type:Akr,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:Ikr,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:Mkr,value:new SMe.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:Rkr,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:Nkr,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:jkr,value:new Date(new SMe.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:Dkr,value:`${(0,FU.toHex)(u.subarray(0,4))}-${(0,FU.toHex)(u.subarray(4,6))}-${(0,FU.toHex)(u.subarray(6,8))}-${(0,FU.toHex)(u.subarray(8,10))}-${(0,FU.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};$ie.HeaderMarshaller=CMe;var rIt;(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"})(rIt||(rIt={}));var nIt="boolean",Tkr="byte",Akr="short",Ikr="integer",Mkr="long",Rkr="binary",Nkr="string",jkr="timestamp",Dkr="uuid",Lkr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var iIt=x(Bie=>{"use strict";Object.defineProperty(Bie,"__esModule",{value:!0});Bie.splitMessage=void 0;var Fkr=Fie(),oIt=4,cM=oIt*2,LD=4,kkr=cM+LD*2;function $kr({byteLength:t,byteOffset:e,buffer:r}){if(t<kkr)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(oIt,!1),a=n.getUint32(cM,!1),s=n.getUint32(t-LD,!1),u=new Fkr.Crc32().update(new Uint8Array(r,e,cM));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+cM,t-(cM+LD))),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+cM+LD,i),body:new Uint8Array(r,e+cM+LD+i,o-i-(cM+LD+LD))}}Bie.splitMessage=$kr});var aIt=x(zie=>{"use strict";Object.defineProperty(zie,"__esModule",{value:!0});zie.EventStreamCodec=void 0;var Bkr=Fie(),zkr=OMe(),Ukr=iIt(),EMe=class{constructor(e,r){this.headerMarshaller=new zkr.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 Bkr.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,Ukr.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};zie.EventStreamCodec=EMe});var uIt=x(sIt=>{"use strict";Object.defineProperty(sIt,"__esModule",{value:!0})});var lIt=x(Uie=>{"use strict";Object.defineProperty(Uie,"__esModule",{value:!0});Uie.MessageDecoderStream=void 0;var PMe=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)}};Uie.MessageDecoderStream=PMe});var cIt=x(qie=>{"use strict";Object.defineProperty(qie,"__esModule",{value:!0});qie.MessageEncoderStream=void 0;var TMe=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=TMe});var dIt=x(Hie=>{"use strict";Object.defineProperty(Hie,"__esModule",{value:!0});Hie.SmithyMessageDecoderStream=void 0;var AMe=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)}}};Hie.SmithyMessageDecoderStream=AMe});var fIt=x(Vie=>{"use strict";Object.defineProperty(Vie,"__esModule",{value:!0});Vie.SmithyMessageEncoderStream=void 0;var IMe=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)}};Vie.SmithyMessageEncoderStream=IMe});var pIt=x(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0});var dM=(DD(),Nc(jD));dM.__exportStar(aIt(),gw);dM.__exportStar(OMe(),gw);dM.__exportStar(xMe(),gw);dM.__exportStar(uIt(),gw);dM.__exportStar(lIt(),gw);dM.__exportStar(cIt(),gw);dM.__exportStar(dIt(),gw);dM.__exportStar(fIt(),gw)});var mIt=x(Wie=>{"use strict";Object.defineProperty(Wie,"__esModule",{value:!0});Wie.normalizeProvider=void 0;var qkr=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};Wie.normalizeProvider=qkr});var hIt=x(MMe=>{"use strict";Object.defineProperty(MMe,"__esModule",{value:!0});var Hkr=(DD(),Nc(jD));Hkr.__exportStar(mIt(),MMe)});var RMe=x(Kie=>{"use strict";Object.defineProperty(Kie,"__esModule",{value:!0});Kie.isArrayBuffer=void 0;var Vkr=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";Kie.isArrayBuffer=Vkr});var jMe=x(kU=>{"use strict";Object.defineProperty(kU,"__esModule",{value:!0});kU.fromString=kU.fromArrayBuffer=void 0;var Wkr=RMe(),NMe=Im(),Kkr=(t,e=0,r=t.byteLength-e)=>{if(!(0,Wkr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return NMe.Buffer.from(t,e,r)};kU.fromArrayBuffer=Kkr;var Gkr=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?NMe.Buffer.from(t,e):NMe.Buffer.from(t)};kU.fromString=Gkr});var DMe=x(Gie=>{"use strict";Object.defineProperty(Gie,"__esModule",{value:!0});Gie.fromUtf8=void 0;var Jkr=jMe(),Zkr=t=>{let e=(0,Jkr.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};Gie.fromUtf8=Zkr});var gIt=x(Jie=>{"use strict";Object.defineProperty(Jie,"__esModule",{value:!0});Jie.toUint8Array=void 0;var Ykr=DMe(),Xkr=t=>typeof t=="string"?(0,Ykr.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);Jie.toUint8Array=Xkr});var yIt=x(Zie=>{"use strict";Object.defineProperty(Zie,"__esModule",{value:!0});Zie.toUtf8=void 0;var Qkr=jMe(),e$r=t=>(0,Qkr.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");Zie.toUtf8=e$r});var Yie=x($W=>{"use strict";Object.defineProperty($W,"__esModule",{value:!0});var LMe=(DD(),Nc(jD));LMe.__exportStar(DMe(),$W);LMe.__exportStar(gIt(),$W);LMe.__exportStar(yIt(),$W)});var FD=x(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.MAX_PRESIGNED_TTL=qt.KEY_TYPE_IDENTIFIER=qt.MAX_CACHE_SIZE=qt.UNSIGNED_PAYLOAD=qt.EVENT_ALGORITHM_IDENTIFIER=qt.ALGORITHM_IDENTIFIER_V4A=qt.ALGORITHM_IDENTIFIER=qt.UNSIGNABLE_PATTERNS=qt.SEC_HEADER_PATTERN=qt.PROXY_HEADER_PATTERN=qt.ALWAYS_UNSIGNABLE_HEADERS=qt.HOST_HEADER=qt.TOKEN_HEADER=qt.SHA256_HEADER=qt.SIGNATURE_HEADER=qt.GENERATED_HEADERS=qt.DATE_HEADER=qt.AMZ_DATE_HEADER=qt.AUTH_HEADER=qt.REGION_SET_PARAM=qt.TOKEN_QUERY_PARAM=qt.SIGNATURE_QUERY_PARAM=qt.EXPIRES_QUERY_PARAM=qt.SIGNED_HEADERS_QUERY_PARAM=qt.AMZ_DATE_QUERY_PARAM=qt.CREDENTIAL_QUERY_PARAM=qt.ALGORITHM_QUERY_PARAM=void 0;qt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";qt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";qt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";qt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";qt.EXPIRES_QUERY_PARAM="X-Amz-Expires";qt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";qt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";qt.REGION_SET_PARAM="X-Amz-Region-Set";qt.AUTH_HEADER="authorization";qt.AMZ_DATE_HEADER=qt.AMZ_DATE_QUERY_PARAM.toLowerCase();qt.DATE_HEADER="date";qt.GENERATED_HEADERS=[qt.AUTH_HEADER,qt.AMZ_DATE_HEADER,qt.DATE_HEADER];qt.SIGNATURE_HEADER=qt.SIGNATURE_QUERY_PARAM.toLowerCase();qt.SHA256_HEADER="x-amz-content-sha256";qt.TOKEN_HEADER=qt.TOKEN_QUERY_PARAM.toLowerCase();qt.HOST_HEADER="host";qt.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};qt.PROXY_HEADER_PATTERN=/^proxy-/;qt.SEC_HEADER_PATTERN=/^sec-/;qt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];qt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";qt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";qt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";qt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";qt.MAX_CACHE_SIZE=50;qt.KEY_TYPE_IDENTIFIER="aws4_request";qt.MAX_PRESIGNED_TTL=60*60*24*7});var kMe=x(fM=>{"use strict";Object.defineProperty(fM,"__esModule",{value:!0});fM.clearCredentialCache=fM.getSigningKey=fM.createScope=void 0;var t$r=LU(),r$r=Yie(),FMe=FD(),$U={},Xie=[],n$r=(t,e,r)=>`${t}/${e}/${r}/${FMe.KEY_TYPE_IDENTIFIER}`;fM.createScope=n$r;var o$r=async(t,e,r,n,o)=>{let i=await bIt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,t$r.toHex)(i)}:${e.sessionToken}`;if(a in $U)return $U[a];for(Xie.push(a);Xie.length>FMe.MAX_CACHE_SIZE;)delete $U[Xie.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,FMe.KEY_TYPE_IDENTIFIER])s=await bIt(t,s,u);return $U[a]=s};fM.getSigningKey=o$r;var i$r=()=>{Xie.length=0,Object.keys($U).forEach(t=>{delete $U[t]})};fM.clearCredentialCache=i$r;var bIt=(t,e,r)=>{let n=new t(e);return n.update((0,r$r.toUint8Array)(r)),n.digest()}});var BMe=x(Qie=>{"use strict";Object.defineProperty(Qie,"__esModule",{value:!0});Qie.getCanonicalHeaders=void 0;var $Me=FD(),a$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 $Me.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||$Me.PROXY_HEADER_PATTERN.test(i)||$Me.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};Qie.getCanonicalHeaders=a$r});var zMe=x(eae=>{"use strict";Object.defineProperty(eae,"__esModule",{value:!0});eae.escapeUri=void 0;var s$r=t=>encodeURIComponent(t).replace(/[!'()*]/g,u$r);eae.escapeUri=s$r;var u$r=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var _It=x(tae=>{"use strict";Object.defineProperty(tae,"__esModule",{value:!0});tae.escapeUriPath=void 0;var l$r=zMe(),c$r=t=>t.split("/").map(l$r.escapeUri).join("/");tae.escapeUriPath=c$r});var wIt=x(rae=>{"use strict";Object.defineProperty(rae,"__esModule",{value:!0});var vIt=(DD(),Nc(jD));vIt.__exportStar(zMe(),rae);vIt.__exportStar(_It(),rae)});var UMe=x(oae=>{"use strict";Object.defineProperty(oae,"__esModule",{value:!0});oae.getCanonicalQuery=void 0;var nae=wIt(),d$r=FD(),f$r=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===d$r.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,nae.escapeUri)(n)}=${(0,nae.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,nae.escapeUri)(n)}=${(0,nae.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};oae.getCanonicalQuery=f$r});var qMe=x(iae=>{"use strict";Object.defineProperty(iae,"__esModule",{value:!0});iae.getPayloadHash=void 0;var p$r=RMe(),m$r=LU(),h$r=Yie(),xIt=FD(),g$r=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===xIt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,p$r.isArrayBuffer)(e)){let n=new r;return n.update((0,h$r.toUint8Array)(e)),(0,m$r.toHex)(await n.digest())}return xIt.UNSIGNED_PAYLOAD};iae.getPayloadHash=g$r});var SIt=x(pM=>{"use strict";Object.defineProperty(pM,"__esModule",{value:!0});pM.deleteHeader=pM.getHeaderValue=pM.hasHeader=void 0;var y$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};pM.hasHeader=y$r;var b$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};pM.getHeaderValue=b$r;var _$r=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};pM.deleteHeader=_$r});var HMe=x(kD=>{"use strict";Object.defineProperty(kD,"__esModule",{value:!0});kD.cloneQuery=kD.cloneRequest=void 0;var v$r=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,kD.cloneQuery)(e):void 0});kD.cloneRequest=v$r;var w$r=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});kD.cloneQuery=w$r});var VMe=x(aae=>{"use strict";Object.defineProperty(aae,"__esModule",{value:!0});aae.moveHeadersToQuery=void 0;var x$r=HMe(),S$r=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,x$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}};aae.moveHeadersToQuery=S$r});var WMe=x(sae=>{"use strict";Object.defineProperty(sae,"__esModule",{value:!0});sae.prepareRequest=void 0;var C$r=HMe(),O$r=FD(),E$r=t=>{t=typeof t.clone=="function"?t.clone():(0,C$r.cloneRequest)(t);for(let e of Object.keys(t.headers))O$r.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};sae.prepareRequest=E$r});var CIt=x($D=>{"use strict";Object.defineProperty($D,"__esModule",{value:!0});$D.toDate=$D.iso8601=void 0;var P$r=t=>(0,$D.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");$D.iso8601=P$r;var T$r=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;$D.toDate=T$r});var AIt=x(dae=>{"use strict";Object.defineProperty(dae,"__esModule",{value:!0});dae.SignatureV4=void 0;var A$r=pIt(),uae=LU(),OIt=hIt(),BW=Yie(),Nd=FD(),lae=kMe(),EIt=BMe(),I$r=UMe(),KMe=qMe(),M$r=SIt(),R$r=VMe(),PIt=WMe(),N$r=CIt(),GMe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new A$r.HeaderMarshaller(BW.toUtf8,BW.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,OIt.normalizeProvider)(n),this.credentialProvider=(0,OIt.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}=cae(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 h=(0,lae.createScope)(p,d,l??this.service),m=(0,R$r.moveHeadersToQuery)((0,PIt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(m.query[Nd.TOKEN_QUERY_PARAM]=c.sessionToken),m.query[Nd.ALGORITHM_QUERY_PARAM]=Nd.ALGORITHM_IDENTIFIER,m.query[Nd.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${h}`,m.query[Nd.AMZ_DATE_QUERY_PARAM]=f,m.query[Nd.EXPIRES_QUERY_PARAM]=o.toString(10);let g=(0,EIt.getCanonicalHeaders)(m,i,s);return m.query[Nd.SIGNED_HEADERS_QUERY_PARAM]=TIt(g),m.query[Nd.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,h,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(m,g,await(0,KMe.getPayloadHash)(e,this.sha256))),m}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}=cae(n),c=(0,lae.createScope)(u,s,a??this.service),d=await(0,KMe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,uae.toHex)(await f.digest()),h=[Nd.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(h,{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}=cae(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,BW.toUint8Array)(e)),(0,uae.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,PIt.prepareRequest)(e),{longDate:c,shortDate:d}=cae(r),f=(0,lae.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,KMe.getPayloadHash)(l,this.sha256);!(0,M$r.hasHeader)(Nd.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Nd.SHA256_HEADER]=p);let h=(0,EIt.getCanonicalHeaders)(l,o,n),m=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,h,p));return l.headers[Nd.AUTH_HEADER]=`${Nd.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${TIt(h)}, Signature=${m}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,I$r.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,BW.toUint8Array)(n));let i=await o.digest();return`${Nd.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,uae.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,BW.toUint8Array)(i)),(0,uae.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,lae.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")}};dae.SignatureV4=GMe;var cae=t=>{let e=(0,N$r.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},TIt=t=>Object.keys(t).sort().join(";")});var MIt=x($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.prepareRequest=$m.moveHeadersToQuery=$m.getPayloadHash=$m.getCanonicalQuery=$m.getCanonicalHeaders=void 0;var IIt=(DD(),Nc(jD));IIt.__exportStar(AIt(),$m);var j$r=BMe();Object.defineProperty($m,"getCanonicalHeaders",{enumerable:!0,get:function(){return j$r.getCanonicalHeaders}});var D$r=UMe();Object.defineProperty($m,"getCanonicalQuery",{enumerable:!0,get:function(){return D$r.getCanonicalQuery}});var L$r=qMe();Object.defineProperty($m,"getPayloadHash",{enumerable:!0,get:function(){return L$r.getPayloadHash}});var F$r=VMe();Object.defineProperty($m,"moveHeadersToQuery",{enumerable:!0,get:function(){return F$r.moveHeadersToQuery}});var k$r=WMe();Object.defineProperty($m,"prepareRequest",{enumerable:!0,get:function(){return k$r.prepareRequest}});IIt.__exportStar(kMe(),$m)});var RIt=x(JMe=>{"use strict";Object.defineProperty(JMe,"__esModule",{value:!0});var $$r=(DD(),Nc(jD));$$r.__exportStar(MIt(),JMe)});var hs=x((Zqo,NIt)=>{"use strict";NIt.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 BU=x((Yqo,fae)=>{"use strict";var{AbortController:jIt,AbortSignal:B$r}=typeof self<"u"?self:typeof window<"u"?window:void 0;fae.exports=jIt;fae.exports.AbortSignal=B$r;fae.exports.default=jIt});var zW=x((Xqo,ZMe)=>{"use strict";var zU=typeof Reflect=="object"?Reflect:null,DIt=zU&&typeof zU.apply=="function"?zU.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},pae;zU&&typeof zU.ownKeys=="function"?pae=zU.ownKeys:Object.getOwnPropertySymbols?pae=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:pae=function(e){return Object.getOwnPropertyNames(e)};function z$r(t){console&&console.warn&&console.warn(t)}var FIt=Number.isNaN||function(e){return e!==e};function Gi(){Gi.init.call(this)}ZMe.exports=Gi;ZMe.exports.once=V$r;Gi.EventEmitter=Gi;Gi.prototype._events=void 0;Gi.prototype._eventsCount=0;Gi.prototype._maxListeners=void 0;var LIt=10;function mae(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Gi,"defaultMaxListeners",{enumerable:!0,get:function(){return LIt},set:function(t){if(typeof t!="number"||t<0||FIt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");LIt=t}});Gi.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};Gi.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||FIt(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 kIt(t){return t._maxListeners===void 0?Gi.defaultMaxListeners:t._maxListeners}Gi.prototype.getMaxListeners=function(){return kIt(this)};Gi.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")DIt(u,this,r);else for(var l=u.length,c=qIt(u,l),n=0;n<l;++n)DIt(c[n],this,r);return!0};function $It(t,e,r,n){var o,i,a;if(mae(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=kIt(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,z$r(s)}return t}Gi.prototype.addListener=function(e,r){return $It(this,e,r,!1)};Gi.prototype.on=Gi.prototype.addListener;Gi.prototype.prependListener=function(e,r){return $It(this,e,r,!0)};function U$r(){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 BIt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=U$r.bind(n);return o.listener=r,n.wrapFn=o,o}Gi.prototype.once=function(e,r){return mae(r),this.on(e,BIt(this,e,r)),this};Gi.prototype.prependOnceListener=function(e,r){return mae(r),this.prependListener(e,BIt(this,e,r)),this};Gi.prototype.removeListener=function(e,r){var n,o,i,a,s;if(mae(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():q$r(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Gi.prototype.off=Gi.prototype.removeListener;Gi.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 zIt(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?H$r(o):qIt(o,o.length)}Gi.prototype.listeners=function(e){return zIt(this,e,!0)};Gi.prototype.rawListeners=function(e){return zIt(this,e,!1)};Gi.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):UIt.call(t,e)};Gi.prototype.listenerCount=UIt;function UIt(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}Gi.prototype.eventNames=function(){return this._eventsCount>0?pae(this._events):[]};function qIt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function q$r(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function H$r(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function V$r(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))}HIt(t,e,i,{once:!0}),e!=="error"&&W$r(t,o,{once:!0})})}function W$r(t,e,r){typeof t.on=="function"&&HIt(t,"error",e,r)}function HIt(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 Vf=x((Qqo,XMe)=>{"use strict";var K$r=Im(),{kResistStopPropagation:G$r,SymbolDispose:J$r}=hs(),Z$r=globalThis.AbortSignal||BU().AbortSignal,Y$r=globalThis.AbortController||BU().AbortController,X$r=Object.getPrototypeOf(async function(){}).constructor,VIt=globalThis.Blob||K$r.Blob,Q$r=typeof VIt<"u"?function(e){return e instanceof VIt}:function(e){return!1},WIt=(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)},YMe=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}};XMe.exports={AggregateError:YMe,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 X$r},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Q$r,deprecate(t,e){return t},addAbortListener:zW().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);WIt(e,"signal"),eBr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[G$r]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[J$r](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:Z$r.any||function(e){if(e.length===1)return e[0];let r=new Y$r,n=()=>r.abort();return e.forEach(o=>{WIt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};XMe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var zp=x((e2o,JIt)=>{"use strict";var{format:tBr,inspect:hae,AggregateError:rBr}=Vf(),nBr=globalThis.AggregateError||rBr,oBr=Symbol("kIsNodeError"),iBr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],aBr=/^([A-Z][a-z0-9]*)+$/,sBr="__node_internal_",gae={};function BD(t,e){if(!t)throw new gae.ERR_INTERNAL_ASSERTION(e)}function KIt(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 uBr(t,e,r){if(typeof e=="function")return BD(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 BD(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:tBr(e,...r)}function jd(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(uBr(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[oBr]=!0,gae[t]=n}function GIt(t){let e=sBr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function lBr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new nBr([e,t],e.message);return r.code=e.code,r}return t||e}var QMe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new gae.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)=>{BD(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)BD(typeof u=="string","All expected entries have to be of type string"),iBr.includes(u)?o.push(u.toLowerCase()):aBr.test(u)?i.push(u):(BD(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=hae(r,{depth:-1});n+=`. Received ${u}`}}else{let u=hae(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=hae(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)=>{BD(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)=>{BD(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=KIt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=KIt(n)),n+="n"):n=hae(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);JIt.exports={AbortError:QMe,aggregateTwoErrors:GIt(lBr),hideStackFrames:GIt,codes:gae}});var qU=x((t2o,iMt)=>{"use strict";var{ArrayIsArray:tRe,ArrayPrototypeIncludes:QIt,ArrayPrototypeJoin:eMt,ArrayPrototypeMap:cBr,NumberIsInteger:rRe,NumberIsNaN:dBr,NumberMAX_SAFE_INTEGER:fBr,NumberMIN_SAFE_INTEGER:pBr,NumberParseInt:mBr,ObjectPrototypeHasOwnProperty:hBr,RegExpPrototypeExec:tMt,String:gBr,StringPrototypeToUpperCase:yBr,StringPrototypeTrim:bBr}=hs(),{hideStackFrames:vy,codes:{ERR_SOCKET_BAD_PORT:_Br,ERR_INVALID_ARG_TYPE:Wf,ERR_INVALID_ARG_VALUE:UU,ERR_OUT_OF_RANGE:zD,ERR_UNKNOWN_SIGNAL:ZIt}}=zp(),{normalizeEncoding:vBr}=Vf(),{isAsyncFunction:wBr,isArrayBufferView:xBr}=Vf().types,YIt={};function SBr(t){return t===(t|0)}function CBr(t){return t===t>>>0}var OBr=/^[0-7]+$/,EBr="must be a 32-bit unsigned integer or an octal string";function PBr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(tMt(OBr,t)===null)throw new UU(e,t,EBr);t=mBr(t,8)}return rMt(t,e),t}var TBr=vy((t,e,r=pBr,n=fBr)=>{if(typeof t!="number")throw new Wf(e,"number",t);if(!rRe(t))throw new zD(e,"an integer",t);if(t<r||t>n)throw new zD(e,`>= ${r} && <= ${n}`,t)}),ABr=vy((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Wf(e,"number",t);if(!rRe(t))throw new zD(e,"an integer",t);if(t<r||t>n)throw new zD(e,`>= ${r} && <= ${n}`,t)}),rMt=vy((t,e,r=!1)=>{if(typeof t!="number")throw new Wf(e,"number",t);if(!rRe(t))throw new zD(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new zD(e,`>= ${n} && <= ${o}`,t)});function nRe(t,e){if(typeof t!="string")throw new Wf(e,"string",t)}function IBr(t,e,r=void 0,n){if(typeof t!="number")throw new Wf(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&dBr(t))throw new zD(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var MBr=vy((t,e,r)=>{if(!QIt(r,t)){let o="must be one of: "+eMt(cBr(r,i=>typeof i=="string"?`'${i}'`:gBr(i)),", ");throw new UU(e,t,o)}});function nMt(t,e){if(typeof t!="boolean")throw new Wf(e,"boolean",t)}function eRe(t,e,r){return t==null||!hBr(t,e)?r:t[e]}var RBr=vy((t,e,r=null)=>{let n=eRe(r,"allowArray",!1),o=eRe(r,"allowFunction",!1);if(!eRe(r,"nullable",!1)&&t===null||!n&&tRe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Wf(e,"Object",t)}),NBr=vy((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Wf(e,"a dictionary",t)}),yae=vy((t,e,r=0)=>{if(!tRe(t))throw new Wf(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new UU(e,t,n)}});function jBr(t,e){yae(t,e);for(let r=0;r<t.length;r++)nRe(t[r],`${e}[${r}]`)}function DBr(t,e){yae(t,e);for(let r=0;r<t.length;r++)nMt(t[r],`${e}[${r}]`)}function LBr(t,e){yae(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Wf(o,"AbortSignal",n);oMt(n,o)}}function FBr(t,e="signal"){if(nRe(t,e),YIt[t]===void 0)throw YIt[yBr(t)]!==void 0?new ZIt(t+" (signals must use all capital letters)"):new ZIt(t)}var kBr=vy((t,e="buffer")=>{if(!xBr(t))throw new Wf(e,["Buffer","TypedArray","DataView"],t)});function $Br(t,e){let r=vBr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new UU("encoding",e,`is invalid for data of length ${n}`)}function BBr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&bBr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new _Br(e,t,r);return t|0}var oMt=vy((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Wf(e,"AbortSignal",t)}),zBr=vy((t,e)=>{if(typeof t!="function")throw new Wf(e,"Function",t)}),UBr=vy((t,e)=>{if(typeof t!="function"||wBr(t))throw new Wf(e,"Function",t)}),qBr=vy((t,e)=>{if(t!==void 0)throw new Wf(e,"undefined",t)});function HBr(t,e,r){if(!QIt(r,t))throw new Wf(e,`('${eMt(r,"|")}')`,t)}var VBr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function XIt(t,e){if(typeof t>"u"||!tMt(VBr,t))throw new UU(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function WBr(t){if(typeof t=="string")return XIt(t,"hints"),t;if(tRe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];XIt(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new UU("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}iMt.exports={isInt32:SBr,isUint32:CBr,parseFileMode:PBr,validateArray:yae,validateStringArray:jBr,validateBooleanArray:DBr,validateAbortSignalArray:LBr,validateBoolean:nMt,validateBuffer:kBr,validateDictionary:NBr,validateEncoding:$Br,validateFunction:zBr,validateInt32:ABr,validateInteger:TBr,validateNumber:IBr,validateObject:RBr,validateOneOf:MBr,validatePlainFunction:UBr,validatePort:BBr,validateSignalName:FBr,validateString:nRe,validateUint32:rMt,validateUndefined:qBr,validateUnion:HBr,validateAbortSignal:oMt,validateLinkHeaderValue:WBr}});var mM=x((r2o,lMt)=>{var su=lMt.exports={},yw,bw;function oRe(){throw new Error("setTimeout has not been defined")}function iRe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?yw=setTimeout:yw=oRe}catch{yw=oRe}try{typeof clearTimeout=="function"?bw=clearTimeout:bw=iRe}catch{bw=iRe}})();function aMt(t){if(yw===setTimeout)return setTimeout(t,0);if((yw===oRe||!yw)&&setTimeout)return yw=setTimeout,setTimeout(t,0);try{return yw(t,0)}catch{try{return yw.call(null,t,0)}catch{return yw.call(this,t,0)}}}function KBr(t){if(bw===clearTimeout)return clearTimeout(t);if((bw===iRe||!bw)&&clearTimeout)return bw=clearTimeout,clearTimeout(t);try{return bw(t)}catch{try{return bw.call(null,t)}catch{return bw.call(this,t)}}}var sP=[],HU=!1,UD,bae=-1;function GBr(){!HU||!UD||(HU=!1,UD.length?sP=UD.concat(sP):bae=-1,sP.length&&sMt())}function sMt(){if(!HU){var t=aMt(GBr);HU=!0;for(var e=sP.length;e;){for(UD=sP,sP=[];++bae<e;)UD&&UD[bae].run();bae=-1,e=sP.length}UD=null,HU=!1,KBr(t)}}su.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];sP.push(new uMt(t,e)),sP.length===1&&!HU&&aMt(sMt)};function uMt(t,e){this.fun=t,this.array=e}uMt.prototype.run=function(){this.fun.apply(null,this.array)};su.title="browser";su.browser=!0;su.env={};su.argv=[];su.version="";su.versions={};function uP(){}su.on=uP;su.addListener=uP;su.once=uP;su.off=uP;su.removeListener=uP;su.removeAllListeners=uP;su.emit=uP;su.prependListener=uP;su.prependOnceListener=uP;su.listeners=function(t){return[]};su.binding=function(t){throw new Error("process.binding is not supported")};su.cwd=function(){return"/"};su.chdir=function(t){throw new Error("process.chdir is not supported")};su.umask=function(){return 0}});var vw=x((n2o,CMt)=>{"use strict";var{SymbolAsyncIterator:cMt,SymbolIterator:dMt,SymbolFor:qD}=hs(),fMt=qD("nodejs.stream.destroyed"),pMt=qD("nodejs.stream.errored"),aRe=qD("nodejs.stream.readable"),sRe=qD("nodejs.stream.writable"),mMt=qD("nodejs.stream.disturbed"),JBr=qD("nodejs.webstream.isClosedPromise"),ZBr=qD("nodejs.webstream.controllerErrorFunction");function _ae(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 vae(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 YBr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function _w(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function hMt(t){return!!(t&&!_w(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function gMt(t){return!!(t&&!_w(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function yMt(t){return!!(t&&!_w(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function XBr(t){return hMt(t)||gMt(t)||yMt(t)}function QBr(t,e){return t==null?!1:e===!0?typeof t[cMt]=="function":e===!1?typeof t[dMt]=="function":typeof t[cMt]=="function"||typeof t[dMt]=="function"}function wae(t){if(!_w(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[fMt]||n!=null&&n.destroyed)}function bMt(t){if(!vae(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(!vae(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 tzr(t){if(!_ae(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 _Mt(t,e){if(!_ae(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 vMt(t){return t&&t[aRe]!=null?t[aRe]:typeof t?.readable!="boolean"?null:wae(t)?!1:_ae(t)&&t.readable&&!_Mt(t)}function wMt(t){return t&&t[sRe]!=null?t[sRe]:typeof t?.writable!="boolean"?null:wae(t)?!1:vae(t)&&t.writable&&!bMt(t)}function rzr(t,e){return _w(t)?wae(t)?!0:!(e?.readable!==!1&&vMt(t)||e?.writable!==!1&&wMt(t)):null}function nzr(t){var e,r;return _w(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 ozr(t){var e,r;return _w(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 izr(t){if(!_w(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"&&xMt(t)?t._closed:null}function xMt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function SMt(t){return typeof t._sent100=="boolean"&&xMt(t)}function azr(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 szr(t){if(!_w(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&SMt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function uzr(t){var e;return!!(t&&((e=t[mMt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function lzr(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[pMt])!==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))}CMt.exports={isDestroyed:wae,kIsDestroyed:fMt,isDisturbed:uzr,kIsDisturbed:mMt,isErrored:lzr,kIsErrored:pMt,isReadable:vMt,kIsReadable:aRe,kIsClosedPromise:JBr,kControllerErrorFunction:ZBr,kIsWritable:sRe,isClosed:izr,isDuplexNodeStream:YBr,isFinished:rzr,isIterable:QBr,isReadableNodeStream:_ae,isReadableStream:hMt,isReadableEnded:tzr,isReadableFinished:_Mt,isReadableErrored:ozr,isNodeStream:_w,isWebStream:XBr,isWritable:wMt,isWritableNodeStream:vae,isWritableStream:gMt,isWritableEnded:bMt,isWritableFinished:ezr,isWritableErrored:nzr,isServerRequest:azr,isServerResponse:SMt,willEmitClose:szr,isTransformStream:yMt}});var lP=x((o2o,fRe)=>{var hM=mM(),{AbortError:NMt,codes:czr}=zp(),{ERR_INVALID_ARG_TYPE:dzr,ERR_STREAM_PREMATURE_CLOSE:OMt}=czr,{kEmptyObject:lRe,once:cRe}=Vf(),{validateAbortSignal:fzr,validateFunction:pzr,validateObject:mzr,validateBoolean:hzr}=qU(),{Promise:gzr,PromisePrototypeThen:yzr,SymbolDispose:jMt}=hs(),{isClosed:bzr,isReadable:EMt,isReadableNodeStream:uRe,isReadableStream:_zr,isReadableFinished:PMt,isReadableErrored:TMt,isWritable:AMt,isWritableNodeStream:IMt,isWritableStream:vzr,isWritableFinished:MMt,isWritableErrored:RMt,isNodeStream:wzr,willEmitClose:xzr,kIsClosedPromise:Szr}=vw(),VU;function Czr(t){return t.setHeader&&typeof t.abort=="function"}var dRe=()=>{};function DMt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=lRe):e==null?e=lRe:mzr(e,"options"),pzr(r,"callback"),fzr(e.signal,"options.signal"),r=cRe(r),_zr(t)||vzr(t))return Ozr(t,e,r);if(!wzr(t))throw new dzr("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:uRe(t),a=(o=e.writable)!==null&&o!==void 0?o:IMt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=xzr(t)&&uRe(t)===i&&IMt(t)===a,d=MMt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=PMt(t,!1),h=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},m=C=>{r.call(t,C)},g=bzr(t),y=()=>{g=!0;let C=RMt(t)||TMt(t);if(C&&typeof C!="boolean")return r.call(t,C);if(i&&!p&&uRe(t,!0)&&!PMt(t,!1))return r.call(t,new OMt);if(a&&!d&&!MMt(t,!1))return r.call(t,new OMt);r.call(t)},_=()=>{g=!0;let C=RMt(t)||TMt(t);if(C&&typeof C!="boolean")return r.call(t,C);r.call(t)},w=()=>{t.req.on("finish",f)};Czr(t)?(t.on("complete",f),c||t.on("abort",y),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",y),t.on("end",h),t.on("finish",f),e.error!==!1&&t.on("error",m),t.on("close",y),g?hM.nextTick(y):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||hM.nextTick(_):(!i&&(!c||EMt(t))&&(d||AMt(t)===!1)||!a&&(!c||AMt(t))&&(p||EMt(t)===!1)||u&&t.req&&t.aborted)&&hM.nextTick(_);let S=()=>{r=dRe,t.removeListener("aborted",y),t.removeListener("complete",f),t.removeListener("abort",y),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",h),t.removeListener("error",m),t.removeListener("close",y)};if(e.signal&&!g){let C=()=>{let E=r;S(),E.call(t,new NMt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)hM.nextTick(C);else{VU=VU||Vf().addAbortListener;let E=VU(e.signal,C),P=r;r=cRe((...T)=>{E[jMt](),P.apply(t,T)})}}return S}function Ozr(t,e,r){let n=!1,o=dRe;if(e.signal)if(o=()=>{n=!0,r.call(t,new NMt(void 0,{cause:e.signal.reason}))},e.signal.aborted)hM.nextTick(o);else{VU=VU||Vf().addAbortListener;let a=VU(e.signal,o),s=r;r=cRe((...u)=>{a[jMt](),s.apply(t,u)})}let i=(...a)=>{n||hM.nextTick(()=>r.apply(t,a))};return yzr(t[Szr].promise,i,i),dRe}function Ezr(t,e){var r;let n=!1;return e===null&&(e=lRe),(r=e)!==null&&r!==void 0&&r.cleanup&&(hzr(e.cleanup,"cleanup"),n=e.cleanup),new gzr((o,i)=>{let a=DMt(t,e,s=>{n&&a(),s?i(s):o()})})}fRe.exports=DMt;fRe.exports.finished=Ezr});var HD=x((i2o,qMt)=>{"use strict";var ww=mM(),{aggregateTwoErrors:Pzr,codes:{ERR_MULTIPLE_CALLBACK:Tzr},AbortError:Azr}=zp(),{Symbol:kMt}=hs(),{kIsDestroyed:Izr,isDestroyed:Mzr,isFinished:Rzr,isServerRequest:Nzr}=vw(),$Mt=kMt("kDestroy"),pRe=kMt("kConstruct");function BMt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function jzr(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):(BMt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?LMt(this,t,e):this.once($Mt,function(i){LMt(this,Pzr(i,t),e)}),this)}function LMt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;BMt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?ww.nextTick(Dzr,t,i):ww.nextTick(zMt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function Dzr(t,e){mRe(t,e),zMt(t)}function zMt(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 mRe(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 Lzr(){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 hRe(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?ww.nextTick(mRe,t,e):mRe(t,e))}function Fzr(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(pRe,e),!(t.listenerCount(pRe)>1)&&ww.nextTick(kzr,t)}function kzr(t){let e=!1;function r(n){if(e){hRe(t,n??new Tzr);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($Mt,n):n?hRe(t,n,!0):ww.nextTick($zr,t)}try{t._construct(n=>{ww.nextTick(r,n)})}catch(n){ww.nextTick(r,n)}}function $zr(t){t.emit(pRe)}function FMt(t){return t?.setHeader&&typeof t.abort=="function"}function UMt(t){t.emit("close")}function Bzr(t,e){t.emit("error",e),ww.nextTick(UMt,t)}function zzr(t,e){!t||Mzr(t)||(!e&&!Rzr(t)&&(e=new Azr),Nzr(t)?(t.socket=null,t.destroy(e)):FMt(t)?t.abort():FMt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ww.nextTick(Bzr,t,e):ww.nextTick(UMt,t),t.destroyed||(t[Izr]=!0))}qMt.exports={construct:Fzr,destroyer:zzr,destroy:jzr,undestroy:Lzr,errorOrDestroy:hRe}});var Cae=x((a2o,VMt)=>{"use strict";var{ArrayIsArray:Uzr,ObjectSetPrototypeOf:HMt}=hs(),{EventEmitter:xae}=zW();function Sae(t){xae.call(this,t)}HMt(Sae.prototype,xae.prototype);HMt(Sae,xae);Sae.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(),xae.listenerCount(this,"error")===0&&this.emit("error",c)}gRe(r,"error",u),gRe(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 gRe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Uzr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}VMt.exports={Stream:Sae,prependListener:gRe}});var UW=x((s2o,Oae)=>{"use strict";var{SymbolDispose:qzr}=hs(),{AbortError:WMt,codes:Hzr}=zp(),{isNodeStream:KMt,isWebStream:Vzr,kControllerErrorFunction:Wzr}=vw(),Kzr=lP(),{ERR_INVALID_ARG_TYPE:GMt}=Hzr,yRe,Gzr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new GMt(e,"AbortSignal",t)};Oae.exports.addAbortSignal=function(e,r){if(Gzr(e,"signal"),!KMt(r)&&!Vzr(r))throw new GMt("stream",["ReadableStream","WritableStream","Stream"],r);return Oae.exports.addAbortSignalNoValidate(e,r)};Oae.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=KMt(e)?()=>{e.destroy(new WMt(void 0,{cause:t.reason}))}:()=>{e[Wzr](new WMt(void 0,{cause:t.reason}))};if(t.aborted)r();else{yRe=yRe||Vf().addAbortListener;let n=yRe(t,r);Kzr(e,n[qzr])}return e}});var YMt=x((l2o,ZMt)=>{"use strict";var{StringPrototypeSlice:JMt,SymbolIterator:Jzr,TypedArrayPrototypeSet:Eae,Uint8Array:Zzr}=hs(),{Buffer:bRe}=Im(),{inspect:Yzr}=Vf();ZMt.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 bRe.alloc(0);let r=bRe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)Eae(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}*[Jzr](){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+=JMt(i,0,e),this.head=n,n.data=JMt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=bRe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)Eae(r,a,n-e),e-=a.length;else{e===a.length?(Eae(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(Eae(r,new Zzr(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 Yzr(this,{...r,depth:0,customInspect:!1})}}});var qW=x((c2o,tRt)=>{"use strict";var{MathFloor:Xzr,NumberIsInteger:Qzr}=hs(),{validateInteger:eUr}=qU(),{ERR_INVALID_ARG_VALUE:tUr}=zp().codes,XMt=16*1024,QMt=16;function rUr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function eRt(t){return t?QMt:XMt}function nUr(t,e){eUr(e,"value",0),t?QMt=e:XMt=e}function oUr(t,e,r,n){let o=rUr(e,n,r);if(o!=null){if(!Qzr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new tUr(i,o)}return Xzr(o)}return eRt(t.objectMode)}tRt.exports={getHighWaterMark:oUr,getDefaultHighWaterMark:eRt,setDefaultHighWaterMark:nUr}});var oRt=x((_Re,nRt)=>{var Pae=Im(),xw=Pae.Buffer;function rRt(t,e){for(var r in t)e[r]=t[r]}xw.from&&xw.alloc&&xw.allocUnsafe&&xw.allocUnsafeSlow?nRt.exports=Pae:(rRt(Pae,_Re),_Re.Buffer=VD);function VD(t,e,r){return xw(t,e,r)}VD.prototype=Object.create(xw.prototype);rRt(xw,VD);VD.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xw(t,e,r)};VD.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=xw(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};VD.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xw(t)};VD.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Pae.SlowBuffer(t)}});var sRt=x(aRt=>{"use strict";var wRe=oRt().Buffer,iRt=wRe.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 iUr(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 aUr(t){var e=iUr(t);if(typeof e!="string"&&(wRe.isEncoding===iRt||!iRt(t)))throw new Error("Unknown encoding: "+t);return e||t}aRt.StringDecoder=HW;function HW(t){this.encoding=aUr(t);var e;switch(this.encoding){case"utf16le":this.text=fUr,this.end=pUr,e=4;break;case"utf8":this.fillLast=lUr,e=4;break;case"base64":this.text=mUr,this.end=hUr,e=3;break;default:this.write=gUr,this.end=yUr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=wRe.allocUnsafe(e)}HW.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||""};HW.prototype.end=dUr;HW.prototype.text=cUr;HW.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 vRe(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function sUr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=vRe(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=vRe(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=vRe(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function uUr(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 lUr(t){var e=this.lastTotal-this.lastNeed,r=uUr(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 cUr(t,e){var r=sUr(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 dUr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function fUr(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 pUr(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 mUr(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 hUr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function gUr(t){return t.toString(this.encoding)}function yUr(t){return t&&t.length?this.write(t):""}});var xRe=x((f2o,dRt)=>{"use strict";var uRt=mM(),{PromisePrototypeThen:bUr,SymbolAsyncIterator:lRt,SymbolIterator:cRt}=hs(),{Buffer:_Ur}=Im(),{ERR_INVALID_ARG_TYPE:vUr,ERR_STREAM_NULL_VALUES:wUr}=zp().codes;function xUr(t,e,r){let n;if(typeof e=="string"||e instanceof _Ur)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[lRt])o=!0,n=e[lRt]();else if(e&&e[cRt])o=!1,n=e[cRt]();else throw new vUr("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){bUr(s(l),()=>uRt.nextTick(c,l),d=>uRt.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 wUr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}dRt.exports=xUr});var WW=x((p2o,ARt)=>{var Xb=mM(),{ArrayPrototypeIndexOf:SUr,NumberIsInteger:CUr,NumberIsNaN:OUr,NumberParseInt:EUr,ObjectDefineProperties:IRe,ObjectKeys:PUr,ObjectSetPrototypeOf:mRt,Promise:hRt,SafeSet:TUr,SymbolAsyncDispose:AUr,SymbolAsyncIterator:IUr,Symbol:MUr}=hs();ARt.exports=Rn;Rn.ReadableState=Mae;var{EventEmitter:RUr}=zW(),{Stream:gM,prependListener:NUr}=Cae(),{Buffer:SRe}=Im(),{addAbortSignal:jUr}=UW(),gRt=lP(),to=Vf().debuglog("stream",t=>{to=t}),DUr=YMt(),GU=HD(),{getHighWaterMark:LUr,getDefaultHighWaterMark:FUr}=qW(),{aggregateTwoErrors:fRt,codes:{ERR_INVALID_ARG_TYPE:kUr,ERR_METHOD_NOT_IMPLEMENTED:$Ur,ERR_OUT_OF_RANGE:BUr,ERR_STREAM_PUSH_AFTER_EOF:zUr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:UUr},AbortError:qUr}=zp(),{validateObject:HUr}=qU(),WD=MUr("kPaused"),{StringDecoder:yRt}=sRt(),VUr=xRe();mRt(Rn.prototype,gM.prototype);mRt(Rn,gM);var CRe=()=>{},{errorOrDestroy:WU}=GU,KU=1,WUr=2,bRt=4,VW=8,_Rt=16,Tae=32,Aae=64,vRt=128,KUr=256,GUr=512,JUr=1024,TRe=2048,ARe=4096,ZUr=8192,YUr=16384,XUr=32768,wRt=65536,QUr=1<<17,eqr=1<<18;function dc(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}IRe(Mae.prototype,{objectMode:dc(KU),ended:dc(WUr),endEmitted:dc(bRt),reading:dc(VW),constructed:dc(_Rt),sync:dc(Tae),needReadable:dc(Aae),emittedReadable:dc(vRt),readableListening:dc(KUr),resumeScheduled:dc(GUr),errorEmitted:dc(JUr),emitClose:dc(TRe),autoDestroy:dc(ARe),destroyed:dc(ZUr),closed:dc(YUr),closeEmitted:dc(XUr),multiAwaitDrain:dc(wRt),readingMore:dc(QUr),dataEmitted:dc(eqr)});function Mae(t,e,r){typeof r!="boolean"&&(r=e instanceof Sw()),this.state=TRe|ARe|_Rt|Tae,t&&t.objectMode&&(this.state|=KU),r&&t&&t.readableObjectMode&&(this.state|=KU),this.highWaterMark=t?LUr(this,t,"readableHighWaterMark",r):FUr(!1),this.buffer=new DUr,this.length=0,this.pipes=[],this.flowing=null,this[WD]=null,t&&t.emitClose===!1&&(this.state&=~TRe),t&&t.autoDestroy===!1&&(this.state&=~ARe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new yRt(t.encoding),this.encoding=t.encoding)}function Rn(t){if(!(this instanceof Rn))return new Rn(t);let e=this instanceof Sw();this._readableState=new Mae(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&&jUr(t.signal,this)),gM.call(this,t),GU.construct(this,()=>{this._readableState.needReadable&&Iae(this,this._readableState)})}Rn.prototype.destroy=GU.destroy;Rn.prototype._undestroy=GU.undestroy;Rn.prototype._destroy=function(t,e){e(t)};Rn.prototype[RUr.captureRejectionSymbol]=function(t){this.destroy(t)};Rn.prototype[AUr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new qUr,this.destroy(t)),new hRt((e,r)=>gRt(this,n=>n&&n!==t?r(n):e(null)))};Rn.prototype.push=function(t,e){return xRt(this,t,e,!1)};Rn.prototype.unshift=function(t,e){return xRt(this,t,e,!0)};function xRt(t,e,r,n){to("readableAddChunk",e);let o=t._readableState,i;if((o.state&KU)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=SRe.from(e,r).toString(o.encoding):(e=SRe.from(e,r),r=""))):e instanceof SRe?r="":gM._isUint8Array(e)?(e=gM._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new kUr("chunk",["string","Buffer","Uint8Array"],e))),i)WU(t,i);else if(e===null)o.state&=~VW,nqr(t,o);else if((o.state&KU)!==0||e&&e.length>0)if(n)if((o.state&bRt)!==0)WU(t,new UUr);else{if(o.destroyed||o.errored)return!1;ORe(t,o,e,!0)}else if(o.ended)WU(t,new zUr);else{if(o.destroyed||o.errored)return!1;o.state&=~VW,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?ORe(t,o,e,!1):Iae(t,o)):ORe(t,o,e,!1)}else n||(o.state&=~VW,Iae(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function ORe(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&wRt)!==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&Aae)!==0&&Rae(t)),Iae(t,e)}Rn.prototype.isPaused=function(){let t=this._readableState;return t[WD]===!0||t.flowing===!1};Rn.prototype.setEncoding=function(t){let e=new yRt(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 tqr=1073741824;function rqr(t){if(t>tqr)throw new BUr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function pRt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&KU)!==0?1:OUr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}Rn.prototype.read=function(t){to("read",t),t===void 0?t=NaN:CUr(t)||(t=EUr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=rqr(t)),t!==0&&(e.state&=~vRt),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?ERe(this):Rae(this),null;if(t=pRt(t,e),t===0&&e.ended)return e.length===0&&ERe(this),null;let n=(e.state&Aae)!==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|=VW|Tae,e.length===0&&(e.state|=Aae);try{this._read(e.highWaterMark)}catch(i){WU(this,i)}e.state&=~Tae,e.reading||(t=pRt(r,e))}let o;return t>0?o=PRt(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&&ERe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function nqr(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?Rae(t):(e.needReadable=!1,e.emittedReadable=!0,SRt(t))}}function Rae(t){let e=t._readableState;to("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(to("emitReadable",e.flowing),e.emittedReadable=!0,Xb.nextTick(SRt,t))}function SRt(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,ORt(t)}function Iae(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Xb.nextTick(oqr,t,e))}function oqr(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}Rn.prototype._read=function(t){throw new $Ur("_read()")};Rn.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new TUr(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!==Xb.stdout&&t!==Xb.stderr?s:g;n.endEmitted?Xb.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(y,_){to("onunpipe"),y===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,c())}function s(){to("onend"),t.end()}let u,l=!1;function c(){to("cleanup"),t.removeListener("close",h),t.removeListener("finish",m),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",g),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=iqr(r,t),t.on("drain",u))}r.on("data",f);function f(y){to("ondata");let _=t.write(y);to("dest.write",_),_===!1&&d()}function p(y){if(to("onerror",y),g(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?WU(t,y):t.emit("error",y)}}NUr(t,"error",p);function h(){t.removeListener("finish",m),g()}t.once("close",h);function m(){to("onfinish"),t.removeListener("close",h),g()}t.once("finish",m);function g(){to("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(to("pipe resume"),r.resume()),t};function iqr(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()}}Rn.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=SUr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};Rn.prototype.on=function(t,e){let r=gM.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?Rae(this):n.reading||Xb.nextTick(aqr,this)),r};Rn.prototype.addListener=Rn.prototype.on;Rn.prototype.removeListener=function(t,e){let r=gM.prototype.removeListener.call(this,t,e);return t==="readable"&&Xb.nextTick(CRt,this),r};Rn.prototype.off=Rn.prototype.removeListener;Rn.prototype.removeAllListeners=function(t){let e=gM.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Xb.nextTick(CRt,this),e};function CRt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[WD]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function aqr(t){to("readable nexttick read 0"),t.read(0)}Rn.prototype.resume=function(){let t=this._readableState;return t.flowing||(to("resume"),t.flowing=!t.readableListening,sqr(this,t)),t[WD]=!1,this};function sqr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Xb.nextTick(uqr,t,e))}function uqr(t,e){to("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ORt(t),e.flowing&&!e.reading&&t.read(0)}Rn.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[WD]=!0,this};function ORt(t){let e=t._readableState;for(to("flow",e.flowing);e.flowing&&t.read()!==null;);}Rn.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=>{WU(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=PUr(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};Rn.prototype[IUr]=function(){return ERt(this)};Rn.prototype.iterator=function(t){return t!==void 0&&HUr(t,"options"),ERt(this,t)};function ERt(t,e){typeof t.read!="function"&&(t=Rn.wrap(t,{objectMode:!0}));let r=lqr(t,e);return r.stream=t,r}async function*lqr(t,e){let r=CRe;function n(a){this===t?(r(),r=CRe):r=a}t.on("readable",n);let o,i=gRt(t,{writable:!1},a=>{o=a?fRt(o,a):null,r(),r=CRe});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 hRt(n)}}}catch(a){throw o=fRt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?GU.destroyer(t,null):(t.off("readable",n),i())}}IRe(Rn.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}}});IRe(Mae.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[WD]!==!1},set(t){this[WD]=!!t}}});Rn._fromList=PRt;function PRt(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 ERe(t){let e=t._readableState;to("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Xb.nextTick(cqr,e,t))}function cqr(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)Xb.nextTick(dqr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function dqr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}Rn.from=function(t,e){return VUr(Rn,t,e)};var PRe;function TRt(){return PRe===void 0&&(PRe={}),PRe}Rn.fromWeb=function(t,e){return TRt().newStreamReadableFromReadableStream(t,e)};Rn.toWeb=function(t,e){return TRt().newReadableStreamFromStreamReadable(t,e)};Rn.wrap=function(t,e){var r,n;return new Rn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){GU.destroyer(t,o),i(o)}}).wrap(t)}});var Fae=x((m2o,zRt)=>{var KD=mM(),{ArrayPrototypeSlice:RRt,Error:fqr,FunctionPrototypeSymbolHasInstance:NRt,ObjectDefineProperty:jRt,ObjectDefineProperties:pqr,ObjectSetPrototypeOf:DRt,StringPrototypeToLowerCase:mqr,Symbol:hqr,SymbolHasInstance:gqr}=hs();zRt.exports=gs;gs.WritableState=JW;var{EventEmitter:yqr}=zW(),KW=Cae().Stream,{Buffer:Nae}=Im(),Lae=HD(),{addAbortSignal:bqr}=UW(),{getHighWaterMark:_qr,getDefaultHighWaterMark:vqr}=qW(),{ERR_INVALID_ARG_TYPE:wqr,ERR_METHOD_NOT_IMPLEMENTED:xqr,ERR_MULTIPLE_CALLBACK:LRt,ERR_STREAM_CANNOT_PIPE:Sqr,ERR_STREAM_DESTROYED:GW,ERR_STREAM_ALREADY_FINISHED:Cqr,ERR_STREAM_NULL_VALUES:Oqr,ERR_STREAM_WRITE_AFTER_END:Eqr,ERR_UNKNOWN_ENCODING:FRt}=zp().codes,{errorOrDestroy:JU}=Lae;DRt(gs.prototype,KW.prototype);DRt(gs,KW);function NRe(){}var ZU=hqr("kOnFinished");function JW(t,e,r){typeof r!="boolean"&&(r=e instanceof Sw()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?_qr(this,t,"writableHighWaterMark",r):vqr(!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=Tqr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Dae(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[ZU]=[]}function Dae(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}JW.prototype.getBuffer=function(){return RRt(this.buffered,this.bufferedIndex)};jRt(JW.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function gs(t){let e=this instanceof Sw();if(!e&&!NRt(gs,this))return new gs(t);this._writableState=new JW(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&&bqr(t.signal,this)),KW.call(this,t),Lae.construct(this,()=>{let r=this._writableState;r.writing||DRe(this,r),LRe(this,r)})}jRt(gs,gqr,{__proto__:null,value:function(t){return NRt(this,t)?!0:this!==gs?!1:t&&t._writableState instanceof JW}});gs.prototype.pipe=function(){JU(this,new Sqr)};function kRt(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"&&!Nae.isEncoding(r))throw new FRt(r);typeof n!="function"&&(n=NRe)}if(e===null)throw new Oqr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=Nae.from(e,r),r="buffer");else if(e instanceof Nae)r="buffer";else if(KW._isUint8Array(e))e=KW._uint8ArrayToBuffer(e),r="buffer";else throw new wqr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new Eqr:o.destroyed&&(i=new GW("write")),i?(KD.nextTick(n,i),JU(t,i,!0),i):(o.pendingcb++,Pqr(t,o,e,r,n))}gs.prototype.write=function(t,e,r){return kRt(this,t,e,r)===!0};gs.prototype.cork=function(){this._writableState.corked++};gs.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||DRe(this,t))};gs.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=mqr(e)),!Nae.isEncoding(e))throw new FRt(e);return this._writableState.defaultEncoding=e,this};function Pqr(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!==NRe&&(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 IRt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new GW("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function MRt(t,e,r,n){--e.pendingcb,n(r),jRe(e),JU(t,r)}function Tqr(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){JU(t,new LRt);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?KD.nextTick(MRt,t,r,e,o):MRt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&DRe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},KD.nextTick(Aqr,r.afterWriteTickInfo)):$Rt(t,r,1,o))}function Aqr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,$Rt(t,e,r,n)}function $Rt(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&&jRe(e),LRe(t,e)}function jRe(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 GW("write"))}let r=t[ZU].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new GW("end"))}Dae(t)}function DRe(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?NRe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:RRt(r,a);u.allBuffers=e.allBuffers,IRt(t,e,!0,e.length,u,"",s),Dae(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;IRt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?Dae(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}gs.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new xqr("_write()")};gs.prototype._writev=null;gs.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=kRt(this,t,e);i instanceof fqr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,LRe(this,n,!0),n.ended=!0):n.finished?o=new Cqr("end"):n.destroyed&&(o=new GW("end"))),typeof r=="function"&&(o||n.finished?KD.nextTick(r,o):n[ZU].push(r)),this};function jae(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 Iqr(t,e){let r=!1;function n(o){if(r){JU(t,o??LRt());return}if(r=!0,e.pendingcb--,o){let i=e[ZU].splice(0);for(let a=0;a<i.length;a++)i[a](o);JU(t,o,e.sync)}else jae(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,KD.nextTick(RRe,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function Mqr(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Iqr(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function LRe(t,e,r){jae(e)&&(Mqr(t,e),e.pendingcb===0&&(r?(e.pendingcb++,KD.nextTick((n,o)=>{jae(o)?RRe(n,o):o.pendingcb--},t,e)):jae(e)&&(e.pendingcb++,RRe(t,e))))}function RRe(t,e){e.pendingcb--,e.finished=!0;let r=e[ZU].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()}}pqr(gs.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 Rqr=Lae.destroy;gs.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[ZU].length)&&KD.nextTick(jRe,r),Rqr.call(this,t,e),this};gs.prototype._undestroy=Lae.undestroy;gs.prototype._destroy=function(t,e){e(t)};gs.prototype[yqr.captureRejectionSymbol]=function(t){this.destroy(t)};var MRe;function BRt(){return MRe===void 0&&(MRe={}),MRe}gs.fromWeb=function(t,e){return BRt().newStreamWritableFromWritableStream(t,e)};gs.toWeb=function(t){return BRt().newWritableStreamFromStreamWritable(t)}});var r1t=x((h2o,t1t)=>{var FRe=mM(),Nqr=Im(),{isReadable:jqr,isWritable:Dqr,isIterable:URt,isNodeStream:Lqr,isReadableNodeStream:qRt,isWritableNodeStream:HRt,isDuplexNodeStream:Fqr,isReadableStream:VRt,isWritableStream:WRt}=vw(),KRt=lP(),{AbortError:QRt,codes:{ERR_INVALID_ARG_TYPE:kqr,ERR_INVALID_RETURN_VALUE:GRt}}=zp(),{destroyer:XU}=HD(),$qr=Sw(),e1t=WW(),Bqr=Fae(),{createDeferredPromise:JRt}=Vf(),ZRt=xRe(),YRt=globalThis.Blob||Nqr.Blob,zqr=typeof YRt<"u"?function(e){return e instanceof YRt}:function(e){return!1},Uqr=globalThis.AbortController||BU().AbortController,{FunctionPrototypeCall:XRt}=hs(),yM=class extends $qr{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)}};t1t.exports=function t(e,r){if(Fqr(e))return e;if(qRt(e))return YU({readable:e});if(HRt(e))return YU({writable:e});if(Lqr(e))return YU({writable:!1,readable:!1});if(VRt(e))return YU({readable:e1t.fromWeb(e)});if(WRt(e))return YU({writable:Bqr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=qqr(e);if(URt(o))return ZRt(yM,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=XRt(u,o,d=>{if(d!=null)throw new GRt("nully","body",d)},d=>{XU(l,d)});return l=new yM({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,FRe.nextTick(d,null)}catch(f){FRe.nextTick(d,f)}})},destroy:s})}throw new GRt("Iterable, AsyncIterable or AsyncFunction",r,o)}if(zqr(e))return t(e.arrayBuffer());if(URt(e))return ZRt(yM,e,{objectMode:!0,writable:!1});if(VRt(e?.readable)&&WRt(e?.writable))return yM.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?qRt(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?HRt(e?.writable)?e?.writable:t(e.writable):void 0;return YU({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return XRt(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{XU(o,i)}),o=new yM({objectMode:!0,writable:!1,read(){}})}throw new kqr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function qqr(t){let{promise:e,resolve:r}=JRt(),n=new Uqr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(FRe.nextTick(l),u)return;if(o.aborted)throw new QRt(void 0,{cause:o.reason});({promise:e,resolve:r}=JRt()),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 YU(t){let e=t.readable&&typeof t.readable.read!="function"?e1t.wrap(t.readable):t.readable,r=t.writable,n=!!jqr(e),o=!!Dqr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new yM({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(KRt(r,d=>{o=!1,d&&XU(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&&(KRt(e,d=>{n=!1,d&&XU(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 QRt),s=null,i=null,a=null,u===null?f(d):(u=f,XU(r,d),XU(e,d))},l}});var Sw=x((g2o,i1t)=>{"use strict";var{ObjectDefineProperties:Hqr,ObjectGetOwnPropertyDescriptor:cP,ObjectKeys:Vqr,ObjectSetPrototypeOf:n1t}=hs();i1t.exports=Qb;var BRe=WW(),wy=Fae();n1t(Qb.prototype,BRe.prototype);n1t(Qb,BRe);{let t=Vqr(wy.prototype);for(let e=0;e<t.length;e++){let r=t[e];Qb.prototype[r]||(Qb.prototype[r]=wy.prototype[r])}}function Qb(t){if(!(this instanceof Qb))return new Qb(t);BRe.call(this,t),wy.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}Hqr(Qb.prototype,{writable:{__proto__:null,...cP(wy.prototype,"writable")},writableHighWaterMark:{__proto__:null,...cP(wy.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...cP(wy.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...cP(wy.prototype,"writableBuffer")},writableLength:{__proto__:null,...cP(wy.prototype,"writableLength")},writableFinished:{__proto__:null,...cP(wy.prototype,"writableFinished")},writableCorked:{__proto__:null,...cP(wy.prototype,"writableCorked")},writableEnded:{__proto__:null,...cP(wy.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...cP(wy.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 kRe;function o1t(){return kRe===void 0&&(kRe={}),kRe}Qb.fromWeb=function(t,e){return o1t().newStreamDuplexFromReadableWritablePair(t,e)};Qb.toWeb=function(t){return o1t().newReadableWritablePairFromDuplex(t)};var $Re;Qb.from=function(t){return $Re||($Re=r1t()),$Re(t,"body")}});var qRe=x((y2o,s1t)=>{"use strict";var{ObjectSetPrototypeOf:a1t,Symbol:Wqr}=hs();s1t.exports=dP;var{ERR_METHOD_NOT_IMPLEMENTED:Kqr}=zp().codes,URe=Sw(),{getHighWaterMark:Gqr}=qW();a1t(dP.prototype,URe.prototype);a1t(dP,URe);var ZW=Wqr("kCallback");function dP(t){if(!(this instanceof dP))return new dP(t);let e=t?Gqr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),URe.call(this,t),this._readableState.sync=!1,this[ZW]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Jqr)}function zRe(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 Jqr(){this._final!==zRe&&zRe.call(this)}dP.prototype._final=zRe;dP.prototype._transform=function(t,e,r){throw new Kqr("_transform()")};dP.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[ZW]=r})};dP.prototype._read=function(){if(this[ZW]){let t=this[ZW];this[ZW]=null,t()}}});var VRe=x((b2o,l1t)=>{"use strict";var{ObjectSetPrototypeOf:u1t}=hs();l1t.exports=QU;var HRe=qRe();u1t(QU.prototype,HRe.prototype);u1t(QU,HRe);function QU(t){if(!(this instanceof QU))return new QU(t);HRe.call(this,t)}QU.prototype._transform=function(t,e,r){r(null,t)}});var zae=x((_2o,m1t)=>{var YW=mM(),{ArrayIsArray:Zqr,Promise:Yqr,SymbolAsyncIterator:Xqr,SymbolDispose:Qqr}=hs(),Bae=lP(),{once:e2r}=Vf(),t2r=HD(),c1t=Sw(),{aggregateTwoErrors:r2r,codes:{ERR_INVALID_ARG_TYPE:e1e,ERR_INVALID_RETURN_VALUE:WRe,ERR_MISSING_ARGS:n2r,ERR_STREAM_DESTROYED:o2r,ERR_STREAM_PREMATURE_CLOSE:i2r},AbortError:a2r}=zp(),{validateFunction:s2r,validateAbortSignal:u2r}=qU(),{isIterable:GD,isReadable:KRe,isReadableNodeStream:$ae,isNodeStream:d1t,isTransformStream:eq,isWebStream:l2r,isReadableStream:GRe,isReadableFinished:c2r}=vw(),d2r=globalThis.AbortController||BU().AbortController,JRe,ZRe,YRe;function f1t(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=Bae(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,t2r.destroyer(t,i||new o2r("pipe")))},cleanup:o}}function f2r(t){return s2r(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function XRe(t){if(GD(t))return t;if($ae(t))return p2r(t);throw new e1e("val",["Readable","Iterable","AsyncIterable"],t)}async function*p2r(t){ZRe||(ZRe=WW()),yield*ZRe.prototype[Xqr].call(t)}async function kae(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new Yqr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=Bae(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?r2r(o,l):l)}finally{u(),e.off("drain",a)}}async function QRe(t,e,r,{end:n}){eq(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 m2r(...t){return p1t(t,e2r(f2r(t)))}function p1t(t,e,r){if(t.length===1&&Zqr(t[0])&&(t=t[0]),t.length<2)throw new n2r("streams");let n=new d2r,o=n.signal,i=r?.signal,a=[];u2r(i,"options.signal");function s(){h(new a2r)}YRe=YRe||Vf().addAbortListener;let u;i&&(u=YRe(i,s));let l,c,d=[],f=0;function p(w){h(w,--f===0)}function h(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[Qqr](),n.abort(),S&&(l||a.forEach(E=>E()),YW.nextTick(e,l,c))}}let m;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(d1t(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}=f1t(S,C,E);d.push(N),KRe(S)&&T&&a.push(M)}S.on("error",I),KRe(S)&&T&&a.push(()=>{S.removeListener("error",I)})}if(w===0)if(typeof S=="function"){if(m=S({signal:o}),!GD(m))throw new WRe("Iterable, AsyncIterable or Stream","source",m)}else GD(S)||$ae(S)||eq(S)?m=S:m=c1t.from(S);else if(typeof S=="function"){if(eq(m)){var g;m=XRe((g=m)===null||g===void 0?void 0:g.readable)}else m=XRe(m);if(m=S(m,{signal:o}),C){if(!GD(m,!0))throw new WRe("AsyncIterable",`transform[${w-1}]`,m)}else{var y;JRe||(JRe=VRe());let I=new JRe({objectMode:!0}),N=(y=m)===null||y===void 0?void 0:y.then;if(typeof N=="function")f++,N.call(m,k=>{c=k,k!=null&&I.write(k),P&&I.end(),YW.nextTick(p)},k=>{I.destroy(k),YW.nextTick(p,k)});else if(GD(m,!0))f++,kae(m,I,p,{end:P});else if(GRe(m)||eq(m)){let k=m.readable||m;f++,kae(k,I,p,{end:P})}else throw new WRe("AsyncIterable or Promise","destination",m);m=I;let{destroy:M,cleanup:D}=f1t(m,!1,!0);d.push(M),T&&a.push(D)}}else if(d1t(S)){if($ae(m)){f+=2;let I=h2r(m,S,p,{end:P});KRe(S)&&T&&a.push(I)}else if(eq(m)||GRe(m)){let I=m.readable||m;f++,kae(I,S,p,{end:P})}else if(GD(m))f++,kae(m,S,p,{end:P});else throw new e1e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=S}else if(l2r(S)){if($ae(m))f++,QRe(XRe(m),S,p,{end:P});else if(GRe(m)||GD(m))f++,QRe(m,S,p,{end:P});else if(eq(m))f++,QRe(m.readable,S,p,{end:P});else throw new e1e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],m);m=S}else m=c1t.from(S)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&YW.nextTick(s),m}function h2r(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new i2r)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;c2r(t)?YW.nextTick(a):t.once("end",a)}else r();return Bae(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)}),Bae(e,{readable:!1,writable:!0},r)}m1t.exports={pipelineImpl:p1t,pipeline:m2r}});var r1e=x((v2o,v1t)=>{"use strict";var{pipeline:g2r}=zae(),Uae=Sw(),{destroyer:y2r}=HD(),{isNodeStream:qae,isReadable:h1t,isWritable:g1t,isWebStream:t1e,isTransformStream:JD,isWritableStream:y1t,isReadableStream:b1t}=vw(),{AbortError:b2r,codes:{ERR_INVALID_ARG_VALUE:_1t,ERR_MISSING_ARGS:_2r}}=zp(),v2r=lP();v1t.exports=function(...e){if(e.length===0)throw new _2r("streams");if(e.length===1)return Uae.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Uae.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=Uae.from(e[p])}for(let p=0;p<e.length;++p)if(!(!qae(e[p])&&!t1e(e[p]))){if(p<e.length-1&&!(h1t(e[p])||b1t(e[p])||JD(e[p])))throw new _1t(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(g1t(e[p])||y1t(e[p])||JD(e[p])))throw new _1t(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let h=a;a=null,h?h(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=g2r(e,u),d=!!(g1t(l)||y1t(l)||JD(l)),f=!!(h1t(c)||b1t(c)||JD(c));if(s=new Uae({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(qae(l))s._write=function(h,m,g){l.write(h,m)?g():n=g},s._final=function(h){l.end(),o=h},l.on("drain",function(){if(n){let h=n;n=null,h()}});else if(t1e(l)){let m=(JD(l)?l.writable:l).getWriter();s._write=async function(g,y,_){try{await m.ready,m.write(g).catch(()=>{}),_()}catch(w){_(w)}},s._final=async function(g){try{await m.ready,m.close().catch(()=>{}),o=g}catch(y){g(y)}}}let p=JD(c)?c.readable:c;v2r(p,()=>{if(o){let h=o;o=null,h()}})}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(t1e(c)){let h=(JD(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:m,done:g}=await h.read();if(!s.push(m))return;if(g){s.push(null);return}}catch{return}}}}return s._destroy=function(p,h){!p&&a!==null&&(p=new b2r),i=null,n=null,o=null,a===null?h(p):(a=h,qae(c)&&y2r(c,p))},s}});var I1t=x((w2o,i1e)=>{"use strict";var w2r=globalThis.AbortController||BU().AbortController,{codes:{ERR_INVALID_ARG_VALUE:x2r,ERR_INVALID_ARG_TYPE:XW,ERR_MISSING_ARGS:S2r,ERR_OUT_OF_RANGE:C2r},AbortError:Cw}=zp(),{validateAbortSignal:ZD,validateInteger:w1t,validateObject:YD}=qU(),O2r=hs().Symbol("kWeak"),E2r=hs().Symbol("kResistStopPropagation"),{finished:P2r}=lP(),T2r=r1e(),{addAbortSignalNoValidate:A2r}=UW(),{isWritable:I2r,isNodeStream:M2r}=vw(),{deprecate:R2r}=Vf(),{ArrayPrototypePush:N2r,Boolean:j2r,MathFloor:x1t,Number:D2r,NumberIsNaN:L2r,Promise:S1t,PromiseReject:C1t,PromiseResolve:F2r,PromisePrototypeThen:O1t,Symbol:P1t}=hs(),Hae=P1t("kEmpty"),E1t=P1t("kEof");function k2r(t,e){if(e!=null&&YD(e,"options"),e?.signal!=null&&ZD(e.signal,"options.signal"),M2r(t)&&!I2r(t))throw new x2r("stream",t,"must be writable");let r=T2r(this,t);return e!=null&&e.signal&&A2r(e.signal,r),r}function Vae(t,e){if(typeof t!="function")throw new XW("fn",["Function","AsyncFunction"],t);e!=null&&YD(e,"options"),e?.signal!=null&&ZD(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=x1t(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=x1t(e.highWaterMark)),w1t(r,"options.concurrency",1),w1t(n,"options.highWaterMark",0),n+=r,async function*(){let i=Vf().AbortSignalAny([e?.signal].filter(j2r)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,h()}function h(){f-=1,m()}function m(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function g(){try{for await(let y of a){if(d)return;if(i.aborted)throw new Cw;try{if(y=t(y,u),y===Hae)continue;y=F2r(y)}catch(_){y=C1t(_)}f+=1,O1t(y,h,p),s.push(y),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new S1t(_=>{c=_})}s.push(E1t)}catch(y){let _=C1t(y);O1t(_,h,p),s.push(_)}finally{d=!0,l&&(l(),l=null)}}g();try{for(;;){for(;s.length>0;){let y=await s[0];if(y===E1t)return;if(i.aborted)throw new Cw;y!==Hae&&(yield y),s.shift(),m()}await new S1t(y=>{l=y})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function $2r(t=void 0){return t!=null&&YD(t,"options"),t?.signal!=null&&ZD(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 Cw({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function T1t(t,e=void 0){for await(let r of o1e.call(this,t,e))return!0;return!1}async function B2r(t,e=void 0){if(typeof t!="function")throw new XW("fn",["Function","AsyncFunction"],t);return!await T1t.call(this,async(...r)=>!await t(...r),e)}async function z2r(t,e){for await(let r of o1e.call(this,t,e))return r}async function U2r(t,e){if(typeof t!="function")throw new XW("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),Hae}for await(let n of Vae.call(this,r,e));}function o1e(t,e){if(typeof t!="function")throw new XW("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:Hae}return Vae.call(this,r,e)}var n1e=class extends S2r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function q2r(t,e,r){var n;if(typeof t!="function")throw new XW("reducer",["Function","AsyncFunction"],t);r!=null&&YD(r,"options"),r?.signal!=null&&ZD(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new Cw(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await P2r(this.destroy(l)),l}let i=new w2r,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[O2r]:this,[E2r]:!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 Cw;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new n1e}finally{i.abort()}return e}async function H2r(t){t!=null&&YD(t,"options"),t?.signal!=null&&ZD(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 Cw(void 0,{cause:t.signal.reason});N2r(e,n)}return e}function V2r(t,e){let r=Vae.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function A1t(t){if(t=D2r(t),L2r(t))return 0;if(t<0)throw new C2r("number",">= 0",t);return t}function W2r(t,e=void 0){return e!=null&&YD(e,"options"),e?.signal!=null&&ZD(e.signal,"options.signal"),t=A1t(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Cw;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new Cw;t--<=0&&(yield i)}}.call(this)}function K2r(t,e=void 0){return e!=null&&YD(e,"options"),e?.signal!=null&&ZD(e.signal,"options.signal"),t=A1t(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Cw;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new Cw;if(t-- >0&&(yield i),t<=0)return}}.call(this)}i1e.exports.streamReturningOperators={asIndexedPairs:R2r($2r,"readable.asIndexedPairs will be removed in a future version."),drop:W2r,filter:o1e,flatMap:V2r,map:Vae,take:K2r,compose:k2r};i1e.exports.promiseReturningOperators={every:B2r,forEach:U2r,reduce:q2r,toArray:H2r,some:T1t,find:z2r}});var a1e=x((x2o,M1t)=>{"use strict";var{ArrayPrototypePop:G2r,Promise:J2r}=hs(),{isIterable:Z2r,isNodeStream:Y2r,isWebStream:X2r}=vw(),{pipelineImpl:Q2r}=zae(),{finished:e4r}=lP();s1e();function t4r(...t){return new J2r((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!Y2r(i)&&!Z2r(i)&&!X2r(i)){let a=G2r(t);n=a.signal,o=a.end}Q2r(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}M1t.exports={finished:e4r,pipeline:t4r}});var s1e=x((S2o,B1t)=>{var{Buffer:r4r}=Im(),{ObjectDefineProperty:fP,ObjectKeys:j1t,ReflectApply:D1t}=hs(),{promisify:{custom:L1t}}=Vf(),{streamReturningOperators:R1t,promiseReturningOperators:N1t}=I1t(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:F1t}}=zp(),n4r=r1e(),{setDefaultHighWaterMark:o4r,getDefaultHighWaterMark:i4r}=qW(),{pipeline:k1t}=zae(),{destroyer:a4r}=HD(),$1t=lP(),u1e=a1e(),QW=vw(),Ea=B1t.exports=Cae().Stream;Ea.isDestroyed=QW.isDestroyed;Ea.isDisturbed=QW.isDisturbed;Ea.isErrored=QW.isErrored;Ea.isReadable=QW.isReadable;Ea.isWritable=QW.isWritable;Ea.Readable=WW();for(let t of j1t(R1t)){let r=function(...n){if(new.target)throw F1t();return Ea.Readable.from(D1t(e,this,n))};l1e=r;let e=R1t[t];fP(r,"name",{__proto__:null,value:e.name}),fP(r,"length",{__proto__:null,value:e.length}),fP(Ea.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var l1e;for(let t of j1t(N1t)){let r=function(...o){if(new.target)throw F1t();return D1t(e,this,o)};l1e=r;let e=N1t[t];fP(r,"name",{__proto__:null,value:e.name}),fP(r,"length",{__proto__:null,value:e.length}),fP(Ea.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var l1e;Ea.Writable=Fae();Ea.Duplex=Sw();Ea.Transform=qRe();Ea.PassThrough=VRe();Ea.pipeline=k1t;var{addAbortSignal:s4r}=UW();Ea.addAbortSignal=s4r;Ea.finished=$1t;Ea.destroy=a4r;Ea.compose=n4r;Ea.setDefaultHighWaterMark=o4r;Ea.getDefaultHighWaterMark=i4r;fP(Ea,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return u1e}});fP(k1t,L1t,{__proto__:null,enumerable:!0,get(){return u1e.pipeline}});fP($1t,L1t,{__proto__:null,enumerable:!0,get(){return u1e.finished}});Ea.Stream=Ea;Ea._isUint8Array=function(e){return e instanceof Uint8Array};Ea._uint8ArrayToBuffer=function(e){return r4r.from(e.buffer,e.byteOffset,e.byteLength)}});var e9=x((C2o,uu)=>{"use strict";var fc=s1e(),u4r=a1e(),l4r=fc.Readable.destroy;uu.exports=fc.Readable;uu.exports._uint8ArrayToBuffer=fc._uint8ArrayToBuffer;uu.exports._isUint8Array=fc._isUint8Array;uu.exports.isDisturbed=fc.isDisturbed;uu.exports.isErrored=fc.isErrored;uu.exports.isReadable=fc.isReadable;uu.exports.Readable=fc.Readable;uu.exports.Writable=fc.Writable;uu.exports.Duplex=fc.Duplex;uu.exports.Transform=fc.Transform;uu.exports.PassThrough=fc.PassThrough;uu.exports.addAbortSignal=fc.addAbortSignal;uu.exports.finished=fc.finished;uu.exports.destroy=fc.destroy;uu.exports.destroy=l4r;uu.exports.pipeline=fc.pipeline;uu.exports.compose=fc.compose;Object.defineProperty(fc,"promises",{configurable:!0,enumerable:!0,get(){return u4r}});uu.exports.Stream=fc.Stream;uu.exports.default=uu.exports});var XD=x((O2o,z1t)=>{"use strict";z1t.exports=TypeError});var U1t=x(()=>{});var o9=x((T2o,uNt)=>{var _1e=typeof Map=="function"&&Map.prototype,c1e=Object.getOwnPropertyDescriptor&&_1e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Kae=_1e&&c1e&&typeof c1e.get=="function"?c1e.get:null,q1t=_1e&&Map.prototype.forEach,v1e=typeof Set=="function"&&Set.prototype,d1e=Object.getOwnPropertyDescriptor&&v1e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Gae=v1e&&d1e&&typeof d1e.get=="function"?d1e.get:null,H1t=v1e&&Set.prototype.forEach,c4r=typeof WeakMap=="function"&&WeakMap.prototype,r9=c4r?WeakMap.prototype.has:null,d4r=typeof WeakSet=="function"&&WeakSet.prototype,n9=d4r?WeakSet.prototype.has:null,f4r=typeof WeakRef=="function"&&WeakRef.prototype,V1t=f4r?WeakRef.prototype.deref:null,p4r=Boolean.prototype.valueOf,m4r=Object.prototype.toString,h4r=Function.prototype.toString,g4r=String.prototype.match,w1e=String.prototype.slice,bM=String.prototype.replace,y4r=String.prototype.toUpperCase,W1t=String.prototype.toLowerCase,tNt=RegExp.prototype.test,K1t=Array.prototype.concat,Ow=Array.prototype.join,b4r=Array.prototype.slice,G1t=Math.floor,m1e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,f1e=Object.getOwnPropertySymbols,h1e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,tq=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Kf=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===tq||!0)?Symbol.toStringTag:null,rNt=Object.prototype.propertyIsEnumerable,J1t=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Z1t(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||tNt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-G1t(-t):G1t(t);if(n!==t){var o=String(n),i=w1e.call(e,o.length+1);return bM.call(o,r,"$&_")+"."+bM.call(bM.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return bM.call(e,r,"$&_")}var g1e=U1t(),Y1t=g1e.custom,X1t=iNt(Y1t)?Y1t:null,nNt={__proto__:null,double:'"',single:"'"},_4r={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};uNt.exports=function t(e,r,n,o){var i=r||{};if(pP(i,"quoteStyle")&&!pP(nNt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pP(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=pP(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(pP(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(pP(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 sNt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?Z1t(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?Z1t(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 y1e(e)?"[Array]":"[Object]";var d=F4r(i,n);if(typeof o>"u")o=[];else if(aNt(o,e)>=0)return"[Circular]";function f(k,F,K){if(F&&(o=b4r.call(o),o.push(F)),K){var U={depth:i.depth};return pP(i,"quoteStyle")&&(U.quoteStyle=i.quoteStyle),t(k,U,n+1,o)}return t(k,i,n+1,o)}if(typeof e=="function"&&!Q1t(e)){var p=T4r(e),h=Wae(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+Ow.call(h,", ")+" }":"")}if(iNt(e)){var m=tq?bM.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):h1e.call(e);return typeof e=="object"&&!tq?t9(m):m}if(j4r(e)){for(var g="<"+W1t.call(String(e.nodeName)),y=e.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+oNt(v4r(y[_].value),"double",i);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+W1t.call(String(e.nodeName))+">",g}if(y1e(e)){if(e.length===0)return"[]";var w=Wae(e,f);return d&&!L4r(w)?"["+b1e(w,d)+"]":"[ "+Ow.call(w,", ")+" ]"}if(x4r(e)){var S=Wae(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!rNt.call(e,"cause")?"{ ["+String(e)+"] "+Ow.call(K1t.call("[cause]: "+f(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Ow.call(S,", ")+" }"}if(typeof e=="object"&&a){if(X1t&&typeof e[X1t]=="function"&&g1e)return g1e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(A4r(e)){var C=[];return q1t&&q1t.call(e,function(k,F){C.push(f(F,e,!0)+" => "+f(k,e))}),eNt("Map",Kae.call(e),C,d)}if(R4r(e)){var E=[];return H1t&&H1t.call(e,function(k){E.push(f(k,e))}),eNt("Set",Gae.call(e),E,d)}if(I4r(e))return p1e("WeakMap");if(N4r(e))return p1e("WeakSet");if(M4r(e))return p1e("WeakRef");if(C4r(e))return t9(f(Number(e)));if(E4r(e))return t9(f(m1e.call(e)));if(O4r(e))return t9(p4r.call(e));if(S4r(e))return t9(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(!w4r(e)&&!Q1t(e)){var P=Wae(e,f),T=J1t?J1t(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",N=!T&&Kf&&Object(e)===e&&Kf in e?w1e.call(_M(e),8,-1):I?"Object":"",M=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",D=M+(N||I?"["+Ow.call(K1t.call([],N||[],I||[]),": ")+"] ":"");return P.length===0?D+"{}":d?D+"{"+b1e(P,d)+"}":D+"{ "+Ow.call(P,", ")+" }"}return String(e)};function oNt(t,e,r){var n=r.quoteStyle||e,o=nNt[n];return o+t+o}function v4r(t){return bM.call(String(t),/"/g,"&quot;")}function y1e(t){return _M(t)==="[object Array]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function w4r(t){return _M(t)==="[object Date]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function Q1t(t){return _M(t)==="[object RegExp]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function x4r(t){return _M(t)==="[object Error]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function S4r(t){return _M(t)==="[object String]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function C4r(t){return _M(t)==="[object Number]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function O4r(t){return _M(t)==="[object Boolean]"&&(!Kf||!(typeof t=="object"&&Kf in t))}function iNt(t){if(tq)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!h1e)return!1;try{return h1e.call(t),!0}catch{}return!1}function E4r(t){if(!t||typeof t!="object"||!m1e)return!1;try{return m1e.call(t),!0}catch{}return!1}var P4r=Object.prototype.hasOwnProperty||function(t){return t in this};function pP(t,e){return P4r.call(t,e)}function _M(t){return m4r.call(t)}function T4r(t){if(t.name)return t.name;var e=g4r.call(h4r.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function aNt(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 A4r(t){if(!Kae||!t||typeof t!="object")return!1;try{Kae.call(t);try{Gae.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function I4r(t){if(!r9||!t||typeof t!="object")return!1;try{r9.call(t,r9);try{n9.call(t,n9)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function M4r(t){if(!V1t||!t||typeof t!="object")return!1;try{return V1t.call(t),!0}catch{}return!1}function R4r(t){if(!Gae||!t||typeof t!="object")return!1;try{Gae.call(t);try{Kae.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function N4r(t){if(!n9||!t||typeof t!="object")return!1;try{n9.call(t,n9);try{r9.call(t,r9)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function j4r(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function sNt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return sNt(w1e.call(t,0,e.maxStringLength),e)+n}var o=_4r[e.quoteStyle||"single"];o.lastIndex=0;var i=bM.call(bM.call(t,o,"\\$1"),/[\x00-\x1f]/g,D4r);return oNt(i,"single",e)}function D4r(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":"")+y4r.call(e.toString(16))}function t9(t){return"Object("+t+")"}function p1e(t){return t+" { ? }"}function eNt(t,e,r,n){var o=n?b1e(r,n):Ow.call(r,", ");return t+" ("+e+") {"+o+"}"}function L4r(t){for(var e=0;e<t.length;e++)if(aNt(t[e],`
`)>=0)return!1;return!0}function F4r(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Ow.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Ow.call(Array(e+1),r)}}function b1e(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+Ow.call(t,","+r)+`
`+e.prev}function Wae(t,e){var r=y1e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=pP(t,o)?e(t[o],t):""}var i=typeof f1e=="function"?f1e(t):[],a;if(tq){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)pP(t,u)&&(r&&String(Number(u))===u&&u<t.length||tq&&a["$"+u]instanceof Symbol||(tNt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof f1e=="function")for(var l=0;l<i.length;l++)rNt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var cNt=x((A2o,lNt)=>{"use strict";var k4r=o9(),$4r=XD(),Jae=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},B4r=function(t,e){if(t){var r=Jae(t,e);return r&&r.value}},z4r=function(t,e,r){var n=Jae(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},U4r=function(t,e){return t?!!Jae(t,e):!1},q4r=function(t,e){if(t)return Jae(t,e,!0)};lNt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new $4r("Side channel does not contain "+k4r(n))},delete:function(n){var o=e&&e.next,i=q4r(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return B4r(e,n)},has:function(n){return U4r(e,n)},set:function(n,o){e||(e={next:void 0}),z4r(e,n,o)}};return r}});var x1e=x((I2o,dNt)=>{"use strict";dNt.exports=Object});var pNt=x((M2o,fNt)=>{"use strict";fNt.exports=Error});var hNt=x((R2o,mNt)=>{"use strict";mNt.exports=EvalError});var yNt=x((N2o,gNt)=>{"use strict";gNt.exports=RangeError});var _Nt=x((j2o,bNt)=>{"use strict";bNt.exports=ReferenceError});var wNt=x((D2o,vNt)=>{"use strict";vNt.exports=SyntaxError});var SNt=x((L2o,xNt)=>{"use strict";xNt.exports=URIError});var ONt=x((F2o,CNt)=>{"use strict";CNt.exports=Math.abs});var PNt=x((k2o,ENt)=>{"use strict";ENt.exports=Math.floor});var ANt=x(($2o,TNt)=>{"use strict";TNt.exports=Math.max});var MNt=x((B2o,INt)=>{"use strict";INt.exports=Math.min});var NNt=x((z2o,RNt)=>{"use strict";RNt.exports=Math.pow});var DNt=x((U2o,jNt)=>{"use strict";jNt.exports=Math.round});var FNt=x((q2o,LNt)=>{"use strict";LNt.exports=Number.isNaN||function(e){return e!==e}});var $Nt=x((H2o,kNt)=>{"use strict";var H4r=FNt();kNt.exports=function(e){return H4r(e)||e===0?e:e<0?-1:1}});var zNt=x((V2o,BNt)=>{"use strict";BNt.exports=Object.getOwnPropertyDescriptor});var S1e=x((W2o,UNt)=>{"use strict";var Zae=zNt();if(Zae)try{Zae([],"length")}catch{Zae=null}UNt.exports=Zae});var HNt=x((K2o,qNt)=>{"use strict";var Yae=Object.defineProperty||!1;if(Yae)try{Yae({},"a",{value:1})}catch{Yae=!1}qNt.exports=Yae});var WNt=x((G2o,VNt)=>{"use strict";VNt.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 JNt=x((J2o,GNt)=>{"use strict";var KNt=typeof Symbol<"u"&&Symbol,V4r=WNt();GNt.exports=function(){return typeof KNt!="function"||typeof Symbol!="function"||typeof KNt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:V4r()}});var C1e=x((Z2o,ZNt)=>{"use strict";ZNt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var O1e=x((Y2o,YNt)=>{"use strict";var W4r=x1e();YNt.exports=W4r.getPrototypeOf||null});var ejt=x((X2o,QNt)=>{"use strict";var K4r="Function.prototype.bind called on incompatible ",G4r=Object.prototype.toString,J4r=Math.max,Z4r="[object Function]",XNt=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},Y4r=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},X4r=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};QNt.exports=function(e){var r=this;if(typeof r!="function"||G4r.apply(r)!==Z4r)throw new TypeError(K4r+r);for(var n=Y4r(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,XNt(n,arguments));return Object(c)===c?c:this}return r.apply(e,XNt(n,arguments))},a=J4r(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+X4r(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 i9=x((Q2o,tjt)=>{"use strict";var Q4r=ejt();tjt.exports=Function.prototype.bind||Q4r});var Xae=x((e4o,rjt)=>{"use strict";rjt.exports=Function.prototype.call});var E1e=x((t4o,njt)=>{"use strict";njt.exports=Function.prototype.apply});var ijt=x((r4o,ojt)=>{"use strict";ojt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var sjt=x((n4o,ajt)=>{"use strict";var e3r=i9(),t3r=E1e(),r3r=Xae(),n3r=ijt();ajt.exports=n3r||e3r.call(r3r,t3r)});var P1e=x((o4o,ujt)=>{"use strict";var o3r=i9(),i3r=XD(),a3r=Xae(),s3r=sjt();ujt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new i3r("a function is required");return s3r(o3r,a3r,e)}});var mjt=x((i4o,pjt)=>{"use strict";var u3r=P1e(),ljt=S1e(),djt;try{djt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var T1e=!!djt&&ljt&&ljt(Object.prototype,"__proto__"),fjt=Object,cjt=fjt.getPrototypeOf;pjt.exports=T1e&&typeof T1e.get=="function"?u3r([T1e.get]):typeof cjt=="function"?function(e){return cjt(e==null?e:fjt(e))}:!1});var _jt=x((a4o,bjt)=>{"use strict";var hjt=C1e(),gjt=O1e(),yjt=mjt();bjt.exports=hjt?function(e){return hjt(e)}:gjt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return gjt(e)}:yjt?function(e){return yjt(e)}:null});var wjt=x((s4o,vjt)=>{"use strict";var l3r=Function.prototype.call,c3r=Object.prototype.hasOwnProperty,d3r=i9();vjt.exports=d3r.call(l3r,c3r)});var tse=x((u4o,Pjt)=>{"use strict";var ro,f3r=x1e(),p3r=pNt(),m3r=hNt(),h3r=yNt(),g3r=_Nt(),iq=wNt(),oq=XD(),y3r=SNt(),b3r=ONt(),_3r=PNt(),v3r=ANt(),w3r=MNt(),x3r=NNt(),S3r=DNt(),C3r=$Nt(),Ojt=Function,A1e=function(t){try{return Ojt('"use strict"; return ('+t+").constructor;")()}catch{}},a9=S1e(),O3r=HNt(),I1e=function(){throw new oq},E3r=a9?function(){try{return arguments.callee,I1e}catch{try{return a9(arguments,"callee").get}catch{return I1e}}}():I1e,rq=JNt()(),Bc=_jt(),P3r=O1e(),T3r=C1e(),Ejt=E1e(),s9=Xae(),nq={},A3r=typeof Uint8Array>"u"||!Bc?ro:Bc(Uint8Array),QD={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ro:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ro:ArrayBuffer,"%ArrayIteratorPrototype%":rq&&Bc?Bc([][Symbol.iterator]()):ro,"%AsyncFromSyncIteratorPrototype%":ro,"%AsyncFunction%":nq,"%AsyncGenerator%":nq,"%AsyncGeneratorFunction%":nq,"%AsyncIteratorPrototype%":nq,"%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%":p3r,"%eval%":eval,"%EvalError%":m3r,"%Float32Array%":typeof Float32Array>"u"?ro:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ro:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ro:FinalizationRegistry,"%Function%":Ojt,"%GeneratorFunction%":nq,"%Int8Array%":typeof Int8Array>"u"?ro:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ro:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ro:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":rq&&Bc?Bc(Bc([][Symbol.iterator]())):ro,"%JSON%":typeof JSON=="object"?JSON:ro,"%Map%":typeof Map>"u"?ro:Map,"%MapIteratorPrototype%":typeof Map>"u"||!rq||!Bc?ro:Bc(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":f3r,"%Object.getOwnPropertyDescriptor%":a9,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ro:Promise,"%Proxy%":typeof Proxy>"u"?ro:Proxy,"%RangeError%":h3r,"%ReferenceError%":g3r,"%Reflect%":typeof Reflect>"u"?ro:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ro:Set,"%SetIteratorPrototype%":typeof Set>"u"||!rq||!Bc?ro:Bc(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ro:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":rq&&Bc?Bc(""[Symbol.iterator]()):ro,"%Symbol%":rq?Symbol:ro,"%SyntaxError%":iq,"%ThrowTypeError%":E3r,"%TypedArray%":A3r,"%TypeError%":oq,"%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%":y3r,"%WeakMap%":typeof WeakMap>"u"?ro:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ro:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ro:WeakSet,"%Function.prototype.call%":s9,"%Function.prototype.apply%":Ejt,"%Object.defineProperty%":O3r,"%Object.getPrototypeOf%":P3r,"%Math.abs%":b3r,"%Math.floor%":_3r,"%Math.max%":v3r,"%Math.min%":w3r,"%Math.pow%":x3r,"%Math.round%":S3r,"%Math.sign%":C3r,"%Reflect.getPrototypeOf%":T3r};if(Bc)try{null.error}catch(t){xjt=Bc(Bc(t)),QD["%Error.prototype%"]=xjt}var xjt,I3r=function t(e){var r;if(e==="%AsyncFunction%")r=A1e("async function () {}");else if(e==="%GeneratorFunction%")r=A1e("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=A1e("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Bc&&(r=Bc(o.prototype))}return QD[e]=r,r},Sjt={__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"]},u9=i9(),Qae=wjt(),M3r=u9.call(s9,Array.prototype.concat),R3r=u9.call(Ejt,Array.prototype.splice),Cjt=u9.call(s9,String.prototype.replace),ese=u9.call(s9,String.prototype.slice),N3r=u9.call(s9,RegExp.prototype.exec),j3r=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,D3r=/\\(\\)?/g,L3r=function(e){var r=ese(e,0,1),n=ese(e,-1);if(r==="%"&&n!=="%")throw new iq("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new iq("invalid intrinsic syntax, expected opening `%`");var o=[];return Cjt(e,j3r,function(i,a,s,u){o[o.length]=s?Cjt(u,D3r,"$1"):a||i}),o},F3r=function(e,r){var n=e,o;if(Qae(Sjt,n)&&(o=Sjt[n],n="%"+o[0]+"%"),Qae(QD,n)){var i=QD[n];if(i===nq&&(i=I3r(n)),typeof i>"u"&&!r)throw new oq("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new iq("intrinsic "+e+" does not exist!")};Pjt.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new oq("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new oq('"allowMissing" argument must be a boolean');if(N3r(/^%?[^%]*%?$/,e)===null)throw new iq("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=L3r(e),o=n.length>0?n[0]:"",i=F3r("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],R3r(n,M3r([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=ese(f,0,1),h=ese(f,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new iq("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",Qae(QD,a))s=QD[a];else if(s!=null){if(!(f in s)){if(!r)throw new oq("base intrinsic for "+e+" exists, but the property is not available.");return}if(a9&&c+1>=n.length){var m=a9(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=Qae(s,f),s=s[f];d&&!u&&(QD[a]=s)}}return s}});var M1e=x((l4o,Ijt)=>{"use strict";var Tjt=tse(),Ajt=P1e(),k3r=Ajt([Tjt("%String.prototype.indexOf%")]);Ijt.exports=function(e,r){var n=Tjt(e,!!r);return typeof n=="function"&&k3r(e,".prototype.")>-1?Ajt([n]):n}});var R1e=x((c4o,Rjt)=>{"use strict";var $3r=tse(),l9=M1e(),B3r=o9(),z3r=XD(),Mjt=$3r("%Map%",!0),U3r=l9("Map.prototype.get",!0),q3r=l9("Map.prototype.set",!0),H3r=l9("Map.prototype.has",!0),V3r=l9("Map.prototype.delete",!0),W3r=l9("Map.prototype.size",!0);Rjt.exports=!!Mjt&&function(){var e,r={assert:function(n){if(!r.has(n))throw new z3r("Side channel does not contain "+B3r(n))},delete:function(n){if(e){var o=V3r(e,n);return W3r(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return U3r(e,n)},has:function(n){return e?H3r(e,n):!1},set:function(n,o){e||(e=new Mjt),q3r(e,n,o)}};return r}});var jjt=x((d4o,Njt)=>{"use strict";var K3r=tse(),nse=M1e(),G3r=o9(),rse=R1e(),J3r=XD(),aq=K3r("%WeakMap%",!0),Z3r=nse("WeakMap.prototype.get",!0),Y3r=nse("WeakMap.prototype.set",!0),X3r=nse("WeakMap.prototype.has",!0),Q3r=nse("WeakMap.prototype.delete",!0);Njt.exports=aq?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new J3r("Side channel does not contain "+G3r(o))},delete:function(o){if(aq&&o&&(typeof o=="object"||typeof o=="function")){if(e)return Q3r(e,o)}else if(rse&&r)return r.delete(o);return!1},get:function(o){return aq&&o&&(typeof o=="object"||typeof o=="function")&&e?Z3r(e,o):r&&r.get(o)},has:function(o){return aq&&o&&(typeof o=="object"||typeof o=="function")&&e?X3r(e,o):!!r&&r.has(o)},set:function(o,i){aq&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new aq),Y3r(e,o,i)):rse&&(r||(r=rse()),r.set(o,i))}};return n}:rse});var Ljt=x((f4o,Djt)=>{"use strict";var eHr=XD(),tHr=o9(),rHr=cNt(),nHr=R1e(),oHr=jjt(),iHr=oHr||nHr||rHr;Djt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new eHr("Side channel does not contain "+tHr(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=iHr()),e.set(n,o)}};return r}});var ose=x((p4o,Fjt)=>{"use strict";var aHr=String.prototype.replace,sHr=/%20/g,N1e={RFC1738:"RFC1738",RFC3986:"RFC3986"};Fjt.exports={default:N1e.RFC3986,formatters:{RFC1738:function(t){return aHr.call(t,sHr,"+")},RFC3986:function(t){return String(t)}},RFC1738:N1e.RFC1738,RFC3986:N1e.RFC3986}});var D1e=x((m4o,$jt)=>{"use strict";var uHr=ose(),j1e=Object.prototype.hasOwnProperty,eL=Array.isArray,Ew=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),lHr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(eL(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},kjt=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},cHr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(eL(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!j1e.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 eL(e)&&!eL(r)&&(o=kjt(e,n)),eL(e)&&eL(r)?(r.forEach(function(i,a){if(j1e.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 j1e.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},dHr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},fHr=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}},pHr=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===uHr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+Ew[l];continue}if(l<2048){s=s+(Ew[192|l>>6]+Ew[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Ew[224|l>>12]+Ew[128|l>>6&63]+Ew[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=Ew[240|l>>18]+Ew[128|l>>12&63]+Ew[128|l>>6&63]+Ew[128|l&63]}return s},mHr=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 lHr(r),e},hHr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},gHr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},yHr=function(e,r){return[].concat(e,r)},bHr=function(e,r){if(eL(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};$jt.exports={arrayToObject:kjt,assign:dHr,combine:yHr,compact:mHr,decode:fHr,encode:pHr,isBuffer:gHr,isRegExp:hHr,maybeMap:bHr,merge:cHr}});var Vjt=x((h4o,Hjt)=>{"use strict";var Ujt=Ljt(),ise=D1e(),c9=ose(),_Hr=Object.prototype.hasOwnProperty,Bjt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},mP=Array.isArray,vHr=Array.prototype.push,qjt=function(t,e){vHr.apply(t,mP(e)?e:[e])},wHr=Date.prototype.toISOString,zjt=c9.default,Gf={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:ise.encode,encodeValuesOnly:!1,format:zjt,formatter:c9.formatters[zjt],indices:!1,serializeDate:function(e){return wHr.call(e)},skipNulls:!1,strictNullHandling:!1},xHr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},L1e={},SHr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,g){for(var y=e,_=g,w=0,S=!1;(_=_.get(L1e))!==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(L1e)>"u"&&(w=0)}if(typeof u=="function"?y=u(r,y):y instanceof Date?y=d(y):n==="comma"&&mP(y)&&(y=ise.maybeMap(y,function(U){return U instanceof Date?d(U):U})),y===null){if(i)return s&&!h?s(r,Gf.encoder,m,"key",f):r;y=""}if(xHr(y)||ise.isBuffer(y)){if(s){var E=h?r:s(r,Gf.encoder,m,"key",f);return[p(E)+"="+p(s(y,Gf.encoder,m,"value",f))]}return[p(r)+"="+p(String(y))]}var P=[];if(typeof y>"u")return P;var T;if(n==="comma"&&mP(y))h&&s&&(y=ise.maybeMap(y,s)),T=[{value:y.length>0?y.join(",")||null:void 0}];else if(mP(u))T=u;else{var I=Object.keys(y);T=l?I.sort(l):I}for(var N=o&&mP(y)&&y.length===1?r+"[]":r,M=0;M<T.length;++M){var D=T[M],k=typeof D=="object"&&typeof D.value<"u"?D.value:y[D];if(!(a&&k===null)){var F=mP(y)?typeof n=="function"?n(N,D):N:N+(c?"."+D:"["+D+"]");g.set(e,w);var K=Ujt();K.set(L1e,g),qjt(P,t(k,F,n,o,i,a,n==="comma"&&h&&mP(y)?null:s,u,l,c,d,f,p,h,m,K))}}return P},CHr=function(e){if(!e)return Gf;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||Gf.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(!_Hr.call(c9.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=c9.formatters[n],i=Gf.filter;return(typeof e.filter=="function"||mP(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Gf.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Gf.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Gf.charsetSentinel,delimiter:typeof e.delimiter>"u"?Gf.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Gf.encode,encoder:typeof e.encoder=="function"?e.encoder:Gf.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Gf.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Gf.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Gf.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Gf.strictNullHandling}};Hjt.exports=function(t,e){var r=t,n=CHr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):mP(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in Bjt?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=Bjt[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=Ujt(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||qjt(a,SHr(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),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),p.length>0?h+p:""}});var Gjt=x((g4o,Kjt)=>{"use strict";var sq=D1e(),F1e=Object.prototype.hasOwnProperty,OHr=Array.isArray,zc={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:sq.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},EHr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Wjt=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},PHr="utf8=%26%2310003%3B",THr="utf8=%E2%9C%93",AHr=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]===THr?l="utf-8":a[u]===PHr&&(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,h;f===-1?(p=r.decoder(c,zc.decoder,l,"key"),h=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),zc.decoder,l,"key"),h=sq.maybeMap(Wjt(c.slice(f+1),r),function(m){return r.decoder(m,zc.decoder,l,"value")})),h&&r.interpretNumericEntities&&l==="iso-8859-1"&&(h=EHr(h)),c.indexOf("[]=")>-1&&(h=OHr(h)?[h]:h),F1e.call(n,p)?n[p]=sq.combine(n[p],h):n[p]=h}return n},IHr=function(t,e,r,n){for(var o=n?e:Wjt(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},MHr=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&&F1e.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&&F1e.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),IHr(c,r,n,o)}},RHr=function(e){if(!e)return zc;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"?zc.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?zc.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:zc.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:zc.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:zc.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:zc.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:zc.comma,decoder:typeof e.decoder=="function"?e.decoder:zc.decoder,delimiter:typeof e.delimiter=="string"||sq.isRegExp(e.delimiter)?e.delimiter:zc.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:zc.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:zc.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:zc.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:zc.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:zc.strictNullHandling}};Kjt.exports=function(t,e){var r=RHr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?AHr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=MHr(s,n[s],r,typeof t=="string");o=sq.merge(o,u,r)}return r.allowSparse===!0?o:sq.compact(o)}});var Zjt=x((y4o,Jjt)=>{"use strict";var NHr=Vjt(),jHr=Gjt(),DHr=ose();Jjt.exports={formats:DHr,parse:jHr,stringify:NHr}});var Yjt=x(uq=>{"use strict";var LHr=uq&&uq.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uq,"__esModule",{value:!0});uq.createRequestUrl=void 0;var FHr=LHr(Zjt());function kHr(t,e){return Object.keys(e??{}).length>0?`${t}?${FHr.default.stringify(e,{arrayFormat:"repeat"})}`:t}uq.createRequestUrl=kHr});var eDt=x(ase=>{"use strict";var k1e,$1e,B1e,z1e,U1e;Object.defineProperty(ase,"__esModule",{value:!0});ase.RUNTIME=void 0;var $Hr=typeof window<"u"&&typeof window.document<"u",BHr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((k1e=self.constructor)===null||k1e===void 0?void 0:k1e.name)==="DedicatedWorkerGlobalScope"||(($1e=self.constructor)===null||$1e===void 0?void 0:$1e.name)==="ServiceWorkerGlobalScope"||((B1e=self.constructor)===null||B1e===void 0?void 0:B1e.name)==="SharedWorkerGlobalScope"),Xjt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",Qjt=typeof Bun<"u"&&typeof Bun.version<"u",zHr=typeof process<"u"&&!!process.version&&!!(!((z1e=process.versions)===null||z1e===void 0)&&z1e.node)&&!Xjt&&!Qjt,UHr=typeof navigator<"u"&&navigator?.product==="ReactNative",qHr=typeof globalThis<"u"&&((U1e=globalThis?.navigator)===null||U1e===void 0?void 0:U1e.userAgent)==="Cloudflare-Workers";ase.RUNTIME=HHr();function HHr(){return $Hr?{type:"browser",version:window.navigator.userAgent}:qHr?{type:"workerd"}:BHr?{type:"web-worker"}:Xjt?{type:"deno",version:Deno.version.deno}:Qjt?{type:"bun",version:Bun.version}:zHr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:UHr?{type:"react-native"}:{type:"unknown"}}});var lq=x(sse=>{"use strict";Object.defineProperty(sse,"__esModule",{value:!0});sse.RUNTIME=void 0;var VHr=eDt();Object.defineProperty(sse,"RUNTIME",{enumerable:!0,get:function(){return VHr.RUNTIME}})});var q1e=x((cq,tDt)=>{"use strict";var WHr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},tL=WHr();tDt.exports=cq=tL.fetch;tL.fetch&&(cq.default=tL.fetch.bind(tL));cq.Headers=tL.Headers;cq.Request=tL.Request;cq.Response=tL.Response});var nDt=x(xy=>{"use strict";var KHr=xy&&xy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GHr=xy&&xy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rDt=xy&&xy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KHr(e,t,r);return GHr(e,t),e},JHr=xy&&xy.__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(xy,"__esModule",{value:!0});xy.getFetchFn=void 0;var use=lq();function ZHr(){return JHr(this,void 0,void 0,function*(){return use.RUNTIME.type==="node"&&use.RUNTIME.parsedVersion!=null&&use.RUNTIME.parsedVersion>=18?fetch:use.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>rDt(q1e()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>rDt(q1e()))).default})}xy.getFetchFn=ZHr});var oDt=x(dq=>{"use strict";var YHr=dq&&dq.__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(dq,"__esModule",{value:!0});dq.getRequestBody=void 0;function XHr({body:t,type:e}){return YHr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}dq.getRequestBody=XHr});var iDt=x(fq=>{"use strict";var e_=fq&&fq.__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(fq,"__esModule",{value:!0});fq.Node18UniversalStreamWrapper=void 0;var H1e=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=>e_(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",()=>e_(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>e_(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=>e_(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",()=>e_(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>e_(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 e_(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 e_(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 e_(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 e_(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:()=>e_(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}}}};fq.Node18UniversalStreamWrapper=H1e});var aDt=x(pq=>{"use strict";var d9=pq&&pq.__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(pq,"__esModule",{value:!0});pq.UndiciStreamWrapper=void 0;var V1e=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 d9(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 d9(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 d9(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 d9(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:()=>d9(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}}}};pq.UndiciStreamWrapper=V1e});var sDt=x(vM=>{"use strict";var lse=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())})},QHr=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)}};Object.defineProperty(vM,"__esModule",{value:!0});vM.NodePre18StreamWrapper=void 0;var W1e=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 lse(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 lse(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=QHr(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 lse(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 lse(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};vM.NodePre18StreamWrapper=W1e});var uDt=x(Sy=>{"use strict";var eVr=Sy&&Sy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tVr=Sy&&Sy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K1e=Sy&&Sy.__importStar||function(t){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 tVr(e,t),e},rVr=Sy&&Sy.__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(Sy,"__esModule",{value:!0});Sy.chooseStreamWrapper=void 0;var cse=lq();function nVr(t){return rVr(this,void 0,void 0,function*(){return cse.RUNTIME.type==="node"&&cse.RUNTIME.parsedVersion!=null&&cse.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>K1e(iDt()))).Node18UniversalStreamWrapper(t):cse.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>K1e(aDt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>K1e(sDt()))).NodePre18StreamWrapper(t)})}Sy.chooseStreamWrapper=nVr});var lDt=x(mq=>{"use strict";var oVr=mq&&mq.__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(mq,"__esModule",{value:!0});mq.getResponseBody=void 0;var iVr=uDt();function aVr(t,e){return oVr(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,iVr.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}})}mq.getResponseBody=aVr});var cDt=x(hq=>{"use strict";Object.defineProperty(hq,"__esModule",{value:!0});hq.anySignal=hq.getTimeoutSignal=void 0;var sVr="timeout";function uVr(t){let e=new AbortController,r=setTimeout(()=>e.abort(sVr),t);return{signal:e.signal,abortId:r}}hq.getTimeoutSignal=uVr;function lVr(...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}hq.anySignal=lVr});var fDt=x(gq=>{"use strict";var cVr=gq&&gq.__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(gq,"__esModule",{value:!0});gq.makeRequest=void 0;var dDt=cDt(),dVr=(t,e,r,n,o,i,a,s,u)=>cVr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:h}=(0,dDt.getTimeoutSignal)(i);c=h,l.push(p)}a!=null&&l.push(a);let d=(0,dDt.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});gq.makeRequest=dVr});var pDt=x(yq=>{"use strict";var fVr=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.requestWithRetries=void 0;var pVr=1,mVr=60,hVr=2;function gVr(t,e=hVr){return fVr(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(pVr*Math.pow(2,n),mVr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}yq.requestWithRetries=gVr});var gDt=x(wM=>{"use strict";var mDt=wM&&wM.__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(wM,"__esModule",{value:!0});wM.fetcher=wM.fetcherImpl=void 0;var yVr=Yjt(),bVr=nDt(),_Vr=oDt(),vVr=lDt(),wVr=fDt(),xVr=pDt();function hDt(t){return mDt(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,yVr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,_Vr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,bVr.getFetchFn)();try{let i=yield(0,xVr.requestWithRetries)(()=>mDt(this,void 0,void 0,function*(){return(0,wVr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,vVr.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)}}}})}wM.fetcherImpl=hDt;wM.fetcher=hDt});var yDt=x(dse=>{"use strict";Object.defineProperty(dse,"__esModule",{value:!0});dse.getHeader=void 0;function SVr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}dse.getHeader=SVr});var bDt=x(bq=>{"use strict";var CVr=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.Supplier=void 0;bq.Supplier={get:t=>CVr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var _Dt=x(xM=>{"use strict";Object.defineProperty(xM,"__esModule",{value:!0});xM.Supplier=xM.getHeader=xM.fetcher=void 0;var OVr=gDt();Object.defineProperty(xM,"fetcher",{enumerable:!0,get:function(){return OVr.fetcher}});var EVr=yDt();Object.defineProperty(xM,"getHeader",{enumerable:!0,get:function(){return EVr.getHeader}});var PVr=bDt();Object.defineProperty(xM,"Supplier",{enumerable:!0,get:function(){return PVr.Supplier}})});var vDt=x((G1e,J1e)=>{(function(t,e){typeof G1e=="object"&&typeof J1e<"u"?J1e.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:G1e,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(H){var G={};return H.forEach(function(Z,de){return G[Z]=de}),G}(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(H,G){return G===void 0&&(G=function(Z){return Z}),new Uint8Array(Array.prototype.slice.call(H,0).map(G))},p=function(H){return H.replace(/=/g,"").replace(/[+\/]/g,function(G){return G=="+"?"-":"_"})},h=function(H){return H.replace(/[^A-Za-z0-9\+\/]/g,"")},m=function(H){for(var G,Z,de,pe,ae="",Te=H.length%3,Ae=0;Ae<H.length;){if((Z=H.charCodeAt(Ae++))>255||(de=H.charCodeAt(Ae++))>255||(pe=H.charCodeAt(Ae++))>255)throw new TypeError("invalid character found");G=Z<<16|de<<8|pe,ae+=u[G>>18&63]+u[G>>12&63]+u[G>>6&63]+u[G&63]}return Te?ae.slice(0,Te-3)+"===".substring(Te):ae},g=n?function(H){return btoa(H)}:o?function(H){return Buffer.from(H,"binary").toString("base64")}:m,y=o?function(H){return Buffer.from(H).toString("base64")}:function(H){for(var G=4096,Z=[],de=0,pe=H.length;de<pe;de+=G)Z.push(d.apply(null,H.subarray(de,de+G)));return g(Z.join(""))},_=function(H,G){return G===void 0&&(G=!1),G?p(y(H)):y(H)},w=function(H){if(H.length<2){var G=H.charCodeAt(0);return G<128?H:G<2048?d(192|G>>>6)+d(128|G&63):d(224|G>>>12&15)+d(128|G>>>6&63)+d(128|G&63)}else{var G=65536+(H.charCodeAt(0)-55296)*1024+(H.charCodeAt(1)-56320);return d(240|G>>>18&7)+d(128|G>>>12&63)+d(128|G>>>6&63)+d(128|G&63)}},S=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(H){return H.replace(S,w)},E=o?function(H){return Buffer.from(H,"utf8").toString("base64")}:a?function(H){return y(a.encode(H))}:function(H){return g(C(H))},P=function(H,G){return G===void 0&&(G=!1),G?p(E(H)):E(H)},T=function(H){return P(H,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,N=function(H){switch(H.length){case 4:var G=(7&H.charCodeAt(0))<<18|(63&H.charCodeAt(1))<<12|(63&H.charCodeAt(2))<<6|63&H.charCodeAt(3),Z=G-65536;return d((Z>>>10)+55296)+d((Z&1023)+56320);case 3:return d((15&H.charCodeAt(0))<<12|(63&H.charCodeAt(1))<<6|63&H.charCodeAt(2));default:return d((31&H.charCodeAt(0))<<6|63&H.charCodeAt(1))}},M=function(H){return H.replace(I,N)},D=function(H){if(H=H.replace(/\s+/g,""),!c.test(H))throw new TypeError("malformed base64.");H+="==".slice(2-(H.length&3));for(var G,Z="",de,pe,ae=0;ae<H.length;)G=l[H.charAt(ae++)]<<18|l[H.charAt(ae++)]<<12|(de=l[H.charAt(ae++)])<<6|(pe=l[H.charAt(ae++)]),Z+=de===64?d(G>>16&255):pe===64?d(G>>16&255,G>>8&255):d(G>>16&255,G>>8&255,G&255);return Z},k=r?function(H){return atob(h(H))}:o?function(H){return Buffer.from(H,"base64").toString("binary")}:D,F=o?function(H){return f(Buffer.from(H,"base64"))}:function(H){return f(k(H),function(G){return G.charCodeAt(0)})},K=function(H){return F(X(H))},U=o?function(H){return Buffer.from(H,"base64").toString("utf8")}:i?function(H){return i.decode(F(H))}:function(H){return M(k(H))},X=function(H){return h(H.replace(/[-_]/g,function(G){return G=="-"?"+":"/"}))},ee=function(H){return U(X(H))},L=function(H){if(typeof H!="string")return!1;var G=H.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(G)||!/[^\s0-9a-zA-Z\-_]/.test(G)},Q=function(H){return{value:H,enumerable:!1,writable:!0,configurable:!0}},z=function(){var H=function(G,Z){return Object.defineProperty(String.prototype,G,Q(Z))};H("fromBase64",function(){return ee(this)}),H("toBase64",function(G){return P(this,G)}),H("toBase64URI",function(){return P(this,!0)}),H("toBase64URL",function(){return P(this,!0)}),H("toUint8Array",function(){return K(this)})},W=function(){var H=function(G,Z){return Object.defineProperty(Uint8Array.prototype,G,Q(Z))};H("toBase64",function(G){return _(this,G)}),H("toBase64URI",function(){return _(this,!0)}),H("toBase64URL",function(){return _(this,!0)})},V=function(){z(),W()},q={version:t,VERSION:e,atob:k,atobPolyfill:D,btoa:g,btoaPolyfill:m,fromBase64:ee,toBase64:P,encode:P,encodeURI:T,encodeURL:T,utob:C,btou:M,decode:ee,isValid:L,fromUint8Array:_,toUint8Array:K,extendString:z,extendUint8Array:W,extendBuiltins:V};return q.Base64={},Object.keys(q).forEach(function(H){return q.Base64[H]=q[H]}),q})});var xDt=x(fse=>{"use strict";Object.defineProperty(fse,"__esModule",{value:!0});fse.BasicAuth=void 0;var wDt=vDt(),TVr=/^Basic /i;fse.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${wDt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(TVr,""),r=wDt.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 SDt=x(pse=>{"use strict";Object.defineProperty(pse,"__esModule",{value:!0});pse.BearerToken=void 0;var AVr=/^Bearer /i;pse.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(AVr,"").trim()}});var CDt=x(_q=>{"use strict";Object.defineProperty(_q,"__esModule",{value:!0});_q.BearerToken=_q.BasicAuth=void 0;var IVr=xDt();Object.defineProperty(_q,"BasicAuth",{enumerable:!0,get:function(){return IVr.BasicAuth}});var MVr=SDt();Object.defineProperty(_q,"BearerToken",{enumerable:!0,get:function(){return MVr.BearerToken}})});var Y1e=x(Bm=>{"use strict";var ODt=Bm&&Bm.__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())})},EDt=Bm&&Bm.__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)}},t_=Bm&&Bm.__await||function(t){return this instanceof t_?(this.v=t,this):new t_(t)},PDt=Bm&&Bm.__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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof t_?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(Bm,"__esModule",{value:!0});Bm.readableStreamAsyncIterable=Bm.Stream=void 0;var RVr=lq(),NVr="data:",Z1e=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=NVr,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return PDt(this,arguments,function*(){var r,n;this.controller.signal;let o=TDt(this.stream),i="",a=!1;try{for(var s=EDt(o),u;u=yield t_(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 t_(void 0);let f=yield t_(this.parse(JSON.parse(d)));yield yield t_(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield t_(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return PDt(this,arguments,function*(){var r,n;try{for(var o=EDt(this.iterMessages()),i;i=yield t_(o.next()),!i.done;){let a=i.value;yield yield t_(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield t_(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 RVr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Bm.Stream=Z1e;function TDt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return ODt(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 ODt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Bm.readableStreamAsyncIterable=TDt});var ADt=x(mse=>{"use strict";Object.defineProperty(mse,"__esModule",{value:!0});mse.Stream=void 0;var jVr=Y1e();Object.defineProperty(mse,"Stream",{enumerable:!0,get:function(){return jVr.Stream}})});var RDt=x((B4o,MDt)=>{"use strict";var X1e=Object.defineProperty,DVr=Object.getOwnPropertyDescriptor,LVr=Object.getOwnPropertyNames,FVr=Object.prototype.hasOwnProperty,kVr=(t,e)=>{for(var r in e)X1e(t,r,{get:e[r],enumerable:!0})},$Vr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of LVr(e))!FVr.call(t,o)&&o!==r&&X1e(t,o,{get:()=>e[o],enumerable:!(n=DVr(e,o))||n.enumerable});return t},BVr=t=>$Vr(X1e({},"__esModule",{value:!0}),t),IDt={};kVr(IDt,{Blob:()=>qVr,File:()=>HVr,FormData:()=>UVr});MDt.exports=BVr(IDt);var zVr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:UVr,Blob:qVr,File:HVr}=zVr});var VDt=x((z4o,HDt)=>{"use strict";var tNe=Object.defineProperty,VVr=Object.getOwnPropertyDescriptor,WVr=Object.getOwnPropertyNames,KVr=Object.prototype.hasOwnProperty,GVr=(t,e)=>{for(var r in e)tNe(t,r,{get:e[r],enumerable:!0})},JVr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of WVr(e))!KVr.call(t,o)&&o!==r&&tNe(t,o,{get:()=>e[o],enumerable:!(n=VVr(e,o))||n.enumerable});return t},ZVr=t=>JVr(tNe({},"__esModule",{value:!0}),t),rNe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Ds=(t,e,r)=>(rNe(t,e,"read from private field"),r?r.call(t):e.get(t)),Pw=(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)},f9=(t,e,r,n)=>(rNe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Q1e=(t,e,r)=>(rNe(t,e,"access private method"),r),$Dt={};GVr($Dt,{FormDataEncoder:()=>o6r,isFile:()=>nL,isFormData:()=>UDt});HDt.exports=ZVr($Dt);var hP=t=>typeof t=="function",YVr=t=>hP(t[Symbol.asyncIterator]),NDt=65536;function*BDt(t){if(t.byteLength<=NDt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,NDt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*XVr(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*BDt(e)}var QVr=t=>{if(YVr(t))return jDt(t);if(hP(t.getReader))return jDt(XVr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},DDt="abcdefghijklmnopqrstuvwxyz0123456789";function e6r(){let t=16,e="";for(;t--;)e+=DDt[Math.random()*DDt.length<<0];return e}var zDt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),t6r=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function LDt(t){if(t6r(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function FDt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var r6r=t=>new Proxy(t,{get:(e,r)=>FDt(e,r),has:(e,r)=>FDt(e,r)!==void 0}),UDt=t=>!!(t&&hP(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&hP(t.append)&&hP(t.getAll)&&hP(t.entries)&&hP(t[Symbol.iterator])),kDt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),nL=t=>!!(t&&typeof t=="object"&&hP(t.constructor)&&t[Symbol.toStringTag]==="File"&&hP(t.stream)&&t.name!=null),n6r={enableAdditionalHeaders:!1},hse={writable:!1,configurable:!1},SM,p9,gse,m9,rL,h9,g9,yse,bse,nNe,eNe,qDt,o6r=class{constructor(t,e,r){if(Pw(this,bse),Pw(this,eNe),Pw(this,SM,`\r
`),Pw(this,p9,void 0),Pw(this,gse,void 0),Pw(this,m9,"-".repeat(2)),Pw(this,rL,new TextEncoder),Pw(this,h9,void 0),Pw(this,g9,void 0),Pw(this,yse,void 0),!UDt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(LDt(e)?r=e:n=e,n||(n=e6r()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!LDt(r))throw new TypeError("Expected options argument to be an object.");f9(this,g9,Array.from(t.entries())),f9(this,yse,{...n6r,...r}),f9(this,p9,Ds(this,rL).encode(Ds(this,SM))),f9(this,gse,Ds(this,p9).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,f9(this,h9,Ds(this,rL).encode(`${Ds(this,m9)}${this.boundary}${Ds(this,m9)}${Ds(this,SM).repeat(2)}`));let o={"Content-Type":this.contentType},i=Q1e(this,eNe,qDt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=r6r(Object.freeze(o)),Object.defineProperties(this,{boundary:hse,contentType:hse,contentLength:hse,headers:hse})}*values(){for(let[t,e]of Ds(this,g9)){let r=nL(e)?e:Ds(this,rL).encode(zDt(e));yield Q1e(this,bse,nNe).call(this,t,r),yield r,yield Ds(this,p9)}yield Ds(this,h9)}async*encode(){for(let t of this.values())nL(t)?yield*QVr(t.stream()):yield*BDt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};SM=new WeakMap;p9=new WeakMap;gse=new WeakMap;m9=new WeakMap;rL=new WeakMap;h9=new WeakMap;g9=new WeakMap;yse=new WeakMap;bse=new WeakSet;nNe=function(t,e){let r="";if(r+=`${Ds(this,m9)}${this.boundary}${Ds(this,SM)}`,r+=`Content-Disposition: form-data; name="${kDt(t)}"`,nL(e)&&(r+=`; filename="${kDt(e.name)}"${Ds(this,SM)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Ds(this,yse).enableAdditionalHeaders===!0){let n=nL(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Ds(this,SM)}Content-Length: ${n}`)}return Ds(this,rL).encode(`${r}${Ds(this,SM).repeat(2)}`)};eNe=new WeakSet;qDt=function(){let t=0;for(let[e,r]of Ds(this,g9)){let n=nL(r)?r:Ds(this,rL).encode(zDt(r)),o=nL(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=Q1e(this,bse,nNe).call(this,e,n).byteLength,t+=o,t+=Ds(this,gse)}return String(t+Ds(this,h9).byteLength)}});var KDt=x((q4o,WDt)=>{"use strict";WDt.exports=typeof self=="object"?self.FormData:window.FormData});var GDt=x(Uc=>{"use strict";var i6r=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]}),a6r=Uc&&Uc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vq=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)&&i6r(e,t,r);return a6r(e,t),e},CM=Uc&&Uc.__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(Uc,"__esModule",{value:!0});Uc.WebFormData=Uc.Node16FormData=Uc.Node18FormData=Uc.newFormData=void 0;var _se=lq();function oNe(t){return typeof t=="object"&&t!=null&&"name"in t}function s6r(){return CM(this,void 0,void 0,function*(){let t;return _se.RUNTIME.type==="node"&&_se.RUNTIME.parsedVersion!=null&&_se.RUNTIME.parsedVersion>=18?t=new vse:_se.RUNTIME.type==="node"?t=new wse:t=new xse,yield t.setup(),t})}Uc.newFormData=s6r;var vse=class{setup(){return CM(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>vq(RDt()))).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 CM(this,void 0,void 0,function*(){n==null&&oNe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>vq(e9()))).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 CM(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>vq(VDt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>vq(e9()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Uc.Node18FormData=vse;var wse=class{setup(){return CM(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>vq(KDt()))).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 CM(this,void 0,void 0,function*(){n==null&&oNe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>vq(e9()))).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():{}}}};Uc.Node16FormData=wse;var xse=class{setup(){return CM(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 CM(this,void 0,void 0,function*(){n==null&&oNe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Uc.WebFormData=xse});var JDt=x(oL=>{"use strict";var u6r=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]}),l6r=oL&&oL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&u6r(e,t,r)};Object.defineProperty(oL,"__esModule",{value:!0});l6r(GDt(),oL)});var Dd=x(Sse=>{"use strict";Object.defineProperty(Sse,"__esModule",{value:!0});Sse.SchemaType=void 0;Sse.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 zm=x(Cse=>{"use strict";Object.defineProperty(Cse,"__esModule",{value:!0});Cse.getErrorMessageForIncorrectType=void 0;function c6r(t,e){return`Expected ${e}. Received ${d6r(t)}.`}Cse.getErrorMessageForIncorrectType=c6r;function d6r(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 gP=x(Ose=>{"use strict";Object.defineProperty(Ose,"__esModule",{value:!0});Ose.maybeSkipValidation=void 0;function f6r(t){return Object.assign(Object.assign({},t),{json:ZDt(t.json),parse:ZDt(t.parse)})}Ose.maybeSkipValidation=f6r;function ZDt(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 iNe=x(Ese=>{"use strict";Object.defineProperty(Ese,"__esModule",{value:!0});Ese.stringifyValidationError=void 0;function p6r(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}Ese.stringifyValidationError=p6r});var sNe=x(Pse=>{"use strict";Object.defineProperty(Pse,"__esModule",{value:!0});Pse.JsonError=void 0;var m6r=iNe(),aNe=class t extends Error{constructor(e){super(e.map(m6r.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};Pse.JsonError=aNe});var lNe=x(Tse=>{"use strict";Object.defineProperty(Tse,"__esModule",{value:!0});Tse.ParseError=void 0;var h6r=iNe(),uNe=class t extends Error{constructor(e){super(e.map(h6r.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};Tse.ParseError=uNe});var QDt=x(OM=>{"use strict";Object.defineProperty(OM,"__esModule",{value:!0});OM.transform=OM.optional=OM.getSchemaUtils=void 0;var g6r=Dd(),y6r=sNe(),b6r=lNe();function cNe(t){return{optional:()=>YDt(t),transform:e=>XDt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new b6r.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new y6r.JsonError(n.errors)}}}OM.getSchemaUtils=cNe;function YDt(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:()=>g6r.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),cNe(e))}OM.optional=YDt;function XDt(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),cNe(r))}OM.transform=XDt});var Jh=x(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:!0});Cy.ParseError=Cy.JsonError=Cy.transform=Cy.optional=Cy.getSchemaUtils=void 0;var dNe=QDt();Object.defineProperty(Cy,"getSchemaUtils",{enumerable:!0,get:function(){return dNe.getSchemaUtils}});Object.defineProperty(Cy,"optional",{enumerable:!0,get:function(){return dNe.optional}});Object.defineProperty(Cy,"transform",{enumerable:!0,get:function(){return dNe.transform}});var _6r=sNe();Object.defineProperty(Cy,"JsonError",{enumerable:!0,get:function(){return _6r.JsonError}});var v6r=lNe();Object.defineProperty(Cy,"ParseError",{enumerable:!0,get:function(){return v6r.ParseError}})});var eLt=x(Ase=>{"use strict";Object.defineProperty(Ase,"__esModule",{value:!0});Ase.date=void 0;var w6r=Dd(),fNe=zm(),x6r=gP(),S6r=Jh(),C6r=/^([+-]?\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 O6r(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,fNe.getErrorMessageForIncorrectType)(e,"string")}]}:C6r.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,fNe.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,fNe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>w6r.SchemaType.DATE};return Object.assign(Object.assign({},(0,x6r.maybeSkipValidation)(t)),(0,S6r.getSchemaUtils)(t))}Ase.date=O6r});var tLt=x(Ise=>{"use strict";Object.defineProperty(Ise,"__esModule",{value:!0});Ise.date=void 0;var E6r=eLt();Object.defineProperty(Ise,"date",{enumerable:!0,get:function(){return E6r.date}})});var yP=x(Mse=>{"use strict";Object.defineProperty(Mse,"__esModule",{value:!0});Mse.createIdentitySchemaCreator=void 0;var P6r=Jh(),T6r=gP();function A6r(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,T6r.maybeSkipValidation)(r)),(0,P6r.getSchemaUtils)(r))}}Mse.createIdentitySchemaCreator=A6r});var nLt=x(Rse=>{"use strict";Object.defineProperty(Rse,"__esModule",{value:!0});Rse.enum_=void 0;var I6r=Dd(),M6r=yP(),rLt=zm();function R6r(t){let e=new Set(t);return(0,M6r.createIdentitySchemaCreator)(I6r.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,rLt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,rLt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}Rse.enum_=R6r});var pNe=x(Nse=>{"use strict";Object.defineProperty(Nse,"__esModule",{value:!0});Nse.enum_=void 0;var N6r=nLt();Object.defineProperty(Nse,"enum_",{enumerable:!0,get:function(){return N6r.enum_}})});var mNe=x(EM=>{"use strict";Object.defineProperty(EM,"__esModule",{value:!0});EM.getMemoizedSchema=EM.constructLazyBaseSchema=EM.lazy=void 0;var j6r=Jh();function D6r(t){let e=oLt(t);return Object.assign(Object.assign({},e),(0,j6r.getSchemaUtils)(e))}EM.lazy=D6r;function oLt(t){return{parse:(e,r)=>jse(t).parse(e,r),json:(e,r)=>jse(t).json(e,r),getType:()=>jse(t).getType()}}EM.constructLazyBaseSchema=oLt;function jse(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}EM.getMemoizedSchema=jse});var hNe=x(Dse=>{"use strict";Object.defineProperty(Dse,"__esModule",{value:!0});Dse.entries=void 0;function L6r(t){return Object.entries(t)}Dse.entries=L6r});var gNe=x(Lse=>{"use strict";Object.defineProperty(Lse,"__esModule",{value:!0});Lse.filterObject=void 0;function F6r(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}Lse.filterObject=F6r});var y9=x(Fse=>{"use strict";Object.defineProperty(Fse,"__esModule",{value:!0});Fse.isPlainObject=void 0;function k6r(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}Fse.isPlainObject=k6r});var yNe=x(kse=>{"use strict";Object.defineProperty(kse,"__esModule",{value:!0});kse.keys=void 0;function $6r(t){return Object.keys(t)}kse.keys=$6r});var iLt=x($se=>{"use strict";Object.defineProperty($se,"__esModule",{value:!0});$se.partition=void 0;function B6r(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}$se.partition=B6r});var uLt=x(wq=>{"use strict";Object.defineProperty(wq,"__esModule",{value:!0});wq.withParsedProperties=wq.getObjectLikeUtils=void 0;var z6r=gNe(),U6r=zm(),q6r=y9(),H6r=Jh();function aLt(t){return{withParsedProperties:e=>sLt(t,e)}}wq.getObjectLikeUtils=aLt;function sLt(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,q6r.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,U6r.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,z6r.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,H6r.getSchemaUtils)(r)),aLt(r))}wq.withParsedProperties=sLt});var b9=x(xq=>{"use strict";Object.defineProperty(xq,"__esModule",{value:!0});xq.withParsedProperties=xq.getObjectLikeUtils=void 0;var lLt=uLt();Object.defineProperty(xq,"getObjectLikeUtils",{enumerable:!0,get:function(){return lLt.getObjectLikeUtils}});Object.defineProperty(xq,"withParsedProperties",{enumerable:!0,get:function(){return lLt.withParsedProperties}})});var bNe=x(Sq=>{"use strict";Object.defineProperty(Sq,"__esModule",{value:!0});Sq.isProperty=Sq.property=void 0;function V6r(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}Sq.property=V6r;function W6r(t){return t.isProperty}Sq.isProperty=W6r});var vNe=x(Cq=>{"use strict";Object.defineProperty(Cq,"__esModule",{value:!0});Cq.getObjectUtils=Cq.object=void 0;var v9=Dd(),cLt=hNe(),dLt=gNe(),K6r=zm(),G6r=y9(),hLt=yNe(),J6r=gP(),Z6r=iLt(),gLt=b9(),yLt=Jh(),_9=bNe();function Y6r(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,_9.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,hLt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,cLt.entries)(t)){let u=(0,_9.isProperty)(s)?s.rawKey:a,l=(0,_9.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,mLt(l)&&i.push(u)}return fLt({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,cLt.entries)(t)){let s=(0,_9.isProperty)(a)?a.valueSchema:a;mLt(s)&&o.push(i)}return fLt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,_9.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:()=>v9.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,J6r.maybeSkipValidation)(e)),(0,yLt.getSchemaUtils)(e)),(0,gLt.getObjectLikeUtils)(e)),_Ne(e))}Cq.object=Y6r;function fLt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,G6r.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,K6r.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 _Ne(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>pLt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>pLt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>v9.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,yLt.getSchemaUtils)(r)),(0,gLt.getObjectLikeUtils)(r)),_Ne(r))}}}Cq.getObjectUtils=_Ne;function pLt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,Z6r.partition)((0,hLt.keys)(e),l=>o.has(l)),s=r((0,dLt.filterObject)(e,a)),u=n((0,dLt.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 mLt(t){return!X6r(t)}function X6r(t){switch(t.getType()){case v9.SchemaType.ANY:case v9.SchemaType.UNKNOWN:case v9.SchemaType.OPTIONAL:return!0;default:return!1}}});var bLt=x(Bse=>{"use strict";Object.defineProperty(Bse,"__esModule",{value:!0});Bse.objectWithoutOptionalProperties=void 0;var Q6r=vNe();function e8r(t){return(0,Q6r.object)(t)}Bse.objectWithoutOptionalProperties=e8r});var wNe=x(Oy=>{"use strict";Object.defineProperty(Oy,"__esModule",{value:!0});Oy.property=Oy.isProperty=Oy.objectWithoutOptionalProperties=Oy.object=Oy.getObjectUtils=void 0;var _Lt=vNe();Object.defineProperty(Oy,"getObjectUtils",{enumerable:!0,get:function(){return _Lt.getObjectUtils}});Object.defineProperty(Oy,"object",{enumerable:!0,get:function(){return _Lt.object}});var t8r=bLt();Object.defineProperty(Oy,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return t8r.objectWithoutOptionalProperties}});var vLt=bNe();Object.defineProperty(Oy,"isProperty",{enumerable:!0,get:function(){return vLt.isProperty}});Object.defineProperty(Oy,"property",{enumerable:!0,get:function(){return vLt.property}})});var wLt=x(zse=>{"use strict";Object.defineProperty(zse,"__esModule",{value:!0});zse.lazyObject=void 0;var r8r=wNe(),n8r=b9(),o8r=Jh(),xNe=mNe();function i8r(t){let e=Object.assign(Object.assign({},(0,xNe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,xNe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,xNe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,o8r.getSchemaUtils)(e)),(0,n8r.getObjectLikeUtils)(e)),(0,r8r.getObjectUtils)(e))}zse.lazyObject=i8r});var xLt=x(Oq=>{"use strict";Object.defineProperty(Oq,"__esModule",{value:!0});Oq.lazyObject=Oq.lazy=void 0;var a8r=mNe();Object.defineProperty(Oq,"lazy",{enumerable:!0,get:function(){return a8r.lazy}});var s8r=wLt();Object.defineProperty(Oq,"lazyObject",{enumerable:!0,get:function(){return s8r.lazyObject}})});var CLt=x(Use=>{"use strict";Object.defineProperty(Use,"__esModule",{value:!0});Use.list=void 0;var u8r=Dd(),l8r=zm(),c8r=gP(),d8r=Jh();function f8r(t){let e={parse:(r,n)=>SLt(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)=>SLt(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:()=>u8r.SchemaType.LIST};return Object.assign(Object.assign({},(0,c8r.maybeSkipValidation)(e)),(0,d8r.getSchemaUtils)(e))}Use.list=f8r;function SLt(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,l8r.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var SNe=x(qse=>{"use strict";Object.defineProperty(qse,"__esModule",{value:!0});qse.list=void 0;var p8r=CLt();Object.defineProperty(qse,"list",{enumerable:!0,get:function(){return p8r.list}})});var OLt=x(Hse=>{"use strict";Object.defineProperty(Hse,"__esModule",{value:!0});Hse.stringLiteral=void 0;var m8r=Dd(),h8r=yP(),g8r=zm();function y8r(t){return(0,h8r.createIdentitySchemaCreator)(m8r.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,g8r.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}Hse.stringLiteral=y8r});var ELt=x(Vse=>{"use strict";Object.defineProperty(Vse,"__esModule",{value:!0});Vse.booleanLiteral=void 0;var b8r=Dd(),_8r=yP(),v8r=zm();function w8r(t){return(0,_8r.createIdentitySchemaCreator)(b8r.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,v8r.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}Vse.booleanLiteral=w8r});var PLt=x(Eq=>{"use strict";Object.defineProperty(Eq,"__esModule",{value:!0});Eq.booleanLiteral=Eq.stringLiteral=void 0;var x8r=OLt();Object.defineProperty(Eq,"stringLiteral",{enumerable:!0,get:function(){return x8r.stringLiteral}});var S8r=ELt();Object.defineProperty(Eq,"booleanLiteral",{enumerable:!0,get:function(){return S8r.booleanLiteral}})});var TLt=x(Wse=>{"use strict";Object.defineProperty(Wse,"__esModule",{value:!0});Wse.any=void 0;var C8r=Dd(),O8r=yP();Wse.any=(0,O8r.createIdentitySchemaCreator)(C8r.SchemaType.ANY,t=>({ok:!0,value:t}))});var ALt=x(Kse=>{"use strict";Object.defineProperty(Kse,"__esModule",{value:!0});Kse.boolean=void 0;var E8r=Dd(),P8r=yP(),T8r=zm();Kse.boolean=(0,P8r.createIdentitySchemaCreator)(E8r.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,T8r.getErrorMessageForIncorrectType)(t,"boolean")}]})});var ILt=x(Gse=>{"use strict";Object.defineProperty(Gse,"__esModule",{value:!0});Gse.number=void 0;var A8r=Dd(),I8r=yP(),M8r=zm();Gse.number=(0,I8r.createIdentitySchemaCreator)(A8r.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,M8r.getErrorMessageForIncorrectType)(t,"number")}]})});var MLt=x(Jse=>{"use strict";Object.defineProperty(Jse,"__esModule",{value:!0});Jse.string=void 0;var R8r=Dd(),N8r=yP(),j8r=zm();Jse.string=(0,N8r.createIdentitySchemaCreator)(R8r.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,j8r.getErrorMessageForIncorrectType)(t,"string")}]})});var RLt=x(Zse=>{"use strict";Object.defineProperty(Zse,"__esModule",{value:!0});Zse.unknown=void 0;var D8r=Dd(),L8r=yP();Zse.unknown=(0,L8r.createIdentitySchemaCreator)(D8r.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var NLt=x(Ey=>{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});Ey.unknown=Ey.string=Ey.number=Ey.boolean=Ey.any=void 0;var F8r=TLt();Object.defineProperty(Ey,"any",{enumerable:!0,get:function(){return F8r.any}});var k8r=ALt();Object.defineProperty(Ey,"boolean",{enumerable:!0,get:function(){return k8r.boolean}});var $8r=ILt();Object.defineProperty(Ey,"number",{enumerable:!0,get:function(){return $8r.number}});var B8r=MLt();Object.defineProperty(Ey,"string",{enumerable:!0,get:function(){return B8r.string}});var z8r=RLt();Object.defineProperty(Ey,"unknown",{enumerable:!0,get:function(){return z8r.unknown}})});var DLt=x(Yse=>{"use strict";Object.defineProperty(Yse,"__esModule",{value:!0});Yse.record=void 0;var CNe=Dd(),U8r=hNe(),q8r=zm(),H8r=y9(),V8r=gP(),W8r=Jh();function K8r(t,e){let r={parse:(n,o)=>jLt({value:n,isKeyNumeric:t.getType()===CNe.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()===CNe.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:()=>CNe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,V8r.maybeSkipValidation)(r)),(0,W8r.getSchemaUtils)(r))}Yse.record=K8r;function jLt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,H8r.isPlainObject)(t)?(0,U8r.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,q8r.getErrorMessageForIncorrectType)(t,"object")}]}}});var LLt=x(Xse=>{"use strict";Object.defineProperty(Xse,"__esModule",{value:!0});Xse.record=void 0;var G8r=DLt();Object.defineProperty(Xse,"record",{enumerable:!0,get:function(){return G8r.record}})});var FLt=x(Qse=>{"use strict";Object.defineProperty(Qse,"__esModule",{value:!0});Qse.set=void 0;var J8r=Dd(),Z8r=zm(),Y8r=gP(),X8r=SNe(),Q8r=Jh();function e5r(t){let e=(0,X8r.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,Z8r.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>J8r.SchemaType.SET};return Object.assign(Object.assign({},(0,Y8r.maybeSkipValidation)(r)),(0,Q8r.getSchemaUtils)(r))}Qse.set=e5r});var kLt=x(eue=>{"use strict";Object.defineProperty(eue,"__esModule",{value:!0});eue.set=void 0;var t5r=FLt();Object.defineProperty(eue,"set",{enumerable:!0,get:function(){return t5r.set}})});var BLt=x(tue=>{"use strict";Object.defineProperty(tue,"__esModule",{value:!0});tue.undiscriminatedUnion=void 0;var r5r=Dd(),n5r=gP(),o5r=Jh();function i5r(t){let e={parse:(r,n)=>$Lt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>$Lt((o,i)=>o.json(r,i),t,n),getType:()=>r5r.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,n5r.maybeSkipValidation)(e)),(0,o5r.getSchemaUtils)(e))}tue.undiscriminatedUnion=i5r;function $Lt(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 zLt=x(rue=>{"use strict";Object.defineProperty(rue,"__esModule",{value:!0});rue.undiscriminatedUnion=void 0;var a5r=BLt();Object.defineProperty(rue,"undiscriminatedUnion",{enumerable:!0,get:function(){return a5r.undiscriminatedUnion}})});var ULt=x(nue=>{"use strict";Object.defineProperty(nue,"__esModule",{value:!0});nue.discriminant=void 0;function s5r(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}nue.discriminant=s5r});var HLt=x(Pq=>{"use strict";var u5r=Pq&&Pq.__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(Pq,"__esModule",{value:!0});Pq.union=void 0;var l5r=Dd(),c5r=zm(),d5r=y9(),f5r=yNe(),p5r=gP(),m5r=pNe(),h5r=b9(),g5r=Jh();function y5r(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,m5r.enum_)((0,f5r.keys)(e)),i={parse:(a,s)=>qLt({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)=>qLt({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:()=>l5r.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,p5r.maybeSkipValidation)(i)),(0,g5r.getSchemaUtils)(i)),(0,h5r.getObjectLikeUtils)(i))}Pq.union=y5r;function qLt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,d5r.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,c5r.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=u5r(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 h=a(d,p);return h.ok?{ok:!0,value:Object.assign({[r]:c},h.value)}:h}});var VLt=x(Tq=>{"use strict";Object.defineProperty(Tq,"__esModule",{value:!0});Tq.union=Tq.discriminant=void 0;var b5r=ULt();Object.defineProperty(Tq,"discriminant",{enumerable:!0,get:function(){return b5r.discriminant}});var _5r=HLt();Object.defineProperty(Tq,"union",{enumerable:!0,get:function(){return _5r.union}})});var WLt=x(pc=>{"use strict";var v5r=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]}),Zh=pc&&pc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v5r(e,t,r)};Object.defineProperty(pc,"__esModule",{value:!0});Zh(tLt(),pc);Zh(pNe(),pc);Zh(xLt(),pc);Zh(SNe(),pc);Zh(PLt(),pc);Zh(wNe(),pc);Zh(b9(),pc);Zh(NLt(),pc);Zh(LLt(),pc);Zh(Jh(),pc);Zh(kLt(),pc);Zh(zLt(),pc);Zh(VLt(),pc)});var KLt=x(iL=>{"use strict";var w5r=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]}),x5r=iL&&iL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&w5r(e,t,r)};Object.defineProperty(iL,"__esModule",{value:!0});x5r(WLt(),iL)});var J=x(Ld=>{"use strict";var GLt=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]}),S5r=Ld&&Ld.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w9=Ld&&Ld.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GLt(e,t,r)},C5r=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)&&GLt(e,t,r);return S5r(e,t),e};Object.defineProperty(Ld,"__esModule",{value:!0});Ld.serialization=void 0;w9(_Dt(),Ld);w9(CDt(),Ld);w9(ADt(),Ld);w9(lq(),Ld);w9(JDt(),Ld);Ld.serialization=C5r(KLt())});var ZLt=x(Cu=>{"use strict";var x9=Cu&&Cu.__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())})},S9=Cu&&Cu.__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)}},Va=Cu&&Cu.__await||function(t){return this instanceof Va?(this.v=t,this):new Va(t)},C9=Cu&&Cu.__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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof Va?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(Cu,"__esModule",{value:!0});Cu.readableStreamAsyncIterable=Cu._decodeChunks=Cu.LineDecoder=Cu._iterSSEMessages=Cu.StreamUtils=void 0;var Aq=ou(),ONe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return C9(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=S9(JLt(e,r)),c;c=yield Va(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 Aq.CohereError({message:`Error: ${f.error}`});yield yield Va(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 Aq.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Va({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Va(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Va(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return C9(this,arguments,function*(){var s,u;let l=new PM,c=PNe(e);try{for(var d=S9(c),f;f=yield Va(d.next()),!f.done;){let p=f.value;for(let h of l.decode(p))yield yield Va(h)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Va(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Va(p)})}function i(){return C9(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=S9(o()),d;d=yield Va(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Va(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Va(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Va(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 x9(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return x9(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 x9(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};Cu.StreamUtils=ONe;function JLt(t,e){return C9(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new Aq.CohereError({message:"Attempted to iterate over a response with no body"});let i=new ENe,a=new PM,s=PNe(t.body);try{for(var u=S9(O5r(s)),l;l=yield Va(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Va(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Va(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Va(d))}})}Cu._iterSSEMessages=JLt;function O5r(t){return C9(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=S9(t),a;a=yield Va(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=E5r(o))!==-1;)yield yield Va(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Va(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Va(o))})}function E5r(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 ENe=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]=T5r(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},PM=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 Aq.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 Aq.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new Aq.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}};Cu.LineDecoder=PM;PM.NEWLINE_CHARS=new Set([`
`,"\r"]);PM.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function P5r(t){let e=new PM,r=[];for(let n of t)r.push(...e.decode(n));return r}Cu._decodeChunks=P5r;function T5r(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function PNe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return x9(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 x9(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Cu.readableStreamAsyncIterable=PNe});var TNe=x(Tw=>{"use strict";var A5r=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]}),I5r=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M5r=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)&&A5r(e,t,r);return I5r(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.V2ChatStreamRequestCitationMode=void 0;var R5r=M5r(J());Tw.V2ChatStreamRequestCitationMode=R5r.serialization.enum_(["FAST","ACCURATE","OFF"])});var ANe=x(Aw=>{"use strict";var N5r=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]}),j5r=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D5r=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)&&N5r(e,t,r);return j5r(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.V2ChatRequestCitationMode=void 0;var L5r=D5r(J());Aw.V2ChatRequestCitationMode=L5r.serialization.enum_(["FAST","ACCURATE","OFF"])});var Iq=x(Iw=>{"use strict";var F5r=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]}),k5r=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5r=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)&&F5r(e,t,r);return k5r(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.TextContent=void 0;var YLt=$5r(J());Iw.TextContent=YLt.serialization.object({text:YLt.serialization.string()})});var INe=x(Mw=>{"use strict";var B5r=Mw&&Mw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z5r=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U5r=Mw&&Mw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&B5r(e,t,r);return z5r(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.Content=void 0;var q5r=U5r(J()),H5r=Iq();Mw.Content=q5r.serialization.union("type",{text:H5r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var RNe=x(Rw=>{"use strict";var V5r=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]}),W5r=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K5r=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)&&V5r(e,t,r);return W5r(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.UserMessageContent=void 0;var MNe=K5r(J()),G5r=INe();Rw.UserMessageContent=MNe.serialization.undiscriminatedUnion([MNe.serialization.string(),MNe.serialization.list(G5r.Content)])});var aL=x(Nw=>{"use strict";var J5r=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]}),Z5r=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5r=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)&&J5r(e,t,r);return Z5r(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.ChatDocument=void 0;var NNe=Y5r(J());Nw.ChatDocument=NNe.serialization.record(NNe.serialization.string(),NNe.serialization.string())});var jNe=x(jw=>{"use strict";var X5r=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]}),Q5r=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eWr=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)&&X5r(e,t,r);return Q5r(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.UserMessage=void 0;var XLt=eWr(J()),tWr=RNe(),rWr=aL();jw.UserMessage=XLt.serialization.object({content:tWr.UserMessageContent,documents:XLt.serialization.list(rWr.ChatDocument).optional()})});var LNe=x(Dw=>{"use strict";var nWr=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]}),oWr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iWr=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)&&nWr(e,t,r);return oWr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.ToolCall2Function=void 0;var DNe=iWr(J());Dw.ToolCall2Function=DNe.serialization.object({name:DNe.serialization.string().optional(),arguments:DNe.serialization.string().optional()})});var oue=x(Lw=>{"use strict";var aWr=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]}),sWr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uWr=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)&&aWr(e,t,r);return sWr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.ToolCall2=void 0;var FNe=uWr(J()),lWr=LNe();Lw.ToolCall2=FNe.serialization.object({id:FNe.serialization.string().optional(),type:FNe.serialization.stringLiteral("function").optional(),function:lWr.ToolCall2Function.optional()})});var kNe=x(Fw=>{"use strict";var cWr=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]}),dWr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fWr=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)&&cWr(e,t,r);return dWr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.ToolSource=void 0;var Mq=fWr(J());Fw.ToolSource=Mq.serialization.object({id:Mq.serialization.string().optional(),toolOutput:Mq.serialization.property("tool_output",Mq.serialization.record(Mq.serialization.string(),Mq.serialization.unknown()).optional())})});var $Ne=x(kw=>{"use strict";var pWr=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]}),mWr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hWr=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)&&pWr(e,t,r);return mWr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.DocumentSource=void 0;var O9=hWr(J());kw.DocumentSource=O9.serialization.object({id:O9.serialization.string().optional(),document:O9.serialization.record(O9.serialization.string(),O9.serialization.unknown()).optional()})});var BNe=x($w=>{"use strict";var gWr=$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]}),yWr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bWr=$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)&&gWr(e,t,r);return yWr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.Source=void 0;var _Wr=bWr(J()),vWr=kNe(),wWr=$Ne();$w.Source=_Wr.serialization.union("type",{tool:vWr.ToolSource,document:wWr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var P9=x(Bw=>{"use strict";var xWr=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]}),SWr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CWr=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)&&xWr(e,t,r);return SWr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.Citation=void 0;var E9=CWr(J()),OWr=BNe();Bw.Citation=E9.serialization.object({start:E9.serialization.number().optional(),end:E9.serialization.number().optional(),text:E9.serialization.string().optional(),sources:E9.serialization.list(OWr.Source).optional()})});var zNe=x(zw=>{"use strict";var EWr=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]}),PWr=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TWr=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)&&EWr(e,t,r);return PWr(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.AssistantMessageContentItem=void 0;var AWr=TWr(J()),IWr=Iq();zw.AssistantMessageContentItem=AWr.serialization.union("type",{text:IWr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var qNe=x(Uw=>{"use strict";var MWr=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]}),RWr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NWr=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)&&MWr(e,t,r);return RWr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.AssistantMessageContent=void 0;var UNe=NWr(J()),jWr=zNe();Uw.AssistantMessageContent=UNe.serialization.undiscriminatedUnion([UNe.serialization.string(),UNe.serialization.list(jWr.AssistantMessageContentItem)])});var HNe=x(qw=>{"use strict";var DWr=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]}),LWr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FWr=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)&&DWr(e,t,r);return LWr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.AssistantMessage=void 0;var Rq=FWr(J()),kWr=oue(),$Wr=qNe(),BWr=P9();qw.AssistantMessage=Rq.serialization.object({toolCalls:Rq.serialization.property("tool_calls",Rq.serialization.list(kWr.ToolCall2).optional()),toolPlan:Rq.serialization.property("tool_plan",Rq.serialization.string().optional()),content:$Wr.AssistantMessageContent.optional(),citations:Rq.serialization.list(BWr.Citation).optional()})});var VNe=x(Hw=>{"use strict";var zWr=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]}),UWr=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qWr=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)&&zWr(e,t,r);return UWr(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.SystemMessageContentItem=void 0;var HWr=qWr(J()),VWr=Iq();Hw.SystemMessageContentItem=HWr.serialization.union("type",{text:VWr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var KNe=x(Vw=>{"use strict";var WWr=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]}),KWr=Vw&&Vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GWr=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)&&WWr(e,t,r);return KWr(e,t),e};Object.defineProperty(Vw,"__esModule",{value:!0});Vw.SystemMessageContent=void 0;var WNe=GWr(J()),JWr=VNe();Vw.SystemMessageContent=WNe.serialization.undiscriminatedUnion([WNe.serialization.string(),WNe.serialization.list(JWr.SystemMessageContentItem)])});var GNe=x(Ww=>{"use strict";var ZWr=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]}),YWr=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XWr=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)&&ZWr(e,t,r);return YWr(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.SystemMessage=void 0;var QWr=XWr(J()),e9r=KNe();Ww.SystemMessage=QWr.serialization.object({content:e9r.SystemMessageContent})});var JNe=x(Kw=>{"use strict";var t9r=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]}),r9r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n9r=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)&&t9r(e,t,r);return r9r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.ToolContent=void 0;var iue=n9r(J());Kw.ToolContent=iue.serialization.object({output:iue.serialization.record(iue.serialization.string(),iue.serialization.unknown())})});var ZNe=x(Gw=>{"use strict";var o9r=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]}),i9r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a9r=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)&&o9r(e,t,r);return i9r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.ToolMessage2ToolContentItem=void 0;var s9r=a9r(J()),u9r=JNe();Gw.ToolMessage2ToolContentItem=s9r.serialization.union("type",{tool_result_object:u9r.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var YNe=x(Jw=>{"use strict";var l9r=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]}),c9r=Jw&&Jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d9r=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)&&l9r(e,t,r);return c9r(e,t),e};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.ToolMessage2=void 0;var T9=d9r(J()),f9r=ZNe();Jw.ToolMessage2=T9.serialization.object({toolCallId:T9.serialization.property("tool_call_id",T9.serialization.string()),toolContent:T9.serialization.property("tool_content",T9.serialization.list(f9r.ToolMessage2ToolContentItem))})});var XNe=x(Zw=>{"use strict";var p9r=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]}),m9r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h9r=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)&&p9r(e,t,r);return m9r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.ChatMessage2=void 0;var g9r=h9r(J()),y9r=jNe(),b9r=HNe(),_9r=GNe(),v9r=YNe();Zw.ChatMessage2=g9r.serialization.union("role",{user:y9r.UserMessage,assistant:b9r.AssistantMessage,system:_9r.SystemMessage,tool:v9r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var aue=x(Yw=>{"use strict";var w9r=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]}),x9r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S9r=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)&&w9r(e,t,r);return x9r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.ChatMessages=void 0;var C9r=S9r(J()),O9r=XNe();Yw.ChatMessages=C9r.serialization.list(O9r.ChatMessage2)});var QNe=x(Xw=>{"use strict";var E9r=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]}),P9r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T9r=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)&&E9r(e,t,r);return P9r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.Tool2Function=void 0;var Nq=T9r(J());Xw.Tool2Function=Nq.serialization.object({name:Nq.serialization.string().optional(),description:Nq.serialization.string().optional(),parameters:Nq.serialization.record(Nq.serialization.string(),Nq.serialization.unknown()).optional()})});var sue=x(Qw=>{"use strict";var A9r=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]}),I9r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M9r=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)&&A9r(e,t,r);return I9r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.Tool2=void 0;var QLt=M9r(J()),R9r=QNe();Qw.Tool2=QLt.serialization.object({type:QLt.serialization.stringLiteral("function").optional(),function:R9r.Tool2Function.optional()})});var uue=x(e0=>{"use strict";var N9r=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]}),j9r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D9r=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)&&N9r(e,t,r);return j9r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.ChatFinishReason=void 0;var L9r=D9r(J());e0.ChatFinishReason=L9r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var eje=x(t0=>{"use strict";var F9r=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]}),k9r=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$9r=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)&&F9r(e,t,r);return k9r(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.AssistantMessageResponseContentItem=void 0;var B9r=$9r(J()),z9r=Iq();t0.AssistantMessageResponseContentItem=B9r.serialization.union("type",{text:z9r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var tje=x(r0=>{"use strict";var U9r=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}),H9r=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)&&U9r(e,t,r);return q9r(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.AssistantMessageResponse=void 0;var TM=H9r(J()),V9r=oue(),W9r=eje(),K9r=P9();r0.AssistantMessageResponse=TM.serialization.object({role:TM.serialization.stringLiteral("assistant"),toolCalls:TM.serialization.property("tool_calls",TM.serialization.list(V9r.ToolCall2).optional()),toolPlan:TM.serialization.property("tool_plan",TM.serialization.string().optional()),content:TM.serialization.list(W9r.AssistantMessageResponseContentItem).optional(),citations:TM.serialization.list(K9r.Citation).optional()})});var rje=x(n0=>{"use strict";var G9r=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]}),J9r=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z9r=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)&&G9r(e,t,r);return J9r(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.UsageBilledUnits=void 0;var AM=Z9r(J());n0.UsageBilledUnits=AM.serialization.object({inputTokens:AM.serialization.property("input_tokens",AM.serialization.number().optional()),outputTokens:AM.serialization.property("output_tokens",AM.serialization.number().optional()),searchUnits:AM.serialization.property("search_units",AM.serialization.number().optional()),classifications:AM.serialization.number().optional()})});var nje=x(o0=>{"use strict";var Y9r=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]}),X9r=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q9r=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)&&Y9r(e,t,r);return X9r(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.UsageTokens=void 0;var A9=Q9r(J());o0.UsageTokens=A9.serialization.object({inputTokens:A9.serialization.property("input_tokens",A9.serialization.number().optional()),outputTokens:A9.serialization.property("output_tokens",A9.serialization.number().optional())})});var lue=x(i0=>{"use strict";var eKr=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]}),tKr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rKr=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)&&eKr(e,t,r);return tKr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.Usage=void 0;var eFt=rKr(J()),nKr=rje(),oKr=nje();i0.Usage=eFt.serialization.object({billedUnits:eFt.serialization.property("billed_units",nKr.UsageBilledUnits.optional()),tokens:oKr.UsageTokens.optional()})});var tFt=x(a0=>{"use strict";var iKr=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]}),aKr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sKr=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)&&iKr(e,t,r);return aKr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.NonStreamedChatResponse2=void 0;var cue=sKr(J()),uKr=uue(),lKr=tje(),cKr=lue();a0.NonStreamedChatResponse2=cue.serialization.object({id:cue.serialization.string(),finishReason:cue.serialization.property("finish_reason",uKr.ChatFinishReason),prompt:cue.serialization.string().optional(),message:lKr.AssistantMessageResponse.optional(),usage:cKr.Usage.optional()})});var Yh=x(s0=>{"use strict";var dKr=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]}),fKr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pKr=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)&&dKr(e,t,r);return fKr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ChatStreamEventType=void 0;var mKr=pKr(J());s0.ChatStreamEventType=mKr.serialization.object({})});var oje=x(u0=>{"use strict";var hKr=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]}),gKr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yKr=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)&&hKr(e,t,r);return gKr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatMessageStartEventDeltaMessage=void 0;var rFt=yKr(J());u0.ChatMessageStartEventDeltaMessage=rFt.serialization.object({role:rFt.serialization.stringLiteral("assistant").optional()})});var ije=x(l0=>{"use strict";var bKr=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]}),_Kr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vKr=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)&&bKr(e,t,r);return _Kr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatMessageStartEventDelta=void 0;var wKr=vKr(J()),xKr=oje();l0.ChatMessageStartEventDelta=wKr.serialization.object({message:xKr.ChatMessageStartEventDeltaMessage.optional()})});var aje=x(c0=>{"use strict";var SKr=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]}),CKr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OKr=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)&&SKr(e,t,r);return CKr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ChatMessageStartEvent=void 0;var nFt=OKr(J()),EKr=ije(),PKr=Yh();c0.ChatMessageStartEvent=nFt.serialization.object({id:nFt.serialization.string().optional(),delta:EKr.ChatMessageStartEventDelta.optional()}).extend(PKr.ChatStreamEventType)});var uje=x(d0=>{"use strict";var TKr=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]}),AKr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IKr=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)&&TKr(e,t,r);return AKr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.ChatContentStartEventDeltaMessageContent=void 0;var sje=IKr(J());d0.ChatContentStartEventDeltaMessageContent=sje.serialization.object({text:sje.serialization.string().optional(),type:sje.serialization.stringLiteral("text").optional()})});var lje=x(f0=>{"use strict";var MKr=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]}),RKr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NKr=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)&&MKr(e,t,r);return RKr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.ChatContentStartEventDeltaMessage=void 0;var jKr=NKr(J()),DKr=uje();f0.ChatContentStartEventDeltaMessage=jKr.serialization.object({content:DKr.ChatContentStartEventDeltaMessageContent.optional()})});var cje=x(p0=>{"use strict";var LKr=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]}),FKr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kKr=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)&&LKr(e,t,r);return FKr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.ChatContentStartEventDelta=void 0;var $Kr=kKr(J()),BKr=lje();p0.ChatContentStartEventDelta=$Kr.serialization.object({message:BKr.ChatContentStartEventDeltaMessage.optional()})});var dje=x(m0=>{"use strict";var zKr=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]}),UKr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qKr=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)&&zKr(e,t,r);return UKr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.ChatContentStartEvent=void 0;var oFt=qKr(J()),HKr=cje(),VKr=Yh();m0.ChatContentStartEvent=oFt.serialization.object({index:oFt.serialization.number().optional(),delta:HKr.ChatContentStartEventDelta.optional()}).extend(VKr.ChatStreamEventType)});var fje=x(h0=>{"use strict";var WKr=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]}),KKr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GKr=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)&&WKr(e,t,r);return KKr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.ChatContentDeltaEventDeltaMessageContent=void 0;var iFt=GKr(J());h0.ChatContentDeltaEventDeltaMessageContent=iFt.serialization.object({text:iFt.serialization.string().optional()})});var pje=x(g0=>{"use strict";var JKr=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]}),ZKr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YKr=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)&&JKr(e,t,r);return ZKr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ChatContentDeltaEventDeltaMessage=void 0;var XKr=YKr(J()),QKr=fje();g0.ChatContentDeltaEventDeltaMessage=XKr.serialization.object({content:QKr.ChatContentDeltaEventDeltaMessageContent.optional()})});var mje=x(y0=>{"use strict";var eGr=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]}),tGr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rGr=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)&&eGr(e,t,r);return tGr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ChatContentDeltaEventDelta=void 0;var nGr=rGr(J()),oGr=pje();y0.ChatContentDeltaEventDelta=nGr.serialization.object({message:oGr.ChatContentDeltaEventDeltaMessage.optional()})});var hje=x(b0=>{"use strict";var iGr=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]}),aGr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sGr=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)&&iGr(e,t,r);return aGr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ChatContentDeltaEvent=void 0;var aFt=sGr(J()),uGr=mje(),lGr=Yh();b0.ChatContentDeltaEvent=aFt.serialization.object({index:aFt.serialization.number().optional(),delta:uGr.ChatContentDeltaEventDelta.optional()}).extend(lGr.ChatStreamEventType)});var gje=x(_0=>{"use strict";var cGr=_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]}),dGr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fGr=_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)&&cGr(e,t,r);return dGr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ChatContentEndEvent=void 0;var sFt=fGr(J()),pGr=Yh();_0.ChatContentEndEvent=sFt.serialization.object({index:sFt.serialization.number().optional()}).extend(pGr.ChatStreamEventType)});var bje=x(v0=>{"use strict";var mGr=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]}),hGr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gGr=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)&&mGr(e,t,r);return hGr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.ChatToolPlanDeltaEventDelta=void 0;var yje=gGr(J());v0.ChatToolPlanDeltaEventDelta=yje.serialization.object({toolPlan:yje.serialization.property("tool_plan",yje.serialization.string().optional())})});var _je=x(w0=>{"use strict";var yGr=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]}),bGr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Gr=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)&&yGr(e,t,r);return bGr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.ChatToolPlanDeltaEvent=void 0;var vGr=_Gr(J()),wGr=bje(),xGr=Yh();w0.ChatToolPlanDeltaEvent=vGr.serialization.object({delta:wGr.ChatToolPlanDeltaEventDelta.optional()}).extend(xGr.ChatStreamEventType)});var wje=x(x0=>{"use strict";var SGr=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]}),CGr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OGr=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)&&SGr(e,t,r);return CGr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.ChatToolCallStartEventDeltaToolCallFunction=void 0;var vje=OGr(J());x0.ChatToolCallStartEventDeltaToolCallFunction=vje.serialization.object({name:vje.serialization.string().optional(),arguments:vje.serialization.string().optional()})});var Sje=x(S0=>{"use strict";var EGr=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]}),PGr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TGr=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)&&EGr(e,t,r);return PGr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.ChatToolCallStartEventDeltaToolCall=void 0;var xje=TGr(J()),AGr=wje();S0.ChatToolCallStartEventDeltaToolCall=xje.serialization.object({id:xje.serialization.string().optional(),type:xje.serialization.stringLiteral("function").optional(),function:AGr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var Cje=x(C0=>{"use strict";var IGr=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]}),MGr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RGr=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)&&IGr(e,t,r);return MGr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.ChatToolCallStartEventDelta=void 0;var uFt=RGr(J()),NGr=Sje();C0.ChatToolCallStartEventDelta=uFt.serialization.object({toolCall:uFt.serialization.property("tool_call",NGr.ChatToolCallStartEventDeltaToolCall.optional())})});var Oje=x(O0=>{"use strict";var jGr=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]}),DGr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LGr=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)&&jGr(e,t,r);return DGr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.ChatToolCallStartEvent=void 0;var lFt=LGr(J()),FGr=Cje(),kGr=Yh();O0.ChatToolCallStartEvent=lFt.serialization.object({index:lFt.serialization.number().optional(),delta:FGr.ChatToolCallStartEventDelta.optional()}).extend(kGr.ChatStreamEventType)});var Eje=x(E0=>{"use strict";var $Gr=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]}),BGr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zGr=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)&&$Gr(e,t,r);return BGr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var cFt=zGr(J());E0.ChatToolCallDeltaEventDeltaToolCallFunction=cFt.serialization.object({arguments:cFt.serialization.string().optional()})});var Pje=x(P0=>{"use strict";var UGr=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}),HGr=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)&&UGr(e,t,r);return qGr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.ChatToolCallDeltaEventDeltaToolCall=void 0;var VGr=HGr(J()),WGr=Eje();P0.ChatToolCallDeltaEventDeltaToolCall=VGr.serialization.object({function:WGr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var Tje=x(T0=>{"use strict";var KGr=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]}),GGr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JGr=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)&&KGr(e,t,r);return GGr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.ChatToolCallDeltaEventDelta=void 0;var dFt=JGr(J()),ZGr=Pje();T0.ChatToolCallDeltaEventDelta=dFt.serialization.object({toolCall:dFt.serialization.property("tool_call",ZGr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var Aje=x(A0=>{"use strict";var YGr=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]}),XGr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QGr=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)&&YGr(e,t,r);return XGr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ChatToolCallDeltaEvent=void 0;var fFt=QGr(J()),eJr=Tje(),tJr=Yh();A0.ChatToolCallDeltaEvent=fFt.serialization.object({index:fFt.serialization.number().optional(),delta:eJr.ChatToolCallDeltaEventDelta.optional()}).extend(tJr.ChatStreamEventType)});var Ije=x(I0=>{"use strict";var rJr=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]}),nJr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oJr=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)&&rJr(e,t,r);return nJr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ChatToolCallEndEvent=void 0;var pFt=oJr(J()),iJr=Yh();I0.ChatToolCallEndEvent=pFt.serialization.object({index:pFt.serialization.number().optional()}).extend(iJr.ChatStreamEventType)});var Mje=x(M0=>{"use strict";var aJr=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]}),sJr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uJr=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)&&aJr(e,t,r);return sJr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.ChatMessageEndEventDelta=void 0;var mFt=uJr(J()),lJr=uue(),cJr=lue();M0.ChatMessageEndEventDelta=mFt.serialization.object({finishReason:mFt.serialization.property("finish_reason",lJr.ChatFinishReason.optional()),usage:cJr.Usage.optional()})});var Rje=x(R0=>{"use strict";var dJr=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]}),fJr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pJr=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)&&dJr(e,t,r);return fJr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.ChatMessageEndEvent=void 0;var hFt=pJr(J()),mJr=Mje(),hJr=Yh();R0.ChatMessageEndEvent=hFt.serialization.object({id:hFt.serialization.string().optional(),delta:mJr.ChatMessageEndEventDelta.optional()}).extend(hJr.ChatStreamEventType)});var Nje=x(N0=>{"use strict";var gJr=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]}),yJr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bJr=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)&&gJr(e,t,r);return yJr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.CitationStartEventDeltaMessage=void 0;var _Jr=bJr(J()),vJr=P9();N0.CitationStartEventDeltaMessage=_Jr.serialization.object({citations:vJr.Citation.optional()})});var jje=x(j0=>{"use strict";var wJr=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]}),xJr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SJr=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)&&wJr(e,t,r);return xJr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.CitationStartEventDelta=void 0;var CJr=SJr(J()),OJr=Nje();j0.CitationStartEventDelta=CJr.serialization.object({message:OJr.CitationStartEventDeltaMessage.optional()})});var Dje=x(D0=>{"use strict";var EJr=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]}),PJr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TJr=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)&&EJr(e,t,r);return PJr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.CitationStartEvent=void 0;var gFt=TJr(J()),AJr=jje(),IJr=Yh();D0.CitationStartEvent=gFt.serialization.object({index:gFt.serialization.number().optional(),delta:AJr.CitationStartEventDelta.optional()}).extend(IJr.ChatStreamEventType)});var Lje=x(L0=>{"use strict";var MJr=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]}),RJr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NJr=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)&&MJr(e,t,r);return RJr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.CitationEndEvent=void 0;var yFt=NJr(J()),jJr=Yh();L0.CitationEndEvent=yFt.serialization.object({index:yFt.serialization.number().optional()}).extend(jJr.ChatStreamEventType)});var bFt=x(F0=>{"use strict";var DJr=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]}),LJr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FJr=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)&&DJr(e,t,r);return LJr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.StreamedChatResponse2=void 0;var kJr=FJr(J()),$Jr=aje(),BJr=dje(),zJr=hje(),UJr=gje(),qJr=_je(),HJr=Oje(),VJr=Aje(),WJr=Ije(),KJr=Dje(),GJr=Lje(),JJr=Rje();F0.StreamedChatResponse2=kJr.serialization.union("type",{"message-start":$Jr.ChatMessageStartEvent,"content-start":BJr.ChatContentStartEvent,"content-delta":zJr.ChatContentDeltaEvent,"content-end":UJr.ChatContentEndEvent,"tool-plan-delta":qJr.ChatToolPlanDeltaEvent,"tool-call-start":HJr.ChatToolCallStartEvent,"tool-call-delta":VJr.ChatToolCallDeltaEvent,"tool-call-end":WJr.ChatToolCallEndEvent,"citation-start":KJr.CitationStartEvent,"citation-end":GJr.CitationEndEvent,"message-end":JJr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var Fje=x(Dt=>{"use strict";var ZJr=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]}),Yt=Dt&&Dt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZJr(e,t,r)};Object.defineProperty(Dt,"__esModule",{value:!0});Yt(TNe(),Dt);Yt(ANe(),Dt);Yt(Iq(),Dt);Yt(INe(),Dt);Yt(RNe(),Dt);Yt(jNe(),Dt);Yt(LNe(),Dt);Yt(oue(),Dt);Yt(kNe(),Dt);Yt($Ne(),Dt);Yt(BNe(),Dt);Yt(P9(),Dt);Yt(zNe(),Dt);Yt(qNe(),Dt);Yt(HNe(),Dt);Yt(VNe(),Dt);Yt(KNe(),Dt);Yt(GNe(),Dt);Yt(JNe(),Dt);Yt(ZNe(),Dt);Yt(YNe(),Dt);Yt(XNe(),Dt);Yt(aue(),Dt);Yt(QNe(),Dt);Yt(sue(),Dt);Yt(uue(),Dt);Yt(eje(),Dt);Yt(tje(),Dt);Yt(rje(),Dt);Yt(nje(),Dt);Yt(lue(),Dt);Yt(tFt(),Dt);Yt(Yh(),Dt);Yt(oje(),Dt);Yt(ije(),Dt);Yt(aje(),Dt);Yt(uje(),Dt);Yt(lje(),Dt);Yt(cje(),Dt);Yt(dje(),Dt);Yt(fje(),Dt);Yt(pje(),Dt);Yt(mje(),Dt);Yt(hje(),Dt);Yt(gje(),Dt);Yt(bje(),Dt);Yt(_je(),Dt);Yt(wje(),Dt);Yt(Sje(),Dt);Yt(Cje(),Dt);Yt(Oje(),Dt);Yt(Eje(),Dt);Yt(Pje(),Dt);Yt(Tje(),Dt);Yt(Aje(),Dt);Yt(Ije(),Dt);Yt(Mje(),Dt);Yt(Rje(),Dt);Yt(bFt(),Dt)});var due=x(k0=>{"use strict";var YJr=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]}),XJr=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QJr=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)&&YJr(e,t,r);return XJr(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.TextResponseFormat=void 0;var e7r=QJr(J());k0.TextResponseFormat=e7r.serialization.object({})});var kje=x($0=>{"use strict";var t7r=$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]}),r7r=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n7r=$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)&&t7r(e,t,r);return r7r(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.JsonResponseFormat2=void 0;var I9=n7r(J());$0.JsonResponseFormat2=I9.serialization.object({jsonSchema:I9.serialization.property("json_schema",I9.serialization.record(I9.serialization.string(),I9.serialization.unknown()).optional())})});var fue=x(B0=>{"use strict";var o7r=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]}),i7r=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a7r=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)&&o7r(e,t,r);return i7r(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.ResponseFormat2=void 0;var s7r=a7r(J()),u7r=due(),l7r=kje();B0.ResponseFormat2=s7r.serialization.union("type",{text:u7r.TextResponseFormat,json_object:l7r.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var _Ft=x(z0=>{"use strict";var c7r=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]}),d7r=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f7r=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)&&c7r(e,t,r);return d7r(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.V2ChatStreamRequest=void 0;var Ou=f7r(J()),p7r=aue(),m7r=sue(),h7r=TNe(),g7r=fue();z0.V2ChatStreamRequest=Ou.serialization.object({model:Ou.serialization.string(),messages:p7r.ChatMessages,tools:Ou.serialization.list(m7r.Tool2).optional(),citationMode:Ou.serialization.property("citation_mode",h7r.V2ChatStreamRequestCitationMode.optional()),responseFormat:Ou.serialization.property("response_format",g7r.ResponseFormat2.optional()),maxTokens:Ou.serialization.property("max_tokens",Ou.serialization.number().optional()),stopSequences:Ou.serialization.property("stop_sequences",Ou.serialization.list(Ou.serialization.string()).optional()),temperature:Ou.serialization.number().optional(),seed:Ou.serialization.number().optional(),frequencyPenalty:Ou.serialization.property("frequency_penalty",Ou.serialization.number().optional()),presencePenalty:Ou.serialization.property("presence_penalty",Ou.serialization.number().optional()),k:Ou.serialization.number().optional(),p:Ou.serialization.number().optional(),returnPrompt:Ou.serialization.property("return_prompt",Ou.serialization.boolean().optional())})});var vFt=x(U0=>{"use strict";var y7r=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]}),b7r=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_7r=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)&&y7r(e,t,r);return b7r(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.V2ChatRequest=void 0;var Eu=_7r(J()),v7r=aue(),w7r=sue(),x7r=ANe(),S7r=fue();U0.V2ChatRequest=Eu.serialization.object({model:Eu.serialization.string(),messages:v7r.ChatMessages,tools:Eu.serialization.list(w7r.Tool2).optional(),citationMode:Eu.serialization.property("citation_mode",x7r.V2ChatRequestCitationMode.optional()),responseFormat:Eu.serialization.property("response_format",S7r.ResponseFormat2.optional()),maxTokens:Eu.serialization.property("max_tokens",Eu.serialization.number().optional()),stopSequences:Eu.serialization.property("stop_sequences",Eu.serialization.list(Eu.serialization.string()).optional()),temperature:Eu.serialization.number().optional(),seed:Eu.serialization.number().optional(),frequencyPenalty:Eu.serialization.property("frequency_penalty",Eu.serialization.number().optional()),presencePenalty:Eu.serialization.property("presence_penalty",Eu.serialization.number().optional()),k:Eu.serialization.number().optional(),p:Eu.serialization.number().optional(),returnPrompt:Eu.serialization.property("return_prompt",Eu.serialization.boolean().optional())})});var $je=x(jq=>{"use strict";Object.defineProperty(jq,"__esModule",{value:!0});jq.V2ChatRequest=jq.V2ChatStreamRequest=void 0;var C7r=_Ft();Object.defineProperty(jq,"V2ChatStreamRequest",{enumerable:!0,get:function(){return C7r.V2ChatStreamRequest}});var O7r=vFt();Object.defineProperty(jq,"V2ChatRequest",{enumerable:!0,get:function(){return O7r.V2ChatRequest}})});var wFt=x(sL=>{"use strict";var E7r=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]}),P7r=sL&&sL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&E7r(e,t,r)};Object.defineProperty(sL,"__esModule",{value:!0});P7r($je(),sL)});var SFt=x(IM=>{"use strict";var T7r=IM&&IM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=IM&&IM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&T7r(e,t,r)};Object.defineProperty(IM,"__esModule",{value:!0});xFt(Fje(),IM);xFt(wFt(),IM)});var Bje=x(q0=>{"use strict";var A7r=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]}),I7r=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M7r=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)&&A7r(e,t,r);return I7r(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.CreateEmbedJobRequestTruncate=void 0;var R7r=M7r(J());q0.CreateEmbedJobRequestTruncate=R7r.serialization.enum_(["START","END"])});var zje=x(uL=>{"use strict";var N7r=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]}),j7r=uL&&uL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N7r(e,t,r)};Object.defineProperty(uL,"__esModule",{value:!0});j7r(Bje(),uL)});var pue=x(H0=>{"use strict";var D7r=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]}),L7r=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F7r=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)&&D7r(e,t,r);return L7r(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.EmbedInputType=void 0;var k7r=F7r(J());H0.EmbedInputType=k7r.serialization.enum_(["search_document","search_query","classification","clustering"])});var mue=x(V0=>{"use strict";var $7r=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]}),B7r=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z7r=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)&&$7r(e,t,r);return B7r(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.EmbeddingType=void 0;var U7r=z7r(J());V0.EmbeddingType=U7r.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var CFt=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.CreateEmbedJobRequest=void 0;var MM=V7r(J()),W7r=pue(),K7r=mue(),G7r=Bje();W0.CreateEmbedJobRequest=MM.serialization.object({model:MM.serialization.string(),datasetId:MM.serialization.property("dataset_id",MM.serialization.string()),inputType:MM.serialization.property("input_type",W7r.EmbedInputType),name:MM.serialization.string().optional(),embeddingTypes:MM.serialization.property("embedding_types",MM.serialization.list(K7r.EmbeddingType).optional()),truncate:G7r.CreateEmbedJobRequestTruncate.optional()})});var Uje=x(hue=>{"use strict";Object.defineProperty(hue,"__esModule",{value:!0});hue.CreateEmbedJobRequest=void 0;var J7r=CFt();Object.defineProperty(hue,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return J7r.CreateEmbedJobRequest}})});var OFt=x(lL=>{"use strict";var Z7r=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]}),Y7r=lL&&lL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Z7r(e,t,r)};Object.defineProperty(lL,"__esModule",{value:!0});Y7r(Uje(),lL)});var PFt=x(RM=>{"use strict";var X7r=RM&&RM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EFt=RM&&RM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X7r(e,t,r)};Object.defineProperty(RM,"__esModule",{value:!0});EFt(zje(),RM);EFt(OFt(),RM)});var qje=x(K0=>{"use strict";var Q7r=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]}),eZr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tZr=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)&&Q7r(e,t,r);return eZr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.DatasetType=void 0;var rZr=tZr(J());K0.DatasetType=rZr.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 Hje=x(G0=>{"use strict";var nZr=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]}),oZr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iZr=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)&&nZr(e,t,r);return oZr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.DatasetValidationStatus=void 0;var aZr=iZr(J());G0.DatasetValidationStatus=aZr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var Vje=x(J0=>{"use strict";var sZr=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]}),uZr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lZr=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)&&sZr(e,t,r);return uZr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.DatasetPart=void 0;var Xh=lZr(J());J0.DatasetPart=Xh.serialization.object({id:Xh.serialization.string(),name:Xh.serialization.string(),url:Xh.serialization.string().optional(),index:Xh.serialization.number().optional(),sizeBytes:Xh.serialization.property("size_bytes",Xh.serialization.number().optional()),numRows:Xh.serialization.property("num_rows",Xh.serialization.number().optional()),originalUrl:Xh.serialization.property("original_url",Xh.serialization.string().optional()),samples:Xh.serialization.list(Xh.serialization.string()).optional()})});var gue=x(Z0=>{"use strict";var cZr=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]}),dZr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fZr=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)&&cZr(e,t,r);return dZr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.Dataset=void 0;var ys=fZr(J()),pZr=qje(),mZr=Hje(),hZr=Vje();Z0.Dataset=ys.serialization.object({id:ys.serialization.string(),name:ys.serialization.string(),createdAt:ys.serialization.property("created_at",ys.serialization.date()),updatedAt:ys.serialization.property("updated_at",ys.serialization.date()),datasetType:ys.serialization.property("dataset_type",pZr.DatasetType),validationStatus:ys.serialization.property("validation_status",mZr.DatasetValidationStatus),validationError:ys.serialization.property("validation_error",ys.serialization.string().optional()),schema:ys.serialization.string().optional(),requiredFields:ys.serialization.property("required_fields",ys.serialization.list(ys.serialization.string()).optional()),preserveFields:ys.serialization.property("preserve_fields",ys.serialization.list(ys.serialization.string()).optional()),datasetParts:ys.serialization.property("dataset_parts",ys.serialization.list(hZr.DatasetPart).optional()),validationWarnings:ys.serialization.property("validation_warnings",ys.serialization.list(ys.serialization.string()).optional())})});var AFt=x(Y0=>{"use strict";var gZr=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]}),yZr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bZr=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)&&gZr(e,t,r);return yZr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.DatasetsListResponse=void 0;var TFt=bZr(J()),_Zr=gue();Y0.DatasetsListResponse=TFt.serialization.object({datasets:TFt.serialization.list(_Zr.Dataset).optional()})});var IFt=x(X0=>{"use strict";var vZr=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]}),wZr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xZr=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)&&vZr(e,t,r);return wZr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.DatasetsCreateResponseDatasetPartsItem=void 0;var NM=xZr(J());X0.DatasetsCreateResponseDatasetPartsItem=NM.serialization.object({name:NM.serialization.string().optional(),numRows:NM.serialization.property("num_rows",NM.serialization.number().optional()),samples:NM.serialization.list(NM.serialization.string()).optional(),partKind:NM.serialization.property("part_kind",NM.serialization.string().optional())})});var RFt=x(Q0=>{"use strict";var SZr=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]}),CZr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OZr=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)&&SZr(e,t,r);return CZr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.DatasetsCreateResponse=void 0;var MFt=OZr(J());Q0.DatasetsCreateResponse=MFt.serialization.object({id:MFt.serialization.string().optional()})});var NFt=x(ex=>{"use strict";var EZr=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]}),PZr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TZr=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)&&EZr(e,t,r);return PZr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.DatasetsGetUsageResponse=void 0;var Wje=TZr(J());ex.DatasetsGetUsageResponse=Wje.serialization.object({organizationUsage:Wje.serialization.property("organization_usage",Wje.serialization.number().optional())})});var jFt=x(tx=>{"use strict";var AZr=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]}),IZr=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MZr=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)&&AZr(e,t,r);return IZr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.DatasetsGetResponse=void 0;var RZr=MZr(J()),NZr=gue();tx.DatasetsGetResponse=RZr.serialization.object({dataset:NZr.Dataset})});var Kje=x(r_=>{"use strict";var jZr=r_&&r_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M9=r_&&r_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jZr(e,t,r)};Object.defineProperty(r_,"__esModule",{value:!0});M9(AFt(),r_);M9(IFt(),r_);M9(RFt(),r_);M9(NFt(),r_);M9(jFt(),r_)});var DFt=x(rx=>{"use strict";var DZr=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]}),LZr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FZr=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)&&DZr(e,t,r);return LZr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.Response=void 0;var Gje=FZr(J());rx.Response=Gje.serialization.record(Gje.serialization.string(),Gje.serialization.unknown())});var LFt=x(nx=>{"use strict";var kZr=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]}),$Zr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BZr=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)&&kZr(e,t,r);return $Zr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.delete=void 0;nx.delete=BZr(DFt())});var kFt=x(jM=>{"use strict";var zZr=jM&&jM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=jM&&jM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zZr(e,t,r)};Object.defineProperty(jM,"__esModule",{value:!0});FFt(Kje(),jM);FFt(LFt(),jM)});var Jje=x(ox=>{"use strict";var UZr=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}),HZr=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)&&UZr(e,t,r);return qZr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.BaseType=void 0;var VZr=HZr(J());ox.BaseType=VZr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var Zje=x(ix=>{"use strict";var WZr=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]}),KZr=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GZr=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)&&WZr(e,t,r);return KZr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.Strategy=void 0;var JZr=GZr(J());ix.Strategy=JZr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var Yje=x(ax=>{"use strict";var ZZr=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]}),YZr=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XZr=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)&&ZZr(e,t,r);return YZr(e,t),e};Object.defineProperty(ax,"__esModule",{value:!0});ax.BaseModel=void 0;var yue=XZr(J()),QZr=Jje(),eYr=Zje();ax.BaseModel=yue.serialization.object({name:yue.serialization.string().optional(),version:yue.serialization.string().optional(),baseType:yue.serialization.property("base_type",QZr.BaseType),strategy:eYr.Strategy.optional()})});var Xje=x(sx=>{"use strict";var tYr=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]}),rYr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nYr=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)&&tYr(e,t,r);return rYr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.Hyperparameters=void 0;var n_=nYr(J());sx.Hyperparameters=n_.serialization.object({earlyStoppingPatience:n_.serialization.property("early_stopping_patience",n_.serialization.number().optional()),earlyStoppingThreshold:n_.serialization.property("early_stopping_threshold",n_.serialization.number().optional()),trainBatchSize:n_.serialization.property("train_batch_size",n_.serialization.number().optional()),trainEpochs:n_.serialization.property("train_epochs",n_.serialization.number().optional()),learningRate:n_.serialization.property("learning_rate",n_.serialization.number().optional())})});var Qje=x(ux=>{"use strict";var oYr=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]}),iYr=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aYr=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)&&oYr(e,t,r);return iYr(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.WandbConfig=void 0;var R9=aYr(J());ux.WandbConfig=R9.serialization.object({project:R9.serialization.string(),apiKey:R9.serialization.property("api_key",R9.serialization.string()),entity:R9.serialization.string().optional()})});var bue=x(lx=>{"use strict";var sYr=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]}),uYr=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lYr=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)&&sYr(e,t,r);return uYr(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.Settings=void 0;var Dq=lYr(J()),cYr=Yje(),dYr=Xje(),fYr=Qje();lx.Settings=Dq.serialization.object({baseModel:Dq.serialization.property("base_model",cYr.BaseModel),datasetId:Dq.serialization.property("dataset_id",Dq.serialization.string()),hyperparameters:dYr.Hyperparameters.optional(),multiLabel:Dq.serialization.property("multi_label",Dq.serialization.boolean().optional()),wandb:fYr.WandbConfig.optional()})});var N9=x(cx=>{"use strict";var pYr=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]}),mYr=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hYr=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)&&pYr(e,t,r);return mYr(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.Status=void 0;var gYr=hYr(J());cx.Status=gYr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var Lq=x(dx=>{"use strict";var yYr=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]}),bYr=dx&&dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Yr=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)&&yYr(e,t,r);return bYr(e,t),e};Object.defineProperty(dx,"__esModule",{value:!0});dx.FinetunedModel=void 0;var Up=_Yr(J()),vYr=bue(),wYr=N9();dx.FinetunedModel=Up.serialization.object({id:Up.serialization.string().optional(),name:Up.serialization.string(),creatorId:Up.serialization.property("creator_id",Up.serialization.string().optional()),organizationId:Up.serialization.property("organization_id",Up.serialization.string().optional()),settings:vYr.Settings,status:wYr.Status.optional(),createdAt:Up.serialization.property("created_at",Up.serialization.date().optional()),updatedAt:Up.serialization.property("updated_at",Up.serialization.date().optional()),completedAt:Up.serialization.property("completed_at",Up.serialization.date().optional()),lastUsed:Up.serialization.property("last_used",Up.serialization.date().optional())})});var $Ft=x(fx=>{"use strict";var xYr=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]}),SYr=fx&&fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CYr=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)&&xYr(e,t,r);return SYr(e,t),e};Object.defineProperty(fx,"__esModule",{value:!0});fx.ListFinetunedModelsResponse=void 0;var cL=CYr(J()),OYr=Lq();fx.ListFinetunedModelsResponse=cL.serialization.object({finetunedModels:cL.serialization.property("finetuned_models",cL.serialization.list(OYr.FinetunedModel).optional()),nextPageToken:cL.serialization.property("next_page_token",cL.serialization.string().optional()),totalSize:cL.serialization.property("total_size",cL.serialization.number().optional())})});var zFt=x(px=>{"use strict";var EYr=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]}),PYr=px&&px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TYr=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)&&EYr(e,t,r);return PYr(e,t),e};Object.defineProperty(px,"__esModule",{value:!0});px.CreateFinetunedModelResponse=void 0;var BFt=TYr(J()),AYr=Lq();px.CreateFinetunedModelResponse=BFt.serialization.object({finetunedModel:BFt.serialization.property("finetuned_model",AYr.FinetunedModel.optional())})});var qFt=x(mx=>{"use strict";var IYr=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]}),MYr=mx&&mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RYr=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)&&IYr(e,t,r);return MYr(e,t),e};Object.defineProperty(mx,"__esModule",{value:!0});mx.GetFinetunedModelResponse=void 0;var UFt=RYr(J()),NYr=Lq();mx.GetFinetunedModelResponse=UFt.serialization.object({finetunedModel:UFt.serialization.property("finetuned_model",NYr.FinetunedModel.optional())})});var HFt=x(hx=>{"use strict";var jYr=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]}),DYr=hx&&hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LYr=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)&&jYr(e,t,r);return DYr(e,t),e};Object.defineProperty(hx,"__esModule",{value:!0});hx.DeleteFinetunedModelResponse=void 0;var eDe=LYr(J());hx.DeleteFinetunedModelResponse=eDe.serialization.record(eDe.serialization.string(),eDe.serialization.unknown())});var WFt=x(gx=>{"use strict";var FYr=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]}),kYr=gx&&gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Yr=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)&&FYr(e,t,r);return kYr(e,t),e};Object.defineProperty(gx,"__esModule",{value:!0});gx.UpdateFinetunedModelResponse=void 0;var VFt=$Yr(J()),BYr=Lq();gx.UpdateFinetunedModelResponse=VFt.serialization.object({finetunedModel:VFt.serialization.property("finetuned_model",BYr.FinetunedModel.optional())})});var tDe=x(yx=>{"use strict";var zYr=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]}),UYr=yx&&yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qYr=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)&&zYr(e,t,r);return UYr(e,t),e};Object.defineProperty(yx,"__esModule",{value:!0});yx.Event=void 0;var j9=qYr(J()),HYr=N9();yx.Event=j9.serialization.object({userId:j9.serialization.property("user_id",j9.serialization.string().optional()),status:HYr.Status.optional(),createdAt:j9.serialization.property("created_at",j9.serialization.date().optional())})});var KFt=x(bx=>{"use strict";var VYr=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]}),WYr=bx&&bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KYr=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)&&VYr(e,t,r);return WYr(e,t),e};Object.defineProperty(bx,"__esModule",{value:!0});bx.ListEventsResponse=void 0;var Fq=KYr(J()),GYr=tDe();bx.ListEventsResponse=Fq.serialization.object({events:Fq.serialization.list(GYr.Event).optional(),nextPageToken:Fq.serialization.property("next_page_token",Fq.serialization.string().optional()),totalSize:Fq.serialization.property("total_size",Fq.serialization.number().optional())})});var rDe=x(_x=>{"use strict";var JYr=_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]}),ZYr=_x&&_x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YYr=_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)&&JYr(e,t,r);return ZYr(e,t),e};Object.defineProperty(_x,"__esModule",{value:!0});_x.TrainingStepMetrics=void 0;var DM=YYr(J());_x.TrainingStepMetrics=DM.serialization.object({createdAt:DM.serialization.property("created_at",DM.serialization.date().optional()),stepNumber:DM.serialization.property("step_number",DM.serialization.number().optional()),metrics:DM.serialization.record(DM.serialization.string(),DM.serialization.number()).optional()})});var GFt=x(vx=>{"use strict";var XYr=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]}),QYr=vx&&vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eXr=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)&&XYr(e,t,r);return QYr(e,t),e};Object.defineProperty(vx,"__esModule",{value:!0});vx.ListTrainingStepMetricsResponse=void 0;var D9=eXr(J()),tXr=rDe();vx.ListTrainingStepMetricsResponse=D9.serialization.object({stepMetrics:D9.serialization.property("step_metrics",D9.serialization.list(tXr.TrainingStepMetrics).optional()),nextPageToken:D9.serialization.property("next_page_token",D9.serialization.string().optional())})});var nDe=x(bs=>{"use strict";var rXr=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]}),Fd=bs&&bs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rXr(e,t,r)};Object.defineProperty(bs,"__esModule",{value:!0});Fd(Jje(),bs);Fd(Zje(),bs);Fd(Yje(),bs);Fd(Xje(),bs);Fd(Qje(),bs);Fd(bue(),bs);Fd(N9(),bs);Fd(Lq(),bs);Fd($Ft(),bs);Fd(zFt(),bs);Fd(qFt(),bs);Fd(HFt(),bs);Fd(WFt(),bs);Fd(tDe(),bs);Fd(KFt(),bs);Fd(rDe(),bs);Fd(GFt(),bs)});var JFt=x(dL=>{"use strict";var nXr=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]}),oXr=dL&&dL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nXr(e,t,r)};Object.defineProperty(dL,"__esModule",{value:!0});oXr(nDe(),dL)});var YFt=x(Qh=>{"use strict";var ZFt=Qh&&Qh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Qh&&Qh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aXr=Qh&&Qh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZFt(e,t,r);return iXr(e,t),e},sXr=Qh&&Qh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZFt(e,t,r)};Object.defineProperty(Qh,"__esModule",{value:!0});Qh.finetuning=void 0;Qh.finetuning=aXr(JFt());sXr(nDe(),Qh)});var XFt=x(wx=>{"use strict";var uXr=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]}),lXr=wx&&wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cXr=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)&&uXr(e,t,r);return lXr(e,t),e};Object.defineProperty(wx,"__esModule",{value:!0});wx.FinetuningUpdateFinetunedModelRequest=void 0;var Um=cXr(J()),dXr=bue(),fXr=N9();wx.FinetuningUpdateFinetunedModelRequest=Um.serialization.object({name:Um.serialization.string(),creatorId:Um.serialization.property("creator_id",Um.serialization.string().optional()),organizationId:Um.serialization.property("organization_id",Um.serialization.string().optional()),settings:dXr.Settings,status:fXr.Status.optional(),createdAt:Um.serialization.property("created_at",Um.serialization.date().optional()),updatedAt:Um.serialization.property("updated_at",Um.serialization.date().optional()),completedAt:Um.serialization.property("completed_at",Um.serialization.date().optional()),lastUsed:Um.serialization.property("last_used",Um.serialization.date().optional())})});var oDe=x(_ue=>{"use strict";Object.defineProperty(_ue,"__esModule",{value:!0});_ue.FinetuningUpdateFinetunedModelRequest=void 0;var pXr=XFt();Object.defineProperty(_ue,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return pXr.FinetuningUpdateFinetunedModelRequest}})});var QFt=x(fL=>{"use strict";var mXr=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]}),hXr=fL&&fL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mXr(e,t,r)};Object.defineProperty(fL,"__esModule",{value:!0});hXr(oDe(),fL)});var tkt=x(LM=>{"use strict";var gXr=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]}),ekt=LM&&LM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gXr(e,t,r)};Object.defineProperty(LM,"__esModule",{value:!0});ekt(YFt(),LM);ekt(QFt(),LM)});var vue=x(Sx=>{"use strict";var yXr=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]}),bXr=Sx&&Sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Xr=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)&&yXr(e,t,r);return bXr(e,t),e};Object.defineProperty(Sx,"__esModule",{value:!0});Sx.CreateConnectorOAuth=void 0;var xx=_Xr(J());Sx.CreateConnectorOAuth=xx.serialization.object({clientId:xx.serialization.property("client_id",xx.serialization.string().optional()),clientSecret:xx.serialization.property("client_secret",xx.serialization.string().optional()),authorizeUrl:xx.serialization.property("authorize_url",xx.serialization.string().optional()),tokenUrl:xx.serialization.property("token_url",xx.serialization.string().optional()),scope:xx.serialization.string().optional()})});var iDe=x(Cx=>{"use strict";var vXr=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]}),wXr=Cx&&Cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xXr=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)&&vXr(e,t,r);return wXr(e,t),e};Object.defineProperty(Cx,"__esModule",{value:!0});Cx.AuthTokenType=void 0;var SXr=xXr(J());Cx.AuthTokenType=SXr.serialization.enum_(["bearer","basic","noscheme"])});var wue=x(Ox=>{"use strict";var CXr=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]}),OXr=Ox&&Ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EXr=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)&&CXr(e,t,r);return OXr(e,t),e};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.CreateConnectorServiceAuth=void 0;var rkt=EXr(J()),PXr=iDe();Ox.CreateConnectorServiceAuth=rkt.serialization.object({type:PXr.AuthTokenType,token:rkt.serialization.string()})});var nkt=x(Px=>{"use strict";var TXr=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]}),AXr=Px&&Px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IXr=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)&&TXr(e,t,r);return AXr(e,t),e};Object.defineProperty(Px,"__esModule",{value:!0});Px.CreateConnectorRequest=void 0;var Ex=IXr(J()),MXr=vue(),RXr=wue();Px.CreateConnectorRequest=Ex.serialization.object({name:Ex.serialization.string(),description:Ex.serialization.string().optional(),url:Ex.serialization.string(),excludes:Ex.serialization.list(Ex.serialization.string()).optional(),oauth:MXr.CreateConnectorOAuth.optional(),active:Ex.serialization.boolean().optional(),continueOnFailure:Ex.serialization.property("continue_on_failure",Ex.serialization.boolean().optional()),serviceAuth:Ex.serialization.property("service_auth",RXr.CreateConnectorServiceAuth.optional())})});var okt=x(Tx=>{"use strict";var NXr=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]}),jXr=Tx&&Tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DXr=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)&&NXr(e,t,r);return jXr(e,t),e};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.UpdateConnectorRequest=void 0;var bP=DXr(J()),LXr=vue(),FXr=wue();Tx.UpdateConnectorRequest=bP.serialization.object({name:bP.serialization.string().optional(),url:bP.serialization.string().optional(),excludes:bP.serialization.list(bP.serialization.string()).optional(),oauth:LXr.CreateConnectorOAuth.optional(),active:bP.serialization.boolean().optional(),continueOnFailure:bP.serialization.property("continue_on_failure",bP.serialization.boolean().optional()),serviceAuth:bP.serialization.property("service_auth",FXr.CreateConnectorServiceAuth.optional())})});var aDe=x(kq=>{"use strict";Object.defineProperty(kq,"__esModule",{value:!0});kq.UpdateConnectorRequest=kq.CreateConnectorRequest=void 0;var kXr=nkt();Object.defineProperty(kq,"CreateConnectorRequest",{enumerable:!0,get:function(){return kXr.CreateConnectorRequest}});var $Xr=okt();Object.defineProperty(kq,"UpdateConnectorRequest",{enumerable:!0,get:function(){return $Xr.UpdateConnectorRequest}})});var ikt=x(pL=>{"use strict";var BXr=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]}),zXr=pL&&pL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BXr(e,t,r)};Object.defineProperty(pL,"__esModule",{value:!0});zXr(aDe(),pL)});var akt=x(mL=>{"use strict";var UXr=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]}),qXr=mL&&mL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UXr(e,t,r)};Object.defineProperty(mL,"__esModule",{value:!0});qXr(ikt(),mL)});var ukt=x(oa=>{"use strict";var skt=oa&&oa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=oa&&oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L9=oa&&oa.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&skt(e,t,r);return HXr(e,t),e},hL=oa&&oa.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&skt(e,t,r)};Object.defineProperty(oa,"__esModule",{value:!0});oa.connectors=oa.finetuning=oa.datasets=oa.embedJobs=oa.v2=void 0;oa.v2=L9(SFt());hL(Fje(),oa);oa.embedJobs=L9(PFt());hL(zje(),oa);oa.datasets=L9(kFt());hL(Kje(),oa);oa.finetuning=L9(tkt());hL($je(),oa);hL(Uje(),oa);oa.connectors=L9(akt());hL(aDe(),oa);hL(oDe(),oa)});var sDe=x(Ax=>{"use strict";var VXr=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]}),WXr=Ax&&Ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KXr=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)&&VXr(e,t,r);return WXr(e,t),e};Object.defineProperty(Ax,"__esModule",{value:!0});Ax.ChatStreamRequestPromptTruncation=void 0;var GXr=KXr(J());Ax.ChatStreamRequestPromptTruncation=GXr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var uDe=x(Ix=>{"use strict";var JXr=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]}),ZXr=Ix&&Ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YXr=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)&&JXr(e,t,r);return ZXr(e,t),e};Object.defineProperty(Ix,"__esModule",{value:!0});Ix.ChatStreamRequestCitationQuality=void 0;var XXr=YXr(J());Ix.ChatStreamRequestCitationQuality=XXr.serialization.enum_(["fast","accurate","off"])});var ckt=x(Mx=>{"use strict";var QXr=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]}),eQr=Mx&&Mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tQr=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)&&QXr(e,t,r);return eQr(e,t),e};Object.defineProperty(Mx,"__esModule",{value:!0});Mx.ChatStreamRequestConnectorsSearchOptions=void 0;var lkt=tQr(J());Mx.ChatStreamRequestConnectorsSearchOptions=lkt.serialization.object({seed:lkt.serialization.number().optional()})});var lDe=x(Rx=>{"use strict";var rQr=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]}),nQr=Rx&&Rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oQr=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)&&rQr(e,t,r);return nQr(e,t),e};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.ChatStreamRequestSafetyMode=void 0;var iQr=oQr(J());Rx.ChatStreamRequestSafetyMode=iQr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var fkt=x(Nx=>{"use strict";var aQr=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]}),sQr=Nx&&Nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uQr=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)&&aQr(e,t,r);return sQr(e,t),e};Object.defineProperty(Nx,"__esModule",{value:!0});Nx.UnprocessableEntityErrorBody=void 0;var dkt=uQr(J());Nx.UnprocessableEntityErrorBody=dkt.serialization.object({data:dkt.serialization.string().optional()})});var mkt=x(jx=>{"use strict";var lQr=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]}),cQr=jx&&jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dQr=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)&&lQr(e,t,r);return cQr(e,t),e};Object.defineProperty(jx,"__esModule",{value:!0});jx.TooManyRequestsErrorBody=void 0;var pkt=dQr(J());jx.TooManyRequestsErrorBody=pkt.serialization.object({data:pkt.serialization.string().optional()})});var gkt=x(Dx=>{"use strict";var fQr=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]}),pQr=Dx&&Dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mQr=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)&&fQr(e,t,r);return pQr(e,t),e};Object.defineProperty(Dx,"__esModule",{value:!0});Dx.ClientClosedRequestErrorBody=void 0;var hkt=mQr(J());Dx.ClientClosedRequestErrorBody=hkt.serialization.object({data:hkt.serialization.string().optional()})});var bkt=x(Lx=>{"use strict";var hQr=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]}),gQr=Lx&&Lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yQr=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)&&hQr(e,t,r);return gQr(e,t),e};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.NotImplementedErrorBody=void 0;var ykt=yQr(J());Lx.NotImplementedErrorBody=ykt.serialization.object({data:ykt.serialization.string().optional()})});var vkt=x(Fx=>{"use strict";var bQr=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]}),_Qr=Fx&&Fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vQr=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)&&bQr(e,t,r);return _Qr(e,t),e};Object.defineProperty(Fx,"__esModule",{value:!0});Fx.GatewayTimeoutErrorBody=void 0;var _kt=vQr(J());Fx.GatewayTimeoutErrorBody=_kt.serialization.object({data:_kt.serialization.string().optional()})});var cDe=x(kx=>{"use strict";var wQr=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]}),xQr=kx&&kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SQr=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)&&wQr(e,t,r);return xQr(e,t),e};Object.defineProperty(kx,"__esModule",{value:!0});kx.ChatRequestPromptTruncation=void 0;var CQr=SQr(J());kx.ChatRequestPromptTruncation=CQr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var dDe=x($x=>{"use strict";var OQr=$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]}),EQr=$x&&$x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PQr=$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)&&OQr(e,t,r);return EQr(e,t),e};Object.defineProperty($x,"__esModule",{value:!0});$x.ChatRequestCitationQuality=void 0;var TQr=PQr(J());$x.ChatRequestCitationQuality=TQr.serialization.enum_(["fast","accurate","off"])});var xkt=x(Bx=>{"use strict";var AQr=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]}),IQr=Bx&&Bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MQr=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)&&AQr(e,t,r);return IQr(e,t),e};Object.defineProperty(Bx,"__esModule",{value:!0});Bx.ChatRequestConnectorsSearchOptions=void 0;var wkt=MQr(J());Bx.ChatRequestConnectorsSearchOptions=wkt.serialization.object({seed:wkt.serialization.number().optional()})});var fDe=x(zx=>{"use strict";var RQr=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]}),NQr=zx&&zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jQr=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)&&RQr(e,t,r);return NQr(e,t),e};Object.defineProperty(zx,"__esModule",{value:!0});zx.ChatRequestSafetyMode=void 0;var DQr=jQr(J());zx.ChatRequestSafetyMode=DQr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var pDe=x(Ux=>{"use strict";var LQr=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]}),FQr=Ux&&Ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kQr=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)&&LQr(e,t,r);return FQr(e,t),e};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.GenerateStreamRequestTruncate=void 0;var $Qr=kQr(J());Ux.GenerateStreamRequestTruncate=$Qr.serialization.enum_(["NONE","START","END"])});var mDe=x(qx=>{"use strict";var BQr=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]}),zQr=qx&&qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UQr=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)&&BQr(e,t,r);return zQr(e,t),e};Object.defineProperty(qx,"__esModule",{value:!0});qx.GenerateStreamRequestReturnLikelihoods=void 0;var qQr=UQr(J());qx.GenerateStreamRequestReturnLikelihoods=qQr.serialization.enum_(["GENERATION","ALL","NONE"])});var hDe=x(Hx=>{"use strict";var HQr=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]}),VQr=Hx&&Hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WQr=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)&&HQr(e,t,r);return VQr(e,t),e};Object.defineProperty(Hx,"__esModule",{value:!0});Hx.GenerateRequestTruncate=void 0;var KQr=WQr(J());Hx.GenerateRequestTruncate=KQr.serialization.enum_(["NONE","START","END"])});var gDe=x(Vx=>{"use strict";var GQr=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]}),JQr=Vx&&Vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZQr=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)&&GQr(e,t,r);return JQr(e,t),e};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.GenerateRequestReturnLikelihoods=void 0;var YQr=ZQr(J());Vx.GenerateRequestReturnLikelihoods=YQr.serialization.enum_(["GENERATION","ALL","NONE"])});var yDe=x(Wx=>{"use strict";var XQr=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]}),QQr=Wx&&Wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),een=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)&&XQr(e,t,r);return QQr(e,t),e};Object.defineProperty(Wx,"__esModule",{value:!0});Wx.EmbedRequestTruncate=void 0;var ten=een(J());Wx.EmbedRequestTruncate=ten.serialization.enum_(["NONE","START","END"])});var bDe=x(Kx=>{"use strict";var ren=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]}),nen=Kx&&Kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oen=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)&&ren(e,t,r);return nen(e,t),e};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.ApiMetaApiVersion=void 0;var $q=oen(J());Kx.ApiMetaApiVersion=$q.serialization.object({version:$q.serialization.string(),isDeprecated:$q.serialization.property("is_deprecated",$q.serialization.boolean().optional()),isExperimental:$q.serialization.property("is_experimental",$q.serialization.boolean().optional())})});var _De=x(Gx=>{"use strict";var ien=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]}),aen=Gx&&Gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sen=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)&&ien(e,t,r);return aen(e,t),e};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.ApiMetaBilledUnits=void 0;var FM=sen(J());Gx.ApiMetaBilledUnits=FM.serialization.object({inputTokens:FM.serialization.property("input_tokens",FM.serialization.number().optional()),outputTokens:FM.serialization.property("output_tokens",FM.serialization.number().optional()),searchUnits:FM.serialization.property("search_units",FM.serialization.number().optional()),classifications:FM.serialization.number().optional()})});var vDe=x(Jx=>{"use strict";var uen=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]}),len=Jx&&Jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cen=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)&&uen(e,t,r);return len(e,t),e};Object.defineProperty(Jx,"__esModule",{value:!0});Jx.ApiMetaTokens=void 0;var F9=cen(J());Jx.ApiMetaTokens=F9.serialization.object({inputTokens:F9.serialization.property("input_tokens",F9.serialization.number().optional()),outputTokens:F9.serialization.property("output_tokens",F9.serialization.number().optional())})});var eg=x(Zx=>{"use strict";var den=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]}),fen=Zx&&Zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pen=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)&&den(e,t,r);return fen(e,t),e};Object.defineProperty(Zx,"__esModule",{value:!0});Zx.ApiMeta=void 0;var k9=pen(J()),men=bDe(),hen=_De(),gen=vDe();Zx.ApiMeta=k9.serialization.object({apiVersion:k9.serialization.property("api_version",men.ApiMetaApiVersion.optional()),billedUnits:k9.serialization.property("billed_units",hen.ApiMetaBilledUnits.optional()),tokens:gen.ApiMetaTokens.optional(),warnings:k9.serialization.list(k9.serialization.string()).optional()})});var wDe=x(Yx=>{"use strict";var yen=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]}),ben=Yx&&Yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_en=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)&&yen(e,t,r);return ben(e,t),e};Object.defineProperty(Yx,"__esModule",{value:!0});Yx.EmbedFloatsResponse=void 0;var gL=_en(J()),ven=eg();Yx.EmbedFloatsResponse=gL.serialization.object({id:gL.serialization.string(),embeddings:gL.serialization.list(gL.serialization.list(gL.serialization.number())),texts:gL.serialization.list(gL.serialization.string()),meta:ven.ApiMeta.optional()})});var xDe=x(Xx=>{"use strict";var wen=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]}),xen=Xx&&Xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sen=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)&&wen(e,t,r);return xen(e,t),e};Object.defineProperty(Xx,"__esModule",{value:!0});Xx.EmbedByTypeResponseEmbeddings=void 0;var Jf=Sen(J());Xx.EmbedByTypeResponseEmbeddings=Jf.serialization.object({float:Jf.serialization.list(Jf.serialization.list(Jf.serialization.number())).optional(),int8:Jf.serialization.list(Jf.serialization.list(Jf.serialization.number())).optional(),uint8:Jf.serialization.list(Jf.serialization.list(Jf.serialization.number())).optional(),binary:Jf.serialization.list(Jf.serialization.list(Jf.serialization.number())).optional(),ubinary:Jf.serialization.list(Jf.serialization.list(Jf.serialization.number())).optional()})});var SDe=x(Qx=>{"use strict";var Cen=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]}),Oen=Qx&&Qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Een=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)&&Cen(e,t,r);return Oen(e,t),e};Object.defineProperty(Qx,"__esModule",{value:!0});Qx.EmbedByTypeResponse=void 0;var xue=Een(J()),Pen=xDe(),Ten=eg();Qx.EmbedByTypeResponse=xue.serialization.object({id:xue.serialization.string(),embeddings:Pen.EmbedByTypeResponseEmbeddings,texts:xue.serialization.list(xue.serialization.string()),meta:Ten.ApiMeta.optional()})});var Ckt=x(eS=>{"use strict";var Aen=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]}),Ien=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Men=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)&&Aen(e,t,r);return Ien(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.EmbedResponse=void 0;var Skt=Men(J()),Ren=wDe(),Nen=SDe();eS.EmbedResponse=Skt.serialization.union(Skt.serialization.discriminant("responseType","response_type"),{embeddings_floats:Ren.EmbedFloatsResponse,embeddings_by_type:Nen.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var ODe=x(tS=>{"use strict";var jen=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]}),Den=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Len=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)&&jen(e,t,r);return Den(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.RerankDocument=void 0;var CDe=Len(J());tS.RerankDocument=CDe.serialization.record(CDe.serialization.string(),CDe.serialization.string())});var EDe=x(rS=>{"use strict";var Fen=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]}),ken=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$en=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)&&Fen(e,t,r);return ken(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.RerankRequestDocumentsItem=void 0;var Okt=$en(J()),Ben=ODe();rS.RerankRequestDocumentsItem=Okt.serialization.undiscriminatedUnion([Okt.serialization.string(),Ben.RerankDocument])});var PDe=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]}),Uen=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qen=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 Uen(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.RerankResponseResultsItemDocument=void 0;var Ekt=qen(J());nS.RerankResponseResultsItemDocument=Ekt.serialization.object({text:Ekt.serialization.string()})});var TDe=x(oS=>{"use strict";var Hen=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]}),Ven=oS&&oS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wen=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)&&Hen(e,t,r);return Ven(e,t),e};Object.defineProperty(oS,"__esModule",{value:!0});oS.RerankResponseResultsItem=void 0;var Sue=Wen(J()),Ken=PDe();oS.RerankResponseResultsItem=Sue.serialization.object({document:Ken.RerankResponseResultsItemDocument.optional(),index:Sue.serialization.number(),relevanceScore:Sue.serialization.property("relevance_score",Sue.serialization.number())})});var Pkt=x(iS=>{"use strict";var Gen=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]}),Jen=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zen=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)&&Gen(e,t,r);return Jen(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.RerankResponse=void 0;var ADe=Zen(J()),Yen=TDe(),Xen=eg();iS.RerankResponse=ADe.serialization.object({id:ADe.serialization.string().optional(),results:ADe.serialization.list(Yen.RerankResponseResultsItem),meta:Xen.ApiMeta.optional()})});var IDe=x(aS=>{"use strict";var Qen=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]}),etn=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ttn=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)&&Qen(e,t,r);return etn(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.ClassifyRequestTruncate=void 0;var rtn=ttn(J());aS.ClassifyRequestTruncate=rtn.serialization.enum_(["NONE","START","END"])});var MDe=x(sS=>{"use strict";var ntn=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]}),otn=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),itn=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)&&ntn(e,t,r);return otn(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.ClassifyResponseClassificationsItemLabelsValue=void 0;var Tkt=itn(J());sS.ClassifyResponseClassificationsItemLabelsValue=Tkt.serialization.object({confidence:Tkt.serialization.number().optional()})});var RDe=x(uS=>{"use strict";var atn=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]}),stn=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),utn=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)&&atn(e,t,r);return stn(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.ClassifyResponseClassificationsItemClassificationType=void 0;var ltn=utn(J());uS.ClassifyResponseClassificationsItemClassificationType=ltn.serialization.enum_(["single-label","multi-label"])});var NDe=x(lS=>{"use strict";var ctn=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]}),dtn=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ftn=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)&&ctn(e,t,r);return dtn(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.ClassifyResponseClassificationsItem=void 0;var Py=ftn(J()),ptn=MDe(),mtn=RDe();lS.ClassifyResponseClassificationsItem=Py.serialization.object({id:Py.serialization.string(),input:Py.serialization.string().optional(),prediction:Py.serialization.string().optional(),predictions:Py.serialization.list(Py.serialization.string()),confidence:Py.serialization.number().optional(),confidences:Py.serialization.list(Py.serialization.number()),labels:Py.serialization.record(Py.serialization.string(),ptn.ClassifyResponseClassificationsItemLabelsValue),classificationType:Py.serialization.property("classification_type",mtn.ClassifyResponseClassificationsItemClassificationType)})});var Akt=x(cS=>{"use strict";var htn=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]}),gtn=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ytn=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)&&htn(e,t,r);return gtn(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.ClassifyResponse=void 0;var jDe=ytn(J()),btn=NDe(),_tn=eg();cS.ClassifyResponse=jDe.serialization.object({id:jDe.serialization.string(),classifications:jDe.serialization.list(btn.ClassifyResponseClassificationsItem),meta:_tn.ApiMeta.optional()})});var DDe=x(dS=>{"use strict";var vtn=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]}),wtn=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xtn=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)&&vtn(e,t,r);return wtn(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.SummarizeRequestLength=void 0;var Stn=xtn(J());dS.SummarizeRequestLength=Stn.serialization.enum_(["short","medium","long"])});var LDe=x(fS=>{"use strict";var Ctn=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]}),Otn=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Etn=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)&&Ctn(e,t,r);return Otn(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.SummarizeRequestFormat=void 0;var Ptn=Etn(J());fS.SummarizeRequestFormat=Ptn.serialization.enum_(["paragraph","bullets"])});var FDe=x(pS=>{"use strict";var Ttn=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]}),Atn=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Itn=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)&&Ttn(e,t,r);return Atn(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.SummarizeRequestExtractiveness=void 0;var Mtn=Itn(J());pS.SummarizeRequestExtractiveness=Mtn.serialization.enum_(["low","medium","high"])});var Ikt=x(mS=>{"use strict";var Rtn=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]}),Ntn=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jtn=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)&&Rtn(e,t,r);return Ntn(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.SummarizeResponse=void 0;var kDe=jtn(J()),Dtn=eg();mS.SummarizeResponse=kDe.serialization.object({id:kDe.serialization.string().optional(),summary:kDe.serialization.string().optional(),meta:Dtn.ApiMeta.optional()})});var Mkt=x(hS=>{"use strict";var Ltn=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]}),Ftn=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ktn=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)&&Ltn(e,t,r);return Ftn(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.TokenizeResponse=void 0;var Bq=ktn(J()),$tn=eg();hS.TokenizeResponse=Bq.serialization.object({tokens:Bq.serialization.list(Bq.serialization.number()),tokenStrings:Bq.serialization.property("token_strings",Bq.serialization.list(Bq.serialization.string())),meta:$tn.ApiMeta.optional()})});var Nkt=x(gS=>{"use strict";var Btn=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]}),ztn=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Utn=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)&&Btn(e,t,r);return ztn(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.DetokenizeResponse=void 0;var Rkt=Utn(J()),qtn=eg();gS.DetokenizeResponse=Rkt.serialization.object({text:Rkt.serialization.string(),meta:qtn.ApiMeta.optional()})});var jkt=x(yS=>{"use strict";var Htn=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]}),Vtn=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wtn=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)&&Htn(e,t,r);return Vtn(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.CheckApiKeyResponse=void 0;var zq=Wtn(J());yS.CheckApiKeyResponse=zq.serialization.object({valid:zq.serialization.boolean(),organizationId:zq.serialization.property("organization_id",zq.serialization.string().optional()),ownerId:zq.serialization.property("owner_id",zq.serialization.string().optional())})});var Uq=x(bS=>{"use strict";var Ktn=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]}),Gtn=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jtn=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)&&Ktn(e,t,r);return Gtn(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.ToolCall=void 0;var $9=Jtn(J());bS.ToolCall=$9.serialization.object({name:$9.serialization.string(),parameters:$9.serialization.record($9.serialization.string(),$9.serialization.unknown())})});var $De=x(_S=>{"use strict";var Ztn=_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]}),Ytn=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xtn=_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)&&Ztn(e,t,r);return Ytn(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.ChatMessage=void 0;var Cue=Xtn(J()),Qtn=Uq();_S.ChatMessage=Cue.serialization.object({message:Cue.serialization.string(),toolCalls:Cue.serialization.property("tool_calls",Cue.serialization.list(Qtn.ToolCall).optional())})});var z9=x(vS=>{"use strict";var ern=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]}),trn=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rrn=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)&&ern(e,t,r);return trn(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.ToolResult=void 0;var B9=rrn(J()),nrn=Uq();vS.ToolResult=B9.serialization.object({call:nrn.ToolCall,outputs:B9.serialization.list(B9.serialization.record(B9.serialization.string(),B9.serialization.unknown()))})});var zDe=x(wS=>{"use strict";var orn=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]}),irn=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),arn=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)&&orn(e,t,r);return irn(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.ToolMessage=void 0;var BDe=arn(J()),srn=z9();wS.ToolMessage=BDe.serialization.object({toolResults:BDe.serialization.property("tool_results",BDe.serialization.list(srn.ToolResult).optional())})});var U9=x(xS=>{"use strict";var urn=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]}),lrn=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),crn=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)&&urn(e,t,r);return lrn(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.Message=void 0;var drn=crn(J()),UDe=$De(),frn=zDe();xS.Message=drn.serialization.union("role",{CHATBOT:UDe.ChatMessage,SYSTEM:UDe.ChatMessage,USER:UDe.ChatMessage,TOOL:frn.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var Oue=x(SS=>{"use strict";var prn=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]}),mrn=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hrn=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)&&prn(e,t,r);return mrn(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.ChatConnector=void 0;var _P=hrn(J());SS.ChatConnector=_P.serialization.object({id:_P.serialization.string(),userAccessToken:_P.serialization.property("user_access_token",_P.serialization.string().optional()),continueOnFailure:_P.serialization.property("continue_on_failure",_P.serialization.boolean().optional()),options:_P.serialization.record(_P.serialization.string(),_P.serialization.unknown()).optional()})});var qDe=x(CS=>{"use strict";var grn=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]}),yrn=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),brn=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)&&grn(e,t,r);return yrn(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.ToolParameterDefinitionsValue=void 0;var Eue=brn(J());CS.ToolParameterDefinitionsValue=Eue.serialization.object({description:Eue.serialization.string().optional(),type:Eue.serialization.string(),required:Eue.serialization.boolean().optional()})});var Pue=x(OS=>{"use strict";var _rn=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]}),vrn=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wrn=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)&&_rn(e,t,r);return vrn(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.Tool=void 0;var qq=wrn(J()),xrn=qDe();OS.Tool=qq.serialization.object({name:qq.serialization.string(),description:qq.serialization.string(),parameterDefinitions:qq.serialization.property("parameter_definitions",qq.serialization.record(qq.serialization.string(),xrn.ToolParameterDefinitionsValue).optional())})});var HDe=x(ES=>{"use strict";var Srn=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]}),Crn=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Orn=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)&&Srn(e,t,r);return Crn(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.JsonResponseFormat=void 0;var Tue=Orn(J());ES.JsonResponseFormat=Tue.serialization.object({schema:Tue.serialization.record(Tue.serialization.string(),Tue.serialization.unknown()).optional()})});var Aue=x(PS=>{"use strict";var Ern=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]}),Prn=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Trn=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)&&Ern(e,t,r);return Prn(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.ResponseFormat=void 0;var Arn=Trn(J()),Irn=due(),Mrn=HDe();PS.ResponseFormat=Arn.serialization.union("type",{text:Irn.TextResponseFormat,json_object:Mrn.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var Iue=x(TS=>{"use strict";var Rrn=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]}),Nrn=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jrn=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)&&Rrn(e,t,r);return Nrn(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.ChatCitation=void 0;var yL=jrn(J());TS.ChatCitation=yL.serialization.object({start:yL.serialization.number(),end:yL.serialization.number(),text:yL.serialization.string(),documentIds:yL.serialization.property("document_ids",yL.serialization.list(yL.serialization.string()))})});var q9=x(AS=>{"use strict";var Drn=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]}),Lrn=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Frn=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)&&Drn(e,t,r);return Lrn(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.ChatSearchQuery=void 0;var Mue=Frn(J());AS.ChatSearchQuery=Mue.serialization.object({text:Mue.serialization.string(),generationId:Mue.serialization.property("generation_id",Mue.serialization.string())})});var VDe=x(IS=>{"use strict";var krn=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]}),$rn=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Brn=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)&&krn(e,t,r);return $rn(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.ChatSearchResultConnector=void 0;var Dkt=Brn(J());IS.ChatSearchResultConnector=Dkt.serialization.object({id:Dkt.serialization.string()})});var Rue=x(MS=>{"use strict";var zrn=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]}),Urn=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qrn=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)&&zrn(e,t,r);return Urn(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.ChatSearchResult=void 0;var vP=qrn(J()),Hrn=q9(),Vrn=VDe();MS.ChatSearchResult=vP.serialization.object({searchQuery:vP.serialization.property("search_query",Hrn.ChatSearchQuery.optional()),connector:Vrn.ChatSearchResultConnector,documentIds:vP.serialization.property("document_ids",vP.serialization.list(vP.serialization.string())),errorMessage:vP.serialization.property("error_message",vP.serialization.string().optional()),continueOnFailure:vP.serialization.property("continue_on_failure",vP.serialization.boolean().optional())})});var Hq=x(RS=>{"use strict";var Wrn=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]}),Krn=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Grn=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)&&Wrn(e,t,r);return Krn(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.FinishReason=void 0;var Jrn=Grn(J());RS.FinishReason=Jrn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var WDe=x(NS=>{"use strict";var Zrn=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]}),Yrn=NS&&NS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xrn=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)&&Zrn(e,t,r);return Yrn(e,t),e};Object.defineProperty(NS,"__esModule",{value:!0});NS.NonStreamedChatResponse=void 0;var qc=Xrn(J()),Qrn=Iue(),enn=aL(),tnn=q9(),rnn=Rue(),nnn=Hq(),onn=Uq(),inn=U9(),ann=eg();NS.NonStreamedChatResponse=qc.serialization.object({text:qc.serialization.string(),generationId:qc.serialization.property("generation_id",qc.serialization.string().optional()),citations:qc.serialization.list(Qrn.ChatCitation).optional(),documents:qc.serialization.list(enn.ChatDocument).optional(),isSearchRequired:qc.serialization.property("is_search_required",qc.serialization.boolean().optional()),searchQueries:qc.serialization.property("search_queries",qc.serialization.list(tnn.ChatSearchQuery).optional()),searchResults:qc.serialization.property("search_results",qc.serialization.list(rnn.ChatSearchResult).optional()),finishReason:qc.serialization.property("finish_reason",nnn.FinishReason.optional()),toolCalls:qc.serialization.property("tool_calls",qc.serialization.list(onn.ToolCall).optional()),chatHistory:qc.serialization.property("chat_history",qc.serialization.list(inn.Message).optional()),prompt:qc.serialization.string().optional(),meta:ann.ApiMeta.optional()})});var DS=x(jS=>{"use strict";var snn=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]}),unn=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lnn=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)&&snn(e,t,r);return unn(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.ChatStreamEvent=void 0;var cnn=lnn(J());jS.ChatStreamEvent=cnn.serialization.object({})});var GDe=x(LS=>{"use strict";var dnn=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]}),fnn=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pnn=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)&&dnn(e,t,r);return fnn(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.ChatStreamStartEvent=void 0;var KDe=pnn(J()),mnn=DS();LS.ChatStreamStartEvent=KDe.serialization.object({generationId:KDe.serialization.property("generation_id",KDe.serialization.string())}).extend(mnn.ChatStreamEvent)});var ZDe=x(FS=>{"use strict";var hnn=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]}),gnn=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ynn=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)&&hnn(e,t,r);return gnn(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.ChatSearchQueriesGenerationEvent=void 0;var JDe=ynn(J()),bnn=q9(),_nn=DS();FS.ChatSearchQueriesGenerationEvent=JDe.serialization.object({searchQueries:JDe.serialization.property("search_queries",JDe.serialization.list(bnn.ChatSearchQuery))}).extend(_nn.ChatStreamEvent)});var YDe=x(kS=>{"use strict";var vnn=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]}),wnn=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xnn=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)&&vnn(e,t,r);return wnn(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.ChatSearchResultsEvent=void 0;var Nue=xnn(J()),Snn=Rue(),Cnn=aL(),Onn=DS();kS.ChatSearchResultsEvent=Nue.serialization.object({searchResults:Nue.serialization.property("search_results",Nue.serialization.list(Snn.ChatSearchResult).optional()),documents:Nue.serialization.list(Cnn.ChatDocument).optional()}).extend(Onn.ChatStreamEvent)});var XDe=x($S=>{"use strict";var Enn=$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]}),Pnn=$S&&$S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tnn=$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)&&Enn(e,t,r);return Pnn(e,t),e};Object.defineProperty($S,"__esModule",{value:!0});$S.ChatTextGenerationEvent=void 0;var Lkt=Tnn(J()),Ann=DS();$S.ChatTextGenerationEvent=Lkt.serialization.object({text:Lkt.serialization.string()}).extend(Ann.ChatStreamEvent)});var QDe=x(BS=>{"use strict";var Inn=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]}),Mnn=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rnn=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)&&Inn(e,t,r);return Mnn(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.ChatCitationGenerationEvent=void 0;var Fkt=Rnn(J()),Nnn=Iue(),jnn=DS();BS.ChatCitationGenerationEvent=Fkt.serialization.object({citations:Fkt.serialization.list(Nnn.ChatCitation)}).extend(jnn.ChatStreamEvent)});var eLe=x(zS=>{"use strict";var Dnn=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]}),Lnn=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fnn=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)&&Dnn(e,t,r);return Lnn(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.ChatToolCallsGenerationEvent=void 0;var jue=Fnn(J()),knn=Uq(),$nn=DS();zS.ChatToolCallsGenerationEvent=jue.serialization.object({text:jue.serialization.string().optional(),toolCalls:jue.serialization.property("tool_calls",jue.serialization.list(knn.ToolCall))}).extend($nn.ChatStreamEvent)});var tLe=x(US=>{"use strict";var Bnn=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]}),znn=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Unn=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)&&Bnn(e,t,r);return znn(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.ChatStreamEndEventFinishReason=void 0;var qnn=Unn(J());US.ChatStreamEndEventFinishReason=qnn.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var rLe=x(qS=>{"use strict";var Hnn=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]}),Vnn=qS&&qS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wnn=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)&&Hnn(e,t,r);return Vnn(e,t),e};Object.defineProperty(qS,"__esModule",{value:!0});qS.ChatStreamEndEvent=void 0;var kkt=Wnn(J()),Knn=tLe(),Gnn=WDe(),Jnn=DS();qS.ChatStreamEndEvent=kkt.serialization.object({finishReason:kkt.serialization.property("finish_reason",Knn.ChatStreamEndEventFinishReason),response:Gnn.NonStreamedChatResponse}).extend(Jnn.ChatStreamEvent)});var nLe=x(HS=>{"use strict";var Znn=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]}),Ynn=HS&&HS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xnn=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)&&Znn(e,t,r);return Ynn(e,t),e};Object.defineProperty(HS,"__esModule",{value:!0});HS.ToolCallDelta=void 0;var H9=Xnn(J());HS.ToolCallDelta=H9.serialization.object({name:H9.serialization.string().optional(),index:H9.serialization.number().optional(),parameters:H9.serialization.string().optional(),text:H9.serialization.string().optional()})});var oLe=x(VS=>{"use strict";var Qnn=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]}),eon=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ton=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)&&Qnn(e,t,r);return eon(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.ChatToolCallsChunkEvent=void 0;var $kt=ton(J()),ron=nLe(),non=DS();VS.ChatToolCallsChunkEvent=$kt.serialization.object({toolCallDelta:$kt.serialization.property("tool_call_delta",ron.ToolCallDelta)}).extend(non.ChatStreamEvent)});var zkt=x(WS=>{"use strict";var oon=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]}),ion=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aon=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)&&oon(e,t,r);return ion(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.StreamedChatResponse=void 0;var Bkt=aon(J()),son=GDe(),uon=ZDe(),lon=YDe(),con=XDe(),don=QDe(),fon=eLe(),pon=rLe(),mon=oLe();WS.StreamedChatResponse=Bkt.serialization.union(Bkt.serialization.discriminant("eventType","event_type"),{"stream-start":son.ChatStreamStartEvent,"search-queries-generation":uon.ChatSearchQueriesGenerationEvent,"search-results":lon.ChatSearchResultsEvent,"text-generation":con.ChatTextGenerationEvent,"citation-generation":don.ChatCitationGenerationEvent,"tool-calls-generation":fon.ChatToolCallsGenerationEvent,"stream-end":pon.ChatStreamEndEvent,"tool-calls-chunk":mon.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var aLe=x(KS=>{"use strict";var hon=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]}),gon=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yon=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)&&hon(e,t,r);return gon(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.SingleGenerationTokenLikelihoodsItem=void 0;var iLe=yon(J());KS.SingleGenerationTokenLikelihoodsItem=iLe.serialization.object({token:iLe.serialization.string(),likelihood:iLe.serialization.number()})});var sLe=x(GS=>{"use strict";var bon=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]}),_on=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),von=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)&&bon(e,t,r);return _on(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.SingleGeneration=void 0;var bL=von(J()),won=aLe();GS.SingleGeneration=bL.serialization.object({id:bL.serialization.string(),text:bL.serialization.string(),index:bL.serialization.number().optional(),likelihood:bL.serialization.number().optional(),tokenLikelihoods:bL.serialization.property("token_likelihoods",bL.serialization.list(won.SingleGenerationTokenLikelihoodsItem).optional())})});var Ukt=x(JS=>{"use strict";var xon=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]}),Son=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Con=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)&&xon(e,t,r);return Son(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.Generation=void 0;var Due=Con(J()),Oon=sLe(),Eon=eg();JS.Generation=Due.serialization.object({id:Due.serialization.string(),prompt:Due.serialization.string().optional(),generations:Due.serialization.list(Oon.SingleGeneration),meta:Eon.ApiMeta.optional()})});var V9=x(ZS=>{"use strict";var Pon=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]}),Ton=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aon=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)&&Pon(e,t,r);return Ton(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.GenerateStreamEvent=void 0;var Ion=Aon(J());ZS.GenerateStreamEvent=Ion.serialization.object({})});var uLe=x(YS=>{"use strict";var Mon=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]}),Ron=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Non=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)&&Mon(e,t,r);return Ron(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.GenerateStreamText=void 0;var W9=Non(J()),jon=V9();YS.GenerateStreamText=W9.serialization.object({text:W9.serialization.string(),index:W9.serialization.number().optional(),isFinished:W9.serialization.property("is_finished",W9.serialization.boolean())}).extend(jon.GenerateStreamEvent)});var lLe=x(XS=>{"use strict";var Don=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]}),Lon=XS&&XS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fon=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)&&Don(e,t,r);return Lon(e,t),e};Object.defineProperty(XS,"__esModule",{value:!0});XS.SingleGenerationInStream=void 0;var K9=Fon(J()),kon=Hq();XS.SingleGenerationInStream=K9.serialization.object({id:K9.serialization.string(),text:K9.serialization.string(),index:K9.serialization.number().optional(),finishReason:K9.serialization.property("finish_reason",kon.FinishReason)})});var cLe=x(QS=>{"use strict";var $on=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]}),Bon=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)&&$on(e,t,r);return Bon(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.GenerateStreamEndResponse=void 0;var Lue=zon(J()),Uon=lLe();QS.GenerateStreamEndResponse=Lue.serialization.object({id:Lue.serialization.string(),prompt:Lue.serialization.string().optional(),generations:Lue.serialization.list(Uon.SingleGenerationInStream).optional()})});var dLe=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]}),Hon=eC&&eC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Von=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 Hon(e,t),e};Object.defineProperty(eC,"__esModule",{value:!0});eC.GenerateStreamEnd=void 0;var Fue=Von(J()),Won=Hq(),Kon=cLe(),Gon=V9();eC.GenerateStreamEnd=Fue.serialization.object({isFinished:Fue.serialization.property("is_finished",Fue.serialization.boolean()),finishReason:Fue.serialization.property("finish_reason",Won.FinishReason.optional()),response:Kon.GenerateStreamEndResponse}).extend(Gon.GenerateStreamEvent)});var fLe=x(tC=>{"use strict";var Jon=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]}),Zon=tC&&tC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yon=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)&&Jon(e,t,r);return Zon(e,t),e};Object.defineProperty(tC,"__esModule",{value:!0});tC.GenerateStreamError=void 0;var Vq=Yon(J()),Xon=Hq(),Qon=V9();tC.GenerateStreamError=Vq.serialization.object({index:Vq.serialization.number().optional(),isFinished:Vq.serialization.property("is_finished",Vq.serialization.boolean()),finishReason:Vq.serialization.property("finish_reason",Xon.FinishReason),err:Vq.serialization.string()}).extend(Qon.GenerateStreamEvent)});var Hkt=x(rC=>{"use strict";var ein=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]}),tin=rC&&rC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rin=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)&&ein(e,t,r);return tin(e,t),e};Object.defineProperty(rC,"__esModule",{value:!0});rC.GenerateStreamedResponse=void 0;var qkt=rin(J()),nin=uLe(),oin=dLe(),iin=fLe();rC.GenerateStreamedResponse=qkt.serialization.union(qkt.serialization.discriminant("eventType","event_type"),{"text-generation":nin.GenerateStreamText,"stream-end":oin.GenerateStreamEnd,"stream-error":iin.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var pLe=x(nC=>{"use strict";var ain=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]}),sin=nC&&nC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uin=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)&&ain(e,t,r);return sin(e,t),e};Object.defineProperty(nC,"__esModule",{value:!0});nC.EmbedJobStatus=void 0;var lin=uin(J());nC.EmbedJobStatus=lin.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var mLe=x(oC=>{"use strict";var cin=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]}),din=oC&&oC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fin=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)&&cin(e,t,r);return din(e,t),e};Object.defineProperty(oC,"__esModule",{value:!0});oC.EmbedJobTruncate=void 0;var pin=fin(J());oC.EmbedJobTruncate=pin.serialization.enum_(["START","END"])});var hLe=x(iC=>{"use strict";var min=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]}),hin=iC&&iC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gin=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)&&min(e,t,r);return hin(e,t),e};Object.defineProperty(iC,"__esModule",{value:!0});iC.EmbedJob=void 0;var o_=gin(J()),yin=pLe(),bin=mLe(),_in=eg();iC.EmbedJob=o_.serialization.object({jobId:o_.serialization.property("job_id",o_.serialization.string()),name:o_.serialization.string().optional(),status:yin.EmbedJobStatus,createdAt:o_.serialization.property("created_at",o_.serialization.date()),inputDatasetId:o_.serialization.property("input_dataset_id",o_.serialization.string()),outputDatasetId:o_.serialization.property("output_dataset_id",o_.serialization.string().optional()),model:o_.serialization.string(),truncate:bin.EmbedJobTruncate,meta:_in.ApiMeta.optional()})});var Vkt=x(aC=>{"use strict";var vin=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]}),win=aC&&aC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xin=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)&&vin(e,t,r);return win(e,t),e};Object.defineProperty(aC,"__esModule",{value:!0});aC.ListEmbedJobResponse=void 0;var gLe=xin(J()),Sin=hLe();aC.ListEmbedJobResponse=gLe.serialization.object({embedJobs:gLe.serialization.property("embed_jobs",gLe.serialization.list(Sin.EmbedJob).optional())})});var Wkt=x(sC=>{"use strict";var Cin=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]}),Oin=sC&&sC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ein=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)&&Cin(e,t,r);return Oin(e,t),e};Object.defineProperty(sC,"__esModule",{value:!0});sC.CreateEmbedJobResponse=void 0;var yLe=Ein(J()),Pin=eg();sC.CreateEmbedJobResponse=yLe.serialization.object({jobId:yLe.serialization.property("job_id",yLe.serialization.string()),meta:Pin.ApiMeta.optional()})});var _Le=x(uC=>{"use strict";var Tin=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]}),Ain=uC&&uC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iin=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)&&Tin(e,t,r);return Ain(e,t),e};Object.defineProperty(uC,"__esModule",{value:!0});uC.ClassifyExample=void 0;var bLe=Iin(J());uC.ClassifyExample=bLe.serialization.object({text:bLe.serialization.string().optional(),label:bLe.serialization.string().optional()})});var Kkt=x(lC=>{"use strict";var Min=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]}),Rin=lC&&lC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nin=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)&&Min(e,t,r);return Rin(e,t),e};Object.defineProperty(lC,"__esModule",{value:!0});lC.ParseInfo=void 0;var vLe=Nin(J());lC.ParseInfo=vLe.serialization.object({separator:vLe.serialization.string().optional(),delimiter:vLe.serialization.string().optional()})});var Gkt=x(cC=>{"use strict";var jin=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]}),Din=cC&&cC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lin=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)&&jin(e,t,r);return Din(e,t),e};Object.defineProperty(cC,"__esModule",{value:!0});cC.RerankerDataMetrics=void 0;var tg=Lin(J());cC.RerankerDataMetrics=tg.serialization.object({numTrainQueries:tg.serialization.property("num_train_queries",tg.serialization.number().optional()),numTrainRelevantPassages:tg.serialization.property("num_train_relevant_passages",tg.serialization.number().optional()),numTrainHardNegatives:tg.serialization.property("num_train_hard_negatives",tg.serialization.number().optional()),numEvalQueries:tg.serialization.property("num_eval_queries",tg.serialization.number().optional()),numEvalRelevantPassages:tg.serialization.property("num_eval_relevant_passages",tg.serialization.number().optional()),numEvalHardNegatives:tg.serialization.property("num_eval_hard_negatives",tg.serialization.number().optional())})});var Jkt=x(dC=>{"use strict";var Fin=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]}),kin=dC&&dC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$in=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)&&Fin(e,t,r);return kin(e,t),e};Object.defineProperty(dC,"__esModule",{value:!0});dC.ChatDataMetrics=void 0;var Wq=$in(J());dC.ChatDataMetrics=Wq.serialization.object({numTrainTurns:Wq.serialization.property("num_train_turns",Wq.serialization.number().optional()),numEvalTurns:Wq.serialization.property("num_eval_turns",Wq.serialization.number().optional()),preamble:Wq.serialization.string().optional()})});var wLe=x(fC=>{"use strict";var Bin=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]}),zin=fC&&fC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uin=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)&&Bin(e,t,r);return zin(e,t),e};Object.defineProperty(fC,"__esModule",{value:!0});fC.LabelMetric=void 0;var Kq=Uin(J());fC.LabelMetric=Kq.serialization.object({totalExamples:Kq.serialization.property("total_examples",Kq.serialization.number().optional()),label:Kq.serialization.string().optional(),samples:Kq.serialization.list(Kq.serialization.string()).optional()})});var Zkt=x(pC=>{"use strict";var qin=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]}),Hin=pC&&pC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vin=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)&&qin(e,t,r);return Hin(e,t),e};Object.defineProperty(pC,"__esModule",{value:!0});pC.ClassifyDataMetrics=void 0;var xLe=Vin(J()),Win=wLe();pC.ClassifyDataMetrics=xLe.serialization.object({labelMetrics:xLe.serialization.property("label_metrics",xLe.serialization.list(Win.LabelMetric).optional())})});var SLe=x(mC=>{"use strict";var Kin=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]}),Gin=mC&&mC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jin=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)&&Kin(e,t,r);return Gin(e,t),e};Object.defineProperty(mC,"__esModule",{value:!0});mC.FinetuneDatasetMetrics=void 0;var rg=Jin(J());mC.FinetuneDatasetMetrics=rg.serialization.object({trainableTokenCount:rg.serialization.property("trainable_token_count",rg.serialization.number().optional()),totalExamples:rg.serialization.property("total_examples",rg.serialization.number().optional()),trainExamples:rg.serialization.property("train_examples",rg.serialization.number().optional()),trainSizeBytes:rg.serialization.property("train_size_bytes",rg.serialization.number().optional()),evalExamples:rg.serialization.property("eval_examples",rg.serialization.number().optional()),evalSizeBytes:rg.serialization.property("eval_size_bytes",rg.serialization.number().optional())})});var OLe=x(hC=>{"use strict";var Zin=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]}),Yin=hC&&hC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xin=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)&&Zin(e,t,r);return Yin(e,t),e};Object.defineProperty(hC,"__esModule",{value:!0});hC.MetricsEmbedDataFieldsItem=void 0;var CLe=Xin(J());hC.MetricsEmbedDataFieldsItem=CLe.serialization.object({name:CLe.serialization.string().optional(),count:CLe.serialization.number().optional()})});var ELe=x(gC=>{"use strict";var Qin=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]}),ean=gC&&gC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tan=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)&&Qin(e,t,r);return ean(e,t),e};Object.defineProperty(gC,"__esModule",{value:!0});gC.MetricsEmbedData=void 0;var Ykt=tan(J()),ran=OLe();gC.MetricsEmbedData=Ykt.serialization.object({fields:Ykt.serialization.list(ran.MetricsEmbedDataFieldsItem).optional()})});var Xkt=x(yC=>{"use strict";var nan=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]}),oan=yC&&yC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ian=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)&&nan(e,t,r);return oan(e,t),e};Object.defineProperty(yC,"__esModule",{value:!0});yC.Metrics=void 0;var PLe=ian(J()),aan=SLe(),san=ELe();yC.Metrics=PLe.serialization.object({finetuneDatasetMetrics:PLe.serialization.property("finetune_dataset_metrics",aan.FinetuneDatasetMetrics.optional()),embedData:PLe.serialization.property("embed_data",san.MetricsEmbedData.optional())})});var TLe=x(_C=>{"use strict";var uan=_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]}),lan=_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)&&uan(e,t,r);return lan(e,t),e};Object.defineProperty(_C,"__esModule",{value:!0});_C.ConnectorOAuth=void 0;var bC=can(J());_C.ConnectorOAuth=bC.serialization.object({clientId:bC.serialization.property("client_id",bC.serialization.string().optional()),clientSecret:bC.serialization.property("client_secret",bC.serialization.string().optional()),authorizeUrl:bC.serialization.property("authorize_url",bC.serialization.string()),tokenUrl:bC.serialization.property("token_url",bC.serialization.string()),scope:bC.serialization.string().optional()})});var ALe=x(vC=>{"use strict";var dan=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]}),fan=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)&&dan(e,t,r);return fan(e,t),e};Object.defineProperty(vC,"__esModule",{value:!0});vC.ConnectorAuthStatus=void 0;var man=pan(J());vC.ConnectorAuthStatus=man.serialization.enum_(["valid","expired"])});var Gq=x(wC=>{"use strict";var han=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]}),gan=wC&&wC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yan=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)&&han(e,t,r);return gan(e,t),e};Object.defineProperty(wC,"__esModule",{value:!0});wC.Connector=void 0;var mc=yan(J()),ban=TLe(),_an=ALe();wC.Connector=mc.serialization.object({id:mc.serialization.string(),organizationId:mc.serialization.property("organization_id",mc.serialization.string().optional()),name:mc.serialization.string(),description:mc.serialization.string().optional(),url:mc.serialization.string().optional(),createdAt:mc.serialization.property("created_at",mc.serialization.date()),updatedAt:mc.serialization.property("updated_at",mc.serialization.date()),excludes:mc.serialization.list(mc.serialization.string()).optional(),authType:mc.serialization.property("auth_type",mc.serialization.string().optional()),oauth:ban.ConnectorOAuth.optional(),authStatus:mc.serialization.property("auth_status",_an.ConnectorAuthStatus.optional()),active:mc.serialization.boolean().optional(),continueOnFailure:mc.serialization.property("continue_on_failure",mc.serialization.boolean().optional())})});var Qkt=x(xC=>{"use strict";var van=xC&&xC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wan=xC&&xC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xan=xC&&xC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&van(e,t,r);return wan(e,t),e};Object.defineProperty(xC,"__esModule",{value:!0});xC.ListConnectorsResponse=void 0;var kue=xan(J()),San=Gq();xC.ListConnectorsResponse=kue.serialization.object({connectors:kue.serialization.list(San.Connector),totalCount:kue.serialization.property("total_count",kue.serialization.number().optional())})});var e$t=x(SC=>{"use strict";var Can=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]}),Oan=SC&&SC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ean=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)&&Can(e,t,r);return Oan(e,t),e};Object.defineProperty(SC,"__esModule",{value:!0});SC.CreateConnectorResponse=void 0;var Pan=Ean(J()),Tan=Gq();SC.CreateConnectorResponse=Pan.serialization.object({connector:Tan.Connector})});var t$t=x(CC=>{"use strict";var Aan=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]}),Ian=CC&&CC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Man=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)&&Aan(e,t,r);return Ian(e,t),e};Object.defineProperty(CC,"__esModule",{value:!0});CC.GetConnectorResponse=void 0;var Ran=Man(J()),Nan=Gq();CC.GetConnectorResponse=Ran.serialization.object({connector:Nan.Connector})});var r$t=x(OC=>{"use strict";var jan=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]}),Dan=OC&&OC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lan=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)&&jan(e,t,r);return Dan(e,t),e};Object.defineProperty(OC,"__esModule",{value:!0});OC.DeleteConnectorResponse=void 0;var ILe=Lan(J());OC.DeleteConnectorResponse=ILe.serialization.record(ILe.serialization.string(),ILe.serialization.unknown())});var n$t=x(EC=>{"use strict";var Fan=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}),$an=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)&&Fan(e,t,r);return kan(e,t),e};Object.defineProperty(EC,"__esModule",{value:!0});EC.UpdateConnectorResponse=void 0;var Ban=$an(J()),zan=Gq();EC.UpdateConnectorResponse=Ban.serialization.object({connector:zan.Connector})});var o$t=x(PC=>{"use strict";var Uan=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]}),qan=PC&&PC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Han=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)&&Uan(e,t,r);return qan(e,t),e};Object.defineProperty(PC,"__esModule",{value:!0});PC.OAuthAuthorizeResponse=void 0;var MLe=Han(J());PC.OAuthAuthorizeResponse=MLe.serialization.object({redirectUrl:MLe.serialization.property("redirect_url",MLe.serialization.string().optional())})});var RLe=x(TC=>{"use strict";var Van=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]}),Wan=TC&&TC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kan=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)&&Van(e,t,r);return Wan(e,t),e};Object.defineProperty(TC,"__esModule",{value:!0});TC.CompatibleEndpoint=void 0;var Gan=Kan(J());TC.CompatibleEndpoint=Gan.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var NLe=x(IC=>{"use strict";var Jan=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]}),Zan=IC&&IC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yan=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)&&Jan(e,t,r);return Zan(e,t),e};Object.defineProperty(IC,"__esModule",{value:!0});IC.GetModelResponse=void 0;var AC=Yan(J()),i$t=RLe();IC.GetModelResponse=AC.serialization.object({name:AC.serialization.string().optional(),endpoints:AC.serialization.list(i$t.CompatibleEndpoint).optional(),finetuned:AC.serialization.boolean().optional(),contextLength:AC.serialization.property("context_length",AC.serialization.number().optional()),tokenizerUrl:AC.serialization.property("tokenizer_url",AC.serialization.string().optional()),defaultEndpoints:AC.serialization.property("default_endpoints",AC.serialization.list(i$t.CompatibleEndpoint).optional())})});var a$t=x(MC=>{"use strict";var Xan=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]}),Qan=MC&&MC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),esn=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)&&Xan(e,t,r);return Qan(e,t),e};Object.defineProperty(MC,"__esModule",{value:!0});MC.ListModelsResponse=void 0;var $ue=esn(J()),tsn=NLe();MC.ListModelsResponse=$ue.serialization.object({models:$ue.serialization.list(tsn.GetModelResponse),nextPageToken:$ue.serialization.property("next_page_token",$ue.serialization.string().optional())})});var s$t=x(ve=>{"use strict";var rsn=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)&&rsn(e,t,r)};Object.defineProperty(ve,"__esModule",{value:!0});Ee(sDe(),ve);Ee(uDe(),ve);Ee(ckt(),ve);Ee(lDe(),ve);Ee(fkt(),ve);Ee(mkt(),ve);Ee(gkt(),ve);Ee(bkt(),ve);Ee(vkt(),ve);Ee(cDe(),ve);Ee(dDe(),ve);Ee(xkt(),ve);Ee(fDe(),ve);Ee(pDe(),ve);Ee(mDe(),ve);Ee(hDe(),ve);Ee(gDe(),ve);Ee(yDe(),ve);Ee(Ckt(),ve);Ee(EDe(),ve);Ee(PDe(),ve);Ee(TDe(),ve);Ee(Pkt(),ve);Ee(IDe(),ve);Ee(MDe(),ve);Ee(RDe(),ve);Ee(NDe(),ve);Ee(Akt(),ve);Ee(DDe(),ve);Ee(LDe(),ve);Ee(FDe(),ve);Ee(Ikt(),ve);Ee(Mkt(),ve);Ee(Nkt(),ve);Ee(jkt(),ve);Ee(Uq(),ve);Ee($De(),ve);Ee(z9(),ve);Ee(zDe(),ve);Ee(U9(),ve);Ee(Oue(),ve);Ee(aL(),ve);Ee(qDe(),ve);Ee(Pue(),ve);Ee(due(),ve);Ee(HDe(),ve);Ee(Aue(),ve);Ee(Iue(),ve);Ee(q9(),ve);Ee(VDe(),ve);Ee(Rue(),ve);Ee(Hq(),ve);Ee(bDe(),ve);Ee(_De(),ve);Ee(vDe(),ve);Ee(eg(),ve);Ee(WDe(),ve);Ee(DS(),ve);Ee(GDe(),ve);Ee(ZDe(),ve);Ee(YDe(),ve);Ee(XDe(),ve);Ee(QDe(),ve);Ee(eLe(),ve);Ee(tLe(),ve);Ee(rLe(),ve);Ee(nLe(),ve);Ee(oLe(),ve);Ee(zkt(),ve);Ee(kje(),ve);Ee(fue(),ve);Ee(Nje(),ve);Ee(jje(),ve);Ee(Dje(),ve);Ee(Lje(),ve);Ee(aLe(),ve);Ee(sLe(),ve);Ee(Ukt(),ve);Ee(V9(),ve);Ee(uLe(),ve);Ee(lLe(),ve);Ee(cLe(),ve);Ee(dLe(),ve);Ee(fLe(),ve);Ee(Hkt(),ve);Ee(pue(),ve);Ee(mue(),ve);Ee(wDe(),ve);Ee(xDe(),ve);Ee(SDe(),ve);Ee(pLe(),ve);Ee(mLe(),ve);Ee(hLe(),ve);Ee(Vkt(),ve);Ee(Wkt(),ve);Ee(ODe(),ve);Ee(_Le(),ve);Ee(Hje(),ve);Ee(qje(),ve);Ee(Vje(),ve);Ee(Kkt(),ve);Ee(Gkt(),ve);Ee(Jkt(),ve);Ee(wLe(),ve);Ee(Zkt(),ve);Ee(SLe(),ve);Ee(OLe(),ve);Ee(ELe(),ve);Ee(Xkt(),ve);Ee(gue(),ve);Ee(TLe(),ve);Ee(ALe(),ve);Ee(Gq(),ve);Ee(Qkt(),ve);Ee(vue(),ve);Ee(iDe(),ve);Ee(wue(),ve);Ee(e$t(),ve);Ee(t$t(),ve);Ee(r$t(),ve);Ee(n$t(),ve);Ee(o$t(),ve);Ee(RLe(),ve);Ee(NLe(),ve);Ee(a$t(),ve)});var u$t=x(RC=>{"use strict";var nsn=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]}),osn=RC&&RC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),isn=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)&&nsn(e,t,r);return osn(e,t),e};Object.defineProperty(RC,"__esModule",{value:!0});RC.ChatStreamRequest=void 0;var Nn=isn(J()),asn=U9(),ssn=sDe(),usn=Oue(),lsn=aL(),csn=uDe(),dsn=Pue(),fsn=z9(),psn=Aue(),msn=lDe();RC.ChatStreamRequest=Nn.serialization.object({message:Nn.serialization.string(),model:Nn.serialization.string().optional(),preamble:Nn.serialization.string().optional(),chatHistory:Nn.serialization.property("chat_history",Nn.serialization.list(asn.Message).optional()),conversationId:Nn.serialization.property("conversation_id",Nn.serialization.string().optional()),promptTruncation:Nn.serialization.property("prompt_truncation",ssn.ChatStreamRequestPromptTruncation.optional()),connectors:Nn.serialization.list(usn.ChatConnector).optional(),searchQueriesOnly:Nn.serialization.property("search_queries_only",Nn.serialization.boolean().optional()),documents:Nn.serialization.list(lsn.ChatDocument).optional(),citationQuality:Nn.serialization.property("citation_quality",csn.ChatStreamRequestCitationQuality.optional()),temperature:Nn.serialization.number().optional(),maxTokens:Nn.serialization.property("max_tokens",Nn.serialization.number().optional()),maxInputTokens:Nn.serialization.property("max_input_tokens",Nn.serialization.number().optional()),k:Nn.serialization.number().optional(),p:Nn.serialization.number().optional(),seed:Nn.serialization.number().optional(),stopSequences:Nn.serialization.property("stop_sequences",Nn.serialization.list(Nn.serialization.string()).optional()),frequencyPenalty:Nn.serialization.property("frequency_penalty",Nn.serialization.number().optional()),presencePenalty:Nn.serialization.property("presence_penalty",Nn.serialization.number().optional()),rawPrompting:Nn.serialization.property("raw_prompting",Nn.serialization.boolean().optional()),returnPrompt:Nn.serialization.property("return_prompt",Nn.serialization.boolean().optional()),tools:Nn.serialization.list(dsn.Tool).optional(),toolResults:Nn.serialization.property("tool_results",Nn.serialization.list(fsn.ToolResult).optional()),forceSingleStep:Nn.serialization.property("force_single_step",Nn.serialization.boolean().optional()),responseFormat:Nn.serialization.property("response_format",psn.ResponseFormat.optional()),safetyMode:Nn.serialization.property("safety_mode",msn.ChatStreamRequestSafetyMode.optional())})});var l$t=x(NC=>{"use strict";var hsn=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]}),gsn=NC&&NC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ysn=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)&&hsn(e,t,r);return gsn(e,t),e};Object.defineProperty(NC,"__esModule",{value:!0});NC.ChatRequest=void 0;var jn=ysn(J()),bsn=U9(),_sn=cDe(),vsn=Oue(),wsn=aL(),xsn=dDe(),Ssn=Pue(),Csn=z9(),Osn=Aue(),Esn=fDe();NC.ChatRequest=jn.serialization.object({message:jn.serialization.string(),model:jn.serialization.string().optional(),preamble:jn.serialization.string().optional(),chatHistory:jn.serialization.property("chat_history",jn.serialization.list(bsn.Message).optional()),conversationId:jn.serialization.property("conversation_id",jn.serialization.string().optional()),promptTruncation:jn.serialization.property("prompt_truncation",_sn.ChatRequestPromptTruncation.optional()),connectors:jn.serialization.list(vsn.ChatConnector).optional(),searchQueriesOnly:jn.serialization.property("search_queries_only",jn.serialization.boolean().optional()),documents:jn.serialization.list(wsn.ChatDocument).optional(),citationQuality:jn.serialization.property("citation_quality",xsn.ChatRequestCitationQuality.optional()),temperature:jn.serialization.number().optional(),maxTokens:jn.serialization.property("max_tokens",jn.serialization.number().optional()),maxInputTokens:jn.serialization.property("max_input_tokens",jn.serialization.number().optional()),k:jn.serialization.number().optional(),p:jn.serialization.number().optional(),seed:jn.serialization.number().optional(),stopSequences:jn.serialization.property("stop_sequences",jn.serialization.list(jn.serialization.string()).optional()),frequencyPenalty:jn.serialization.property("frequency_penalty",jn.serialization.number().optional()),presencePenalty:jn.serialization.property("presence_penalty",jn.serialization.number().optional()),rawPrompting:jn.serialization.property("raw_prompting",jn.serialization.boolean().optional()),returnPrompt:jn.serialization.property("return_prompt",jn.serialization.boolean().optional()),tools:jn.serialization.list(Ssn.Tool).optional(),toolResults:jn.serialization.property("tool_results",jn.serialization.list(Csn.ToolResult).optional()),forceSingleStep:jn.serialization.property("force_single_step",jn.serialization.boolean().optional()),responseFormat:jn.serialization.property("response_format",Osn.ResponseFormat.optional()),safetyMode:jn.serialization.property("safety_mode",Esn.ChatRequestSafetyMode.optional())})});var c$t=x(jC=>{"use strict";var Psn=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]}),Tsn=jC&&jC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Asn=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)&&Psn(e,t,r);return Tsn(e,t),e};Object.defineProperty(jC,"__esModule",{value:!0});jC.GenerateStreamRequest=void 0;var Pa=Asn(J()),Isn=pDe(),Msn=mDe();jC.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:Isn.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",Msn.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Pa.serialization.property("raw_prompting",Pa.serialization.boolean().optional())})});var d$t=x(DC=>{"use strict";var Rsn=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]}),Nsn=DC&&DC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jsn=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)&&Rsn(e,t,r);return Nsn(e,t),e};Object.defineProperty(DC,"__esModule",{value:!0});DC.GenerateRequest=void 0;var Ta=jsn(J()),Dsn=hDe(),Lsn=gDe();DC.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:Dsn.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",Lsn.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Ta.serialization.property("raw_prompting",Ta.serialization.boolean().optional())})});var f$t=x(LC=>{"use strict";var Fsn=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]}),ksn=LC&&LC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$sn=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)&&Fsn(e,t,r);return ksn(e,t),e};Object.defineProperty(LC,"__esModule",{value:!0});LC.EmbedRequest=void 0;var _L=$sn(J()),Bsn=pue(),zsn=mue(),Usn=yDe();LC.EmbedRequest=_L.serialization.object({texts:_L.serialization.list(_L.serialization.string()),model:_L.serialization.string().optional(),inputType:_L.serialization.property("input_type",Bsn.EmbedInputType.optional()),embeddingTypes:_L.serialization.property("embedding_types",_L.serialization.list(zsn.EmbeddingType).optional()),truncate:Usn.EmbedRequestTruncate.optional()})});var p$t=x(FC=>{"use strict";var qsn=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]}),Hsn=FC&&FC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vsn=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)&&qsn(e,t,r);return Hsn(e,t),e};Object.defineProperty(FC,"__esModule",{value:!0});FC.RerankRequest=void 0;var ng=Vsn(J()),Wsn=EDe();FC.RerankRequest=ng.serialization.object({model:ng.serialization.string().optional(),query:ng.serialization.string(),documents:ng.serialization.list(Wsn.RerankRequestDocumentsItem),topN:ng.serialization.property("top_n",ng.serialization.number().optional()),rankFields:ng.serialization.property("rank_fields",ng.serialization.list(ng.serialization.string()).optional()),returnDocuments:ng.serialization.property("return_documents",ng.serialization.boolean().optional()),maxChunksPerDoc:ng.serialization.property("max_chunks_per_doc",ng.serialization.number().optional())})});var m$t=x(kC=>{"use strict";var Ksn=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]}),Gsn=kC&&kC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jsn=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)&&Ksn(e,t,r);return Gsn(e,t),e};Object.defineProperty(kC,"__esModule",{value:!0});kC.ClassifyRequest=void 0;var Jq=Jsn(J()),Zsn=_Le(),Ysn=IDe();kC.ClassifyRequest=Jq.serialization.object({inputs:Jq.serialization.list(Jq.serialization.string()),examples:Jq.serialization.list(Zsn.ClassifyExample).optional(),model:Jq.serialization.string().optional(),preset:Jq.serialization.string().optional(),truncate:Ysn.ClassifyRequestTruncate.optional()})});var h$t=x($C=>{"use strict";var Xsn=$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]}),Qsn=$C&&$C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eun=$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)&&Xsn(e,t,r);return Qsn(e,t),e};Object.defineProperty($C,"__esModule",{value:!0});$C.SummarizeRequest=void 0;var Zq=eun(J()),tun=DDe(),run=LDe(),nun=FDe();$C.SummarizeRequest=Zq.serialization.object({text:Zq.serialization.string(),length:tun.SummarizeRequestLength.optional(),format:run.SummarizeRequestFormat.optional(),model:Zq.serialization.string().optional(),extractiveness:nun.SummarizeRequestExtractiveness.optional(),temperature:Zq.serialization.number().optional(),additionalCommand:Zq.serialization.property("additional_command",Zq.serialization.string().optional())})});var g$t=x(BC=>{"use strict";var oun=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]}),iun=BC&&BC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aun=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)&&oun(e,t,r);return iun(e,t),e};Object.defineProperty(BC,"__esModule",{value:!0});BC.TokenizeRequest=void 0;var jLe=aun(J());BC.TokenizeRequest=jLe.serialization.object({text:jLe.serialization.string(),model:jLe.serialization.string()})});var y$t=x(zC=>{"use strict";var sun=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]}),uun=zC&&zC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lun=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)&&sun(e,t,r);return uun(e,t),e};Object.defineProperty(zC,"__esModule",{value:!0});zC.DetokenizeRequest=void 0;var Bue=lun(J());zC.DetokenizeRequest=Bue.serialization.object({tokens:Bue.serialization.list(Bue.serialization.number()),model:Bue.serialization.string()})});var b$t=x(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.DetokenizeRequest=Ls.TokenizeRequest=Ls.SummarizeRequest=Ls.ClassifyRequest=Ls.RerankRequest=Ls.EmbedRequest=Ls.GenerateRequest=Ls.GenerateStreamRequest=Ls.ChatRequest=Ls.ChatStreamRequest=void 0;var cun=u$t();Object.defineProperty(Ls,"ChatStreamRequest",{enumerable:!0,get:function(){return cun.ChatStreamRequest}});var dun=l$t();Object.defineProperty(Ls,"ChatRequest",{enumerable:!0,get:function(){return dun.ChatRequest}});var fun=c$t();Object.defineProperty(Ls,"GenerateStreamRequest",{enumerable:!0,get:function(){return fun.GenerateStreamRequest}});var pun=d$t();Object.defineProperty(Ls,"GenerateRequest",{enumerable:!0,get:function(){return pun.GenerateRequest}});var mun=f$t();Object.defineProperty(Ls,"EmbedRequest",{enumerable:!0,get:function(){return mun.EmbedRequest}});var hun=p$t();Object.defineProperty(Ls,"RerankRequest",{enumerable:!0,get:function(){return hun.RerankRequest}});var gun=m$t();Object.defineProperty(Ls,"ClassifyRequest",{enumerable:!0,get:function(){return gun.ClassifyRequest}});var yun=h$t();Object.defineProperty(Ls,"SummarizeRequest",{enumerable:!0,get:function(){return yun.SummarizeRequest}});var bun=g$t();Object.defineProperty(Ls,"TokenizeRequest",{enumerable:!0,get:function(){return bun.TokenizeRequest}});var _un=y$t();Object.defineProperty(Ls,"DetokenizeRequest",{enumerable:!0,get:function(){return _un.DetokenizeRequest}})});var _$t=x(vL=>{"use strict";var vun=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]}),wun=vL&&vL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vun(e,t,r)};Object.defineProperty(vL,"__esModule",{value:!0});wun(b$t(),vL)});var xP=x(wP=>{"use strict";var xun=wP&&wP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DLe=wP&&wP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xun(e,t,r)};Object.defineProperty(wP,"__esModule",{value:!0});DLe(ukt(),wP);DLe(s$t(),wP);DLe(_$t(),wP)});var LLe=x(xi=>{"use strict";var Sun=xi&&xi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=xi&&xi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oun=xi&&xi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sun(e,t,r);return Cun(e,t),e},zue=xi&&xi.__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())})},Eun=xi&&xi.__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(xi,"__esModule",{value:!0});xi.fetchOverride=xi.parseAWSEvent=xi.getEndpointFromUrl=xi.getAuthHeaders=xi.getUrl=xi.mapResponseFromBedrock=void 0;var Pun=xPe(),Tun=(dPt(),Nc(cPt)),Aun=yAt(),Iun=RIt(),Mun=e9(),Run=J(),Nun=Y1e(),jun=ZLt(),G9=Oun(xP()),Dun=(t,e)=>zue(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),Lun={chat:G9.StreamedChatResponse,generate:G9.GenerateStreamedResponse},Fun={chat:G9.NonStreamedChatResponse,embed:G9.EmbedResponse,generate:G9.Generation},kun=(t,e,r)=>zue(void 0,void 0,void 0,function*(){let n=t?Lun[e]:Fun[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});xi.mapResponseFromBedrock=kun;var $un=(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]};xi.getUrl=$un;var zun=(t,e,r,n,o,i)=>zue(void 0,void 0,void 0,function*(){let a=(0,Tun.fromNodeProviderChain)(),s=yield Dun(()=>{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 Iun.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:Pun.Sha256});delete r.connection,r.host=t.hostname;let l=new Aun.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});xi.getAuthHeaders=zun;var Uun=(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}`)};xi.getEndpointFromUrl=Uun;var qun=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}}};xi.parseAWSEvent=qun;var Hun=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>zue(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,xi.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,xi.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,Run.fetcher)(i);if(!p.ok)return p;try{if(c){let g=(0,Nun.readableStreamAsyncIterable)(p.body),y=new jun.LineDecoder,_=new Mun.PassThrough;try{for(var h=Eun(g),m;m=yield h.next(),!m.done;){let w=m.value;for(let S of y.decode(w)){let C=(0,xi.parseAWSEvent)(S);if(C){let E=yield(0,xi.mapResponseFromBedrock)(c,u,C);_.push(JSON.stringify(E)+`
`)}}}}catch(w){a={error:w}}finally{try{m&&!m.done&&(s=h.return)&&(yield s.call(h))}finally{if(a)throw a.error}}for(let w of y.flush()){let S=(0,xi.parseAWSEvent)(w);if(S){let C=yield(0,xi.mapResponseFromBedrock)(c,u,S);_.push(JSON.stringify(C)+`
`)}}return _.end(),{ok:!0,body:_}}else{let g=yield p.body;return{ok:!0,body:yield(0,xi.mapResponseFromBedrock)(c,u,g)}}}catch(g){throw g}});xi.fetchOverride=Hun});var SP=x(Uue=>{"use strict";Object.defineProperty(Uue,"__esModule",{value:!0});Uue.CohereEnvironment=void 0;Uue.CohereEnvironment={Production:"https://api.cohere.com"}});var kM=x((v$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",v$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 kLe=x(Vm=>{"use strict";var Vun=Vm&&Vm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wun=Vm&&Vm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J9=Vm&&Vm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vun(e,t,r);return Wun(e,t),e},Hue=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())})},Kun=Vm&&Vm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vm,"__esModule",{value:!0});Vm.V2=void 0;var w$t=J9(SP()),qm=J9(J()),Fs=J9(KE()),Hm=J9(xP()),x$t=Kun(kM()),CP=J9(ou()),FLe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Hue(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qm.fetcher)({url:(0,x$t.default)((o=yield qm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:w$t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qm.Supplier.get(this._options.clientName))!=null?yield qm.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":qm.RUNTIME.type,"X-Fern-Runtime-Version":qm.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Hm.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 qm.Stream({stream:i.body,parse:a=>Hue(this,void 0,void 0,function*(){return Hm.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 Fs.BadRequestError(i.error.body);case 401:throw new Fs.UnauthorizedError(i.error.body);case 403:throw new Fs.ForbiddenError(i.error.body);case 404:throw new Fs.NotFoundError(i.error.body);case 422:throw new Fs.UnprocessableEntityError(Hm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Fs.TooManyRequestsError(Hm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Fs.ClientClosedRequestError(Hm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Fs.InternalServerError(i.error.body);case 501:throw new Fs.NotImplementedError(Hm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Fs.ServiceUnavailableError(i.error.body);case 504:throw new Fs.GatewayTimeoutError(Hm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new CP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new CP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new CP.CohereTimeoutError;case"unknown":throw new CP.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Hue(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qm.fetcher)({url:(0,x$t.default)((o=yield qm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:w$t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qm.Supplier.get(this._options.clientName))!=null?yield qm.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":qm.RUNTIME.type,"X-Fern-Runtime-Version":qm.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Hm.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 Hm.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 Fs.BadRequestError(i.error.body);case 401:throw new Fs.UnauthorizedError(i.error.body);case 403:throw new Fs.ForbiddenError(i.error.body);case 404:throw new Fs.NotFoundError(i.error.body);case 422:throw new Fs.UnprocessableEntityError(Hm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Fs.TooManyRequestsError(Hm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Fs.ClientClosedRequestError(Hm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Fs.InternalServerError(i.error.body);case 501:throw new Fs.NotImplementedError(Hm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Fs.ServiceUnavailableError(i.error.body);case 504:throw new Fs.GatewayTimeoutError(Hm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new CP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new CP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new CP.CohereTimeoutError;case"unknown":throw new CP.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Hue(this,void 0,void 0,function*(){let r=(e=yield qm.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new CP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Vm.V2=FLe});var S$t=x(Wm=>{"use strict";var Gun=Wm&&Wm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Wm&&Wm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y9=Wm&&Wm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gun(e,t,r);return Jun(e,t),e},Z9=Wm&&Wm.__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())})},Zun=Wm&&Wm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wm,"__esModule",{value:!0});Wm.EmbedJobs=void 0;var Vue=Y9(SP()),Aa=Y9(J()),nn=Y9(KE()),Wue=Zun(kM()),Wa=Y9(xP()),kd=Y9(ou()),$Le=class{constructor(e={}){this._options=e}list(e){var r,n;return Z9(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Aa.fetcher)({url:(0,Wue.default)((n=yield Aa.Supplier.get(this._options.environment))!==null&&n!==void 0?n:Vue.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 Wa.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 nn.BadRequestError(o.error.body);case 401:throw new nn.UnauthorizedError(o.error.body);case 403:throw new nn.ForbiddenError(o.error.body);case 404:throw new nn.NotFoundError(o.error.body);case 422:throw new nn.UnprocessableEntityError(Wa.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new nn.TooManyRequestsError(Wa.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new nn.ClientClosedRequestError(Wa.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new nn.InternalServerError(o.error.body);case 501:throw new nn.NotImplementedError(Wa.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new nn.ServiceUnavailableError(o.error.body);case 504:throw new nn.GatewayTimeoutError(Wa.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 Z9(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Aa.fetcher)({url:(0,Wue.default)((o=yield Aa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Vue.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:Wa.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 Wa.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 nn.BadRequestError(i.error.body);case 401:throw new nn.UnauthorizedError(i.error.body);case 403:throw new nn.ForbiddenError(i.error.body);case 404:throw new nn.NotFoundError(i.error.body);case 422:throw new nn.UnprocessableEntityError(Wa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new nn.TooManyRequestsError(Wa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new nn.ClientClosedRequestError(Wa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new nn.InternalServerError(i.error.body);case 501:throw new nn.NotImplementedError(Wa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new nn.ServiceUnavailableError(i.error.body);case 504:throw new nn.GatewayTimeoutError(Wa.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 Z9(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Aa.fetcher)({url:(0,Wue.default)((o=yield Aa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Vue.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 Wa.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 nn.BadRequestError(i.error.body);case 401:throw new nn.UnauthorizedError(i.error.body);case 403:throw new nn.ForbiddenError(i.error.body);case 404:throw new nn.NotFoundError(i.error.body);case 422:throw new nn.UnprocessableEntityError(Wa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new nn.TooManyRequestsError(Wa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new nn.ClientClosedRequestError(Wa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new nn.InternalServerError(i.error.body);case 501:throw new nn.NotImplementedError(Wa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new nn.ServiceUnavailableError(i.error.body);case 504:throw new nn.GatewayTimeoutError(Wa.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 Z9(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Aa.fetcher)({url:(0,Wue.default)((o=yield Aa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Vue.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 nn.BadRequestError(i.error.body);case 401:throw new nn.UnauthorizedError(i.error.body);case 403:throw new nn.ForbiddenError(i.error.body);case 404:throw new nn.NotFoundError(i.error.body);case 422:throw new nn.UnprocessableEntityError(Wa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new nn.TooManyRequestsError(Wa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new nn.ClientClosedRequestError(Wa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new nn.InternalServerError(i.error.body);case 501:throw new nn.NotImplementedError(Wa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new nn.ServiceUnavailableError(i.error.body);case 504:throw new nn.GatewayTimeoutError(Wa.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 Z9(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}`})}};Wm.EmbedJobs=$Le});var C$t=x(Km=>{"use strict";var Yun=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]}),Xun=Km&&Km.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eK=Km&&Km.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yun(e,t,r);return Xun(e,t),e},Yq=Km&&Km.__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=Km&&Km.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Km,"__esModule",{value:!0});Km.Datasets=void 0;var X9=eK(SP()),qo=eK(J()),mr=eK(KE()),Q9=Qun(kM()),Mi=eK(xP()),lu=eK(ou()),BLe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return Yq(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,Q9.default)((o=yield qo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:X9.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 mr.BadRequestError(f.error.body);case 401:throw new mr.UnauthorizedError(f.error.body);case 403:throw new mr.ForbiddenError(f.error.body);case 404:throw new mr.NotFoundError(f.error.body);case 422:throw new mr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mr.InternalServerError(f.error.body);case 501:throw new mr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mr.ServiceUnavailableError(f.error.body);case 504:throw new mr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new lu.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new lu.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new lu.CohereTimeoutError;case"unknown":throw new lu.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return Yq(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,Q9.default)((a=yield qo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:X9.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 mr.BadRequestError(c.error.body);case 401:throw new mr.UnauthorizedError(c.error.body);case 403:throw new mr.ForbiddenError(c.error.body);case 404:throw new mr.NotFoundError(c.error.body);case 422:throw new mr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mr.InternalServerError(c.error.body);case 501:throw new mr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mr.ServiceUnavailableError(c.error.body);case 504:throw new mr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new lu.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new lu.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new lu.CohereTimeoutError;case"unknown":throw new lu.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return Yq(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:qo.fetcher)({url:(0,Q9.default)((n=yield qo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:X9.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 mr.BadRequestError(o.error.body);case 401:throw new mr.UnauthorizedError(o.error.body);case 403:throw new mr.ForbiddenError(o.error.body);case 404:throw new mr.NotFoundError(o.error.body);case 422:throw new mr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mr.InternalServerError(o.error.body);case 501:throw new mr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mr.ServiceUnavailableError(o.error.body);case 504:throw new mr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new lu.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new lu.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new lu.CohereTimeoutError;case"unknown":throw new lu.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return Yq(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qo.fetcher)({url:(0,Q9.default)((o=yield qo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:X9.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 mr.BadRequestError(i.error.body);case 401:throw new mr.UnauthorizedError(i.error.body);case 403:throw new mr.ForbiddenError(i.error.body);case 404:throw new mr.NotFoundError(i.error.body);case 422:throw new mr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mr.InternalServerError(i.error.body);case 501:throw new mr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mr.ServiceUnavailableError(i.error.body);case 504:throw new mr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new lu.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new lu.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new lu.CohereTimeoutError;case"unknown":throw new lu.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return Yq(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qo.fetcher)({url:(0,Q9.default)((o=yield qo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:X9.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 mr.BadRequestError(i.error.body);case 401:throw new mr.UnauthorizedError(i.error.body);case 403:throw new mr.ForbiddenError(i.error.body);case 404:throw new mr.NotFoundError(i.error.body);case 422:throw new mr.UnprocessableEntityError(Mi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mr.TooManyRequestsError(Mi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mr.ClientClosedRequestError(Mi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mr.InternalServerError(i.error.body);case 501:throw new mr.NotImplementedError(Mi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mr.ServiceUnavailableError(i.error.body);case 504:throw new mr.GatewayTimeoutError(Mi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new lu.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new lu.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new lu.CohereTimeoutError;case"unknown":throw new lu.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Yq(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 lu.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Km.Datasets=BLe});var O$t=x(Gm=>{"use strict";var eln=Gm&&Gm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tln=Gm&&Gm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tK=Gm&&Gm.__importStar||function(t){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 tln(e,t),e},wL=Gm&&Gm.__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())})},rln=Gm&&Gm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gm,"__esModule",{value:!0});Gm.Connectors=void 0;var Xq=tK(SP()),Jn=tK(J()),Rt=tK(KE()),Qq=rln(kM()),qn=tK(xP()),Ia=tK(ou()),zLe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return wL(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,Qq.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Xq.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 Rt.BadRequestError(u.error.body);case 401:throw new Rt.UnauthorizedError(u.error.body);case 403:throw new Rt.ForbiddenError(u.error.body);case 404:throw new Rt.NotFoundError(u.error.body);case 422:throw new Rt.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(u.error.body);case 501:throw new Rt.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(u.error.body);case 504:throw new Rt.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 wL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,Qq.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Xq.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.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 wL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,Qq.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Xq.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.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 wL(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jn.fetcher)({url:(0,Qq.default)((o=yield Jn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Xq.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 Rt.BadRequestError(i.error.body);case 401:throw new Rt.UnauthorizedError(i.error.body);case 403:throw new Rt.ForbiddenError(i.error.body);case 404:throw new Rt.NotFoundError(i.error.body);case 422:throw new Rt.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(i.error.body);case 501:throw new Rt.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(i.error.body);case 504:throw new Rt.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 wL(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Jn.fetcher)({url:(0,Qq.default)((i=yield Jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Xq.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 Rt.BadRequestError(a.error.body);case 401:throw new Rt.UnauthorizedError(a.error.body);case 403:throw new Rt.ForbiddenError(a.error.body);case 404:throw new Rt.NotFoundError(a.error.body);case 422:throw new Rt.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(a.error.body);case 501:throw new Rt.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(a.error.body);case 504:throw new Rt.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 wL(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,Qq.default)((i=yield Jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Xq.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 Rt.BadRequestError(u.error.body);case 401:throw new Rt.UnauthorizedError(u.error.body);case 403:throw new Rt.ForbiddenError(u.error.body);case 404:throw new Rt.NotFoundError(u.error.body);case 422:throw new Rt.UnprocessableEntityError(qn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Rt.TooManyRequestsError(qn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Rt.ClientClosedRequestError(qn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Rt.InternalServerError(u.error.body);case 501:throw new Rt.NotImplementedError(qn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Rt.ServiceUnavailableError(u.error.body);case 504:throw new Rt.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 wL(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}`})}};Gm.Connectors=zLe});var T$t=x(Jm=>{"use strict";var nln=Jm&&Jm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oln=Jm&&Jm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rK=Jm&&Jm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nln(e,t,r);return oln(e,t),e},ULe=Jm&&Jm.__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())})},iln=Jm&&Jm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jm,"__esModule",{value:!0});Jm.Models=void 0;var E$t=rK(SP()),og=rK(J()),ks=rK(KE()),P$t=iln(kM()),Ty=rK(xP()),OP=rK(ou()),qLe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return ULe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:og.fetcher)({url:(0,P$t.default)((o=yield og.Supplier.get(this._options.environment))!==null&&o!==void 0?o:E$t.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield og.Supplier.get(this._options.clientName))!=null?yield og.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":og.RUNTIME.type,"X-Fern-Runtime-Version":og.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 Ty.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 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(Ty.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ks.TooManyRequestsError(Ty.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ks.ClientClosedRequestError(Ty.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(Ty.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(Ty.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new OP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new OP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new OP.CohereTimeoutError;case"unknown":throw new OP.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return ULe(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:og.fetcher)({url:(0,P$t.default)((o=yield og.Supplier.get(this._options.environment))!==null&&o!==void 0?o:E$t.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield og.Supplier.get(this._options.clientName))!=null?yield og.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":og.RUNTIME.type,"X-Fern-Runtime-Version":og.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 Ty.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 ks.BadRequestError(c.error.body);case 401:throw new ks.UnauthorizedError(c.error.body);case 403:throw new ks.ForbiddenError(c.error.body);case 404:throw new ks.NotFoundError(c.error.body);case 422:throw new ks.UnprocessableEntityError(Ty.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ks.TooManyRequestsError(Ty.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ks.ClientClosedRequestError(Ty.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ks.InternalServerError(c.error.body);case 501:throw new ks.NotImplementedError(Ty.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ks.ServiceUnavailableError(c.error.body);case 504:throw new ks.GatewayTimeoutError(Ty.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new OP.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new OP.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new OP.CohereTimeoutError;case"unknown":throw new OP.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return ULe(this,void 0,void 0,function*(){let r=(e=yield og.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new OP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Jm.Models=qLe});var A$t=x(Zm=>{"use strict";var aln=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]}),sln=Zm&&Zm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nK=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)&&aln(e,t,r);return sln(e,t),e},$M=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())})},uln=Zm&&Zm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zm,"__esModule",{value:!0});Zm.Finetuning=void 0;var xL=nK(SP()),ln=nK(J()),mn=nK(KE()),SL=uln(kM()),EP=nK(xP()),Bi=nK(ou()),HLe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return $M(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:ln.fetcher)({url:(0,SL.default)((o=yield ln.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xL.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.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 EP.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 mn.BadRequestError(l.error.body);case 401:throw new mn.UnauthorizedError(l.error.body);case 403:throw new mn.ForbiddenError(l.error.body);case 404:throw new mn.NotFoundError(l.error.body);case 500:throw new mn.InternalServerError(l.error.body);case 503:throw new mn.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 $M(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ln.fetcher)({url:(0,SL.default)((o=yield ln.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xL.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.RUNTIME.version},contentType:"application/json",requestType:"json",body:EP.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 EP.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 mn.BadRequestError(i.error.body);case 401:throw new mn.UnauthorizedError(i.error.body);case 403:throw new mn.ForbiddenError(i.error.body);case 404:throw new mn.NotFoundError(i.error.body);case 500:throw new mn.InternalServerError(i.error.body);case 503:throw new mn.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 $M(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ln.fetcher)({url:(0,SL.default)((o=yield ln.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.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 EP.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 mn.BadRequestError(i.error.body);case 401:throw new mn.UnauthorizedError(i.error.body);case 403:throw new mn.ForbiddenError(i.error.body);case 404:throw new mn.NotFoundError(i.error.body);case 500:throw new mn.InternalServerError(i.error.body);case 503:throw new mn.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 $M(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ln.fetcher)({url:(0,SL.default)((o=yield ln.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.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 EP.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 mn.BadRequestError(i.error.body);case 401:throw new mn.UnauthorizedError(i.error.body);case 403:throw new mn.ForbiddenError(i.error.body);case 404:throw new mn.NotFoundError(i.error.body);case 500:throw new mn.InternalServerError(i.error.body);case 503:throw new mn.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 $M(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:ln.fetcher)({url:(0,SL.default)((i=yield ln.Supplier.get(this._options.environment))!==null&&i!==void 0?i:xL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.RUNTIME.version},contentType:"application/json",requestType:"json",body:EP.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 EP.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 mn.BadRequestError(a.error.body);case 401:throw new mn.UnauthorizedError(a.error.body);case 403:throw new mn.ForbiddenError(a.error.body);case 404:throw new mn.NotFoundError(a.error.body);case 500:throw new mn.InternalServerError(a.error.body);case 503:throw new mn.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 $M(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:ln.fetcher)({url:(0,SL.default)((i=yield ln.Supplier.get(this._options.environment))!==null&&i!==void 0?i:xL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.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 EP.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 mn.BadRequestError(c.error.body);case 401:throw new mn.UnauthorizedError(c.error.body);case 403:throw new mn.ForbiddenError(c.error.body);case 404:throw new mn.NotFoundError(c.error.body);case 500:throw new mn.InternalServerError(c.error.body);case 503:throw new mn.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 $M(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:ln.fetcher)({url:(0,SL.default)((i=yield ln.Supplier.get(this._options.environment))!==null&&i!==void 0?i:xL.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ln.Supplier.get(this._options.clientName))!=null?yield ln.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":ln.RUNTIME.type,"X-Fern-Runtime-Version":ln.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 EP.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 mn.BadRequestError(l.error.body);case 401:throw new mn.UnauthorizedError(l.error.body);case 403:throw new mn.ForbiddenError(l.error.body);case 404:throw new mn.NotFoundError(l.error.body);case 500:throw new mn.InternalServerError(l.error.body);case 503:throw new mn.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 $M(this,void 0,void 0,function*(){let r=(e=yield ln.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}`})}};Zm.Finetuning=HLe});var Kue=x(Xm=>{"use strict";var lln=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}),oK=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)&&lln(e,t,r);return cln(e,t),e},Ym=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())})},dln=Xm&&Xm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xm,"__esModule",{value:!0});Xm.CohereClient=void 0;var i_=oK(SP()),Et=oK(J()),Pe=oK(KE()),ct=oK(xP()),a_=dln(kM()),Qr=oK(ou()),fln=kLe(),pln=S$t(),mln=C$t(),hln=O$t(),gln=T$t(),yln=A$t(),VLe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Et.Stream({stream:i.body,parse:a=>Ym(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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Et.Stream({stream:i.body,parse:a=>Ym(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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Ym(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Et.fetcher)({url:(0,a_.default)((o=yield Et.Supplier.get(this._options.environment))!==null&&o!==void 0?o:i_.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(i.error.body);case 401:throw new Pe.UnauthorizedError(i.error.body);case 403:throw new Pe.ForbiddenError(i.error.body);case 404:throw new Pe.NotFoundError(i.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(i.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(i.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Ym(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Et.fetcher)({url:(0,a_.default)((n=yield Et.Supplier.get(this._options.environment))!==null&&n!==void 0?n:i_.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Et.Supplier.get(this._options.clientName))!=null?yield Et.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":Et.RUNTIME.type,"X-Fern-Runtime-Version":Et.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 Pe.BadRequestError(o.error.body);case 401:throw new Pe.UnauthorizedError(o.error.body);case 403:throw new Pe.ForbiddenError(o.error.body);case 404:throw new Pe.NotFoundError(o.error.body);case 422:throw new Pe.UnprocessableEntityError(ct.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pe.TooManyRequestsError(ct.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pe.ClientClosedRequestError(ct.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pe.InternalServerError(o.error.body);case 501:throw new Pe.NotImplementedError(ct.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pe.ServiceUnavailableError(o.error.body);case 504:throw new Pe.GatewayTimeoutError(ct.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Qr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Qr.CohereTimeoutError;case"unknown":throw new Qr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new fln.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new pln.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new mln.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new hln.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new gln.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new yln.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Ym(this,void 0,void 0,function*(){let r=(e=yield Et.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Qr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Xm.CohereClient=VLe});var KLe=x(Gue=>{"use strict";Object.defineProperty(Gue,"__esModule",{value:!0});Gue.AwsClient=void 0;var bln=Kue(),WLe=class extends bln.CohereClient{constructor(e){e.token="n/a",super(e)}};Gue.AwsClient=WLe});var I$t=x(Jue=>{"use strict";Object.defineProperty(Jue,"__esModule",{value:!0});Jue.BedrockClient=void 0;var _ln=LLe(),vln=KLe(),GLe=class extends vln.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,_ln.fetchOverride)("bedrock",e)}))}};Jue.BedrockClient=GLe});var M$t=x(Zue=>{"use strict";Object.defineProperty(Zue,"__esModule",{value:!0});Zue.CohereClientV2=void 0;var wln=kLe(),xln=Kue(),JLe=class{constructor(e){this._options=e,this.client=new xln.CohereClient(this._options),this.clientV2=new wln.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}};Zue.CohereClientV2=JLe});var R$t=x(Yue=>{"use strict";Object.defineProperty(Yue,"__esModule",{value:!0});Yue.CustomClient=void 0;var Sln=Kue(),ZLe=class extends Sln.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}};Yue.CustomClient=ZLe});var N$t=x(Xue=>{"use strict";Object.defineProperty(Xue,"__esModule",{value:!0});Xue.SagemakerClient=void 0;var Cln=KLe(),Oln=LLe(),YLe=class extends Cln.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Oln.fetchOverride)("sagemaker",e)}))}};Xue.SagemakerClient=YLe});var iK=x(Ka=>{"use strict";var Eln=Ka&&Ka.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Ka&&Ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tln=Ka&&Ka.__importStar||function(t){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};Object.defineProperty(Ka,"__esModule",{value:!0});Ka.SagemakerClient=Ka.CohereTimeoutError=Ka.CohereError=Ka.CohereEnvironment=Ka.CohereClient=Ka.CohereClientV2=Ka.BedrockClient=Ka.Cohere=void 0;Ka.Cohere=Tln(KE());var Aln=I$t();Object.defineProperty(Ka,"BedrockClient",{enumerable:!0,get:function(){return Aln.BedrockClient}});var Iln=M$t();Object.defineProperty(Ka,"CohereClientV2",{enumerable:!0,get:function(){return Iln.CohereClientV2}});var Mln=R$t();Object.defineProperty(Ka,"CohereClient",{enumerable:!0,get:function(){return Mln.CustomClient}});var Rln=SP();Object.defineProperty(Ka,"CohereEnvironment",{enumerable:!0,get:function(){return Rln.CohereEnvironment}});var j$t=ou();Object.defineProperty(Ka,"CohereError",{enumerable:!0,get:function(){return j$t.CohereError}});Object.defineProperty(Ka,"CohereTimeoutError",{enumerable:!0,get:function(){return j$t.CohereTimeoutError}});var Nln=N$t();Object.defineProperty(Ka,"SagemakerClient",{enumerable:!0,get:function(){return Nln.SagemakerClient}})});var $s=b(()=>{vj()});function u_(t){t?(Hc[0]=Hc[16]=Hc[1]=Hc[2]=Hc[3]=Hc[4]=Hc[5]=Hc[6]=Hc[7]=Hc[8]=Hc[9]=Hc[10]=Hc[11]=Hc[12]=Hc[13]=Hc[14]=Hc[15]=0,this.blocks=Hc):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 jln,Dn,Dln,s_,Hc,D$t,XLe,L$t=b(()=>{"use strict";jln=typeof window=="object"?window:{},Dn="0123456789abcdef".split(""),Dln=[-2147483648,8388608,32768,128],s_=[24,16,8,0],Hc=[];u_.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===jln.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]<<s_[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<s_[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<s_[o++&3],a[o>>2]|=(128|r&63)<<s_[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<s_[o++&3],a[o>>2]|=(128|r>>6&63)<<s_[o++&3],a[o>>2]|=(128|r&63)<<s_[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<s_[o++&3],a[o>>2]|=(128|r>>12&63)<<s_[o++&3],a[o>>2]|=(128|r>>6&63)<<s_[o++&3],a[o>>2]|=(128|r&63)<<s_[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}};u_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=Dln[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()}};u_.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};u_.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return Dn[t>>28&15]+Dn[t>>24&15]+Dn[t>>20&15]+Dn[t>>16&15]+Dn[t>>12&15]+Dn[t>>8&15]+Dn[t>>4&15]+Dn[t&15]+Dn[e>>28&15]+Dn[e>>24&15]+Dn[e>>20&15]+Dn[e>>16&15]+Dn[e>>12&15]+Dn[e>>8&15]+Dn[e>>4&15]+Dn[e&15]+Dn[r>>28&15]+Dn[r>>24&15]+Dn[r>>20&15]+Dn[r>>16&15]+Dn[r>>12&15]+Dn[r>>8&15]+Dn[r>>4&15]+Dn[r&15]+Dn[n>>28&15]+Dn[n>>24&15]+Dn[n>>20&15]+Dn[n>>16&15]+Dn[n>>12&15]+Dn[n>>8&15]+Dn[n>>4&15]+Dn[n&15]+Dn[o>>28&15]+Dn[o>>24&15]+Dn[o>>20&15]+Dn[o>>16&15]+Dn[o>>12&15]+Dn[o>>8&15]+Dn[o>>4&15]+Dn[o&15]};u_.prototype.toString=u_.prototype.hex;u_.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]};u_.prototype.array=u_.prototype.digest;u_.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};D$t=!1,XLe=t=>(D$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(`
`)),D$t=!0),new u_(!0).update(t).hex())});function UC(t,e){e?(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],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 kt,Lln,l_,Que,Vc,F$t=b(()=>{"use strict";kt="0123456789abcdef".split(""),Lln=[-2147483648,8388608,32768,128],l_=[24,16,8,0],Que=[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],Vc=[];UC.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]<<l_[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<l_[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<l_[i++&3],s[i>>>2]|=(128|n&63)<<l_[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<l_[i++&3],s[i>>>2]|=(128|n>>>6&63)<<l_[i++&3],s[i>>>2]|=(128|n&63)<<l_[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<l_[i++&3],s[i>>>2]|=(128|n>>>12&63)<<l_[i++&3],s[i>>>2]|=(128|n>>>6&63)<<l_[i++&3],s[i>>>2]|=(128|n&63)<<l_[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}};UC.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=Lln[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()}};UC.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,h,m,g,y,_,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?(g=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(g=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),g=t&e,f=g^t&r^w,m=o&i^~o&a,p=s+d+m+Que[l]+u[l],h=c+f,s=n+p<<0,n=p+h<<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),y=n&t,f=y^n&e^g,m=a&s^~a&o,p=i+d+m+Que[l+1]+u[l+1],h=c+f,a=r+p<<0,r=p+h<<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^y,m=i&a^~i&s,p=o+d+m+Que[l+2]+u[l+2],h=c+f,i=e+p<<0,e=p+h<<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^_,m=i&a^~i&s,p=o+d+m+Que[l+3]+u[l+3],h=c+f,o=t+p<<0,t=p+h<<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};UC.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=kt[t>>>28&15]+kt[t>>>24&15]+kt[t>>>20&15]+kt[t>>>16&15]+kt[t>>>12&15]+kt[t>>>8&15]+kt[t>>>4&15]+kt[t&15]+kt[e>>>28&15]+kt[e>>>24&15]+kt[e>>>20&15]+kt[e>>>16&15]+kt[e>>>12&15]+kt[e>>>8&15]+kt[e>>>4&15]+kt[e&15]+kt[r>>>28&15]+kt[r>>>24&15]+kt[r>>>20&15]+kt[r>>>16&15]+kt[r>>>12&15]+kt[r>>>8&15]+kt[r>>>4&15]+kt[r&15]+kt[n>>>28&15]+kt[n>>>24&15]+kt[n>>>20&15]+kt[n>>>16&15]+kt[n>>>12&15]+kt[n>>>8&15]+kt[n>>>4&15]+kt[n&15]+kt[o>>>28&15]+kt[o>>>24&15]+kt[o>>>20&15]+kt[o>>>16&15]+kt[o>>>12&15]+kt[o>>>8&15]+kt[o>>>4&15]+kt[o&15]+kt[i>>>28&15]+kt[i>>>24&15]+kt[i>>>20&15]+kt[i>>>16&15]+kt[i>>>12&15]+kt[i>>>8&15]+kt[i>>>4&15]+kt[i&15]+kt[a>>>28&15]+kt[a>>>24&15]+kt[a>>>20&15]+kt[a>>>16&15]+kt[a>>>12&15]+kt[a>>>8&15]+kt[a>>>4&15]+kt[a&15];return this.is224||(u+=kt[s>>>28&15]+kt[s>>>24&15]+kt[s>>>20&15]+kt[s>>>16&15]+kt[s>>>12&15]+kt[s>>>8&15]+kt[s>>>4&15]+kt[s&15]),u};UC.prototype.toString=UC.prototype.hex;UC.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};UC.prototype.array=UC.prototype.digest;UC.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 k$t=b(()=>{L$t();F$t()});var Fln,QLe,kln,ele,$$t=b(()=>{k$t();BA();Fln=(...t)=>XLe(t.join("_")),QLe=class{constructor(){Object.defineProperty(this,"keyEncoder",{enumerable:!0,configurable:!0,writable:!0,value:Fln})}makeDefaultKeyEncoder(e){this.keyEncoder=e}},kln=new Map,ele=class t extends QLe{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(kln)}}});function Uln(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 qln(t,e){return t.length===1?[e.get(t.join(","))]:Uln(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function Hln(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function tFe(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 B$t,$ln,Bln,zln,eFe,tle,z$t=b(()=>{B$t=j(aCe(),1),$ln=Object.defineProperty,Bln=(t,e,r)=>e in t?$ln(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zln=(t,e,r)=>(Bln(t,typeof e!="symbol"?e+"":e,r),r);eFe=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=B$t.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=eFe.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=eFe.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 h=this.textEncoder.encode(p[0]),m=this.rankMap.get(h.join(","));if(m!=null){i.push(m);continue}i.push(...qln(h,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)}},tle=eFe;zln(tle,"specialTokenRegex",t=>new RegExp(t.map(e=>Hln(e)).join("|"),"g"))});var U$t=b(()=>{z$t()});async function q$t(t){return t in rle||(rle[t]=Vln.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new tle(e)).catch(e=>{throw delete rle[t],e})),await rle[t]}async function H$t(t){return q$t(tFe(t))}var rle,Vln,rFe=b(()=>{U$t();PB();rle={},Vln=new Ph({})});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 Wln,Kln,e2,t2,aK=b(()=>{$$t();H6();BA();PB();rFe();Tf();Wln=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;Kln=()=>!1,e2=class extends Un{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??Kln(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},t2=class extends e2{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=ele.global():this.cache=void 0,this.caller=new Ph(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 H$t("modelName"in this?Wln(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 kB(e):Array.isArray(e)?new $B(e.map(Mb)):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 ig=b(()=>{aK()});function nFe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function oFe(t){return t!==void 0&&Un.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function iFe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Ih(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 Wc(t){return iFe(t)||oFe(t)||nFe(t)}var nle=b(()=>{Tf();bE()});function BM(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Cm(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function qC(t,e){let r=typeof e=="number"?void 0:e,n;return Wc(t)?n={type:"function",function:BM(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var V$t=b(()=>{nle();_j();nle()});var ag=b(()=>{V$t()});function aFe(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];($Ye(i)||BYe(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),zYe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var Pu,W$t=b(()=>{vj();EB();aK();UA();Tf();xv();see();bE();_6();_j();Pu=class t extends t2{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 gu.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(),[aFe(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 h=c?.at(0)?.runId;h!=null&&p.message._updateId(`run-${h}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,Y0e(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(h=>h?.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(Mb)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await gu.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(aFe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(U0e)&&!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 h of d){if(h.message.id==null){let m=a?.at(0)?.runId;m!=null&&h.message._updateId(`run-${m}`)}f===void 0?f=h:f=jc(f,h),Y0e(h.message)&&h.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.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 h=f.value;for(let m of h.generations){if(m.message.id==null){let g=a?.at(0)?.runId;g!=null&&m.message._updateId(`run-${g}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),s[p]=h.generations,u[p]=h.llmOutput,a?.[p]?.handleLLMEnd({generations:[h.generations],llmOutput:h.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,M6,{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(g=>g.map(Mb)),s={...i.metadata,...this.getLsParams(o)},u=await gu.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(aFe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(g,y)=>{let _=t._convertInputToPromptValue(g).toString(),w=await r.lookup(_,n);return w==null&&d.push(y),w}))).map((g,y)=>({result:g,runManager:c?.[y]})).filter(({result:g})=>g.status==="fulfilled"&&g.value!=null||g.status==="rejected"),h=[];await Promise.all(p.map(async({result:g,runManager:y},_)=>{if(g.status==="fulfilled"){let w=g.value;return h[_]=w.map(S=>("message"in S&&qg(S.message)&&Wi(S.message)&&(S.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),S.generationInfo={...S.generationInfo,tokenUsage:{}},S)),w.length&&await y?.handleLLMNewToken(w[0].text),y?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await y?.handleLLMError(g.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(g.reason)}));let m={generations:h,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(m,M6,{value:c?{runIds:c?.map(g=>g.runId)}:void 0,configurable:!0}),m}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(h=>h.map(Mb)),[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 h=await this._generateUncached(d.map(m=>i[m]),s,a,f!==void 0?d.map(m=>f?.[m]):void 0);await Promise.all(h.generations.map(async(m,g)=>{let y=d[g];c[y]=m;let _=t._convertInputToPromptValue(i[y]).toString();return u.update(_,l,m)})),p=h.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(Mb)],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 Xs(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=bj(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;Ih(n)?l=[{type:"function",function:{name:u,description:i,parameters:Cm(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Tp.from(m=>{if(!m.tool_calls||m.tool_calls.length===0)throw new Error("No tool calls found in the response.");let g=m.tool_calls.find(y=>y.name===u);if(!g)throw new Error(`No tool call found with name ${u}.`);return g.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=Lo.assign({parsed:(m,g)=>d.invoke(m.raw,g)}),p=Lo.assign({parsed:()=>null}),h=f.withFallbacks({fallbacks:[p]});return Li.from([{raw:c},h]).withConfig({runName:"StructuredOutputRunnable"})}}});var HC=b(()=>{W$t()});var Zf=b(()=>{EB()});var no=b(()=>{dj()});function K$t(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,ole,G$t=b(()=>{Bd=[];for(ole=0;ole<256;++ole)Bd.push((ole+256).toString(16).slice(1))});function sFe(){if(!ile&&(ile=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ile))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ile(Gln)}var ile,Gln,J$t=b(()=>{Gln=new Uint8Array(16)});var Jln,uFe,Z$t=b(()=>{Jln=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uFe={randomUUID:Jln}});function Zln(t,e,r){if(uFe.randomUUID&&!e&&!t)return uFe.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 K$t(n)}var lFe,Y$t=b(()=>{Z$t();J$t();G$t();lFe=Zln});var X$t=b(()=>{Y$t()});function Q$t(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 ale(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=>Wi(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 Xln(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function eBt(t){return t._getType()==="tool"}function tBt(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 Qln(t){if(t){if(t.every(Xln))return t;if(t.every($d))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:tBt(e.function.parameters)}));if(t.every(Wc))return t.map(e=>{let r=is(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:tBt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var rBt,sle,nBt=b(()=>{rBt=j(iK(),1);Kg();$s();ig();ag();HC();Zf();$s();no();X$t();sle=class extends Pu{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 rBt.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:Qln(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(!(Wi(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=ale(c,s);i.push(d),s=[]}}else i.push(ale(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=ale(c,s);i.push(d),s=[]}}else i.push(ale(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(eBt(o)){let i=o,a=n.filter(s=>Wi(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:Q$t(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!eBt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Wi(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:Q$t(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:lFe().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 h=p.generationInfo?.completion??0;d[h]===void 0?d[h]=p:d[h]=d[h].concat(p)}return{generations:Object.entries(d).sort(([p],[h])=>parseInt(p,10)-parseInt(h,10)).map(([p,h])=>h),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 kn({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 Sr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new co({text:"",message:new Sr({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 Sr({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 oBt=b(()=>{vj();EB();UA();aK();xv();_6()});var CL=b(()=>{oBt()});var ecn,aBt=b(()=>{ecn=j(iK(),1);no();CL()});var qp,sBt=b(()=>{PB();qp=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new Ph(e??{})}}});var PP=b(()=>{sBt()});var Hp,uBt=b(()=>{Hp=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var Ay=b(()=>{uBt()});var lBt,ule,cBt=b(()=>{lBt=j(iK(),1);no();PP();Ay();ule=class extends qp{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 lBt.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=Hp(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 dBt=b(()=>{});var fBt=b(()=>{dBt()});var tcn,pBt=b(()=>{fBt();no();tcn=j(iK(),1)});var mBt=b(()=>{nBt();aBt();cBt();pBt()});var cFe=b(()=>{mBt()});function acn(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${icn}/${ocn}`),e.join(" ")}async function scn(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",acn(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 VC(`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 VC(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new VC(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function ucn(t,e,r,n,o,i){let a=new dFe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},fcn(i)),{method:"POST",headers:await scn(a),body:o})}}async function cK(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await ucn(t,e,r,n,o,i);return lcn(s,u,a)}async function lcn(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){ccn(o,t)}return n.ok||await dcn(n,t),n}function ccn(t,e){let r=t;throw t instanceof cle||t instanceof VC||(r=new Yf(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function dcn(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 cle(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function fcn(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 pFe(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.`),lle(t.candidates[0]))throw new zM(`${UM(t)}`,t);return pcn(t)}else if(t.promptFeedback)throw new zM(`Text not available. ${UM(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.`),lle(t.candidates[0]))throw new zM(`${UM(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),SBt(t)[0]}else if(t.promptFeedback)throw new zM(`Function call not available. ${UM(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.`),lle(t.candidates[0]))throw new zM(`${UM(t)}`,t);return SBt(t)}else if(t.promptFeedback)throw new zM(`Function call not available. ${UM(t)}`,t)},t}function pcn(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 SBt(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 lle(t){return!!t.finishReason&&mcn.includes(t.finishReason)}function UM(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];lle(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function uK(t){return this instanceof uK?(this.v=t,this):new uK(t)}function hcn(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(h,m){i.push([f,p,h,m])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(h){d(i[0][3],h)}}function u(f){f.value instanceof uK?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 gcn(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=_cn(e),[n,o]=r.tee();return{stream:bcn(n),response:ycn(o)}}async function ycn(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return pFe(vcn(e));e.push(o)}}function bcn(t){return hcn(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield uK(r.read());if(o)break;yield yield uK(pFe(n))}})}function _cn(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 Yf("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(CBt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new Yf(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(CBt)}return i()})}}})}function vcn(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 TBt(t,e,r,n){let o=await cK(e,TL.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return gcn(o)}async function ABt(t,e,r,n){let i=await(await cK(e,TL.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:pFe(i)}}function IBt(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 lK(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 wcn(e)}function wcn(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 Yf("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 Yf("No content is provided for sending chat message.");return n?e:r}function xcn(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 VC("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=lK(t);n.contents=[i]}return{generateContentRequest:n}}function OBt(t){let e;return t.contents?e=t:e={contents:[lK(t)]},t.systemInstruction&&(e.systemInstruction=IBt(t.systemInstruction)),e}function Scn(t){return typeof t=="string"||Array.isArray(t)?{content:lK(t)}:t}function Ocn(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new Yf(`First content should be with role 'user', got ${n}`);if(!bBt.includes(n))throw new Yf(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(bBt)}`);if(!Array.isArray(o))throw new Yf("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Yf("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 EBt)u in s&&(i[u]+=1);let a=Ccn[n];for(let s of EBt)if(!a.includes(s)&&i[s]>0)throw new Yf(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function Ecn(t,e,r,n){return(await cK(e,TL.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function Pcn(t,e,r,n){return(await cK(e,TL.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function Tcn(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await cK(e,TL.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var hBt,gBt,yBt,bBt,OL,EL,_Bt,vBt,sK,wBt,PL,xBt,Yf,zM,cle,VC,rcn,ncn,ocn,icn,TL,dFe,mcn,CBt,EBt,Ccn,PBt,fFe,dle,AL,dK=b(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(hBt||(hBt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(gBt||(gBt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(yBt||(yBt={}));bBt=["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"})(OL||(OL={}));(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"})(EL||(EL={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(_Bt||(_Bt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(vBt||(vBt={}));(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"})(sK||(sK={}));(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"})(wBt||(wBt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(PL||(PL={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(xBt||(xBt={}));Yf=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},zM=class extends Yf{constructor(e,r){super(e),this.response=r}},cle=class extends Yf{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},VC=class extends Yf{};rcn="https://generativelanguage.googleapis.com",ncn="v1beta",ocn="0.21.0",icn="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"})(TL||(TL={}));dFe=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)||ncn,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||rcn}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};mcn=[sK.RECITATION,sK.SAFETY,sK.LANGUAGE];CBt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;EBt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],Ccn={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};PBt="SILENT_ERROR",fFe=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&&(Ocn(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=lK(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(()=>ABt(this._apiKey,this.model,c,d)).then(p=>{var h;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let m=Object.assign({parts:[],role:"model"},(h=p.response.candidates)===null||h===void 0?void 0:h[0].content);this._history.push(m)}else{let m=UM(p.response);m&&console.warn(`sendMessage() was unsuccessful. ${m}. 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=lK(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=TBt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(PBt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let h=Object.assign({},p.candidates[0].content);h.role||(h.role="model"),this._history.push(h)}else{let h=UM(p);h&&console.warn(`sendMessageStream() was unsuccessful. ${h}. Inspect response object for details.`)}}).catch(p=>{p.message!==PBt&&console.error(p)}),f}};dle=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=IBt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=OBt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return ABt(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=OBt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return TBt(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 fFe(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=xcn(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 Ecn(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=Scn(e),o=Object.assign(Object.assign({},this._requestOptions),r);return Pcn(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return Tcn(this.apiKey,this.model,e,n)}};AL=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new Yf("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new dle(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new VC("Cached content must contain a `name` field.");if(!e.model)throw new VC("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 VC(`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 dle(this.apiKey,i,n)}}});var MBt=b(()=>{bE()});var IL=b(()=>{MBt()});function r2(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(r2):typeof e[r]=="object"&&e[r]!==null&&(e[r]=r2(e[r])));return e}return t}function fle(t){let e=r2(is(t)),{$schema:r,...n}=e;return n}function RBt(t){let e=r2(t),{$schema:r,...n}=e;return n}var ple=b(()=>{Kg()});function Acn(t){let e=t._getType();return Ys.isInstance(t)?t.role:e==="tool"?e:t.name??e}function Icn(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 Mcn(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function Rcn(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 Mcn(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 mFe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!qg(o))throw new Error("Unsupported message input");let a=Acn(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=Icn(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=Rcn(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 NBt(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 kn({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 Sr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function DBt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Wc(e)){let r=fle(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:RBt(e.function.parameters)}:e})}]}var hFe=b(()=>{$s();Zf();ag();ig();ple()});var fK,LBt=b(()=>{Db();fK=class extends wj{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 Mh(`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 gFe(t,e){let r=Ncn(t),n=Dcn(r,e);return{tools:r,toolConfig:n}}function Ncn(t){let e=[],r=[];return t.forEach(o=>{if(Wc(o)){let[i]=DBt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if($d(o)){let{functionDeclarations:i}=jcn(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 jcn(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:r2(t.function.parameters)}]}}function Dcn(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:PL.ANY,auto:PL.AUTO,none:PL.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:PL.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var FBt=b(()=>{dK();ag();ig();hFe();ple()});var mle,kBt=b(()=>{dK();no();HC();Pm();IL();ple();hFe();LBt();FBt();mle=class extends Pu{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 AL(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 AL(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:gFe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?gFe(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=mFe(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 h of d){let m=h.generationInfo?.completion??0;f[m]===void 0?f[m]=h:f[m]=f[m].concat(h)}return{generations:Object.entries(f).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),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=NBt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=mFe(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 h=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:h,total_tokens:h}}}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(Cv(n)){let h=fle(n);l=[{functionDeclarations:[{name:s,description:h.description??"A function available to call.",parameters:h}]}],u=new fK({returnSingle:!0,keyName:s,zodSchema:n})}else{let h;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(h=n,s=n.name):h={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[h]}],u=new fK({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=Lo.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=Lo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Li.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var hle,$Bt=b(()=>{dK();no();PP();Ay();hle=class extends qp{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 AL(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=Hp(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 BBt=b(()=>{kBt();$Bt()});var yFe=b(()=>{BBt()});function Lcn(t){return t&&DataView.prototype.isPrototypeOf(t)}function n2(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 _Fe(t){return typeof t!="string"&&(t=String(t)),t}function vFe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Vp.iterable&&(e[Symbol.iterator]=function(){return e}),e}function hc(t){this.map={},t instanceof hc?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 bFe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function HBt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Fcn(t){var e=new FileReader,r=HBt(e);return e.readAsArrayBuffer(t),r}function kcn(t){var e=new FileReader,r=HBt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function $cn(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 UBt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function VBt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Vp.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Vp.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Vp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Vp.arrayBuffer&&Vp.blob&&Lcn(t)?(this._bodyArrayBuffer=UBt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Vp.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||qBt(t))?this._bodyArrayBuffer=UBt(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):Vp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Vp.blob&&(this.blob=function(){var t=bFe(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=bFe(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(Vp.blob)return this.blob().then(Fcn);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=bFe(this);if(t)return t;if(this._bodyBlob)return kcn(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve($cn(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Vp.formData&&(this.formData=function(){return this.text().then(Ucn)}),this.json=function(){return this.text().then(JSON.parse)},this}function zcn(t){var e=t.toUpperCase();return Bcn.indexOf(e)>-1?e:t}function RL(t,e){if(!(this instanceof RL))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 RL){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new hc(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 hc(e.headers)),this.method=zcn(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 Ucn(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 qcn(t){var e=new hc,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 WC(t,e){if(!(this instanceof WC))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 hc(e.headers),this.url=e.url||"",this._initBody(t)}function WBt(t,e){return new Promise(function(r,n){var o=new RL(t,e);if(o.signal&&o.signal.aborted)return n(new ML("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:qcn(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 WC(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 ML("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&&(Vp.blob?i.responseType="blob":Vp.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof hc||zd.Headers&&e.headers instanceof zd.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(n2(l)),i.setRequestHeader(l,_Fe(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,Vp,zBt,qBt,Bcn,Hcn,ML,KBt=b(()=>{zd=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Vp={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};Vp.arrayBuffer&&(zBt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],qBt=ArrayBuffer.isView||function(t){return t&&zBt.indexOf(Object.prototype.toString.call(t))>-1});hc.prototype.append=function(t,e){t=n2(t),e=_Fe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};hc.prototype.delete=function(t){delete this.map[n2(t)]};hc.prototype.get=function(t){return t=n2(t),this.has(t)?this.map[t]:null};hc.prototype.has=function(t){return this.map.hasOwnProperty(n2(t))};hc.prototype.set=function(t,e){this.map[n2(t)]=_Fe(e)};hc.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};hc.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),vFe(t)};hc.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),vFe(t)};hc.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),vFe(t)};Vp.iterable&&(hc.prototype[Symbol.iterator]=hc.prototype.entries);Bcn=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];RL.prototype.clone=function(){return new RL(this,{body:this._bodyInit})};VBt.call(RL.prototype);VBt.call(WC.prototype);WC.prototype.clone=function(){return new WC(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new hc(this.headers),url:this.url})};WC.error=function(){var t=new WC(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};Hcn=[301,302,303,307,308];WC.redirect=function(t,e){if(Hcn.indexOf(e)===-1)throw new RangeError("Invalid status code");return new WC(null,{status:e,headers:{location:t}})};ML=zd.DOMException;try{new ML}catch{ML=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},ML.prototype=Object.create(Error.prototype),ML.prototype.constructor=ML}WBt.polyfill=!0;zd.fetch||(zd.fetch=WBt,zd.Headers=hc,zd.Request=RL,zd.Response=WC)});function Gcn(){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 Jcn(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 Vcn,JBt,ZBt,Wcn,Kcn,wFe,SFe,CFe,OFe,EFe,GBt,o2,Zcn,Ycn,Xcn,Qcn,edn,xFe,i2,TKo,gle=b(()=>{KBt();Vcn="0.5.14",JBt="11434",ZBt=`http://127.0.0.1:${JBt}`,Wcn=Object.defineProperty,Kcn=(t,e,r)=>e in t?Wcn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wFe=(t,e,r)=>(Kcn(t,typeof e!="symbol"?e+"":e,r),r),SFe=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)}},CFe=class{constructor(e,r,n){wFe(this,"abortController"),wFe(this,"itr"),wFe(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.")}},OFe=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 SFe(e,t.status)};EFe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${Vcn} (${Gcn()})`};r.headers=Jcn(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)},GBt=async(t,e,r)=>{let n=await EFe(t,e,{headers:r?.headers});return await OFe(n),n},o2=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await EFe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await OFe(a),a},Zcn=async(t,e,r,n)=>{let o=await EFe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await OFe(o),o},Ycn=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)}},Xcn=t=>{if(!t)return ZBt;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=JBt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},Qcn=Object.defineProperty,edn=(t,e,r)=>e in t?Qcn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xFe=(t,e,r)=>(edn(t,typeof e!="symbol"?e+"":e,r),r),i2=class{constructor(e){xFe(this,"config"),xFe(this,"fetch"),xFe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Xcn(e?.host??ZBt)),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 o2(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Ycn(a.body),u=new CFe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await o2(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 Zcn(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await o2(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await GBt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await o2(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await o2(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await o2(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await GBt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},TKo=new i2});var YBt=b(()=>{xv()});function XBt(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,yle,QBt=b(()=>{Ud=[];for(yle=0;yle<256;++yle)Ud.push((yle+256).toString(16).slice(1))});function PFe(){if(!ble&&(ble=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ble))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ble(tdn)}var ble,tdn,ezt=b(()=>{tdn=new Uint8Array(16)});var rdn,TFe,tzt=b(()=>{rdn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),TFe={randomUUID:rdn}});function ndn(t,e,r){if(TFe.randomUUID&&!e&&!t)return TFe.randomUUID();t=t||{};var n=t.random||(t.rng||PFe)();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 XBt(n)}var AFe,rzt=b(()=>{tzt();ezt();QBt();AFe=ndn});var nzt=b(()=>{rzt()});function IFe(t,e){return new Sr({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:AFe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function ozt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function odn(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 idn(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:[ozt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[ozt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function adn(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 sdn(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function izt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return idn(e);if(e._getType()==="ai")return odn(e);if(e._getType()==="system")return adn(e);if(e._getType()==="tool")return sdn(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var azt=b(()=>{$s();nzt()});var _le,szt=b(()=>{$s();HC();gle();Zf();$s();Pm();ag();YBt();Db();IL();Kg();azt();_le=class extends Pu{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 i2({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=>qC(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=>qC(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=jc(o,a.message):o=a.message;let i=new kn({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=izt(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:IFe(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:IFe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new co({text:"",message:new Sr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Cv(e),o=n?is(e):e,i=this.bind({format:o}),a=n?Sd.fromZodSchema(e):new Cd;if(!r?.includeRaw)return i.pipe(a);let s=Lo.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=Lo.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return Li.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var vle,uzt=b(()=>{PP();gle();vle=class extends qp{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 i2({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 lzt=b(()=>{});var czt=b(()=>{Zf();CL();gle()});var dzt=b(()=>{szt();uzt();lzt();czt()});var MFe=b(()=>{dzt()});function tr(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 ce(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 Iy=b(()=>{});var RFe,NFe=b(()=>{RFe=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return RFe=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 mK,wle=b(()=>{mK=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,gc,Bs,qM,KC,a2,s2,u2,l2,c2,d2,f2,p2,m2,h2,GC,JC=b(()=>{wle();ht=class extends Error{},gc=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 qM({message:n,cause:mK(r)});let i=r?.error;return e===400?new a2(e,i,n,o):e===401?new s2(e,i,n,o):e===403?new u2(e,i,n,o):e===404?new l2(e,i,n,o):e===409?new c2(e,i,n,o):e===422?new d2(e,i,n,o):e===429?new f2(e,i,n,o):e>=500?new p2(e,i,n,o):new t(e,i,n,o)}},Bs=class extends gc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},qM=class extends gc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},KC=class extends qM{constructor({message:e}={}){super({message:e??"Request timed out."})}},a2=class extends gc{},s2=class extends gc{},u2=class extends gc{},l2=class extends gc{},c2=class extends gc{},d2=class extends gc{},f2=class extends gc{},p2=class extends gc{},m2=class extends ht{constructor(){super("Could not parse response content as the length limit was reached")}},h2=class extends ht{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},GC=class extends Error{constructor(e){super(e)}}});function pzt(t){return typeof t!="object"?{}:t??{}}function mzt(t){if(!t)return!0;for(let e in t)return!1;return!0}function hzt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function g2(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var ldn,fzt,Xf,jFe,gzt,yzt,TP=b(()=>{JC();ldn=/^[a-z][a-z0-9+.-]*:/i,fzt=t=>ldn.test(t),Xf=t=>(Xf=Array.isArray,Xf(t)),jFe=Xf;gzt=(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},yzt=t=>{try{return JSON.parse(t)}catch{return}}});var ZC,y2=b(()=>{ZC=t=>new Promise(e=>setTimeout(e,t))});var HM,DFe=b(()=>{HM="5.12.1"});function cdn(){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 fdn(){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 wzt,ddn,bzt,_zt,vzt,xzt,LFe=b(()=>{DFe();wzt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";ddn=()=>{let t=cdn();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":HM,"X-Stainless-OS":_zt(Deno.build.os),"X-Stainless-Arch":bzt(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":HM,"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":HM,"X-Stainless-OS":_zt(globalThis.process.platform??"unknown"),"X-Stainless-Arch":bzt(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=fdn();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":HM,"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":HM,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};bzt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",_zt=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"),xzt=()=>vzt??(vzt=ddn())});function Szt(){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 FFe(...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 xle(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return FFe({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function kFe(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 Czt(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 hK=b(()=>{});var Ozt,Ezt=b(()=>{Ozt=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var Sle,$Fe,Cle,BFe,Ole=b(()=>{Sle="RFC3986",$Fe=t=>String(t),Cle={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:$Fe},BFe="RFC1738"});function Tzt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function UFe(t,e){if(Xf(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Ele,YC,zFe,Pzt,Azt=b(()=>{Ole();TP();Ele=(t,e)=>(Ele=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ele(t,e)),YC=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),zFe=1024,Pzt=(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+=zFe){let u=i.length>=zFe?i.slice(s,s+zFe):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===BFe&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=YC[d];continue}if(d<2048){l[l.length]=YC[192|d>>6]+YC[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=YC[224|d>>12]+YC[128|d>>6&63]+YC[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=YC[240|d>>18]+YC[128|d>>12&63]+YC[128|d>>6&63]+YC[128|d&63]}a+=l.join("")}return a}});function hdn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function Nzt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,g,y){let _=t,w=y,S=0,C=!1;for(;(w=w.get(qFe))!==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(qFe)>"u"&&(S=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&Xf(_)&&(_=UFe(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!m?u(e,yc.encoder,g,"key",p):e;_=""}if(hdn(_)||Tzt(_)){if(u){let N=m?e:u(e,yc.encoder,g,"key",p);return[h?.(N)+"="+h?.(u(_,yc.encoder,g,"value",p))]}return[h?.(e)+"="+h?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&Xf(_))m&&u&&(_=UFe(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(Xf(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&&Xf(_)&&_.length===1?T+"[]":T;if(o&&Xf(_)&&_.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,F=Xf(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");y.set(t,S);let K=new WeakMap;K.set(qFe,y),Rzt(E,Nzt(D,F,r,n,o,i,a,s,r==="comma"&&m&&Xf(_)?null:u,l,c,d,f,p,h,m,g,K))}return E}function gdn(t=yc){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||yc.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=Sle;if(typeof t.format<"u"){if(!Ele(Cle,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=Cle[r],o=yc.filter;(typeof t.filter=="function"||Xf(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Mzt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=yc.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:yc.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:yc.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:yc.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:yc.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?yc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:yc.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:yc.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:yc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:yc.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:yc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:yc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:yc.strictNullHandling}}function HFe(t,e={}){let r=t,n=gdn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Xf(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Mzt[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||Rzt(a,Nzt(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 Mzt,Rzt,Izt,yc,qFe,jzt=b(()=>{Azt();Ole();TP();Mzt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Rzt=function(t,e){Array.prototype.push.apply(t,Xf(e)?e:[e])},yc={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Pzt,encodeValuesOnly:!1,format:Sle,formatter:$Fe,indices:!1,serializeDate(t){return(Izt??(Izt=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};qFe={}});var Dzt=b(()=>{Ole();jzt()});function kzt(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 b2(t){let e;return(Lzt??(e=new globalThis.TextEncoder,Lzt=e.encode.bind(e)))(t)}function VFe(t){let e;return(Fzt??(e=new globalThis.TextDecoder,Fzt=e.decode.bind(e)))(t)}var Lzt,Fzt,Ple=b(()=>{});function bdn(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 $zt(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 sg,ug,NL,Bzt=b(()=>{Iy();Ple();NL=class{constructor(){sg.set(this,void 0),ug.set(this,void 0),tr(this,sg,new Uint8Array,"f"),tr(this,ug,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?b2(e):e;tr(this,sg,kzt([ce(this,sg,"f"),r]),"f");let n=[],o;for(;(o=bdn(ce(this,sg,"f"),ce(this,ug,"f")))!=null;){if(o.carriage&&ce(this,ug,"f")==null){tr(this,ug,o.index,"f");continue}if(ce(this,ug,"f")!=null&&(o.index!==ce(this,ug,"f")+1||o.carriage)){n.push(VFe(ce(this,sg,"f").subarray(0,ce(this,ug,"f")-1))),tr(this,sg,ce(this,sg,"f").subarray(ce(this,ug,"f")),"f"),tr(this,ug,null,"f");continue}let i=ce(this,ug,"f")!==null?o.preceding-1:o.preceding,a=VFe(ce(this,sg,"f").subarray(0,i));n.push(a),tr(this,sg,ce(this,sg,"f").subarray(o.index),"f"),tr(this,ug,null,"f")}return n}flush(){return ce(this,sg,"f").length?this.decode(`
`):[]}};sg=new WeakMap,ug=new WeakMap;NL.NEWLINE_CHARS=new Set([`
`,"\r"]);NL.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function gK(){}function Tle(t,e,r){return!e||Ale[t]>Ale[r]?gK:e[t].bind(e)}function cu(t){let e=t.logger,r=t.logLevel??"off";if(!e)return _dn;let n=zzt.get(e);if(n&&n[0]===r)return n[1];let o={error:Tle("error",e,r),warn:Tle("warn",e,r),info:Tle("info",e,r),debug:Tle("debug",e,r)};return zzt.set(e,[r,o]),o}var Ale,WFe,_dn,zzt,AP,yK=b(()=>{TP();Ale={off:0,error:200,warn:300,info:400,debug:500},WFe=(t,e,r)=>{if(t){if(hzt(Ale,t))return t;cu(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Ale))}`)}};_dn={error:gK,warn:gK,info:gK,debug:gK},zzt=new WeakMap;AP=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*vdn(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 KFe,n=new NL,o=kFe(t.body);for await(let i of wdn(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*wdn(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"?b2(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=$zt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function xdn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var bK,XC,KFe,GFe=b(()=>{Iy();JC();hK();Bzt();hK();wle();Ple();yK();JC();XC=class t{constructor(e,r,n){this.iterator=e,bK.set(this,void 0),this.controller=r,tr(this,bK,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?cu(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 vdn(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 gc(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 gc(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 NL,u=kFe(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)}[(bK=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,ce(this,bK,"f")),new t(()=>o(r),this.controller,ce(this,bK,"f"))]}toReadableStream(){let e=this,r;return FFe({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=b2(JSON.stringify(o)+`
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};KFe=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]=xdn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function Ile(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return cu(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):XC.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 JFe(d,r)}return await r.text()})();return cu(t).debug(`[${n}] response parsed`,AP({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function JFe(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 ZFe=b(()=>{GFe();yK()});var _K,jL,Mle=b(()=>{Iy();ZFe();jL=class t extends Promise{constructor(e,r,n=Ile){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,_K.set(this,void 0),tr(this,_K,e,"f")}_thenUnwrap(e){return new t(ce(this,_K,"f"),this.responsePromise,async(r,n)=>JFe(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(ce(this,_K,"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)}};_K=new WeakMap});var Rle,Nle,vK,QC,Cn,Ga=b(()=>{Iy();JC();ZFe();Mle();TP();Nle=class{constructor(e,r,n,o){Rle.set(this,void 0),tr(this,Rle,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 ce(this,Rle,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Rle=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},vK=class extends jL{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Ile(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},QC=class extends Nle{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}},Cn=class extends Nle{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:{...pzt(this.options.query),after:r}}:null}}});function _2(t,e,r){return XFe(),new File(t,e??"unknown_file",r)}function wK(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 Cdn(t){let e=typeof t=="function"?t:t.fetch,r=Uzt.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 Uzt.set(e,n),n}var XFe,QFe,lg,Uzt,Odn,Edn,YFe,IP=b(()=>{hK();XFe=()=>{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`.":""))}};QFe=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",lg=async(t,e)=>({...t,body:await Odn(t.body,e)}),Uzt=new WeakMap;Odn=async(t,e)=>{if(!await Cdn(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])=>YFe(r,n,o))),r},Edn=t=>t instanceof Blob&&"name"in t,YFe=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,_2([await r.blob()],wK(r)));else if(QFe(r))t.append(e,_2([await new Response(xle(r)).blob()],wK(r)));else if(Edn(r))t.append(e,r,wK(r));else if(Array.isArray(r))await Promise.all(r.map(n=>YFe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>YFe(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 xK(t,e,r){if(XFe(),t=await t,Pdn(t))return t instanceof File?t:_2([await t.arrayBuffer()],t.name);if(Tdn(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),_2(await eke(o),e,r)}let n=await eke(t);if(e||(e=wK(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return _2(n,e,r)}async function eke(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(qzt(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(QFe(t))for await(let r of t)e.push(...await eke(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${Adn(t)}`)}return e}function Adn(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var qzt,Pdn,Tdn,Hzt=b(()=>{IP();IP();qzt=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",Pdn=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&qzt(t),Tdn=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var tke=b(()=>{Hzt()});var qe,Dr=b(()=>{qe=class{constructor(e){this._client=e}}});function Wzt(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Vzt,Mdn,Le,ia=b(()=>{JC();Vzt=Object.freeze(Object.create(null)),Mdn=(t=Wzt)=>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],h=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??Vzt)??Vzt)?.toString)&&(h=p+"",i.push({start:c.length+d.length,length:h.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":h)},""),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 h=" ".repeat(p.start-c),m="^".repeat(p.length);return c=p.start+p.length,f+h+m},"");throw new ht(`Path parameters result in path with invalid segments:
${i.map(f=>f.error).join(`
`)}
${a}
${d}`)}return a},Le=Mdn(Wzt)});var DL,jle=b(()=>{Dr();Ga();ia();DL=class extends qe{list(e,r={},n){return this._client.getAPIList(Le`/chat/completions/${e}/messages`,Cn,{query:r,...n})}}});var c_=b(()=>{JC()});function SK(t){return t!==void 0&&"function"in t&&t.function!==void 0}function Kzt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function CK(t){return t?.$brand==="auto-parseable-response-format"}function LL(t){return t?.$brand==="auto-parseable-tool"}function Gzt(t,e){return!e||!rke(e)?{...t,choices:t.choices.map(r=>(Zzt(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:OK(t,e)}function OK(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new m2;if(n.finish_reason==="content_filter")throw new h2;return Zzt(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>Ddn(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?jdn(e,n.message.content):null}}});return{...t,choices:r}}function jdn(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 Ddn(t,e){let r=t.tools?.find(n=>SK(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:LL(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function Jzt(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>SK(n)&&n.function?.name===e.function.name);return SK(r)&&(LL(r)||r?.function.strict||!1)}function rke(t){return CK(t.response_format)?!0:t.tools?.some(e=>LL(e)||e.type==="function"&&e.function.strict===!0)??!1}function Zzt(t){for(let e of t||[])if(e.type!=="function")throw new ht(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function Yzt(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 v2=b(()=>{c_()});var w2,nke,oke=b(()=>{w2=t=>t?.role==="assistant",nke=t=>t?.role==="tool"});var ike,Dle,Lle,EK,PK,Fle,TK,MP,AK,kle,$le,x2,Xzt,VM,Ble=b(()=>{Iy();c_();VM=class{constructor(){ike.add(this),this.controller=new AbortController,Dle.set(this,void 0),Lle.set(this,()=>{}),EK.set(this,()=>{}),PK.set(this,void 0),Fle.set(this,()=>{}),TK.set(this,()=>{}),MP.set(this,{}),AK.set(this,!1),kle.set(this,!1),$le.set(this,!1),x2.set(this,!1),tr(this,Dle,new Promise((e,r)=>{tr(this,Lle,e,"f"),tr(this,EK,r,"f")}),"f"),tr(this,PK,new Promise((e,r)=>{tr(this,Fle,e,"f"),tr(this,TK,r,"f")}),"f"),ce(this,Dle,"f").catch(()=>{}),ce(this,PK,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},ce(this,ike,"m",Xzt).bind(this))},0)}_connected(){this.ended||(ce(this,Lle,"f").call(this),this._emit("connect"))}get ended(){return ce(this,AK,"f")}get errored(){return ce(this,kle,"f")}get aborted(){return ce(this,$le,"f")}abort(){this.controller.abort()}on(e,r){return(ce(this,MP,"f")[e]||(ce(this,MP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=ce(this,MP,"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(ce(this,MP,"f")[e]||(ce(this,MP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{tr(this,x2,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){tr(this,x2,!0,"f"),await ce(this,PK,"f")}_emit(e,...r){if(ce(this,AK,"f"))return;e==="end"&&(tr(this,AK,!0,"f"),ce(this,Fle,"f").call(this));let n=ce(this,MP,"f")[e];if(n&&(ce(this,MP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!ce(this,x2,"f")&&!n?.length&&Promise.reject(o),ce(this,EK,"f").call(this,o),ce(this,TK,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!ce(this,x2,"f")&&!n?.length&&Promise.reject(o),ce(this,EK,"f").call(this,o),ce(this,TK,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Dle=new WeakMap,Lle=new WeakMap,EK=new WeakMap,PK=new WeakMap,Fle=new WeakMap,TK=new WeakMap,MP=new WeakMap,AK=new WeakMap,kle=new WeakMap,$le=new WeakMap,x2=new WeakMap,ike=new WeakSet,Xzt=function(e){if(tr(this,kle,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Bs),e instanceof Bs)return tr(this,$le,!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 Qzt(t){return typeof t.parse=="function"}var ake=b(()=>{});var Wp,ske,zle,uke,lke,cke,eUt,tUt,Ldn,S2,dke=b(()=>{Iy();c_();v2();oke();Ble();ake();Ldn=10,S2=class extends VM{constructor(){super(...arguments),Wp.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),nke(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(w2(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(),ce(this,Wp,"m",ske).call(this)}async finalMessage(){return await this.done(),ce(this,Wp,"m",zle).call(this)}async finalFunctionToolCall(){return await this.done(),ce(this,Wp,"m",uke).call(this)}async finalFunctionToolCallResult(){return await this.done(),ce(this,Wp,"m",lke).call(this)}async totalUsage(){return await this.done(),ce(this,Wp,"m",cke).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=ce(this,Wp,"m",zle).call(this);r&&this._emit("finalMessage",r);let n=ce(this,Wp,"m",ske).call(this);n&&this._emit("finalContent",n);let o=ce(this,Wp,"m",uke).call(this);o&&this._emit("finalFunctionToolCall",o);let i=ce(this,Wp,"m",lke).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",ce(this,Wp,"m",cke).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),ce(this,Wp,"m",eUt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(OK(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=Ldn}=n||{},c=r.tools.map(p=>{if(LL(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 m=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new ht("missing message in ChatCompletion response");if(!m.tool_calls?.length)return;for(let g of m.tool_calls){if(g.type!=="function")continue;let y=g.id,{name:_,arguments:w}=g.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:y,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:y,content:T});continue}let C;try{C=Qzt(S)?await S.parse(w):w}catch(T){let I=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:y,content:I});continue}let E=await S.function(C,this),P=ce(this,Wp,"m",tUt).call(this,E);if(this._addMessage({role:o,tool_call_id:y,content:P}),u)return}}}};Wp=new WeakSet,ske=function(){return ce(this,Wp,"m",zle).call(this).content??null},zle=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(w2(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new ht("stream ended without producing a ChatCompletionMessage with role=assistant")},uke=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(w2(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},lke=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(nke(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}},cke=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},eUt=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.")},tUt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var IK,fke=b(()=>{dke();oke();IK=class t extends S2{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),w2(e)&&e.content&&this._emit("content",e.content)}}});function Fdn(t,e=Kc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return kdn(t.trim(),e)}var Kc,pke,mke,kdn,hke,rUt=b(()=>{Kc={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},pke=class extends Error{},mke=class extends Error{};kdn=(t,e)=>{let r=t.length,n=0,o=f=>{throw new pke(`${f} at position ${n}`)},i=f=>{throw new mke(`${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"||Kc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Kc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Kc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Kc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Kc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Kc.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(h){i(String(h))}else if(Kc.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&&Kc.OBJ&e)return f;let p=s();d(),n++;try{let h=a();Object.defineProperty(f,p,{value:h,writable:!0,enumerable:!0,configurable:!0})}catch(h){if(Kc.OBJ&e)return f;throw h}d(),t[n]===","&&n++}}catch{if(Kc.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(Kc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Kc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Kc.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&&!(Kc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Kc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(h){i(String(h))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},hke=t=>Fdn(t,Kc.ALL^Kc.NUM)});var gke=b(()=>{GFe()});function $dn(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:h=null,function_call:m,tool_calls:g,...y}=l,_=l.role;if(!_)throw new ht(`missing role for choice ${d}`);if(m){let{arguments:w,name:S}=m;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:h,function_call:{arguments:w,name:S},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return g?{...p,index:d,finish_reason:c,logprobs:f,message:{...y,role:_,content:h,refusal:l.refusal??null,tool_calls:g.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
${Hle(t)}`);if(E==null)throw new ht(`missing choices[${d}].tool_calls[${S}].type
${Hle(t)}`);if(N==null)throw new ht(`missing choices[${d}].tool_calls[${S}].function.name
${Hle(t)}`);if(I==null)throw new ht(`missing choices[${d}].tool_calls[${S}].function.arguments
${Hle(t)}`);return{...T,id:P,type:E,function:{...M,name:N,arguments:I}}})}}:{...p,message:{...y,content:h,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return Gzt(u,e)}function Hle(t){return JSON.stringify(t)}var bc,RP,C2,WM,yke,Ule,bke,_ke,vke,qle,wke,nUt,FL,Vle=b(()=>{Iy();rUt();c_();v2();gke();dke();FL=class t extends S2{constructor(e){super(),bc.add(this),RP.set(this,void 0),C2.set(this,void 0),WM.set(this,void 0),tr(this,RP,e,"f"),tr(this,C2,[],"f")}get currentChatCompletionSnapshot(){return ce(this,WM,"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())),ce(this,bc,"m",yke).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)ce(this,bc,"m",bke).call(this,a);if(i.controller.signal?.aborted)throw new Bs;return this._addChatCompletion(ce(this,bc,"m",qle).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),ce(this,bc,"m",yke).call(this),this._connected();let o=XC.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(ce(this,bc,"m",qle).call(this)),ce(this,bc,"m",bke).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Bs;return this._addChatCompletion(ce(this,bc,"m",qle).call(this))}[(RP=new WeakMap,C2=new WeakMap,WM=new WeakMap,bc=new WeakSet,yke=function(){this.ended||tr(this,WM,void 0,"f")},Ule=function(r){let n=ce(this,C2,"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},ce(this,C2,"f")[r.index]=n,n)},bke=function(r){if(this.ended)return;let n=ce(this,bc,"m",nUt).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=ce(this,bc,"m",Ule).call(this,i);i.finish_reason&&(ce(this,bc,"m",vke).call(this,i),a.current_tool_call_index!=null&&ce(this,bc,"m",_ke).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(ce(this,bc,"m",vke).call(this,i),a.current_tool_call_index!=null&&ce(this,bc,"m",_ke).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))}}},_ke=function(r,n){if(ce(this,bc,"m",Ule).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=ce(this,RP,"f")?.tools?.find(s=>SK(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:LL(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},vke=function(r){let n=ce(this,bc,"m",Ule).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=ce(this,bc,"m",wke).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=ce(this,WM,"f");if(!r)throw new ht("request ended without sending any chunks");return tr(this,WM,void 0,"f"),tr(this,C2,[],"f"),$dn(r,ce(this,RP,"f"))},wke=function(){let r=ce(this,RP,"f")?.response_format;return CK(r)?r:null},nUt=function(r){var n,o,i,a;let s=ce(this,WM,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=tr(this,WM,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...h}of r.choices){let m=s.choices[f];if(m||(m=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...h}),p)if(!m.logprobs)m.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...T}=p;Object.assign(m.logprobs,T),E&&((n=m.logprobs).content??(n.content=[]),m.logprobs.content.push(...E)),P&&((o=m.logprobs).refusal??(o.refusal=[]),m.logprobs.refusal.push(...P))}if(d&&(m.finish_reason=d,ce(this,RP,"f")&&rke(ce(this,RP,"f")))){if(d==="length")throw new m2;if(d==="content_filter")throw new h2}if(Object.assign(m,h),!c)continue;let{content:g,refusal:y,function_call:_,role:w,tool_calls:S,...C}=c;if(Object.assign(m.message,C),y&&(m.message.refusal=(m.message.refusal||"")+y),w&&(m.message.role=w),_&&(m.message.function_call?(_.name&&(m.message.function_call.name=_.name),_.arguments&&((i=m.message.function_call).arguments??(i.arguments=""),m.message.function_call.arguments+=_.arguments)):m.message.function_call=_),g&&(m.message.content=(m.message.content||"")+g,!m.message.refusal&&ce(this,bc,"m",wke).call(this)&&(m.message.parsed=hke(m.message.content))),S){m.message.tool_calls||(m.message.tool_calls=[]);for(let{index:E,id:P,type:T,function:I,...N}of S){let M=(a=m.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,Jzt(ce(this,RP,"f"),M)&&(M.function.parsed_arguments=hke(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 XC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var MK,xke=b(()=>{Vle();MK=class t extends FL{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 NP,RK=b(()=>{Dr();jle();jle();Ga();ia();fke();xke();Vle();v2();xke();ake();Vle();fke();NP=class extends qe{constructor(){super(...arguments),this.messages=new DL(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(Le`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(Le`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",Cn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/chat/completions/${e}`,r)}parse(e,r){return Yzt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>OK(n,e))}runTools(e,r){return e.stream?MK.runTools(this._client,e,r):IK.runTools(this._client,e,r)}stream(e,r){return FL.createChatCompletion(this._client,e,r)}};NP.Messages=DL});var KM,Ske=b(()=>{Dr();RK();RK();KM=class extends qe{constructor(){super(...arguments),this.completions=new NP(this._client)}};KM.Completions=NP});var oUt=b(()=>{RK();RK();jle()});var iUt=b(()=>{Ske();oUt()});var aUt=b(()=>{});function*zdn(t){if(!t)return;if(sUt 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():jFe(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=jFe(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 sUt,mt,Tu=b(()=>{TP();sUt=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 zdn(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{[sUt]:!0,values:e,nulls:r}}});var O2,Cke=b(()=>{Dr();Tu();O2=class extends qe{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:mt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var E2,Oke=b(()=>{Dr();IP();E2=class extends qe{create(e,r){return this._client.post("/audio/transcriptions",lg({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var P2,Eke=b(()=>{Dr();IP();P2=class extends qe{create(e,r){return this._client.post("/audio/translations",lg({body:e,...r,__metadata:{model:e.model}},this._client))}}});var eO,Pke=b(()=>{Dr();Cke();Cke();Oke();Oke();Eke();Eke();eO=class extends qe{constructor(){super(...arguments),this.transcriptions=new E2(this._client),this.translations=new P2(this._client),this.speech=new O2(this._client)}};eO.Transcriptions=E2;eO.Translations=P2;eO.Speech=O2});var kL,Tke=b(()=>{Dr();Ga();ia();kL=class extends qe{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",Cn,{query:e,...r})}cancel(e,r){return this._client.post(Le`/batches/${e}/cancel`,r)}}});var T2,Ake=b(()=>{Dr();Ga();Tu();ia();T2=class extends qe{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(Le`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/assistants/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",Cn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(Le`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var A2,Ike=b(()=>{Dr();Tu();A2=class extends qe{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var I2,Mke=b(()=>{Dr();Tu();I2=class extends qe{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var GM,Rke=b(()=>{Dr();Ike();Ike();Mke();Mke();GM=class extends qe{constructor(){super(...arguments),this.sessions=new A2(this._client),this.transcriptionSessions=new I2(this._client)}};GM.Sessions=A2;GM.TranscriptionSessions=I2});var M2,Nke=b(()=>{Dr();Ga();Tu();ia();M2=class extends qe{create(e,r,n){return this._client.post(Le`/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(Le`/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(Le`/threads/${o}/messages/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/threads/${e}/messages`,Cn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(Le`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var R2,jke=b(()=>{Dr();Ga();Tu();ia();R2=class extends qe{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(Le`/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(Le`/threads/${o}/runs/${e}/steps`,Cn,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var uUt,lUt=b(()=>{JC();Ple();uUt=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 d_,Dke=b(()=>{d_=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 NK=b(()=>{TP();lUt();Dke();yK();NFe();y2()});var qd,BL,Lke,tO,Wle,f_,zL,N2,$L,Jle,cg,Kle,Gle,LK,jK,DK,cUt,dUt,fUt,pUt,mUt,hUt,gUt,jP,Fke=b(()=>{Iy();gke();c_();Ble();NK();jP=class extends VM{constructor(){super(...arguments),qd.add(this),Lke.set(this,[]),tO.set(this,{}),Wle.set(this,{}),f_.set(this,void 0),zL.set(this,void 0),N2.set(this,void 0),$L.set(this,void 0),Jle.set(this,void 0),cg.set(this,void 0),Kle.set(this,void 0),Gle.set(this,void 0),LK.set(this,void 0)}[(Lke=new WeakMap,tO=new WeakMap,Wle=new WeakMap,f_=new WeakMap,zL=new WeakMap,N2=new WeakMap,$L=new WeakMap,Jle=new WeakMap,cg=new WeakMap,Kle=new WeakMap,Gle=new WeakMap,LK=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 BL;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=XC.fromReadableStream(e,this.controller);for await(let i of o)ce(this,qd,"m",jK).call(this,i);if(o.controller.signal?.aborted)throw new Bs;return this._addRun(ce(this,qd,"m",DK).call(this))}toReadableStream(){return new XC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new BL;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)ce(this,qd,"m",jK).call(this,u);if(s.controller.signal?.aborted)throw new Bs;return this._addRun(ce(this,qd,"m",DK).call(this))}static createThreadAssistantStream(e,r,n){let o=new BL;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 BL;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return ce(this,Kle,"f")}currentRun(){return ce(this,Gle,"f")}currentMessageSnapshot(){return ce(this,f_,"f")}currentRunStepSnapshot(){return ce(this,LK,"f")}async finalRunSteps(){return await this.done(),Object.values(ce(this,tO,"f"))}async finalMessages(){return await this.done(),Object.values(ce(this,Wle,"f"))}async finalRun(){if(await this.done(),!ce(this,zL,"f"))throw Error("Final run was not received.");return ce(this,zL,"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)ce(this,qd,"m",jK).call(this,s);if(a.controller.signal?.aborted)throw new Bs;return this._addRun(ce(this,qd,"m",DK).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)ce(this,qd,"m",jK).call(this,u);if(s.controller.signal?.aborted)throw new Bs;return this._addRun(ce(this,qd,"m",DK).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(g2(i)&&g2(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(!g2(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)}};BL=jP,jK=function(e){if(!this.ended)switch(tr(this,Kle,e,"f"),ce(this,qd,"m",fUt).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":ce(this,qd,"m",gUt).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":ce(this,qd,"m",dUt).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":ce(this,qd,"m",cUt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},DK=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");if(!ce(this,zL,"f"))throw Error("Final run has not been received");return ce(this,zL,"f")},cUt=function(e){let[r,n]=ce(this,qd,"m",mUt).call(this,e,ce(this,f_,"f"));tr(this,f_,r,"f"),ce(this,Wle,"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!=ce(this,N2,"f")){if(ce(this,$L,"f"))switch(ce(this,$L,"f").type){case"text":this._emit("textDone",ce(this,$L,"f").text,ce(this,f_,"f"));break;case"image_file":this._emit("imageFileDone",ce(this,$L,"f").image_file,ce(this,f_,"f"));break}tr(this,N2,o.index,"f")}tr(this,$L,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(ce(this,N2,"f")!==void 0){let o=e.data.content[ce(this,N2,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,ce(this,f_,"f"));break;case"text":this._emit("textDone",o.text,ce(this,f_,"f"));break}}ce(this,f_,"f")&&this._emit("messageDone",e.data),tr(this,f_,void 0,"f")}},dUt=function(e){let r=ce(this,qd,"m",pUt).call(this,e);switch(tr(this,LK,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==ce(this,Jle,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(ce(this,cg,"f")&&this._emit("toolCallDone",ce(this,cg,"f")),tr(this,Jle,i.index,"f"),tr(this,cg,r.step_details.tool_calls[i.index],"f"),ce(this,cg,"f")&&this._emit("toolCallCreated",ce(this,cg,"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":tr(this,LK,void 0,"f"),e.data.step_details.type=="tool_calls"&&ce(this,cg,"f")&&(this._emit("toolCallDone",ce(this,cg,"f")),tr(this,cg,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},fUt=function(e){ce(this,Lke,"f").push(e),this._emit("event",e)},pUt=function(e){switch(e.event){case"thread.run.step.created":return ce(this,tO,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=ce(this,tO,"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=BL.accumulateDelta(r,n.delta);ce(this,tO,"f")[e.data.id]=o}return ce(this,tO,"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":ce(this,tO,"f")[e.data.id]=e.data;break}if(ce(this,tO,"f")[e.data.id])return ce(this,tO,"f")[e.data.id];throw new Error("No snapshot available")},mUt=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]=ce(this,qd,"m",hUt).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")},hUt=function(e,r){return BL.accumulateDelta(r,e)},gUt=function(e){switch(tr(this,Gle,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":tr(this,zL,e.data,"f"),ce(this,cg,"f")&&(this._emit("toolCallDone",ce(this,cg,"f")),tr(this,cg,void 0,"f"));break;case"thread.run.cancelling":break}}});var UL,kke=b(()=>{Dr();jke();jke();Ga();Tu();Fke();y2();ia();UL=class extends qe{constructor(){super(...arguments),this.steps=new R2(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(Le`/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(Le`/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(Le`/threads/${o}/runs/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/threads/${e}/runs`,Cn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(Le`/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 jP.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 ZC(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return jP.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/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 jP.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};UL.Steps=R2});var JM,$ke=b(()=>{Dr();Nke();Nke();kke();kke();Tu();Fke();ia();JM=class extends qe{constructor(){super(...arguments),this.runs=new UL(this._client),this.messages=new M2(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(Le`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/threads/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(Le`/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 jP.createThreadAssistantStream(e,this._client.beta.threads,r)}};JM.Runs=UL;JM.Messages=M2});var rO,Bke=b(()=>{Dr();Ake();Ake();Rke();Rke();$ke();$ke();rO=class extends qe{constructor(){super(...arguments),this.realtime=new GM(this._client),this.assistants=new T2(this._client),this.threads=new JM(this._client)}};rO.Realtime=GM;rO.Assistants=T2;rO.Threads=JM});var qL,zke=b(()=>{Dr();qL=class extends qe{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var j2,Uke=b(()=>{Dr();Tu();ia();j2=class extends qe{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(Le`/containers/${o}/files/${e}/content`,{...n,headers:mt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var HL,qke=b(()=>{Dr();Uke();Uke();Ga();Tu();IP();ia();HL=class extends qe{constructor(){super(...arguments),this.content=new j2(this._client)}create(e,r,n){return this._client.post(Le`/containers/${e}/files`,lg({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(Le`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(Le`/containers/${e}/files`,Cn,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(Le`/containers/${o}/files/${e}`,{...n,headers:mt([{Accept:"*/*"},n?.headers])})}};HL.Content=j2});var ZM,Hke=b(()=>{Dr();qke();qke();Ga();Tu();ia();ZM=class extends qe{constructor(){super(...arguments),this.files=new HL(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",Cn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/containers/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}};ZM.Files=HL});var VL,Vke=b(()=>{Dr();NK();VL=class extends qe{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&cu(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:(cu(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=uUt(u)}),a)))}}});var D2,Wke=b(()=>{Dr();Ga();ia();D2=class extends qe{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(Le`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(Le`/evals/${o}/runs/${e}/output_items`,Cn,{query:i,...n})}}});var WL,Kke=b(()=>{Dr();Wke();Wke();Ga();ia();WL=class extends qe{constructor(){super(...arguments),this.outputItems=new D2(this._client)}create(e,r,n){return this._client.post(Le`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(Le`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(Le`/evals/${e}/runs`,Cn,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(Le`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(Le`/evals/${o}/runs/${e}`,n)}};WL.OutputItems=D2});var YM,Gke=b(()=>{Dr();Kke();Kke();Ga();ia();YM=class extends qe{constructor(){super(...arguments),this.runs=new WL(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/evals/${e}`,r)}update(e,r,n){return this._client.post(Le`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",Cn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/evals/${e}`,r)}};YM.Runs=WL});var KL,Jke=b(()=>{Dr();Ga();Tu();y2();c_();IP();ia();KL=class extends qe{create(e,r){return this._client.post("/files",lg({body:e,...r},this._client))}retrieve(e,r){return this._client.get(Le`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",Cn,{query:e,...r})}delete(e,r){return this._client.delete(Le`/files/${e}`,r)}content(e,r){return this._client.get(Le`/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 ZC(r),a=await this.retrieve(e),Date.now()-i>n)throw new KC({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var L2,Zke=b(()=>{Dr();L2=class extends qe{}});var F2,Yke=b(()=>{Dr();F2=class extends qe{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 GL,Xke=b(()=>{Dr();Yke();Yke();GL=class extends qe{constructor(){super(...arguments),this.graders=new F2(this._client)}};GL.Graders=F2});var k2,Qke=b(()=>{Dr();Ga();ia();k2=class extends qe{create(e,r,n){return this._client.getAPIList(Le`/fine_tuning/checkpoints/${e}/permissions`,QC,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(Le`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(Le`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var JL,e$e=b(()=>{Dr();Qke();Qke();JL=class extends qe{constructor(){super(...arguments),this.permissions=new k2(this._client)}};JL.Permissions=k2});var $2,t$e=b(()=>{Dr();Ga();ia();$2=class extends qe{list(e,r={},n){return this._client.getAPIList(Le`/fine_tuning/jobs/${e}/checkpoints`,Cn,{query:r,...n})}}});var ZL,r$e=b(()=>{Dr();t$e();t$e();Ga();ia();ZL=class extends qe{constructor(){super(...arguments),this.checkpoints=new $2(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",Cn,{query:e,...r})}cancel(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(Le`/fine_tuning/jobs/${e}/events`,Cn,{query:r,...n})}pause(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/resume`,r)}};ZL.Checkpoints=$2});var p_,n$e=b(()=>{Dr();Zke();Zke();Xke();Xke();e$e();e$e();r$e();r$e();p_=class extends qe{constructor(){super(...arguments),this.methods=new L2(this._client),this.jobs=new ZL(this._client),this.checkpoints=new JL(this._client),this.alpha=new GL(this._client)}};p_.Methods=L2;p_.Jobs=ZL;p_.Checkpoints=JL;p_.Alpha=GL});var B2,o$e=b(()=>{Dr();B2=class extends qe{}});var XM,i$e=b(()=>{Dr();o$e();o$e();XM=class extends qe{constructor(){super(...arguments),this.graderModels=new B2(this._client)}};XM.GraderModels=B2});var YL,a$e=b(()=>{Dr();IP();YL=class extends qe{createVariation(e,r){return this._client.post("/images/variations",lg({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",lg({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 XL,s$e=b(()=>{Dr();Ga();ia();XL=class extends qe{retrieve(e,r){return this._client.get(Le`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",QC,e)}delete(e,r){return this._client.delete(Le`/models/${e}`,r)}}});var QL,u$e=b(()=>{Dr();QL=class extends qe{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function yUt(t,e){return!e||!ffn(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)}:l$e(t,e)}function l$e(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:hfn(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:dfn(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Zle(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 dfn(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function ffn(t){return!!CK(t.text?.format)}function pfn(t){return t?.$brand==="auto-parseable-tool"}function mfn(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function hfn(t,e){let r=mfn(t.tools??[],e.name);return{...e,...e,parsed_arguments:pfn(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Zle(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 Yle=b(()=>{c_();v2()});function gfn(t,e){return yUt(t,e)}var z2,Xle,QM,Qle,bUt,_Ut,vUt,wUt,ece,xUt=b(()=>{Iy();c_();Ble();Yle();ece=class t extends VM{constructor(e){super(),z2.add(this),Xle.set(this,void 0),QM.set(this,void 0),Qle.set(this,void 0),tr(this,Xle,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())),ce(this,z2,"m",bUt).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)ce(this,z2,"m",_Ut).call(this,s,a);if(i.controller.signal?.aborted)throw new Bs;return ce(this,z2,"m",vUt).call(this)}[(Xle=new WeakMap,QM=new WeakMap,Qle=new WeakMap,z2=new WeakSet,bUt=function(){this.ended||tr(this,QM,void 0,"f")},_Ut=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=ce(this,z2,"m",wUt).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}},vUt=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");let r=ce(this,QM,"f");if(!r)throw new ht("request ended without sending any events");tr(this,QM,void 0,"f");let n=gfn(r,ce(this,Xle,"f"));return tr(this,Qle,n,"f"),n},wUt=function(r){let n=ce(this,QM,"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=tr(this,QM,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":{tr(this,QM,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=ce(this,Qle,"f");if(!e)throw new ht("stream ended without producing a ChatCompletion");return e}}});var U2,c$e=b(()=>{Dr();Ga();ia();U2=class extends qe{list(e,r={},n){return this._client.getAPIList(Le`/responses/${e}/input_items`,Cn,{query:r,...n})}}});var eR,d$e=b(()=>{Yle();xUt();Dr();c$e();c$e();Tu();ia();eR=class extends qe{constructor(){super(...arguments),this.inputItems=new U2(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"&&Zle(n),n))}retrieve(e,r={},n){return this._client.get(Le`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Zle(o),o))}delete(e,r){return this._client.delete(Le`/responses/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>l$e(n,e))}stream(e,r){return ece.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(Le`/responses/${e}/cancel`,r)}};eR.InputItems=U2});var q2,f$e=b(()=>{Dr();IP();ia();q2=class extends qe{create(e,r,n){return this._client.post(Le`/uploads/${e}/parts`,lg({body:r,...n},this._client))}}});var tR,p$e=b(()=>{Dr();f$e();f$e();ia();tR=class extends qe{constructor(){super(...arguments),this.parts=new q2(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(Le`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(Le`/uploads/${e}/complete`,{body:r,...n})}};tR.Parts=q2});var SUt,CUt=b(()=>{SUt=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 H2,m$e=b(()=>{Dr();Ga();Tu();y2();CUt();ia();H2=class extends qe{create(e,r,n){return this._client.post(Le`/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(Le`/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(Le`/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(Le`/vector_stores/${o}/file_batches/${e}/files`,Cn,{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 ZC(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 h=await s.files.create({file:p,purpose:"assistants"},o);l.push(h.id)}}let d=Array(a).fill(u).map(c);return await SUt(d),await this.createAndPoll(e,{file_ids:l})}}});var V2,h$e=b(()=>{Dr();Ga();Tu();NK();ia();V2=class extends qe{create(e,r,n){return this._client.post(Le`/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(Le`/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(Le`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/vector_stores/${e}/files`,Cn,{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(Le`/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 ZC(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(Le`/vector_stores/${o}/files/${e}/content`,QC,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var DP,g$e=b(()=>{Dr();m$e();m$e();h$e();h$e();Ga();Tu();ia();DP=class extends qe{constructor(){super(...arguments),this.files=new V2(this._client),this.fileBatches=new H2(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(Le`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/vector_stores/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",Cn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(Le`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(Le`/vector_stores/${e}/search`,QC,{body:r,method:"post",...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};DP.Files=V2;DP.FileBatches=H2});var W2,OUt,tce,eF,y$e=b(()=>{Iy();c_();Dr();Tu();eF=class extends qe{constructor(){super(...arguments),W2.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");ce(this,W2,"m",OUt).call(this,n);let i=mt([r]).values,a=ce(this,W2,"m",tce).call(this,i,"webhook-signature"),s=ce(this,W2,"m",tce).call(this,i,"webhook-timestamp"),u=ce(this,W2,"m",tce).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new GC("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new GC("Webhook timestamp is too old");if(l>c+o)throw new GC("Webhook timestamp is too new");let d=a.split(" ").map(m=>m.startsWith("v1,")?m.substring(3):m),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=u?`${u}.${s}.${e}`:`${s}.${e}`,h=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let m of d)try{let g=Buffer.from(m,"base64");if(await crypto.subtle.verify("HMAC",h,g,new TextEncoder().encode(p)))return}catch{continue}throw new GC("The given webhook signature does not match the expected signature")}};W2=new WeakSet,OUt=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")},tce=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 EUt=b(()=>{iUt();aUt();Pke();Tke();Bke();zke();Hke();Vke();Gke();Jke();n$e();i$e();a$e();s$e();u$e();d$e();p$e();g$e();y$e()});var b$e,_$e,rce,PUt,Er,nce=b(()=>{Iy();NFe();TP();y2();wle();LFe();hK();Ezt();Dzt();DFe();JC();Ga();tke();EUt();Mle();Tke();zke();Vke();Jke();a$e();s$e();u$e();y$e();Pke();Bke();Ske();Hke();Gke();n$e();i$e();d$e();p$e();g$e();LFe();Tu();Dke();yK();TP();Er=class{constructor({baseURL:e=d_("OPENAI_BASE_URL"),apiKey:r=d_("OPENAI_API_KEY"),organization:n=d_("OPENAI_ORG_ID")??null,project:o=d_("OPENAI_PROJECT_ID")??null,webhookSecret:i=d_("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(b$e.add(this),rce.set(this,void 0),this.completions=new qL(this),this.chat=new KM(this),this.embeddings=new VL(this),this.files=new KL(this),this.images=new YL(this),this.audio=new eO(this),this.moderations=new QL(this),this.models=new XL(this),this.fineTuning=new p_(this),this.graders=new XM(this),this.vectorStores=new DP(this),this.webhooks=new eF(this),this.beta=new rO(this),this.batches=new kL(this),this.uploads=new tR(this),this.responses=new eR(this),this.evals=new YM(this),this.containers=new ZM(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&&wzt())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??_$e.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=WFe(s.logLevel,"ClientOptions.logLevel",this)??WFe(d_("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??Szt(),tr(this,rce,Ozt,"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 HFe(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${HM}`}defaultIdempotencyKey(){return`stainless-node-retry-${RFe()}`}makeStatusError(e,r,n,o){return gc.generate(e,r,n,o)}buildURL(e,r,n){let o=!ce(this,b$e,"m",PUt).call(this)&&n||this.baseURL,i=fzt(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return mzt(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 jL(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(cu(this).debug(`[${l}] sending request`,AP({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new Bs;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(mK),h=Date.now();if(p instanceof Error){let y=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Bs;let _=pK(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return cu(this).info(`[${l}] connection ${_?"timed out":"failed"} - ${y}`),cu(this).debug(`[${l}] connection ${_?"timed out":"failed"} (${y})`,AP({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),this.retryRequest(o,r,n??l);throw cu(this).info(`[${l}] connection ${_?"timed out":"failed"} - error; no more retries left`),cu(this).debug(`[${l}] connection ${_?"timed out":"failed"} (error; no more retries left)`,AP({retryOfRequestLogID:n,url:s,durationMs:h-d,message:p.message})),_?new KC:new qM({cause:p})}let m=[...p.headers.entries()].filter(([y])=>y==="x-request-id").map(([y,_])=>", "+y+": "+JSON.stringify(_)).join(""),g=`[${l}${c}${m}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){let y=await this.shouldRetry(p);if(r&&y){let P=`retrying, ${r} attempts remaining`;return await Czt(p.body),cu(this).info(`${g} - ${P}`),cu(this).debug(`[${l}] response error (${P})`,AP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(o,r,n??l,p.headers)}let _=y?"error; no more retries left":"error; not retryable";cu(this).info(`${g} - ${_}`);let w=await p.text().catch(P=>mK(P).message),S=yzt(w),C=S?void 0:w;throw cu(this).debug(`[${l}] response error (${_})`,AP({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 cu(this).info(g),cu(this).debug(`[${l}] response start`,AP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-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 vK(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 ZC(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&&gzt("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))}:{},...xzt(),"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:xle(e)}:ce(this,rce,"f").call(this,{body:e,headers:n})}};_$e=Er,rce=new WeakMap,b$e=new WeakSet,PUt=function(){return this.baseURL!=="https://api.openai.com/v1"};Er.OpenAI=_$e;Er.DEFAULT_TIMEOUT=6e5;Er.OpenAIError=ht;Er.APIError=gc;Er.APIConnectionError=qM;Er.APIConnectionTimeoutError=KC;Er.APIUserAbortError=Bs;Er.NotFoundError=l2;Er.ConflictError=c2;Er.RateLimitError=f2;Er.BadRequestError=a2;Er.AuthenticationError=s2;Er.InternalServerError=p2;Er.PermissionDeniedError=u2;Er.UnprocessableEntityError=d2;Er.InvalidWebhookSignatureError=GC;Er.toFile=xK;Er.Completions=qL;Er.Chat=KM;Er.Embeddings=VL;Er.Files=KL;Er.Images=YL;Er.Audio=eO;Er.Moderations=QL;Er.Models=XL;Er.FineTuning=p_;Er.Graders=XM;Er.VectorStores=DP;Er.Webhooks=eF;Er.Beta=rO;Er.Batches=kL;Er.Uploads=tR;Er.Responses=eR;Er.Evals=YM;Er.Containers=ZM});var tF,xfn,TUt,AUt=b(()=>{c_();NK();nce();Tu();tF=class extends Er{constructor({baseURL:e=d_("OPENAI_BASE_URL"),apiKey:r=d_("AZURE_OPENAI_API_KEY"),apiVersion:n=d_("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=TUt),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(xfn.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!g2(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!==TUt)e.headers.values.set("api-key",this.apiKey);else throw new ht("Unable to handle auth");return super.prepareOptions(e)}},xfn=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]),TUt="<Missing Key>"});var nO=b(()=>{nce();tke();Mle();nce();Ga();JC();AUt()});function Qm(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=vB(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Mh([`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 oO(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 eh(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var v$e,Hd,IUt=b(()=>{FB();dSe();GA();hj();bE();v$e=class extends Cj{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(Wi(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=>Qm(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 v$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 wQe(this.zodSchema,e);if(r.success)return r.data;throw new Mh(`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 MUt=b(()=>{IUt()});var K2=b(()=>{MUt()});var w$e=b(()=>{_j()});function LP(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 rR=b(()=>{});var NUt,RUt,jUt,oce=b(()=>{NUt=Symbol("Let zodToJsonSchema decide on which parser to use"),RUt={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"?{...RUt,basePath:["#"],definitions:{},name:t}:{...RUt,basePath:["#"],definitions:{},...t}});function DUt(t){if(!t)return!0;for(let e in t)return!1;return!0}var FK,x$e=b(()=>{FK=t=>"_def"in t?t._def:t});var LUt,S$e=b(()=>{oce();x$e();LUt=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])=>[FK(o),{def:FK(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function C$e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function go(t,e,r,n,o){t[e]=r,C$e(t,e,n,o)}var nR=b(()=>{});function FUt(){return{}}var O$e=b(()=>{});function kUt(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=Pr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&go(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&go(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(go(r,"minItems",t.exactLength.value,t.exactLength.message,e),go(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var E$e=b(()=>{xd();nR();Au()});function $Ut(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?go(r,"minimum",n.value,n.message,e):go(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),go(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?go(r,"maximum",n.value,n.message,e):go(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),go(r,"maximum",n.value,n.message,e));break;case"multipleOf":go(r,"multipleOf",n.value,n.message,e);break}return r}var P$e=b(()=>{nR()});function BUt(){return{type:"boolean"}}var T$e=b(()=>{});function zUt(t,e){return Pr(t.type._def,e)}var A$e=b(()=>{Au()});var UUt,I$e=b(()=>{Au();UUt=(t,e)=>Pr(t.innerType._def,e)});function M$e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>M$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 Sfn(t,e)}}var Sfn,R$e=b(()=>{nR();Sfn=(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":go(r,"minimum",n.value,n.message,e);break;case"max":go(r,"maximum",n.value,n.message,e);break}return r}});function qUt(t,e){return{...Pr(t.innerType._def,e),default:t.defaultValue()}}var N$e=b(()=>{Au()});function HUt(t,e,r){return e.effectStrategy==="input"?Pr(t.schema._def,e,r):{}}var j$e=b(()=>{Au()});function VUt(t){return{type:"string",enum:[...t.values]}}var D$e=b(()=>{});function WUt(t,e){let r=[Pr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Pr(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(Cfn(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 Cfn,L$e=b(()=>{Au();Cfn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function KUt(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 F$e=b(()=>{});function ice(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Ofn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":go(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":go(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":m_(r,"email",o.message,e);break;case"format:idn-email":m_(r,"idn-email",o.message,e);break;case"pattern:zod":h_(r,rF.email,o.message,e);break}break;case"url":m_(r,"uri",o.message,e);break;case"uuid":m_(r,"uuid",o.message,e);break;case"regex":h_(r,o.regex,o.message,e);break;case"cuid":h_(r,rF.cuid,o.message,e);break;case"cuid2":h_(r,rF.cuid2,o.message,e);break;case"startsWith":h_(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":h_(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":m_(r,"date-time",o.message,e);break;case"date":m_(r,"date",o.message,e);break;case"time":m_(r,"time",o.message,e);break;case"duration":m_(r,"duration",o.message,e);break;case"length":go(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),go(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{h_(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&m_(r,"ipv4",o.message,e),o.version!=="v4"&&m_(r,"ipv6",o.message,e);break}case"emoji":h_(r,rF.emoji,o.message,e);break;case"ulid":{h_(r,rF.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{m_(r,"binary",o.message,e);break}case"contentEncoding:base64":{go(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{h_(r,rF.base64,o.message,e);break}}break}case"nanoid":h_(r,rF.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var k$e,rF,Ofn,m_,h_,GUt,ace=b(()=>{nR();rF={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:()=>(k$e===void 0&&(k$e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),k$e),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}$/};Ofn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),m_=(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}}})):go(t,"format",e,r,n)},h_=(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:GUt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):go(t,"pattern",GUt(e,n),r,n)},GUt=(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 sce(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]:Pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Pr(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(ice(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 uce=b(()=>{xd();Au();ace()});function JUt(t,e){if(e.mapStrategy==="record")return sce(t,e);let r=Pr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Pr(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 $$e=b(()=>{Au();uce()});function ZUt(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 B$e=b(()=>{});function YUt(){return{not:{}}}var z$e=b(()=>{});function XUt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var U$e=b(()=>{});function eqt(t,e){if(e.target==="openApi3")return QUt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in kK&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=kK[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 QUt(t,e)}var kK,QUt,lce=b(()=>{Au();kK={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};QUt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Pr(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 tqt(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:kK[t.innerType._def.typeName],nullable:!0}:{type:[kK[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Pr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var q$e=b(()=>{Au();lce()});function rqt(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",C$e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?go(r,"minimum",n.value,n.message,e):go(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),go(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?go(r,"maximum",n.value,n.message,e):go(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),go(r,"maximum",n.value,n.message,e));break;case"multipleOf":go(r,"multipleOf",n.value,n.message,e);break}return r}var H$e=b(()=>{nR()});function Efn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function nqt(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=Pr(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:Efn(t,e)};return r.required.length||delete r.required,r}var V$e=b(()=>{Au()});var oqt,W$e=b(()=>{Au();oqt=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return Pr(t.innerType._def,{...e,currentPath:e.currentPath});let r=Pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var iqt,K$e=b(()=>{Au();iqt=(t,e)=>{if(e.pipeStrategy==="input")return Pr(t.in._def,e);if(e.pipeStrategy==="output")return Pr(t.out._def,e);let r=Pr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Pr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function aqt(t,e){return Pr(t.type._def,e)}var G$e=b(()=>{Au()});function sqt(t,e){let n={type:"array",uniqueItems:!0,items:Pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&go(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&go(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var J$e=b(()=>{nR();Au()});function uqt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Pr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Z$e=b(()=>{Au()});function lqt(){return{not:{}}}var Y$e=b(()=>{});function cqt(){return{}}var X$e=b(()=>{});var dqt,Q$e=b(()=>{Au();dqt=(t,e)=>Pr(t.innerType._def,e)});function Pr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==NUt)return a}if(n&&!r){let a=Pfn(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=Afn(t,t.typeName,e,r);return i&&Ifn(t,e,i),o.jsonSchema=i,i}var Pfn,Tfn,Afn,Ifn,Au=b(()=>{xd();O$e();E$e();P$e();T$e();A$e();I$e();R$e();N$e();j$e();D$e();L$e();F$e();$$e();B$e();z$e();U$e();q$e();H$e();V$e();W$e();K$e();G$e();uce();J$e();ace();Z$e();Y$e();lce();X$e();Q$e();oce();Pfn=(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:Tfn(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}},Tfn=(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("/")},Afn=(t,e,r,n)=>{switch(e){case re.ZodString:return ice(t,r);case re.ZodNumber:return rqt(t,r);case re.ZodObject:return nqt(t,r);case re.ZodBigInt:return $Ut(t,r);case re.ZodBoolean:return BUt();case re.ZodDate:return M$e(t,r);case re.ZodUndefined:return lqt();case re.ZodNull:return XUt(r);case re.ZodArray:return kUt(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return eqt(t,r);case re.ZodIntersection:return WUt(t,r);case re.ZodTuple:return uqt(t,r);case re.ZodRecord:return sce(t,r);case re.ZodLiteral:return KUt(t,r);case re.ZodEnum:return VUt(t);case re.ZodNativeEnum:return ZUt(t);case re.ZodNullable:return tqt(t,r);case re.ZodOptional:return oqt(t,r);case re.ZodMap:return JUt(t,r);case re.ZodSet:return sqt(t,r);case re.ZodLazy:return Pr(t.getter()._def,r);case re.ZodPromise:return aqt(t,r);case re.ZodNaN:case re.ZodNever:return YUt();case re.ZodEffects:return HUt(t,r,n);case re.ZodAny:return FUt();case re.ZodUnknown:return cqt();case re.ZodDefault:return qUt(t,r);case re.ZodBranded:return zUt(t,r);case re.ZodReadonly:return dqt(t,r);case re.ZodCatch:return UUt(t,r);case re.ZodPipeline:return iqt(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},Ifn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var eBe,tBe=b(()=>{Au();S$e();x$e();eBe=(t,e)=>{let r=LUt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Pr(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(DUt(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]=Pr(FK(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 fqt=b(()=>{oce();S$e();nR();Au();O$e();E$e();P$e();T$e();A$e();I$e();R$e();N$e();j$e();D$e();L$e();F$e();$$e();B$e();z$e();U$e();q$e();H$e();V$e();W$e();K$e();G$e();Q$e();uce();J$e();ace();Z$e();Y$e();lce();X$e();tBe();tBe()});function Mfn(t,e){return eBe(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function pqt(t,e,r){return Kzt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Mfn(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var mqt=b(()=>{v2();fqt();Yle()});function $K(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var hqt=b(()=>{});function oR(t){let e;return t.constructor.name===KC.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Bs.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=$K(t,"INVALID_TOOL_RESULTS"):t.status===401?e=$K(t,"MODEL_AUTHENTICATION"):t.status===429?e=$K(t,"MODEL_RATE_LIMIT"):t.status===404?e=$K(t,"MODEL_NOT_FOUND"):e=t,e}function rBe(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 Rfn(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function gqt(t,e,r){if(Ah(t))return pqt(t,e,r);if(Sm(t))return Rfn({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:F6(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>UQ(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}var nF=b(()=>{nO();ag();IL();w$e();HQ();mqt();hqt()});function Nfn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function yqt(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(bqt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function bqt(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}: ${cce(o,e)},`):r.push(`${n}?: ${cce(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function cce(t,e){if(Nfn(t))return t.anyOf.map(r=>cce(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["{",bqt(t,e+2),"}"].join(`
`);case"array":return t.items?`${cce(t.items,e)}[]`:"any[]";default:return""}}var _qt=b(()=>{});function vqt(t,e){let r;return Wc(t)?r=qC(t):r=t,r.type==="function"&&e?.strict!==void 0&&(r.function.strict=e.strict),r}function dce(t){return"type"in t&&t.type!=="function"&&t.type!=="custom"}function wqt(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function xqt(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 nBe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function Sqt(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 Cqt(t){return t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function Oqt(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 Eqt(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 Pqt=b(()=>{ag();nF()});function mce(t){return t&&(/^o\d/.test(t)||t.startsWith("gpt-5"))}function jfn(t){return t!==void 0&&typeof t.schema=="object"}function Dfn(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 iBe(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(!Ys.isInstance(t))throw new Error("Invalid generic chat message");return Dfn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function oBe(t,e){return t.flatMap(r=>{let n=iBe(r);n==="system"&&mce(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>Ib(a)?x6(a,Tqt):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=""),Wi(r)&&r.tool_calls?.length?(i.tool_calls=r.tool_calls.map(oO),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 G2,Tqt,BK,fce,pce,iO,hce=b(()=>{nO();$s();Zf();no();HC();ig();Pm();Db();K2();IL();w$e();rR();nF();_qt();Pqt();G2="__openai_function_call_ids__";Tqt={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=wB({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=G0e(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=G0e(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(!wB({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`)}};BK=class extends Pu{_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(!mce(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&&Ih(e.json_schema.schema)?gqt(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=LP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Er(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return xqt(e)?Eqt(e.metadata.customTool):$d(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:vqt(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=>dce(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(iBe(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=yqt(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;jfn(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"){Ih(n)?u=Sd.fromZodSchema(n):u=new Cd;let f=Cm(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:bj(n),schema:n,strict:r?.strict},p=Cm(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}}}),Ih(n)){let h=Sd.fromZodSchema(n);u=Tp.from(m=>"parsed"in m.additional_kwargs?m.additional_kwargs.parsed:h)}else u=new Cd}else{let f=o??"extract";if(Ih(n)){let p=Cm(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 h=Cm(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,...h}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new Hd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Lo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Lo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Li.from([{raw:s},d])}},fce=class extends BK{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:wqt(e?.tool_choice)?e?.tool_choice:(()=>{let i=rBe(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 oR(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(Qm(l,{returnId:!0}))}catch(c){let d;typeof c=="object"&&c!=null&&"message"in c&&typeof c.message=="string"&&(d=c.message),i.push(eh(l,d))}s[G2]??(s[G2]={}),u.id&&(s[G2][u.call_id]=u.id)}else if(u.type==="reasoning")s.reasoning=u;else if(u.type==="custom_tool_call"){let l=Sqt(u);l?o.push(l):i.push(eh(u,"Malformed custom tool call"))}else s.tool_outputs??(s.tool_outputs=[]),s.tool_outputs.push(u);return new kn({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[G2]={[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 Sr({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=iBe(r);if(o==="system"&&mce(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?.[G2];Wi(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(c=>Cqt(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}),Ib(s)?x6(s,Tqt):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)dce(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}):nBe(o)&&n.push(Oqt(o));return n}},pce=class extends BK{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:rBe(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),mce(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=oBe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{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 h of s?.choices??[]){let g={text:h.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(h.message??{role:"assistant"},s)};g.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Wi(g.message)&&(g.message.usage_metadata=o),g.message=new kn(Object.fromEntries(Object.entries(g.message).filter(([y])=>!y.startsWith("lc_")))),p.push(g)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async*_streamResponseChunks(e,r,n){let o=oBe(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 h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model,h.service_tier=l.service_tier),this.logprobs&&(h.logprobs=c.logprobs);let m=new co({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}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 Sr({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 oR(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(Qm(u,{returnId:!0}))}catch(l){i.push(eh(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 kn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Ys(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 Cp({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 Sr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Ef({content:i,response_metadata:s}):o==="developer"?new Ef({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Eh({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Vg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Sp({content:i,role:o,response_metadata:s})}},iO=class t extends BK{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 fce(e),this.completions=e?.completions??new pce(e)}_useResponsesApi(e){let r=e?.tools?.some(dce),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(nBe);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 Aqt(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function gce(t){let e=Lfn(()=>{if(Aqt(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&Aqt(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 Lfn,yce=b(()=>{Lfn=t=>t()});var Iqt=b(()=>{nO();no();hce();rR();yce()});var aBe=b(()=>{nO();ig();Zf();no();CL();Ay();rR();nF()});var Nqt=b(()=>{nO();no();aBe();rR();yce()});var FP,sBe=b(()=>{nO();no();PP();Ay();rR();nF();FP=class extends qp{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=Hp(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=LP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Er(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw oR(n)}})}}});var bce,jqt=b(()=>{nO();no();sBe();rR();nF();yce();bce=class extends FP{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=LP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL;let a=gce(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 tF({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 oR(n)}})}}});var Dqt=b(()=>{});function Ffn(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!VYe(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new mE({content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new mE({content:kfn(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function kfn(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var uBe,iR,Lqt=b(()=>{NX();$6();UA();aK();vv();xB();yj();PQ();bE();_j();nle();uBe=class extends e2{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=In(OB(this.defaultConfig,r));return $A(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=$A(e)?e.args:e,i;if(Ih(this.schema))try{i=await DB(this.schema,o)}catch(h){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
Details: ${h.message}`),new mj(m,JSON.stringify(e))}else{let h=va(o,this.schema);if(!h.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
Details: ${h.errors.map(g=>`${g.keywordLocation}: ${g.error}`).join(`
`)}`),new mj(m,JSON.stringify(e))}i=o}let a=T6(r),u=await gu.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(h){throw await u?.handleToolError(h),h}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;$A(e)&&(f=e.id),!f&&kYe(a)&&(f=a.toolCall.id);let p=Ffn({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},iR=class extends uBe{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 zK=b(()=>{Lqt()});var lBe,Fqt=b(()=>{no();nO();zK();lBe=class extends iR{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 Er(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(lBe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var kqt=b(()=>{Fqt()});var $qt=b(()=>{hce()});var Bqt=b(()=>{yj()});var zqt=b(()=>{Pm();Bqt();zK()});var Uqt=b(()=>{nO();hce();Iqt();aBe();Nqt();jqt();sBe();Dqt();nF();rR();kqt();$qt();zqt()});var _ce=b(()=>{Uqt()});var vce,qqt=b(()=>{PP();Ay();no();vce=class extends qp{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=Hp(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 Hqt=b(()=>{qqt()});var wce,Vqt=b(()=>{Hqt();wce=class extends vce{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var UK,Wqt=b(()=>{_ce();UK=class extends FP{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 xce,$fn,Iu,oF=b(()=>{or();jj();xE();bt();My();ir();cFe();yFe();MFe();_ce();xce=require("obsidian");Vqt();Wqt();$fn={"copilot-plus":UK,"copilot-plus-jina":wce,openai:FP,cohereai:ule,google:hle,"azure openai":bce,ollama:vle,"lm-studio":UK,"3rd party (openai-format)":FP},Iu=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>oe().plusLicenseKey,"copilot-plus-jina":()=>oe().plusLicenseKey,openai:()=>oe().openAIApiKey,cohereai:()=>oe().cohereApiKey,google:()=>oe().googleApiKey,"azure openai":()=>oe().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),wa(()=>this.initialize())}initialize(){let e=oe().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=$fn[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(QA).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=tn(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=tn(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=oe();if(!t.modelMap.hasOwnProperty(e))throw new rn(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!oe().isPlusUser)throw new xce.Notice("Plus-only model, please consider upgrading to Plus to access it."),new rn("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Ji.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new xce.Notice("Believer-only model, please consider upgrading to Believer to access it."),new rn("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new rn(`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 rn(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=oe(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await So(r.plusLicenseKey),timeout:1e4,batchSize:oe().embeddingBatchSize,configuration:{baseURL:tI,fetch:e.enableCors?_u:void 0}},"copilot-plus-jina":{model:n,apiKey:await So(r.plusLicenseKey),timeout:1e4,batchSize:oe().embeddingBatchSize,dimensions:e.dimensions,baseUrl:tI+"/embeddings",configuration:{fetch:e.enableCors?_u:void 0}},openai:{modelName:n,apiKey:await So(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:oe().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?_u:void 0}},cohereai:{model:n,apiKey:await So(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await So(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await So(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 So(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await So(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?_u:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await So(e.apiKey||""),batchSize:oe().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?_u: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 xce.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: `+eo(n)+`
with CORS Error: `+eo(o);throw new Error(i)}}}}});function Jqt(t){return t!==void 0&&qK.includes(t)?Kqt[t]:void 0}var Kqt,Gqt,qK,Sce=b(()=>{Kqt={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"},Gqt={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},qK=Object.keys(Kqt)});function aa(t,e){if(e.length<cBe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=cBe)Array.prototype.push.apply(t,e.slice(n,n+cBe))}}function e2t(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 Ufn(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function qfn(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Qqt(){return BigInt(Math.floor(performance.now()*1e6))}function iF(t){return typeof t=="number"&&(t=BigInt(t)),t<Zqt?`${t}ns`:t<Yqt?`${t/Zqt}\u03BCs`:t<Xqt?`${t/Yqt}ms`:`${t/Xqt}s`}function g_(){return Ufn()?Qqt():qfn()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Qqt():BigInt(0)}function HK(){return`${Bfn}-${zfn++}`}function J2(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 t2t(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function Z2(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 Cce(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 Y2(t,e){return Cce(t,[e])[e]}function dBe(t,e){let r=Hfn[e];if(r===void 0)throw new Error(Xt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function Oce(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 Mu(t){return t?.constructor?.name==="AsyncFunction"}var Bfn,zfn,Zqt,Yqt,Xqt,cBe,Hfn,du=b(()=>{Gc();Bfn=Date.now().toString().slice(5),zfn=0,Zqt=BigInt(1e3),Yqt=BigInt(1e6),Xqt=BigInt(1e9),cBe=65535;Hfn={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Xt(t,...e){let r=new Error(e2t(Wfn[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var Vfn,Wfn,Gc=b(()=>{Sce();du();Vfn=qK.join(`
- `),Wfn={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:
- ${Vfn}`,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 r2t(t){return{raw:Number(t),formatted:iF(t)}}function n2t(t){if(t.id){if(typeof t.id!="string")throw Xt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return HK()}function fBe(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(kP(n)){let i=mBe(n);if(!Array.isArray(o)||o.length!==i)throw Xt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(X2(n)){if(!Array.isArray(o))return r;let i=pBe(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=fBe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function o2t(t){return t==="geopoint"}function kP(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function X2(t){return typeof t=="string"&&Kfn[t]}function pBe(t){return Gfn[t]}function mBe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Xt("INVALID_VECTOR_VALUE",t);case e<=0:throw Xt("INVALID_VECTOR_SIZE",t);default:return e}}var Kfn,Gfn,VK=b(()=>{Gc();du();du();Kfn={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Gfn={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function i2t(){return{idToInternalId:new Map,internalIdToId:[],save:Jfn,load:Zfn}}function Jfn(t){return{internalIdToId:t.internalIdToId}}function Zfn(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 Ry(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var Ny=b(()=>{});function Xfn(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Qfn(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 tpn(t){return t.docs}function rpn(t,e,r){let n=zi(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function npn(t,e){let r=zi(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function opn(t){return t.count}function ipn(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function apn(t){return{docs:t.docs,count:t.count}}function a2t(){return{create:Xfn,get:Qfn,getMultiple:epn,getAll:tpn,store:rpn,remove:npn,count:opn,load:ipn,save:apn}}var hBe=b(()=>{Ny()});function u2t(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),Xt("PLUGIN_CRASHED")}return r}var s2t,l2t=b(()=>{Gc();s2t=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function y_(t,e,r,n){if(t.some(Mu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function aF(t,e,r){if(t.some(Mu))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function Q2(t,e,r,n,o){if(t.some(Mu))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function e4(t,e,r,n){if(t.some(Mu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function d2t(t,e){if(t.some(Mu))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var c2t,gBe,aR=b(()=>{du();c2t=["tokenizer","index","documentsStore","sorter"],gBe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function yBe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(jy(t.l),jy(t.r))+1,e.h=Math.max(jy(e.l),jy(e.r))+1,e}function bBe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(jy(t.l),jy(t.r))+1,e.h=Math.max(jy(e.l),jy(e.r))+1,e}function p2t(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&aa(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function _Be(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&&aa(n,i.v),!r&&i.k>e&&aa(n,i.v),o.push(i.r),o.push(i.l))}return n}function vBe(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&&aa(n,i.v),!r&&i.k<e&&aa(n,i.v),o.push(i.r),o.push(i.l))}return n}function m2t(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 h2t(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function g2t(t,e,r,n=500){function o(i,a,s){if(i===null)return f2t++,{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 f2t%n===0?upn(i,a):i}t.root=o(t.root,e,r)}function upn(t,e){t.h=1+Math.max(jy(t.l),jy(t.r));let r=jy(t.l)-jy(t.r);return r>1&&e<t.l.k?bBe(t):r<-1&&e>t.r.k?yBe(t):r>1&&e>t.l.k?(t.l=yBe(t.l),bBe(t)):r<-1&&e<t.r.k?(t.r=bBe(t.r),yBe(t)):t}function jy(t){return t!==null?t.h:-1}function y2t(t,e){let r=m2t(t.root,e);return r===null?null:r.v}function lpn(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 b2t(t,e,r){let n=m2t(t.root,r);if(n){if(n.v.length===1){lpn(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var f2t,_2t=b(()=>{du();f2t=0});function v2t(){return{numberToDocumentId:new Map}}function w2t(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function x2t(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 S2t(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&&aa(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&&aa(i,u)}return i}}throw new Error("Invalid operation")}function C2t(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 Z2(i)}}throw new Error("Invalid operation")}var O2t=b(()=>{du()});function cpn(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 wBe(t,e,r){let n=cpn(t,e,r);return{distance:n,isBounded:n>=0}}var xBe=b(()=>{});function t4(t,e){t.w=e.w+t.s}function Ece(t,e){t.d.push(e)}function dpn(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function CBe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(J2(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&wBe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),J2(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))CBe(t.c[i],e,r,n,o);return e}function E2t(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 sF(t=!1,e="",r=""){return new SBe(r,e,t)}function P2t(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=E2t(u,a),d=c.length;if(u===a){Ece(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=sF(!0,a,i);p.c[f]=s;let h=p.c[f];h.s=u.substring(d),h.k=f,t.c[i]=p,t4(p,t),t4(h,p),Ece(p,r);return}if(d<l&&d<a.length){let p=sF(!1,c,i);p.c[f]=s,t.c[i]=p;let h=p.c[f];h.s=u.substring(d),h.k=f;let m=a[d],g=sF(!0,e.substring(o+d),m);Ece(g,r),p.c[m]=g,t4(p,t),t4(g,p),t4(h,p);return}o+=l-1,t=s}else{let u=sF(!0,a,i);Ece(u,r),t.c[i]=u,t4(u,t);return}}}function WK(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){CBe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(wBe(e,a,o).isBounded&&(i[a]=[]),J2(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&&WK(t.c[e[r]],e,r+1,n,o,i),WK(t,e,r+1,n-1,o,i);for(let a in t.c)WK(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&WK(t.c[a],e,r+1,n-1,o,i)}}}function OBe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,WK(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=E2t(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 CBe(t,i,e,r,n),i}}function T2t(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||dpn(t,r)}else return!1}return!0}var SBe,A2t=b(()=>{xBe();du();SBe=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 I2t(){return{root:null}}function M2t(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 R2t(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 N2t(t,e,r,n=!0,o="asc",i=!1){let a=i?L2t:D2t,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=ppn(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=fpn(e);if(n){let u=o?L2t:D2t;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 fpn(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 ppn(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 D2t(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 L2t(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),h=Math.cos(c),m=u,g,y=1e3,_,w,S,C,E;do{let D=Math.sin(m),k=Math.cos(m);S=Math.sqrt(h*D*(h*D)+(f*p-d*h*k)*(f*p-d*h*k)),C=d*p+f*h*k,E=Math.atan2(S,C),_=f*h*D/S,w=1-_*_;let F=C-2*d*p/w,K=n/16*w*(4+n*(4-3*w));g=m,m=u+(1-K)*n*_*(E+K*S*(F+K*C*(-1+2*F*F)))}while(Math.abs(m-g)>1e-12&&--y>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 F2t=b(()=>{});function Pce(t,e,r=0,n){if(e===0)throw Xt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let m=0;m<i;m++){let g=t[m],y=g.length;for(let _=0;_<y;_++){let[w,S]=g[_],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 m of o.entries())a.push([m[0],m[1][0]]);let s=a.sort((m,g)=>g[1]-m[1]);if(r===1)return s;let u=s.length,l=[];for(let m of o.entries())l.push([m[0],m[1][0],m[1][1]]);let c=l.sort((m,g)=>m[2]>g[2]?-1:m[2]<g[2]?1:m[1]>g[1]?-1:m[1]<g[1]?1:0),d;for(let m=0;m<u&&c[m][2]===n;m++)d=m;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let m=0;m<f;m++)p[m]=[c[m][0],c[m][1]];if(r===0)return p.slice(0,d+1);let h=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+h)}function EBe(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 KK=b(()=>{Gc()});function PBe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function Tce(t,e,r,n=.8){let o=PBe(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 Ace=b(()=>{});function mpn(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 hpn(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 gpn(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 ypn(t,e,r){t.tokenOccurrences[e][r]--}function bpn(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 h=zi(e.sharedInternalDocumentStore,i[p]),m=l?.[h]?.[n]??0,g=EBe(m,c,t.docsCount,s[h],a,t.params.relevance);d.push([h,g])}return d}function $2t(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)){$2t(t,e,a,n,s);continue}if(kP(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:mBe(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:h2t(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:sF(),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:v2t(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:I2t(),isArray:u};break;default:throw Xt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function _pn(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;g2t(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),P2t(d,p,l);break}case"Flat":{w2t(d,u,l);break}case"BKD":{M2t(d,u,[l]);break}}}}function vpn(t,e,r,n,o,i,a,s,u,l){if(kP(i))return wpn(e,r,o,n);let c=_pn(t,e,r,n,a,s,u,l);if(!X2(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function wpn(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=PBe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function k2t(t,e,r,n,o,i,a,s,u){let l=zi(e.sharedInternalDocumentStore,n);if(kP(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return b2t(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),T2t(d,p,l);return!0}case"Flat":return x2t(d,l,o),!0;case"BKD":return R2t(d,o,l),!1}}function xpn(t,e,r,n,o,i,a,s,u){if(!X2(i))return k2t(t,e,r,n,o,i,a,s,u);let l=pBe(i),c=o,d=c.length;for(let f=0;f<d;f++)k2t(t,e,r,n,c[f],l,a,s,u);return!0}function Spn(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Xt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=OBe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(J2(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function Cpn(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 Xt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];aa(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:h="m",inside:m=!0,highPrecision:g=!1}=a[d],y=dBe(f,h),_=N2t(s.root,p,y,m,void 0,g);aa(o[i],_.flatMap(({docIDs:w})=>w))}else{let{coordinates:f,inside:p=!0,highPrecision:h=!1}=a[d],m=j2t(s.root,f,p,void 0,h);aa(o[i],m.flatMap(({docIDs:g})=>g))}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 h=OBe(s,{term:p,exact:!0});aa(o[i],Object.values(h).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Xt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?C2t:S2t;aa(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=_Be(s,f,!1);break}case"gte":{p=_Be(s,f,!0);break}case"lt":{p=vBe(s,f,!1);break}case"lte":{p=vBe(s,f,!0);break}case"eq":{p=y2t(s,f)??[];break}case"between":{let[h,m]=f;p=p2t(s,h,m);break}}aa(o[i],p)}}return Z2(Object.values(o))}function Opn(t){return t.searchableProperties}function Epn(t){return t.searchablePropertiesWithTypes}function B2t(t){let e=sF(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]=B2t(t.c[r]);return e}function Ppn(t){return{numberToDocumentId:new Map(t)}}function Tpn(t){return Array.from(t.numberToDocumentId.entries())}function Apn(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:h,isArray:m}=r[f];switch(h){case"Radix":c[f]={type:"Radix",node:B2t(p),isArray:m};break;case"Flat":c[f]={type:"Flat",node:Ppn(p),isArray:m};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let h in p)p[h]=[p[h][0],new Float32Array(p[h][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 Ipn(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:h}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:Tpn(p),isArray:h}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function z2t(){return{create:$2t,insert:vpn,remove:xpn,insertDocumentScoreParameters:mpn,insertTokenScoreParameters:hpn,removeDocumentScoreParameters:gpn,removeTokenScoreParameters:ypn,calculateResultScores:bpn,search:Spn,searchByWhereClause:Cpn,getSearchableProperties:Opn,getSearchablePropertiesWithTypes:Epn,load:Apn,save:Ipn}}var TBe=b(()=>{Gc();_2t();O2t();A2t();F2t();du();KK();Ace();VK();Ny()});function U2t(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=U2t(t,e,s,n,u);aa(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!kP(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 Xt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function Rpn(t,e,r,n){return n?.enabled!==!1?U2t(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function Npn(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)&&ABe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function q2t(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)Fpn(t,r);t.isSorted=!0}function jpn(t,e,r){return e[1].localeCompare(r[1],Jqt(t))}function Dpn(t,e){return t[1]-e[1]}function Lpn(t,e){return e[1]?-1:1}function Fpn(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=jpn.bind(null,t.language);break;case"number":n=Dpn.bind(null);break;case"boolean":n=Lpn.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 kpn(t){let e=Object.keys(t.sorts);for(let r of e)ABe(t,r)}function ABe(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 $pn(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 Bpn(t,e,r){if(!t.enabled)throw Xt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Xt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return ABe(t,n),q2t(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 zpn(t){return t.enabled?t.sortableProperties:[]}function Upn(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function qpn(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 Hpn(t){if(!t.enabled)return{enabled:!1};kpn(t),q2t(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 H2t(){return{create:Rpn,insert:Npn,remove:$pn,save:Hpn,load:qpn,sortBy:Bpn,getSortableProperties:zpn,getSortablePropertiesWithTypes:Upn}}var IBe=b(()=>{Gc();VK();Ny();du();Sce()});function Kpn(t){return t<192||t>383?t:Wpn[t-192]||t}function V2t(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Kpn(t.charCodeAt(r));return String.fromCharCode(...e)}var Wpn,W2t=b(()=>{Wpn=[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 G2t(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(MBe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(K2t),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+aO+Mce+"[^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(K2t),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(MBe),e&&n.test(e)&&(t=e+Gpn[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(MBe),e&&n.test(e)&&(t=e+Jpn[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(Ice),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(Ice),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(Ice),o=new RegExp(Ypn),i=new RegExp("^"+aO+Mce+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(Ice),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var Gpn,Jpn,Zpn,Mce,aO,GK,MBe,Ypn,Ice,K2t,J2t=b(()=>{Gpn={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"},Jpn={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Zpn="[^aeiou]",Mce="[aeiouy]",aO=Zpn+"[^aeiouy]*",GK=Mce+"[aeiou]*",MBe="^("+aO+")?"+GK+aO,Ypn="^("+aO+")?"+GK+aO+"("+GK+")?$",Ice="^("+aO+")?"+GK+aO+GK+aO,K2t="^("+aO+")?"+Mce});function RBe(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=V2t(e),this.normalizationCache.set(r,e),e)}function Xpn(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function Z2t(t,e,r){if(e&&e!==this.language)throw Xt("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=Gqt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Xpn(n);return this.allowDuplicates?o:Array.from(new Set(o))}function NBe(t={}){if(!t.language)t.language="english";else if(!qK.includes(t.language))throw Xt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Xt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=G2t;else throw Xt("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 Xt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Xt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Xt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:Z2t,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:RBe,normalizationCache:new Map};return n.tokenize=Z2t.bind(n),n.normalizeToken=RBe,n}var Rce=b(()=>{Gc();W2t();Sce();J2t()});function emn(t){let e={formatElapsedTime:r2t,getDocumentIndexId:n2t,getDocumentProperties:Cce,validateSchema:fBe};for(let r of gBe){let n=r;if(t[n]){if(typeof t[n]!="function")throw Xt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!c2t.includes(r)&&!gBe.includes(r))throw Xt("UNSUPPORTED_COMPONENT",r)}function r4({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=HK());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=NBe(a):a=NBe({language:r??"english"}),n.tokenizer&&r)throw Xt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=i2t();s||(s=z2t()),l||(l=H2t()),u||(u=a2t()),emn(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:h}=n,m={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:h,id:o,plugins:i,version:tmn()};m.data={index:m.index.create(m,c,t),docs:m.documentsStore.create(m,c),sorting:m.sorter.create(m,c,t,e)};for(let y of s2t)m[y]=(m[y]??[]).concat(u2t(m,y));let g=m.afterCreate;return g&&d2t(g,m),m}function tmn(){return"{{VERSION}}"}var Y2t=b(()=>{VK();hBe();l2t();aR();TBe();Ny();IBe();Rce();Gc();du()});var X2t=b(()=>{});var jBe=b(()=>{VK();hBe();TBe();Rce();IBe();Ny()});var Nce,DBe,LBe,FBe=b(()=>{Nce="fulltext",DBe="hybrid",LBe="vector"});var sR,uR,kBe=b(()=>{FBe();sR=Symbol("orama.insertions"),uR=Symbol("orama.removals")});function $Be(t){typeof t[sR]!="number"&&(queueMicrotask(()=>{t[sR]=void 0}),t[sR]=0),t[sR]>1e3?(Q2t("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[sR]=-1):t[sR]>=0&&t[sR]++}function BBe(t){typeof t[uR]!="number"&&(queueMicrotask(()=>{t[uR]=void 0}),t[uR]=0),t[uR]>1e3?(Q2t("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[uR]=-1):t[uR]>=0&&t[uR]++}var Q2t,zBe=b(()=>{kBe();Q2t=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function JK(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Xt("SCHEMA_VALIDATION_FAILURE",i);return Mu(t.index.beforeInsert)||Mu(t.index.insert)||Mu(t.index.afterInsert)?imn(t,e,r,n,o):amn(t,e,r,n,o)}async function imn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Xt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Xt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await y_(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 h=typeof p,m=c[f];e4t(h,m,f,p)}return await smn(t,s,l,d,u,r,e,o),n||await y_(t.afterInsert,t,s,e),$Be(t),s}function amn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Xt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Xt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||y_(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 h=typeof p,m=c[f];e4t(h,m,f,p)}return umn(t,s,l,d,u,r,e,o),n||y_(t.afterInsert,t,s,e),$Be(t),s}function e4t(t,e,r,n){if(!(o2t(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(kP(e)&&Array.isArray(n))&&!(X2(e)&&Array.isArray(n))&&!(nmn.has(e)&&omn.has(t))&&t!==e)throw Xt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function smn(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 umn(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 nmn,omn,UBe=b(()=>{jBe();du();aR();zBe();Gc();nmn=new Set(["enum","enum[]"]),omn=new Set(["string","number"])});function uF(t,e,r,n){return Mu(t.index.beforeRemove)||Mu(t.index.remove)||Mu(t.index.afterRemove)?lmn(t,e,r,n):cmn(t,e,r,n)}async 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=Ry(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await y_(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let m of c){let g=f[m];if(typeof g>"u")continue;let y=d[m];await t.index.beforeRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,m,e,g,y,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),h=await t.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||t.sorter.remove(t.data.sorting,m,e);return n||await y_(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),BBe(t),o}function cmn(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=Ry(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||y_(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let m of c){let g=f[m];if(typeof g>"u")continue;let y=d[m];t.index.beforeRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,m,e,g,y,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,m,u,g,y,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),h=t.getDocumentProperties(s,p);for(let m of p)typeof h[m]>"u"||t.sorter.remove(t.data.sorting,m,e);return n||y_(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),BBe(t),o}function ZK(t,e,r,n,o){return Mu(t.index.beforeRemove)||Mu(t.index.remove)||Mu(t.index.afterRemove)||Mu(t.beforeRemoveMultiple)||Mu(t.afterRemoveMultiple)?dmn(t,e,r,n,o):fmn(t,e,r,n,o)}async function dmn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>Ry(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,s)));return o||await aF(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 uF(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await aF(t.afterRemoveMultiple,t,a),i}function fmn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>Ry(t.internalDocumentIDStore,zi(t.internalDocumentIDStore,l)));o||aF(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)uF(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||aF(t.afterRemoveMultiple,t,a),i}var qBe=b(()=>{aR();Ny();zBe();du()});function pmn(t,e){return t[1]-e[1]}function mmn(t,e){return e[1]-t[1]}function hmn(t="desc"){return t.toLowerCase()==="asc"?pmn:mmn}function n4(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 h=0;h<f;h++){let m=d[h];p[h]=[`${m.from}-${m.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(".")?Y2(c,d):c[d],p=s[d],h=n[d].values;switch(p){case"number":{let m=r[d].ranges;t4t(m,h)(f);break}case"number[]":{let m=new Set,g=r[d].ranges,y=t4t(g,h,m);for(let _ of f)y(_);break}case"boolean":case"enum":case"string":{r4t(h,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let y=r4t(h,p==="boolean[]"?"boolean":"string",new Set);for(let _ of f)y(_);break}default:throw Xt("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=hmn(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function t4t(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 r4t(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 jce=b(()=>{Gc();du()});function o4(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 Dce=b(()=>{});function i4(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let y=0;y<o;y++){let _=n[y];if(typeof i[_]>"u")throw Xt("UNKNOWN_GROUP_BY_PROPERTY",_);if(!n4t.includes(i[_]))throw Xt("INVALID_GROUP_BY_PROPERTY",_,n4t.join(", "),i[_])}let a=e.map(([y])=>Ry(t.internalDocumentIDStore,y)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let y=0;y<o;y++){let _=n[y],w={property:_,perValue:{}},S=new Set;for(let C=0;C<u;C++){let E=s[C],P=Y2(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=o4t(c),p=f.length,h=[];for(let y=0;y<p;y++){let _=f[y],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=Z2(C).sort((E,P)=>E-P),S.indexes.length!==0&&h.push(S)}let m=h.length,g=Array.from({length:m});for(let y=0;y<m;y++){let _=h[y],w=r.reduce||gmn,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);g[y]={values:_.values,result:P}}return g}function o4t(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=o4t(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];aa(s,a),o.push(s)}return o}var gmn,n4t,Lce=b(()=>{Gc();du();Ny();gmn={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},n4t=["string","number","boolean"]});function i4t(t,e,r){let n=g_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(Fce,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:h,includeVectors:m=!1}=e,g=e.preflight===!0,{index:y,docs:_}=t.data,w=t.tokenizer.tokenize(d??"",r),S=t.caches.propertiesToSearch;if(!S){let D=t.index.getSearchablePropertiesWithTypes(y);S=t.index.getSearchableProperties(y),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 Xt("UNKNOWN_INDEX",D,S.join(", "));S=S.filter(D=>f.includes(D))}let C=lF(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,y,e.where));let T=w.length;if(T||f?.length){let D=S.length;for(let k=0;k<D;k++){let F=S[k],K=C.indexMap[F];if(T!==0)for(let L=0;L<T;L++){let Q=w[L],z=t.index.search(C,y,F,Q);aa(K[Q],z)}else{K[""]=[];let L=t.index.search(C,y,F,"");aa(K[""],L)}let U=Object.values(K);C.docsIntersection[F]=Pce(U,e?.boost?.[F]??1,p,T);let X=C.docsIntersection[F],ee=X.length;for(let L=0;L<ee;L++){let[Q,z]=X[L],W=C.uniqueDocsIDs[Q];W?C.uniqueDocsIDs[Q]=W+z+.5:C.uniqueDocsIDs[Q]=z}}}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=o4(P,I)),e.sortBy)if(typeof e.sortBy=="function"){let D=I.map(([K])=>K),F=t.documentsStore.getMultiple(t.data.docs,D).map((K,U)=>[I[U][0],I[U][1],K]);F.sort(e.sortBy),I=F.map(([K,U])=>[K,U])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([D,k])=>[zi(t.internalDocumentIDStore,D),k]);else I=I.sort(t2t);let N;g||(N=h?s4t(t,I,c,l,h):kce(t,I,c,l));let M={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof N<"u"&&(M.hits=N.filter(Boolean),m||Oce(M,s)),u){let D=n4(t,I,e.facets);M.facets=D}return e.groupBy&&(M.groups=i4(t,I,e.groupBy)),M.elapsed=t.formatElapsedTime(g_()-C.timeStart),M}async function a(){t.beforeSearch&&await e4(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Q2(t.afterSearch,t,e,r,s),s}return o?a():i()}var a4t=b(()=>{KK();jce();Dce();Lce();aR();Ny();Gc();du();cF()});function HBe(t,e,r="english"){let n=g_(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Xt("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,h=e.facets&&Object.keys(e.facets).length>0,m=Object.keys(e.where??{}).length>0,{index:g,docs:y}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Xt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Xt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let _=Tce(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(g);w=t.index.getSearchableProperties(g),w=w.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=w}let S=[],C=lF(t.tokenizer,t.index,t.documentsStore,r,e,w,S,t.documentsStore.count(y),n),E=[];m&&(E=t.index.searchByWhereClause(C,g,e.where),_=o4(E,_));let P=[];h&&(P=n4(t,_,e.facets));let T=Array.from({length:u});for(let D=0;D<u;D++){let k=_[D+l];if(!k)break;let F=t.data.docs.docs[k[0]];if(F){c||(F[s.property]=null);let K={id:Ry(t.internalDocumentIDStore,k[0]),score:k[1],document:F};T[D]=K}}let I=[];e.groupBy&&(I=i4(t,_,e.groupBy));let M=g_()-n;return{count:_.length,hits:T.filter(Boolean),elapsed:{raw:Number(M),formatted:iF(M)},...P?{facets:P}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await e4(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Q2(t.afterSearch,t,e,r,s),s}return o?a():i()}var VBe=b(()=>{cF();du();jce();Gc();Ace();Dce();Lce();Ny();aR()});function l4t(t,e,r){let n=g_(),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=ymn(t,e,r),f=bmn(t,e),{index:p,docs:h}=t.data,m=e.hybridWeights,g=vmn(d,f,e.term??"",m),y=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 Xt("UNKNOWN_INDEX",M,_.join(", "));_=_.filter(M=>e.properties.includes(M))}let w=lF(t.tokenizer,t.index,t.documentsStore,r,e,_,y,t.documentsStore.count(h),n),S=Object.keys(e.where??{}).length>0,C=[];S&&(C=t.index.searchByWhereClause(w,p,e.where),g=o4(C,g));let E;c&&(E=n4(t,g,e.facets));let P;e.groupBy&&(P=i4(t,g,e.groupBy));let T=kce(t,g,s,u).filter(Boolean),I=g_(),N={count:g.length,elapsed:{raw:Number(I-n),formatted:iF(I-n)},hits:T,...E?{facets:E}:{},...P?{groups:P}:{}};if(!l){let M=Object.keys(t.data.index.vectorIndexes);Oce(N,M)}return N}async function a(){t.beforeSearch&&await e4(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Q2(t.afterSearch,t,e,r,s),s}return o?a():i()}function ymn(t,e,r){let n=g_();e.relevance=Object.assign(Fce,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 h=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(m=>h[m].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let h=new Set(c),m=new Set(i);for(let g of i)if(!h.has(g))throw Xt("UNKNOWN_INDEX",g,c.join(", "));c=c.filter(g=>m.has(g))}let d=lF(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 h=c.length;for(let m=0;m<h;m++){let g=c[m];if(f!==0)for(let C=0;C<f;C++){let E=l[C],P=t.index.search(d,s,g,E);aa(d.indexMap[g][E],P)}else{let C=[];d.indexMap[g][""]=C;let E=t.index.search(d,s,g,"");aa(C,E)}let y=d.indexMap[g],_=Object.values(y);d.docsIntersection[g]=Pce(_,e?.boost?.[g]??1,a,f);let w=d.docsIntersection[g],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(h=>[h,0]));let p=Object.entries(d.uniqueDocsIDs).map(([h,m])=>[+h,m]).sort((h,m)=>m[1]-h[1]);return c4t(p)}function bmn(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 Xt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Xt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Tce(r.value,i,o,e.similarity).map(([s,u])=>[zi(t.internalDocumentIDStore,s),u]);return c4t(a)}function WBe([,t]){return t}function c4t(t){let e=Math.max.apply(Math,t.map(WBe));return t.map(([r,n])=>[r,n/e])}function u4t(t,e){return t/e}function _mn(t,e){return(r,n)=>r*t+n*e}function vmn(t,e,r,n){let o=Math.max.apply(Math,t.map(WBe)),i=Math.max.apply(Math,e.map(WBe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:wmn(r),l=new Map,c=t.length,d=_mn(s,u);for(let p=0;p<c;p++){let[h,m]=t[p],g=u4t(m,o),y=d(g,0);l.set(h,y)}let f=e.length;for(let p=0;p<f;p++){let[h,m]=e[p],g=u4t(m,i),y=l.get(h)??0;l.set(h,y+d(0,g))}return[...l].sort((p,h)=>h[1]-p[1])}function wmn(t){return{text:.5,vector:.5}}var d4t=b(()=>{du();Dce();KK();Gc();cF();jce();Lce();Ace();Ny();cF();aR()});function lF(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 Kp(t,e,r){let n=e.mode??Nce;if(n===Nce)return i4t(t,e,r);if(n===LBe)return HBe(t,e);if(n===DBe)return l4t(t,e);throw Xt("INVALID_SEARCH_MODE",n)}function s4t(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,h]=f;if(u.has(p))continue;let m=t.documentsStore.get(i,p),g=Y2(m,o);if(!(typeof g>"u"||a.has(g))&&(a.set(g,!0),c++,!(c<=r)&&(s.push({id:Ry(t.internalDocumentIDStore,p),score:h,document:m}),u.add(p),c>=r+n)))break}return s}function kce(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:Ry(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var Fce,cF=b(()=>{Ny();Gc();du();FBe();a4t();VBe();d4t();Fce={k:1.2,b:.75,d:.5}});function $ce(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 KBe(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 f4t=b(()=>{});var p4t=b(()=>{aR();Gc();UBe();qBe();du()});var m4t=b(()=>{Gc();cF()});var h4t=b(()=>{xBe();du();KK();Rce()});var Bce=b(()=>{Y2t();X2t();UBe();qBe();cF();VBe();f4t();p4t();m4t();kBe();jBe();h4t()});function Omn(t,e){let r=g4t(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function g4t(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Dui,Lui,Smn,Cmn,GBe,Emn,dF,JBe=b(()=>{Dui=new Error("timeout while waiting for mutex to become available"),Lui=new Error("mutex already locked"),Smn=new Error("request for lock canceled"),Cmn=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())})},GBe=class{constructor(e,r=Smn){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=g4t(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return Cmn(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]=[]),Omn(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}};Emn=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())})},dF=class{constructor(e){this._semaphore=new GBe(1,e)}acquire(){return Emn(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 y4t=x(()=>{});var oo=x((zce,b4t)=>{(function(t,e){typeof zce=="object"?b4t.exports=zce=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(zce,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=y4t()}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 y(){}return function(_){var w;return y.prototype=_,w=new y,y.prototype=null,w}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(y){var _=i(this);return y&&_.mixIn(y),(!_.hasOwnProperty("init")||this.init===_.init)&&(_.init=function(){_.$super.init.apply(this,arguments)}),_.init.prototype=_,_.$super=this,_},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var _ in y)y.hasOwnProperty(_)&&(this[_]=y[_]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(y,_){y=this.words=y||[],_!=r?this.sigBytes=_:this.sigBytes=y.length*4},toString:function(y){return(y||d).stringify(this)},concat:function(y){var _=this.words,w=y.words,S=this.sigBytes,C=y.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 y=this.words,_=this.sigBytes;y[_>>>2]&=4294967295<<32-_%4*8,y.length=e.ceil(_/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var _=[],w=0;w<y;w+=4)_.push(o());return new l.init(_,y)}}),c=a.enc={},d=c.Hex={stringify:function(y){for(var _=y.words,w=y.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(y){for(var _=y.length,w=[],S=0;S<_;S+=2)w[S>>>3]|=parseInt(y.substr(S,2),16)<<24-S%8*4;return new l.init(w,_/2)}},f=c.Latin1={stringify:function(y){for(var _=y.words,w=y.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(y){for(var _=y.length,w=[],S=0;S<_;S++)w[S>>>2]|=(y.charCodeAt(S)&255)<<24-S%4*8;return new l.init(w,_)}},p=c.Utf8={stringify:function(y){try{return decodeURIComponent(escape(f.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return f.parse(unescape(encodeURIComponent(y)))}},h=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=p.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var _,w=this._data,S=w.words,C=w.sigBytes,E=this.blockSize,P=E*4,T=C/P;y?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 y=u.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0}),m=s.Hasher=h.extend({cfg:u.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var _=this._doFinalize();return _},blockSize:512/32,_createHelper:function(y){return function(_,w){return new y.init(w).finalize(_)}},_createHmacHelper:function(y){return function(_,w){return new g.HMAC.init(y,w).finalize(_)}}}),g=a.algo={};return a}(Math);return t})});var YK=x((Uce,_4t)=>{(function(t,e){typeof Uce=="object"?_4t.exports=Uce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Uce,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 w4t=x((qce,v4t)=>{(function(t,e){typeof qce=="object"?v4t.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 S4t=x((Hce,x4t)=>{(function(t,e){typeof Hce=="object"?x4t.exports=Hce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Hce,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 lR=x((Vce,C4t)=>{(function(t,e){typeof Vce=="object"?C4t.exports=Vce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Vce,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,h=u[f+1>>>2]>>>24-(f+1)%4*8&255,m=u[f+2>>>2]>>>24-(f+2)%4*8&255,g=p<<16|h<<8|m,y=0;y<4&&f+y*.75<l;y++)d.push(c.charAt(g>>>6*(3-y)&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,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var E4t=x((Wce,O4t)=>{(function(t,e){typeof Wce=="object"?O4t.exports=Wce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Wce,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 h=l[p>>>2]>>>24-p%4*8&255,m=l[p+1>>>2]>>>24-(p+1)%4*8&255,g=l[p+2>>>2]>>>24-(p+2)%4*8&255,y=h<<16|m<<8|g,_=0;_<4&&p+_*.75<c;_++)f.push(d.charAt(y>>>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 h=s.indexOf(p);h!==-1&&(l=h)}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,h=l[s.charCodeAt(f)]>>>6-f%4*2,m=p|h;c[d>>>2]|=m<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var cR=x((Kce,P4t)=>{(function(t,e){typeof Kce=="object"?P4t.exports=Kce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Kce,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,h){for(var m=0;m<16;m++){var g=h+m,y=p[g];p[g]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360}var _=this._hash.words,w=p[h+0],S=p[h+1],C=p[h+2],E=p[h+3],P=p[h+4],T=p[h+5],I=p[h+6],N=p[h+7],M=p[h+8],D=p[h+9],k=p[h+10],F=p[h+11],K=p[h+12],U=p[h+13],X=p[h+14],ee=p[h+15],L=_[0],Q=_[1],z=_[2],W=_[3];L=l(L,Q,z,W,w,7,s[0]),W=l(W,L,Q,z,S,12,s[1]),z=l(z,W,L,Q,C,17,s[2]),Q=l(Q,z,W,L,E,22,s[3]),L=l(L,Q,z,W,P,7,s[4]),W=l(W,L,Q,z,T,12,s[5]),z=l(z,W,L,Q,I,17,s[6]),Q=l(Q,z,W,L,N,22,s[7]),L=l(L,Q,z,W,M,7,s[8]),W=l(W,L,Q,z,D,12,s[9]),z=l(z,W,L,Q,k,17,s[10]),Q=l(Q,z,W,L,F,22,s[11]),L=l(L,Q,z,W,K,7,s[12]),W=l(W,L,Q,z,U,12,s[13]),z=l(z,W,L,Q,X,17,s[14]),Q=l(Q,z,W,L,ee,22,s[15]),L=c(L,Q,z,W,S,5,s[16]),W=c(W,L,Q,z,I,9,s[17]),z=c(z,W,L,Q,F,14,s[18]),Q=c(Q,z,W,L,w,20,s[19]),L=c(L,Q,z,W,T,5,s[20]),W=c(W,L,Q,z,k,9,s[21]),z=c(z,W,L,Q,ee,14,s[22]),Q=c(Q,z,W,L,P,20,s[23]),L=c(L,Q,z,W,D,5,s[24]),W=c(W,L,Q,z,X,9,s[25]),z=c(z,W,L,Q,E,14,s[26]),Q=c(Q,z,W,L,M,20,s[27]),L=c(L,Q,z,W,U,5,s[28]),W=c(W,L,Q,z,C,9,s[29]),z=c(z,W,L,Q,N,14,s[30]),Q=c(Q,z,W,L,K,20,s[31]),L=d(L,Q,z,W,T,4,s[32]),W=d(W,L,Q,z,M,11,s[33]),z=d(z,W,L,Q,F,16,s[34]),Q=d(Q,z,W,L,X,23,s[35]),L=d(L,Q,z,W,S,4,s[36]),W=d(W,L,Q,z,P,11,s[37]),z=d(z,W,L,Q,N,16,s[38]),Q=d(Q,z,W,L,k,23,s[39]),L=d(L,Q,z,W,U,4,s[40]),W=d(W,L,Q,z,w,11,s[41]),z=d(z,W,L,Q,E,16,s[42]),Q=d(Q,z,W,L,I,23,s[43]),L=d(L,Q,z,W,D,4,s[44]),W=d(W,L,Q,z,K,11,s[45]),z=d(z,W,L,Q,ee,16,s[46]),Q=d(Q,z,W,L,C,23,s[47]),L=f(L,Q,z,W,w,6,s[48]),W=f(W,L,Q,z,N,10,s[49]),z=f(z,W,L,Q,X,15,s[50]),Q=f(Q,z,W,L,T,21,s[51]),L=f(L,Q,z,W,K,6,s[52]),W=f(W,L,Q,z,E,10,s[53]),z=f(z,W,L,Q,k,15,s[54]),Q=f(Q,z,W,L,S,21,s[55]),L=f(L,Q,z,W,M,6,s[56]),W=f(W,L,Q,z,ee,10,s[57]),z=f(z,W,L,Q,I,15,s[58]),Q=f(Q,z,W,L,U,21,s[59]),L=f(L,Q,z,W,P,6,s[60]),W=f(W,L,Q,z,F,10,s[61]),z=f(z,W,L,Q,C,15,s[62]),Q=f(Q,z,W,L,D,21,s[63]),_[0]=_[0]+L|0,_[1]=_[1]+Q|0,_[2]=_[2]+z|0,_[3]=_[3]+W|0},_doFinalize:function(){var p=this._data,h=p.words,m=this._nDataBytes*8,g=p.sigBytes*8;h[g>>>5]|=128<<24-g%32;var y=e.floor(m/4294967296),_=m;h[(g+64>>>9<<4)+15]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,h[(g+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,p.sigBytes=(h.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,h,m,g,y,_,w){var S=p+(h&m|~h&g)+y+w;return(S<<_|S>>>32-_)+h}function c(p,h,m,g,y,_,w){var S=p+(h&g|m&~g)+y+w;return(S<<_|S>>>32-_)+h}function d(p,h,m,g,y,_,w){var S=p+(h^m^g)+y+w;return(S<<_|S>>>32-_)+h}function f(p,h,m,g,y,_,w){var S=p+(m^(h|~g))+y+w;return(S<<_|S>>>32-_)+h}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var ZBe=x((Gce,T4t)=>{(function(t,e){typeof Gce=="object"?T4t.exports=Gce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Gce,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],h=c[3],m=c[4],g=0;g<80;g++){if(g<16)a[g]=u[l+g]|0;else{var y=a[g-3]^a[g-8]^a[g-14]^a[g-16];a[g]=y<<1|y>>>31}var _=(d<<5|d>>>27)+m+a[g];g<20?_+=(f&p|~f&h)+1518500249:g<40?_+=(f^p^h)+1859775393:g<60?_+=(f&p|f&h|p&h)-1894007588:_+=(f^p^h)-899497514,m=h,h=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]+h|0,c[4]=c[4]+m|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 Zce=x((Jce,A4t)=>{(function(t,e){typeof Jce=="object"?A4t.exports=Jce=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Jce,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(m){for(var g=e.sqrt(m),y=2;y<=g;y++)if(!(m%y))return!1;return!0}function f(m){return(m-(m|0))*4294967296|0}for(var p=2,h=0;h<64;)d(p)&&(h<8&&(s[h]=f(e.pow(p,1/2))),u[h]=f(e.pow(p,1/3)),h++),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,h=p[0],m=p[1],g=p[2],y=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=h&m^h&g^m&g,k=(h<<30|h>>>2)^(h<<19|h>>>13)^(h<<10|h>>>22),F=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),K=C+F+M+u[E]+l[E],U=k+D;C=S,S=w,w=_,_=y+K|0,y=g,g=m,m=h,h=K+U|0}p[0]=p[0]+h|0,p[1]=p[1]+m|0,p[2]=p[2]+g|0,p[3]=p[3]+y|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,h=d.sigBytes*8;return f[h>>>5]|=128<<24-h%32,f[(h+64>>>9<<4)+14]=e.floor(p/4294967296),f[(h+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 M4t=x((Yce,I4t)=>{(function(t,e,r){typeof Yce=="object"?I4t.exports=Yce=e(oo(),Zce()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Yce,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 YBe=x((Xce,R4t)=>{(function(t,e,r){typeof Xce=="object"?R4t.exports=Xce=e(oo(),YK()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Xce,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 h=this._hash.words,m=h[0],g=h[1],y=h[2],_=h[3],w=h[4],S=h[5],C=h[6],E=h[7],P=m.high,T=m.low,I=g.high,N=g.low,M=y.high,D=y.low,k=_.high,F=_.low,K=w.high,U=w.low,X=S.high,ee=S.low,L=C.high,Q=C.low,z=E.high,W=E.low,V=P,q=T,H=I,G=N,Z=M,de=D,pe=k,ae=F,Te=K,Ae=U,ke=X,Ot=ee,jr=L,Mr=Q,Vn=z,Xr=W,Cr=0;Cr<80;Cr++){var Me,Ze,je=c[Cr];if(Cr<16)Ze=je.high=f[p+Cr*2]|0,Me=je.low=f[p+Cr*2+1]|0;else{var le=c[Cr-15],ne=le.high,fe=le.low,be=(ne>>>1|fe<<31)^(ne>>>8|fe<<24)^ne>>>7,ye=(fe>>>1|ne<<31)^(fe>>>8|ne<<24)^(fe>>>7|ne<<25),ze=c[Cr-2],hr=ze.high,Ii=ze.low,_i=(hr>>>19|Ii<<13)^(hr<<3|Ii>>>29)^hr>>>6,bf=(Ii>>>19|hr<<13)^(Ii<<3|hr>>>29)^(Ii>>>6|hr<<26),mp=c[Cr-7],Hi=mp.high,gd=mp.low,yd=c[Cr-16],_f=yd.high,Wn=yd.low;Me=ye+gd,Ze=be+Hi+(Me>>>0<ye>>>0?1:0),Me=Me+bf,Ze=Ze+_i+(Me>>>0<bf>>>0?1:0),Me=Me+Wn,Ze=Ze+_f+(Me>>>0<Wn>>>0?1:0),je.high=Ze,je.low=Me}var EA=Te&ke^~Te&jr,FN=Ae&Ot^~Ae&Mr,PA=V&H^V&Z^H&Z,Is=q&G^q&de^G&de,hu=(V>>>28|q<<4)^(V<<30|q>>>2)^(V<<25|q>>>7),ns=(q>>>28|V<<4)^(q<<30|V>>>2)^(q<<25|V>>>7),hp=(Te>>>14|Ae<<18)^(Te>>>18|Ae<<14)^(Te<<23|Ae>>>9),vf=(Ae>>>14|Te<<18)^(Ae>>>18|Te<<14)^(Ae<<23|Te>>>9),Gs=l[Cr],cm=Gs.high,gp=Gs.low,Xn=Xr+vf,Qe=Vn+hp+(Xn>>>0<Xr>>>0?1:0),Xn=Xn+FN,Qe=Qe+EA+(Xn>>>0<FN>>>0?1:0),Xn=Xn+gp,Qe=Qe+cm+(Xn>>>0<gp>>>0?1:0),Xn=Xn+Me,Qe=Qe+Ze+(Xn>>>0<Me>>>0?1:0),yp=ns+Is,Ch=hu+PA+(yp>>>0<ns>>>0?1:0);Vn=jr,Xr=Mr,jr=ke,Mr=Ot,ke=Te,Ot=Ae,Ae=ae+Xn|0,Te=pe+Qe+(Ae>>>0<ae>>>0?1:0)|0,pe=Z,ae=de,Z=H,de=G,H=V,G=q,q=Xn+yp|0,V=Qe+Ch+(q>>>0<Xn>>>0?1:0)|0}T=m.low=T+q,m.high=P+V+(T>>>0<q>>>0?1:0),N=g.low=N+G,g.high=I+H+(N>>>0<G>>>0?1:0),D=y.low=D+de,y.high=M+Z+(D>>>0<de>>>0?1:0),F=_.low=F+ae,_.high=k+pe+(F>>>0<ae>>>0?1:0),U=w.low=U+Ae,w.high=K+Te+(U>>>0<Ae>>>0?1:0),ee=S.low=ee+Ot,S.high=X+ke+(ee>>>0<Ot>>>0?1:0),Q=C.low=Q+Mr,C.high=L+jr+(Q>>>0<Mr>>>0?1:0),W=E.low=W+Xr,E.high=z+Vn+(W>>>0<Xr>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,h=this._nDataBytes*8,m=f.sigBytes*8;p[m>>>5]|=128<<24-m%32,p[(m+128>>>10<<5)+30]=Math.floor(h/4294967296),p[(m+128>>>10<<5)+31]=h,f.sigBytes=p.length*4,this._process();var g=this._hash.toX32();return g},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((Qce,N4t)=>{(function(t,e,r){typeof Qce=="object"?N4t.exports=Qce=e(oo(),YK(),YBe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Qce,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 L4t=x((ede,D4t)=>{(function(t,e,r){typeof ede=="object"?D4t.exports=ede=e(oo(),YK()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(ede,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 h=1,m=0,g=0;g<24;g++){l[h+5*m]=(g+1)*(g+2)/2%64;var y=m%5,_=(2*h+3*m)%5;h=y,m=_}for(var h=0;h<5;h++)for(var m=0;m<5;m++)c[h+5*m]=m+(2*h+3*m)%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 h=0;h<25;h++)f[h]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var h=this._state=[],m=0;m<25;m++)h[m]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(h,m){for(var g=this._state,y=this.blockSize/2,_=0;_<y;_++){var w=h[m+2*_],S=h[m+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=g[_];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=g[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],F=k.high,K=k.low,T=D.high^(F<<1|K>>>31),I=D.low^(K<<1|F>>>31),N=0;N<5;N++){var C=g[P+5*N];C.high^=T,C.low^=I}for(var U=1;U<25;U++){var T,I,C=g[U],X=C.high,ee=C.low,L=l[U];L<32?(T=X<<L|ee>>>32-L,I=ee<<L|X>>>32-L):(T=ee<<L-32|X>>>64-L,I=X<<L-32|ee>>>64-L);var Q=f[c[U]];Q.high=T,Q.low=I}var z=f[0],W=g[0];z.high=W.high,z.low=W.low;for(var P=0;P<5;P++)for(var N=0;N<5;N++){var U=P+5*N,C=g[U],V=f[U],q=f[(P+1)%5+5*N],H=f[(P+2)%5+5*N];C.high=V.high^~q.high&H.high,C.low=V.low^~q.low&H.low}var C=g[0],G=d[E];C.high^=G.high,C.low^=G.low}},_doFinalize:function(){var h=this._data,m=h.words,g=this._nDataBytes*8,y=h.sigBytes*8,_=this.blockSize*32;m[y>>>5]|=1<<24-y%32,m[(e.ceil((y+1)/_)*_>>>5)-1]|=128,h.sigBytes=m.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 h=i.clone.call(this),m=h._state=this._state.slice(0),g=0;g<25;g++)m[g]=m[g].clone();return h}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var k4t=x((tde,F4t)=>{(function(t,e){typeof tde=="object"?F4t.exports=tde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(tde,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,F=l.words,K=c.words,U,X,ee,L,Q,z,W,V,q,H;z=U=I[0],W=X=I[1],V=ee=I[2],q=L=I[3],H=Q=I[4];for(var G,E=0;E<80;E+=1)G=U+S[C+D[E]]|0,E<16?G+=h(X,ee,L)+N[0]:E<32?G+=m(X,ee,L)+N[1]:E<48?G+=g(X,ee,L)+N[2]:E<64?G+=y(X,ee,L)+N[3]:G+=_(X,ee,L)+N[4],G=G|0,G=w(G,F[E]),G=G+Q|0,U=Q,Q=L,L=w(ee,10),ee=X,X=G,G=z+S[C+k[E]]|0,E<16?G+=_(W,V,q)+M[0]:E<32?G+=y(W,V,q)+M[1]:E<48?G+=g(W,V,q)+M[2]:E<64?G+=m(W,V,q)+M[3]:G+=h(W,V,q)+M[4],G=G|0,G=w(G,K[E]),G=G+H|0,z=H,H=q,q=w(V,10),V=W,W=G;G=I[1]+ee+q|0,I[1]=I[2]+L+H|0,I[2]=I[3]+Q+z|0,I[3]=I[4]+U+W|0,I[4]=I[0]+X+V|0,I[0]=G},_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 h(S,C,E){return S^C^E}function m(S,C,E){return S&C|~S&E}function g(S,C,E){return(S|~C)^E}function y(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 nde=x((rde,$4t)=>{(function(t,e){typeof rde=="object"?$4t.exports=rde=e(oo()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(rde,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(),h=f.words,m=p.words,g=0;g<c;g++)h[g]^=1549556828,m[g]^=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 z4t=x((ode,B4t)=>{(function(t,e,r){typeof ode=="object"?B4t.exports=ode=e(oo(),Zce(),nde()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(ode,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(),h=o.create([1]),m=p.words,g=h.words,y=d.keySize,_=d.iterations;m.length<y;){var w=f.update(c).finalize(h);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),g[0]++}return p.sigBytes=y*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var $P=x((ide,U4t)=>{(function(t,e,r){typeof ide=="object"?U4t.exports=ide=e(oo(),ZBe(),nde()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(ide,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(),h=p.words,m=d.keySize,g=d.iterations;h.length<m;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var y=1;y<g;y++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=m*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var _c=x((ade,q4t)=>{(function(t,e,r){typeof ade=="object"?q4t.exports=ade=e(oo(),$P()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(ade,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,F,K){return M(F).encrypt(D,k,F,K)},decrypt:function(k,F,K){return M(F).decrypt(D,k,F,K)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var M=this._process(!0);return M},blockSize:1}),h=r.mode={},m=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}}),g=h.CBC=function(){var M=m.extend();M.Encryptor=M.extend({processBlock:function(k,F){var K=this._cipher,U=K.blockSize;D.call(this,k,F,U),K.encryptBlock(k,F),this._prevBlock=k.slice(F,F+U)}}),M.Decryptor=M.extend({processBlock:function(k,F){var K=this._cipher,U=K.blockSize,X=k.slice(F,F+U);K.decryptBlock(k,F),D.call(this,k,F,U),this._prevBlock=X}});function D(k,F,K){var U,X=this._iv;X?(U=X,this._iv=e):U=this._prevBlock;for(var ee=0;ee<K;ee++)k[F+ee]^=U[ee]}return M}(),y=r.pad={},_=y.Pkcs7={pad:function(M,D){for(var k=D*4,F=k-M.sigBytes%k,K=F<<24|F<<16|F<<8|F,U=[],X=0;X<F;X+=4)U.push(K);var ee=i.create(U,F);M.concat(ee)},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:g,padding:_}),reset:function(){var M;f.reset.call(this);var D=this.cfg,k=D.iv,F=D.mode;this._xformMode==this._ENC_XFORM_MODE?M=F.createEncryptor:(M=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==M?this._mode.init(this,k&&k.words):(this._mode=M.call(F,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,F=M.salt;return F?D=i.create([1398893684,1701076831]).concat(F).concat(k):D=k,D.toString(l)},parse:function(M){var D,k=l.parse(M),F=k.words;return F[0]==1398893684&&F[1]==1701076831&&(D=i.create(F.slice(2,4)),F.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,F){F=this.cfg.extend(F);var K=M.createEncryptor(k,F),U=K.finalize(D),X=K.cfg;return S.create({ciphertext:U,key:k,iv:X.iv,algorithm:M,mode:X.mode,padding:X.padding,blockSize:M.blockSize,formatter:F.format})},decrypt:function(M,D,k,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var K=M.createDecryptor(k,F).finalize(D.ciphertext);return K},_parse:function(M,D){return typeof M=="string"?D.parse(M,this):M}}),T=r.kdf={},I=T.OpenSSL={execute:function(M,D,k,F,K){if(F||(F=i.random(64/8)),K)var U=d.create({keySize:D+k,hasher:K}).compute(M,F);else var U=d.create({keySize:D+k}).compute(M,F);var X=i.create(U.words.slice(D),k*4);return U.sigBytes=D*4,S.create({key:U,iv:X,salt:F})}},N=n.PasswordBasedCipher=P.extend({cfg:P.cfg.extend({kdf:I}),encrypt:function(M,D,k,F){F=this.cfg.extend(F);var K=F.kdf.execute(k,M.keySize,M.ivSize,F.salt,F.hasher);F.iv=K.iv;var U=P.encrypt.call(this,M,D,K.key,F);return U.mixIn(K),U},decrypt:function(M,D,k,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var K=F.kdf.execute(k,M.keySize,M.ivSize,D.salt,F.hasher);F.iv=K.iv;var U=P.decrypt.call(this,M,D,K.key,F);return U}})}()})});var V4t=x((sde,H4t)=>{(function(t,e,r){typeof sde=="object"?H4t.exports=sde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(sde,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 K4t=x((ude,W4t)=>{(function(t,e,r){typeof ude=="object"?W4t.exports=ude=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ude,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 J4t=x((lde,G4t)=>{(function(t,e,r){typeof lde=="object"?G4t.exports=lde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(lde,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 Y4t=x((cde,Z4t)=>{(function(t,e,r){typeof cde=="object"?Z4t.exports=cde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(cde,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 Q4t=x((dde,X4t)=>{(function(t,e,r){typeof dde=="object"?X4t.exports=dde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(dde,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 t3t=x((fde,e3t)=>{(function(t,e,r){typeof fde=="object"?e3t.exports=fde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(fde,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 n3t=x((pde,r3t)=>{(function(t,e,r){typeof pde=="object"?r3t.exports=pde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(pde,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 i3t=x((mde,o3t)=>{(function(t,e,r){typeof mde=="object"?o3t.exports=mde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(mde,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 s3t=x((hde,a3t)=>{(function(t,e,r){typeof hde=="object"?a3t.exports=hde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(hde,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 l3t=x((gde,u3t)=>{(function(t,e,r){typeof gde=="object"?u3t.exports=gde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(gde,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var d3t=x((yde,c3t)=>{(function(t,e,r){typeof yde=="object"?c3t.exports=yde=e(oo(),_c()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(yde,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 p3t=x((bde,f3t)=>{(function(t,e,r){typeof bde=="object"?f3t.exports=bde=e(oo(),lR(),cR(),$P(),_c()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(bde,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=[],h=[];(function(){for(var y=[],_=0;_<256;_++)_<128?y[_]=_<<1:y[_]=_<<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=y[w],P=y[E],T=y[P],I=y[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,h[C]=I,w?(w=E^y[y[y[T^E]]],S^=y[y[S]]):w=S=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],g=o.AES=n.extend({_doReset:function(){var y;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]:(y=P[T-1],T%S?S>6&&T%S==4&&(y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255]):(y=y<<8|y>>>24,y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255],y^=m[T/S|0]<<24),P[T]=P[T-S]^y);for(var I=this._invKeySchedule=[],N=0;N<E;N++){var T=E-N;if(N%4)var y=P[T];else var y=P[T-4];N<4||T<=4?I[N]=y:I[N]=d[i[y>>>24]]^f[i[y>>>16&255]]^p[i[y>>>8&255]]^h[i[y&255]]}}},encryptBlock:function(y,_){this._doCryptBlock(y,_,this._keySchedule,s,u,l,c,i)},decryptBlock:function(y,_){var w=y[_+1];y[_+1]=y[_+3],y[_+3]=w,this._doCryptBlock(y,_,this._invKeySchedule,d,f,p,h,a);var w=y[_+1];y[_+1]=y[_+3],y[_+3]=w},_doCryptBlock:function(y,_,w,S,C,E,P,T){for(var I=this._nRounds,N=y[_]^w[0],M=y[_+1]^w[1],D=y[_+2]^w[2],k=y[_+3]^w[3],F=4,K=1;K<I;K++){var U=S[N>>>24]^C[M>>>16&255]^E[D>>>8&255]^P[k&255]^w[F++],X=S[M>>>24]^C[D>>>16&255]^E[k>>>8&255]^P[N&255]^w[F++],ee=S[D>>>24]^C[k>>>16&255]^E[N>>>8&255]^P[M&255]^w[F++],L=S[k>>>24]^C[N>>>16&255]^E[M>>>8&255]^P[D&255]^w[F++];N=U,M=X,D=ee,k=L}var U=(T[N>>>24]<<24|T[M>>>16&255]<<16|T[D>>>8&255]<<8|T[k&255])^w[F++],X=(T[M>>>24]<<24|T[D>>>16&255]<<16|T[k>>>8&255]<<8|T[N&255])^w[F++],ee=(T[D>>>24]<<24|T[k>>>16&255]<<16|T[N>>>8&255]<<8|T[M&255])^w[F++],L=(T[k>>>24]<<24|T[N>>>16&255]<<16|T[M>>>8&255]<<8|T[D&255])^w[F++];y[_]=U,y[_+1]=X,y[_+2]=ee,y[_+3]=L},keySize:256/32});e.AES=n._createHelper(g)}(),t.AES})});var h3t=x((_de,m3t)=>{(function(t,e,r){typeof _de=="object"?m3t.exports=_de=e(oo(),lR(),cR(),$P(),_c()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(_de,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 m=this._key,g=m.words,y=[],_=0;_<56;_++){var w=a[_]-1;y[_]=g[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]|=y[(s[_]-1+P)%28]<<31-_%6,E[4+(_/6|0)]|=y[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(m,g){this._doCryptBlock(m,g,this._subKeys)},decryptBlock:function(m,g){this._doCryptBlock(m,g,this._invSubKeys)},_doCryptBlock:function(m,g,y){this._lBlock=m[g],this._rBlock=m[g+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=y[_],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),m[g]=this._lBlock,m[g+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(m,g){var y=(this._lBlock>>>m^this._rBlock)&g;this._rBlock^=y,this._lBlock^=y<<m}function p(m,g){var y=(this._rBlock>>>m^this._lBlock)&g;this._lBlock^=y,this._rBlock^=y<<m}e.DES=o._createHelper(d);var h=i.TripleDES=o.extend({_doReset:function(){var m=this._key,g=m.words;if(g.length!==2&&g.length!==4&&g.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var y=g.slice(0,2),_=g.length<4?g.slice(0,2):g.slice(2,4),w=g.length<6?g.slice(0,2):g.slice(4,6);this._des1=d.createEncryptor(n.create(y)),this._des2=d.createEncryptor(n.create(_)),this._des3=d.createEncryptor(n.create(w))},encryptBlock:function(m,g){this._des1.encryptBlock(m,g),this._des2.decryptBlock(m,g),this._des3.encryptBlock(m,g)},decryptBlock:function(m,g){this._des3.decryptBlock(m,g),this._des2.encryptBlock(m,g),this._des1.decryptBlock(m,g)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(h)}(),t.TripleDES})});var y3t=x((vde,g3t)=>{(function(t,e,r){typeof vde=="object"?g3t.exports=vde=e(oo(),lR(),cR(),$P(),_c()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(vde,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 h=f%c,m=l[h>>>2]>>>24-h%4*8&255;p=(p+d[f]+m)%256;var g=d[f];d[f]=d[p],d[p]=g}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 _3t=x((wde,b3t)=>{(function(t,e,r){typeof wde=="object"?b3t.exports=wde=e(oo(),lR(),cR(),$P(),_c()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(wde,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],h=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++)h[f]^=p[f+4&7];if(d){var m=d.words,g=m[0],y=m[1],_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,S=_>>>16|w&4294901760,C=w<<16|_&65535;h[0]^=_,h[1]^=S,h[2]^=w,h[3]^=C,h[4]^=_,h[5]^=S,h[6]^=w,h[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],h=p&65535,m=p>>>16,g=((h*h>>>17)+h*m>>>15)+m*m,y=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=g^y}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 w3t=x((xde,v3t)=>{(function(t,e,r){typeof xde=="object"?v3t.exports=xde=e(oo(),lR(),cR(),$P(),_c()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(xde,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 h=0;h<4;h++)l.call(this);for(var h=0;h<8;h++)p[h]^=f[h+4&7];if(d){var m=d.words,g=m[0],y=m[1],_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=(y<<8|y>>>24)&16711935|(y<<24|y>>>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 h=0;h<4;h++)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],h=p&65535,m=p>>>16,g=((h*h>>>17)+h*m>>>15)+m*m,y=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=g^y}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 S3t=x((Sde,x3t)=>{(function(t,e,r){typeof Sde=="object"?x3t.exports=Sde=e(oo(),lR(),cR(),$P(),_c()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Sde,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(h,m){let g=m>>24&255,y=m>>16&255,_=m>>8&255,w=m&255,S=h.sbox[0][g]+h.sbox[1][y];return S=S^h.sbox[2][_],S=S+h.sbox[3][w],S}function c(h,m,g){let y=m,_=g,w;for(let S=0;S<i;++S)y=y^h.pbox[S],_=l(h,y)^_,w=y,y=_,_=w;return w=y,y=_,_=w,_=_^h.pbox[i],y=y^h.pbox[i+1],{left:y,right:_}}function d(h,m,g){let y=m,_=g,w;for(let S=i+1;S>1;--S)y=y^h.pbox[S],_=l(h,y)^_,w=y,y=_,_=w;return w=y,y=_,_=w,_=_^h.pbox[1],y=y^h.pbox[0],{left:y,right:_}}function f(h,m,g){for(let C=0;C<4;C++){h.sbox[C]=[];for(let E=0;E<256;E++)h.sbox[C][E]=s[C][E]}let y=0;for(let C=0;C<i+2;C++)h.pbox[C]=a[C]^m[y],y++,y>=g&&(y=0);let _=0,w=0,S=0;for(let C=0;C<i+2;C+=2)S=c(h,_,w),_=S.left,w=S.right,h.pbox[C]=_,h.pbox[C+1]=w;for(let C=0;C<4;C++)for(let E=0;E<256;E+=2)S=c(h,_,w),_=S.left,w=S.right,h.sbox[C][E]=_,h.sbox[C][E+1]=w;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var h=this._keyPriorReset=this._key,m=h.words,g=h.sigBytes/4;f(u,m,g)}},encryptBlock:function(h,m){var g=c(u,h[m],h[m+1]);h[m]=g.left,h[m+1]=g.right},decryptBlock:function(h,m){var g=d(u,h[m],h[m+1]);h[m]=g.left,h[m+1]=g.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var a4=x((Cde,C3t)=>{(function(t,e,r){typeof Cde=="object"?C3t.exports=Cde=e(oo(),YK(),w4t(),S4t(),lR(),E4t(),cR(),ZBe(),Zce(),M4t(),YBe(),j4t(),L4t(),k4t(),nde(),z4t(),$P(),_c(),V4t(),K4t(),J4t(),Y4t(),Q4t(),t3t(),n3t(),i3t(),s3t(),l3t(),d3t(),p3t(),h3t(),y3t(),_3t(),w3t(),S3t()):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)})(Cde,function(t){return t})});var XBe,Pmn,Ode,O3t=b(()=>{xE();bt();Bce();XBe="copilot-index-chunk-",Pmn=".json",Ode=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${XBe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${XBe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${Pmn}`}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,[]);oe().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,oe().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),oe().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 KBe(e),n=oe().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(oe().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)),oe().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(([h])=>c.some(m=>m.id===h)))}}},docs:{docs:Object.fromEntries(c.map((h,m)=>[(m+1).toString(),h])),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)),oe().debug&&console.log(`Saved partition ${l+1}/${n}`)}oe().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new rn(`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 rn("Invalid legacy database format");let l=await r4({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await $ce(l,u),l}let r=await this.loadMetadata(),n=await r4({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 rn("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++):oe().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 $ce(n,o),n}catch(e){throw console.error("Error loading database:",e),new rn(`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}/${XBe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new rn(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(oe().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 rn("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new rn("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 P3t={};os(P3t,{categorizePatterns:()=>s4,createPatternSettingsValue:()=>u4,extractAppIgnoreSettings:()=>XK,getAllQAMarkdownContent:()=>tze,getDecodedPatterns:()=>th,getExtensionPattern:()=>rze,getFilePattern:()=>l4,getMatchingPatterns:()=>vc,getTagPattern:()=>QK,getVectorLength:()=>eze,previewPatternValue:()=>Imn,shouldIndexFile:()=>_s});async function eze(t){if(!t)throw new rn("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new rn("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${Iu.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new rn("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function tze(t){let e="",{inclusions:r,exclusions:n}=vc(),o=t.vault.getMarkdownFiles().filter(i=>_s(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function th(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function Tmn(){return oe().qaExclusions?th(oe().qaExclusions):[]}function Amn(){return oe().qaInclusions?th(oe().qaInclusions):[]}function vc(t){let e=t?.inclusions?th(t.inclusions):t?.isProject?[]:Amn(),r=t?.exclusions?th(t.exclusions):t?.isProject?[]:Tmn();return{inclusions:e.length>0?s4(e):null,exclusions:r.length>0?s4(r):null}}function _s(t,e,r,n){return!(r&&E3t(t.path,r)||e&&!E3t(t.path,e)||n&&!e)}function s4(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 Imn(t){return th(t).join(", ")}function u4({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function Mmn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof QBe.TFile){let n=Tj(r);if(e.some(o=>n.includes(ZB(o))))return!0}return!1}function Rmn(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 Nmn(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 jmn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof QBe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function E3t(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return Mmn(t,r??[])||Rmn(t,n??[])||Nmn(t,o??[])||jmn(t,i??[])}function XK(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 QK(t){return`#${t}`}function l4(t){return`[[${t.basename}]]`}function rze(t){return`*.${t}`}var QBe,rh=b(()=>{xE();oF();bt();ir();QBe=require("obsidian")});var T3t,sO,BP,Ede=b(()=>{oF();xE();Gt();bt();ir();Bce();JBe();T3t=j(a4()),sO=require("obsidian");O3t();rh();BP=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new dF;wa(async()=>{let r=oe();sO.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):sO.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await Iu.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 Iu.getInstance().getEmbeddingsAPI()),B("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new rn("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Ode(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),sO.Platform.isMobile&&oe().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new rn("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 sO.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(sO.Platform.isMobile&&oe().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await Iu.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new rn("Semantic index database not found.")}catch(e){throw ie("Failed to initialize database during save:",e),new rn("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,oe().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 sO.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 sO.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new rn("Semantic index database not found.");try{let r=await Kp(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await ZK(this.oramaDb,r.hits.map(n=>n.id),500),oe().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(oe().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,T3t.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new rn("Embedding instance not found.");let r=await eze(e);if(!r||r===0)throw new rn("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await r4({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return B(`Created new semantic index database for ${this.dbPath}. Embedding model: ${Iu.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 Kp(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Kp(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 Kp(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,oe().numPartitions),o=await Kp(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await uF(r,o.hits[0].id);try{return await JK(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 JK(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 Kp(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 rn("Failed to initialize semantic index database. Please check your embedding model settings.")}}let r=await Kp(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=Iu.getModelName(e);if(!Met(n,o))return new sO.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 Kp(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 Iu.getInstance().getEmbeddingsAPI();if(!e)throw new rn("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new rn("Failed to initialize database after attempt.")}catch(e){throw ie("Failed to initialize database during garbage collection:",e),new rn("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(i=>i.path)),o=(await t.getAllDocuments(this.oramaDb)).filter(i=>!r.has(i.path));return o.length===0?0:(B("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await uF(this.oramaDb,o[0].id):await ZK(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw ie("Error garbage collecting the Copilot index:",e),new rn("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new rn("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 rn("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Kp(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ie("Error checking if database is empty:",e),new rn("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 rn("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 rn("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 rn("Failed to check index integrity.")}}}});var c4,Dmn,Pde,A3t=b(()=>{ua();vu();bt();c4=require("obsidian");rh();Dmn=5e3,Pde=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.handleActiveLeafChange=async e=>{if(c4.Platform.isMobile&&oe().disableIndexOnMobile||ey()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof c4.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}=vc(),u=_s(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=e=>{this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{oe().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},Dmn)};this.handleFileDelete=async e=>{e instanceof c4.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){oe().debug&&console.log("Copilot Plus: Initializing event listeners"),this.app.workspace.on("active-leaf-change",this.handleActiveLeafChange),this.app.vault.on("delete",this.handleFileDelete)}cleanup(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete)}unload(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.lastActiveFile=null,this.lastActiveFileMtime=null,this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete)}}});var eG,I3t=b(()=>{eG=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 nh,M3t=b(()=>{nh=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 Tde,R3t=b(()=>{Tf();Tde=class extends Un{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 N3t=b(()=>{M3t();R3t()});var tG=b(()=>{N3t()});var j3t=b(()=>{rFe()});var nze,d4,D3t=b(()=>{tG();j3t();nze=class extends Tde{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 h of await this.splitText(c)){let m=i,g=c.indexOf(h,p+1);if(f===null){let S=this.numberOfNewLines(c,0,g);d+=S}else{let S=p+await this.lengthFunction(f);if(S<g){let C=this.numberOfNewLines(c,S,g);d+=C}else if(S>g){let C=this.numberOfNewLines(c,g,S);d-=C}s&&(m+=a)}let y=this.numberOfNewLines(h),_=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};_.lines={from:d,to:d+y};let w={...o[l],loc:_};m+=h,u.push(new nh({pageContent:m,metadata:w})),d+=y,f=h,p=g}}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}},d4=class t extends nze{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 L3t=b(()=>{D3t()});var F3t=b(()=>{L3t()});var k3t=b(()=>{F3t()});var oze=b(()=>{k3t()});var $3t,uO,Ade,B3t=b(()=>{or();oF();Gt();I3t();bt();ir();$3t=j(a4());oze();uO=require("obsidian");rh();Ade=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=oe();this.rateLimiter=new eG(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,wa(async()=>{let i=oe();this.rateLimiter=new eG(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 uO.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 uO.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],h=l[f];if(!h||!Array.isArray(h)||h.length===0){ie(`Invalid embedding for document ${p.fileInfo.path}: ${h}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:h,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(m){this.handleError(m,{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=Iu.getModelName(r),o=d4.fromLanguage("markdown",{chunkSize:Mj}),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:tu(new Date(a.stat.ctime)).display,modified:tu(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,$3t.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=vc(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>_s(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(!_s(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 uO.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 uO.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=oe(),o=th(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...XK(this.app),...th(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 uO.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 uO.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 uO.Notice("Indexing cancelled");return}e.length>0?new uO.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new uO.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(),oe().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 Qf={};os(Qf,{default:()=>zP});var rG,zP,Jc=b(()=>{xE();oF();bt();rG=require("obsidian");Ede();A3t();B3t();zP=class t{constructor(){this.embeddingsManager=Iu.getInstance(),this.dbOps=new BP(app),this.indexOps=new Ade(app,this.dbOps,this.embeddingsManager),this.eventHandler=new Pde(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={...oe()};let e=async()=>{let r=oe(),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())}};wa(()=>{this.initializationPromise=e()})}async initialize(){try{let e=3;for(;e>0;)try{let r=await this.embeddingsManager.getEmbeddingsAPI();await this.dbOps.initializeDB(r);break}catch(r){if(r instanceof rn&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new rG.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:",r);break}}catch(e){console.error("Failed to initialize vector store:",e)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(e){return await this.waitForInitialization(),rG.Platform.isMobile&&oe().disableIndexOnMobile?(new rG.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 qEe(t){return t.split("|")[1]==="copilot-plus"}function f4(){return vn().isPlusUser}async function lO(t){return oe().plusLicenseKey?(await Ji.getInstance().validateLicenseKey(t)).isValid:(lze(),!1)}function U3t(){let t=Lmn,e=sze,r=oe().embeddingModelKey;B("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),mtt(t),Dj("copilot_plus"),wE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(B("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Jc(),Qf)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ie("Failed to trigger indexing after Plus settings applied:",n),new z3t.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):B("applyPlusSettings: No embedding model change, skipping indexing")}function uze(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function oD(t){window.open(uze(t),"_blank")}function q3t(){nt("isPlusUser",!0)}function lze(){let t=oe().isPlusUser;nt("isPlusUser",!1),t&&new lre(app).open()}var z3t,ize,Lmn,aze,sze,pci,mci,ly=b(()=>{ua();vu();jat();or();My();Gt();bt();z3t=require("obsidian"),ize="copilot-plus-flash",Lmn=ize+"|"+"copilot-plus",aze="copilot-plus-small",sze=aze+"|"+"copilot-plus",pci=bu.defaultModelKey,mci=bu.embeddingModelKey});var H3t,V3t,Ji,My=b(()=>{or();jj();Gt();ly();bt();H3t=j(Im()),V3t=require("obsidian"),Ji=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!oe().plusLicenseKey)throw new V3t.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=oe().userId;let a=new URL(`${tI}${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 So(oe().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(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",oe().userId);let o=new URL(`${tI}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await So(oe().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(`==== ${e} FormData 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 So(oe().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"?(lze(),{isValid:!1}):{isValid:void 0}:(q3t(),{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=H3t.Buffer.from(e).toString("base64"),{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 W3t,p4,cze=b(()=>{Gt();W3t=j(a4()),p4=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,W3t.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 pze=x((Cci,J3t)=>{var Fmn="Expected a function",K3t=NaN,kmn="[object Symbol]",$mn=/^\s+|\s+$/g,Bmn=/^[-+]0x[0-9a-f]+$/i,zmn=/^0b[01]+$/i,Umn=/^0o[0-7]+$/i,qmn=parseInt,Hmn=typeof window=="object"&&window&&window.Object===Object&&window,Vmn=typeof self=="object"&&self&&self.Object===Object&&self,Wmn=Hmn||Vmn||Function("return this")(),Kmn=Object.prototype,Gmn=Kmn.toString,Jmn=Math.max,Zmn=Math.min,dze=function(){return Wmn.Date.now()};function Ymn(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(Fmn);e=G3t(e)||0,fze(r)&&(c=!!r.leading,d="maxWait"in r,i=d?Jmn(G3t(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 h(E){return l=E,s=setTimeout(y,e),c?p(E):a}function m(E){var P=E-u,T=E-l,I=e-P;return d?Zmn(I,i-T):I}function g(E){var P=E-u,T=E-l;return u===void 0||P>=e||P<0||d&&T>=i}function y(){var E=dze();if(g(E))return _(E);s=setTimeout(y,m(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:_(dze())}function C(){var E=dze(),P=g(E);if(n=arguments,o=this,u=E,P){if(s===void 0)return h(u);if(d)return s=setTimeout(y,e),p(u)}return s===void 0&&(s=setTimeout(y,e)),a}return C.cancel=w,C.flush=S,C}function fze(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Xmn(t){return!!t&&typeof t=="object"}function Qmn(t){return typeof t=="symbol"||Xmn(t)&&Gmn.call(t)==kmn}function G3t(t){if(typeof t=="number")return t;if(Qmn(t))return K3t;if(fze(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=fze(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace($mn,"");var r=zmn.test(t);return r||Umn.test(t)?qmn(t.slice(2),r?2:8):Bmn.test(t)?K3t:+t}J3t.exports=Ymn});var Z3t,Ide,Y3t,dR,b_,nG=b(()=>{cze();Gt();rh();bt();Z3t=j(a4()),Ide=require("obsidian"),Y3t=j(pze());JBe();dR=class dR{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new dF;this.handleFileEvent=e=>{e instanceof Ide.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=oe().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=vc({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});_s(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,Y3t.default)(e=>{this.handleFileChange(e)},dR.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=p4.getInstance(),this.initializeEventListeners()}static getInstance(){return dR.instance||(dR.instance=new dR),dR.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,Z3t.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 dF;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++):Bt(`[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 Bt(`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"?(Bt(`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 Ide.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=oe().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}=vc({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 Ide.TFile)||!_s(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}=vc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(_s(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)))}};dR.DEBOUNCE_DELAY=5e3;b_=dR});var fF,cO,pF,mze=b(()=>{Gt();ir();fF=require("obsidian"),cO=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 _u(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 fF.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 a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return ie("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await _u(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 a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}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 fF.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 u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}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 fF.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 fF.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}};cO.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],cO.MAX_IMAGE_SIZE=3*1024*1024,cO.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};pF=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 cO.isImageUrl(e,n))return null;let o=await cO.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 cO.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 fF.Notice(`Failed to process images:
${e.join(`
`)}`)}}});var fR,Mde=b(()=>{mze();My();ir();Gt();fR=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Ji.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=>!jet(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){let n=eo(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 cO.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 X3t,Rde,Q3t=b(()=>{Gt();X3t=j(a4()),Rde=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,X3t.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 UP(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 eHt(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var oG=b(()=>{});var tHt,jde,rHt,Nde,nHt=b(()=>{tHt=require("obsidian"),Nde=class{constructor(e){this.vault=e;bwe(this,jde)}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 tHt.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];SGe(this,jde,rHt).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}};jde=new WeakSet,rHt=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 oHt,hze,Dde,gze,m4,iG,pR,Lde=b(()=>{Q3t();nG();Gt();oG();oHt=require("obsidian");nHt();hze=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},Dde=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=Rde.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()}},gze=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{B("Parsing Canvas file:",e.path);let n=new Nde(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}]`}}},m4=class m4{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=b_.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){m4.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),UP(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-m4.lastRateLimitNoticeTime<6e4)return;m4.lastRateLimitNoticeTime=r;let n=eHt(e);new oHt.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")}};m4.lastRateLimitNoticeTime=0;iG=m4,pR=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new hze),this.registerParser(new iG(e,o)),n||this.registerParser(new Dde(e)),this.registerParser(new gze)}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 Dde&&await e.clearCache()}}});var kde={};os(kde,{createToolCallMarker:()=>Fde,decodeResultFromMarker:()=>bze,decodeToolCallMarkerResults:()=>ehn,ensureEncodedToolCallMarkerResults:()=>thn,parseToolCallMarkers:()=>_ze,updateToolCallMarker:()=>vze});function yze(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function bze(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=bze(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function thn(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=yze(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function _ze(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:bze(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 Fde(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&yze(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function vze(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=yze(r);return t.replace(o,`$1false$2${i}-->`)}var h4=b(()=>{});var iHt,qP,sG=b(()=>{or();Gt();ir();iHt=require("obsidian"),qP=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:Zg,isVisible:!0,timestamp:tu(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i(""),B(`==== Chat Memory ====
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(u=>u.content));try{let{decodeToolCallMarkerResults:u}=await Promise.resolve().then(()=>(h4(),kde)),l=u(e);B(`==== Final AI Response ====
`,l)}catch{B(`==== Final AI Response ====
`,e)}return e}async handleError(e,r,n){let o=eo(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:Zg,isVisible:!0,timestamp:tu(new Date)})}else new iHt.Notice(s),ie(i)}}});var __,g4=b(()=>{__=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 uG,aHt=b(()=>{or();Gt();bt();ir();sG();g4();uG=class extends qP{async run(e,r,n,o,i){let a=new __(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=QB(l),d=[],f=Mf(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:eI(p),content:f});for(let m of c)d.push({role:m.role,content:m.content});if(e.content&&Array.isArray(e.content)){let m=e.content.map(g=>g.type==="text"?{...g,text:e.message}:g);d.push({role:"user",content:m})}else d.push({role:"user",content:e.message});B(`==== Final Request to AI ====
`,d);let h=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let m of h){if(r.signal.aborted){B("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(m)}}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 y4,sHt=b(()=>{UA();Tf();vv();y4=class extends Un{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,In(r))}async getRelevantDocuments(e,r){let n=In(T6(r)),i=await(await gu.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 wze=b(()=>{sHt()});var $de={};os($de,{HybridRetriever:()=>lG});var lG,cG=b(()=>{My();oF();mR();Gt();Jc();or();bt();ir();tG();ZA();wze();Bce();Ede();lG=class extends y4{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Em.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=Jg(r,app.vault),i=o.map(m=>m.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 oe().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((m,g)=>{let y=g.metadata.score;return typeof y=="number"&&!isNaN(y)?Math.max(m,y):m},0),p=c.every(m=>typeof m.metadata.score!="number"||isNaN(m.metadata.score)),h=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return h&&(d=(await Ji.getInstance().rerank(r,c.map(g=>g.pageContent.slice(0,3e3)))).response.data.map(g=>({...c[g.index],metadata:{...c[g.index].metadata,rerank_score:g.relevance_score}}))),oe().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),h?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{return await Cee(async()=>{let n=await this.queryRewritePrompt.format({question:r}),o=await Od(()=>Vd.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?Aj(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)},oz)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await zP.getInstance().getDb(),a=await BP.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new nh({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 zP.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&&(oe().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=Jg(d.join(", "),app.vault),h=(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 g=(await Kp(a,s)).hits.map(w=>new nh({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}})),y=[...h,...g];return Array.from(new Set(y.map(w=>w.metadata.id))).map(w=>y.find(S=>S.metadata.id===w)).filter(w=>w!==void 0)}oe().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await Kp(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 nh({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 Iu.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 Sze,xze,hR,Bde=b(()=>{Gt();or();Sze=require("obsidian");oze();xze={maxChars:Mj,overlap:0,maxBytesTotal:10*1024*1024},hR=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0;this.splitter=d4.fromLanguage("markdown",{chunkSize:Mj,chunkOverlap:0,separators:[`
`,`
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return Bt("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&(Bt("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 Bt("ChunkManager: No valid note paths provided"),[];let o={...xze,...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):Bt(`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 Bt("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||Bt(`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 Bt(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof Sze.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)?(Bt(`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||"":(Bt(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),"")}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,xze);if(r.length>0){let n=this.calculateChunkBytes(r);if(this.memoryUsage+n<=xze.maxBytesTotal){let o=this.cache.get(e);o&&(this.memoryUsage-=this.calculateChunkBytes(o)),this.cache.set(e,r),this.memoryUsage+=n}else Bt(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return Bt(`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 Sze.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,h=o.substring(f,p),m=await this.processContentSection(h,c.heading,n,u,r);s.push(...m),u+=m.length}return s}catch(n){return Bt(`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,h=this.generateChunkId(n.path,p),m=this.calculateContentHash(d.pageContent);s.push({id:h,notePath:n.path,chunkIndex:p,content:d.pageContent,contentHash:m,title:a,heading:r,mtime:n.stat.mtime})})}catch(c){Bt(`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 Bt(`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 Cze=x(()=>{});function Wd(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 b4(t,e){return typeof t>"u"?e:t}function zs(){return Object.create(null)}function v_(t){return typeof t=="string"}function fG(t){return typeof t=="object"}function pG(t,e){if(v_(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}function x4(t={}){if(!this||this.constructor!==x4)return new x4(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}function hF(t){t.F=null,t.B.clear(),t.D.clear()}function Mze(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 bF);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 bF(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}function pHt(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 S4(t){if(!this||this.constructor!==S4)return new S4(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 pHt(e,o||0,i||e.length,!1)};if(n==="splice")return function(o,i){return pHt(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 w_(t=8){if(!this||this.constructor!==w_)return new w_(t);this.index=zs(),this.h=[],this.size=0,t>32?(this.B=xHt,this.A=BigInt(t)):(this.B=wHt,this.A=t)}function x_(t=8){if(!this||this.constructor!==x_)return new x_(t);this.index=zs(),this.h=[],this.size=0,t>32?(this.B=xHt,this.A=BigInt(t)):(this.B=wHt,this.A=t)}function wHt(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 xHt(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 ahn(t){t=t.data;var e=t.task;let r=t.id,n=t.args;switch(e){case"init":dG=t.options||{},(e=t.factory)?(Function("return "+e)()(self),_4=new self.FlexSearch.Index(dG),delete self.FlexSearch):_4=new S_(dG),postMessage({id:r});break;default:let o;e==="export"&&(n[1]?(n[0]=dG.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=await dG.import.call(_4,n[0]),_4.import(n[0],t)):((o=n&&_4[e].apply(_4,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 Nze(t){v4.call(t,"add"),v4.call(t,"append"),v4.call(t,"search"),v4.call(t,"update"),v4.call(t,"remove"),v4.call(t,"searchCache")}function shn(){Pze=Hde=0}function v4(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]),Pze?Hde||(Hde=Date.now()-mHt>=this.priority*this.priority*3):(Pze=setTimeout(shn,0),mHt=Date.now()),Hde){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 gF(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=zs(),this.worker)return o?this.worker.on("message",u):this.worker.onmessage=u,t.config?new Promise(function(l){gR>1e9&&(gR=0),i.h[++gR]=function(){l(i)},i.worker.postMessage({id:gR,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!==gF)return new gF(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=uhn(n,o,t.worker);return a.then?a.then(function(s){return r.call(i,s)}):r.call(this,a)}function yR(t){gF.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),gR>1e9&&(gR=0),e.h[++gR]=i,e.worker.postMessage({task:t,id:gR,args:r})}),o?(n.then(o),this):n}}function uhn(t,e,r){return e?typeof module<"u"?new(Cze()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>j(Cze())).then(function(n){return new n.Worker(vHt.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ahn.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:vHt.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"})}function Tze(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++)Tze(t,e,r,n,o);else e=e[o]||(e[o]=zs()),o=r[++n],Tze(t,e,r,n,o)}function Aze(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++)Aze(t,e,r,n,o,i,a,s);else a=e[++n],Aze(t,e,r,n,o,i,a,s)}function jze(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?w4.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?w4.call(this,a):a;if(o.push(a),e-=s,!e)break}return o=o.length>1?[].concat.apply([],o):o[0],n?w4.call(this,o):o}function Yde(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===fa)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 h=o.async||p,m=o.index,g=o.query;if(m?t.index||(t.index=m):m=t.index,g||o.tag){let y=o.field||o.pluck;if(y&&(!g||t.query&&!d||(t.query=g,t.field=y,t.highlight=d),m=m.index.get(y)),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=h?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)}})(m,Object.assign({},o)),t.C.push(S),i[e]=S;continue}else o.resolve=!1,o.index=null,p=h?m.searchAsync(o):m.search(o),o.resolve=l,o.index=m}else if(o.and)p=Ude(o,"and",m);else if(o.or)p=Ude(o,"or",m);else if(o.not)p=Ude(o,"not",m);else if(o.xor)p=Ude(o,"xor",m);else continue}p.await?(f=1,p=p.await):p.then?(f=1,p=p.then(function(h){return h.result||h})):p=p.result||p,i[e]=p}if(f&&!t.await&&(t.await=new Promise(function(h){t.return=h})),f){let h=Promise.all(i).then(function(m){for(let g=0;g<t.C.length;g++)if(t.C[g]===h){t.C[g]=function(){return r.call(t,m,a,s,u,l,c,d)};break}Dze(t)});t.C.push(h)}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 Ude(t,e,r){t=t[e];let n=t[0]||t;return n.index||(n.index=r),r=new fa(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}function lhn(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=SHt(t,e,r,!1,this.h),r=0)),o&&(this.await=null),o?this.resolve(e,r,n,a):this}function chn(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=Wde(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 dhn(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=zs(),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,h;p<f.length;p++)if(h=f[p])for(let m=0,g;m<h.length;m++)g=h[m],l[g]=l[g]?2:1}for(let d=0,f,p=0;d<c;d++)for(let h=0,m;h<t.length;h++)if((m=t[h])&&(f=m[d])){for(let g=0,y;g<f.length;g++)if(y=f[g],l[y]===1)if(i)i--;else if(o){if(u.push(y),u.length===e){t=u;break e}}else{let _=d+(h?s:0);if(u[_]||(u[_]=[]),u[_].push(y),++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 fhn(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 Vde(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,h;typeof u=="object"&&(p=u.before,p===0&&(p=-1),h=u.after,h===0&&(h=-1),u=u.total||9e5),d=new Map;for(let X=0,ee,L,Q;X<e.length;X++){let z;if(n)z=e,Q=n;else{var m=e[X];if(Q=m.field,!Q)continue;z=m.result}L=r.get(Q),ee=L.encoder,m=d.get(ee),typeof m!="string"&&(m=ee.encode(t),d.set(ee,m));for(let W=0;W<z.length;W++){var g=z[W].doc;if(!g||(g=pG(g,Q),!g))continue;var y=g.trim().split(/\s+/);if(!y.length)continue;g="";var _=[];let V=[];for(var w=-1,S=-1,C=0,E=0;E<y.length;E++){var P=y[E],T=ee.encode(P);T=T.length>1?T.join(" "):T[0];let q;if(T&&P){for(var I=P.length,N=(ee.split?P.replace(ee.split,""):P).length-T.length,M="",D=0,k=0;k<m.length;k++){var F=m[k];if(F){var K=F.length;K+=N,D&&K<=D||(F=T.indexOf(F),F>-1&&(M=(F?P.substring(0,F):"")+a+P.substring(F,F+K)+s+(F+K<I?P.substring(F+K):""),D=K,q=!0))}}M&&(u&&(w<0&&(w=g.length+(g?1:0)),S=g.length+(g?1:0)+M.length,C+=I,V.push(_.length),_.push({match:M})),g+=(g?" ":"")+M)}if(!q)P=y[E],g+=(g?" ":"")+P,u&&_.push({text:P});else if(u&&C>=u)break}if(C=V.length*(i.length-2),p||h||u&&g.length-C>u)if(C=u+C-f*2,E=S-w,p>0&&(E+=p),h>0&&(E+=h),E<=C)y=p?w-(p>0?p:0):w-((C-E)/2|0),_=h?S+(h>0?h:0):y+C,l||(y>0&&g.charAt(y)!==" "&&g.charAt(y-1)!==" "&&(y=g.indexOf(" ",y),y<0&&(y=0)),_<g.length&&g.charAt(_-1)!==" "&&g.charAt(_)!==" "&&(_=g.lastIndexOf(" ",_),_<S?_=S:++_)),g=(y?o:"")+g.substring(y,_)+(_<g.length?o:"");else{for(S=[],w={},C={},E={},P={},T={},M=N=I=0,k=D=1;;){var U=void 0;for(let q=0,H;q<V.length;q++){if(H=V[q],M)if(N!==M){if(E[q+1])continue;if(H+=M,w[H]){I-=f,C[q+1]=1,E[q+1]=1;continue}if(H>=_.length-1){if(H>=_.length){E[q+1]=1,H>=y.length&&(C[q+1]=1);continue}I-=f}if(g=_[H].text,K=h&&T[q])if(K>0){if(g.length>K)if(E[q+1]=1,l)g=g.substring(0,K);else continue;(K-=g.length)||(K=-1),T[q]=K}else{E[q+1]=1;continue}if(I+g.length+1<=u)g=" "+g,S[q]+=g;else if(l)U=u-I-1,U>0&&(g=" "+g.substring(0,U),S[q]+=g),E[q+1]=1;else{E[q+1]=1;continue}}else{if(E[q])continue;if(H-=N,w[H]){I-=f,E[q]=1,C[q]=1;continue}if(H<=0){if(H<0){E[q]=1,C[q]=1;continue}I-=f}if(g=_[H].text,K=p&&P[q])if(K>0){if(g.length>K)if(E[q]=1,l)g=g.substring(g.length-K);else continue;(K-=g.length)||(K=-1),P[q]=K}else{E[q]=1;continue}if(I+g.length+1<=u)g+=" ",S[q]=g+S[q];else if(l)U=g.length+1-(u-I),U>=0&&U<g.length&&(g=g.substring(U)+" ",S[q]=g+S[q]),E[q]=1;else{E[q]=1;continue}}else{g=_[H].match,p&&(P[q]=p),h&&(T[q]=h),q&&I++;let G;if(H?!q&&f&&(I+=f):(C[q]=1,E[q]=1),H>=y.length-1||H<_.length-1&&_[H+1].match?G=1:f&&(I+=f),I-=i.length-2,!q||I+g.length<=u)S[q]=g;else{U=D=k=C[q]=0;break}G&&(C[q+1]=1,E[q+1]=1)}I+=g.length,U=w[H]=1}if(U)N===M?M++:N++;else{if(N===M?D=0:k=0,!D&&!k)break;D?(N++,M=N):M++}}g="";for(let q=0,H;q<S.length;q++)H=(q&&C[q]?" ":(q&&!o?" ":"")+o)+S[q],g+=H;o&&!C[S.length]&&(g+=o)}c&&(g=g.replace(c," ")),z[W].highlight=g}if(n)break}return e}function fa(t,e){if(!this||this.constructor!==fa)return new fa(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,Dze(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 Dze(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 Wde(t,e,r,n,o,i,a){let s=t.length,u=[],l,c;l=zs();for(let d=0,f,p,h,m;d<e;d++)for(let g=0;g<s;g++)if(h=t[g],d<h.length&&(f=h[d]))for(let y=0;y<f.length;y++){if(p=f[y],(c=l[p])?l[p]++:(c=0,l[p]=1),m=u[c]||(u[c]=[]),!a){let _=d+(g||!o?0:i||0);m=m[_]||(m[_]=[])}if(m.push(p),a&&r&&c===s-1&&m.length-n===r)return n?m.slice(n):m}if(t=u.length)if(o)u=u.length>1?SHt(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 SHt(t,e,r,n,o){let i=[],a=zs(),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 h=0;h<l;h++)if(s=n[h],!a[s])if(a[s]=1,r)r--;else{let m=(p+(c<u-1&&o||0))/(c+1)|0;if((i[m]||(i[m]=[])).push(s),++f===e)return i}}}return i}function phn(t,e,r){let n=zs(),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 hHt(t){let e=[],r=zs(),n=zs();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 mhn(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=w4.call(this,t))),t):[]):[]}function w4(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 yF(t){if(!this||this.constructor!==yF)return new yF(t);let e=t.document||t.doc||t,r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&Kde(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 x_(n):new Set:n?new w_(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new w_(n):new Map:null,this.cache=(r=t.cache||null)&&new bF(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=hhn.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]=Kde(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 hhn(t,e){let r=new Map,n=e.index||e.field||e;v_(n)&&(n=[n]);for(let i=0,a,s;i<n.length;i++){if(a=n[i],v_(a)||(s=a,a=a.field),s=fG(s)?Object.assign({},t,s):t,this.worker){var o=void 0;o=(o=s.encoder)&&o.encode?o:new x4(typeof o=="string"?Rze[o]:o||{}),o=new gF(s,o),r.set(a,o)}this.worker||r.set(a,new S_(s,this.reg)),s.custom?this.B[i]=s.custom:(this.B[i]=Kde(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,v_(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]=Kde(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 Kde(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 Lze(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 Fze(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 CHt(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(let o of t.entries())n.push([o[0],Lze(o[1])[0]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function OHt(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],Fze(n[1],o));return e}function EHt(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 PHt(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function Gde(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 Gde.call(l,t,e,r,s?n:null,o,i,a+1)})}return Gde.call(this,t,e,r,s?n:null,o,i,a+1)}function ghn(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=EHt(this.reg),e=null;break;case 1:o="tag",i=this.tag&&CHt(this.tag,this.reg.size),e=null;break;case 2:o="doc",i=this.store&&Lze(this.store),e=null;break;default:return}return Gde.call(this,t,e,o,i||null,r,n)}function yhn(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=PHt(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=OHt(e,this.tag);break;case"doc":this.store=Fze(e,this.store)}}}function gHt(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 mG(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],mG(o[1],e)?r++:t.delete(n);return r}function HP(t,e,r,n,o,i,a){let s,u;if(!(s=e[r])||a&&!s[a]){if(a?(e=s||(e[r]=zs()),e[a]=1,u=t.ctx,(s=u.get(a))?u=s:u.set(a,u=t.keystore?new w_(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 S4(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 qde(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 yHt(t,e,r,n,o,i,a){let s=t.length,u=t;if(s>1)u=Wde(t,e,r,n,o,i,a);else if(s===1)return a?jze.call(null,t[0],r,n):new fa(t[0],this);return a?u:new fa(u,this)}function bHt(t,e,r,n,o,i,a){return t=Ize(this,t,e,r,n,o,i,a),this.db?t.then(function(s){return o?s||[]:new fa(s,this)}):t&&t.length?o?jze.call(this,t,r,n):new fa(t,this):o?[]:new fa([],this)}function _Ht(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 Ize(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 S_(t,e){if(!this||this.constructor!==S_)return new S_(t);if(t){var r=v_(t)?t:t.preset;r&&(t=Object.assign({},bhn[r],t))}else t={};r=t.context;let n=r===!0?{depth:1}:r||{},o=v_(t.encoder)?Rze[t.encoder]:t.encode||t.encoder||{};this.encoder=o.encode?o:typeof o=="object"?new x4(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 w_(r):new Map,this.ctx=r?new w_(r):new Map,this.reg=e||(this.fastupdate?r?new w_(r):new Map:r?new x_(r):new Set),this.N=n.resolution||3,this.rtl=o.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new bF(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 THt(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}function Zde(t,e={}){if(!this||this.constructor!==Zde)return new Zde(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 Eze(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 bR(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 vHt,$t,rhn,nhn,ohn,ihn,uHt,lHt,zde,Oze,cHt,dHt,fHt,Rze,_4,dG,Pze,mHt,Hde,gR,bhn,AHt,Jde,mF,IHt,MHt=b(()=>{vHt={};rhn=/[^\p{L}\p{N}]+/u,nhn=/(\d{3})/g,ohn=/(\D)(\d{3})/g,ihn=/(\d{3})(\D)/g,uHt=/[\u0300-\u036f]/g;$t=x4.prototype;$t.assign=function(t){this.normalize=Wd(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=Wd(t.numeric,n)}else{try{this.split=Wd(this.split,rhn)}catch{this.split=/\s+/}this.numeric=Wd(t.numeric,Wd(this.numeric,!0))}if(this.prepare=Wd(t.prepare,null,this.prepare),this.finalize=Wd(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:Wd(r&&new Set(r),null,this.filter),this.dedupe=Wd(t.dedupe,!0,this.dedupe),this.matcher=Wd((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=Wd((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=Wd((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=Wd(t.replacer,null,this.replacer),this.minlength=Wd(t.minlength,1,this.minlength),this.maxlength=Wd(t.maxlength,1024,this.maxlength),this.rtl=Wd(t.rtl,!1,this.rtl),(this.cache=r=Wd(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};$t.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&&hF(this),this};$t.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&hF(this),this};$t.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&&hF(this),this)};$t.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&&hF(this),this)};$t.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&hF(this),this)};$t.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(hF,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=uHt?t.normalize("NFKD").replace(uHt,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(ohn,"$1 $2").replace(ihn,"$1 $2").replace(nhn,"$1 "));let r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),n=[],o=zs(),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(hF,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="",h,m;f<c.length;f++)h=c.charAt(f),h===p&&this.dedupe||((m=this.mapper&&this.mapper.get(h))||m===""?m===p&&this.dedupe||!(p=m)||(u+=m):u+=p=h);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};bF.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)};bF.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};bF.prototype.remove=function(t){for(let e of this.cache){let r=e[0];e[1].includes(t)&&this.cache.delete(r)}};bF.prototype.clear=function(){this.cache.clear(),this.h=""};lHt={normalize:!1,numeric:!1,dedupe:!1},zde={},Oze=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"]]),cHt=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),dHt=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],fHt={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},Rze={Exact:lHt,Default:zde,Normalize:zde,LatinBalance:{mapper:Oze},LatinAdvanced:{mapper:Oze,matcher:cHt,replacer:dHt},LatinExtra:{mapper:Oze,replacer:dHt.concat([/(?!^)[aeo]/g,""]),matcher:cHt},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=fHt[n];for(let i=1,a;i<e.length&&(a=e.charAt(i),a==="h"||a==="w"||!(a=fHt[a])||a===o||(n+=a,o=a,n.length!==4));i++);t[r]=n}}},CJK:{split:""},LatinExact:lHt,LatinDefault:zde,LatinSimple:zde};S4.prototype.clear=function(){this.index.length=0};S4.prototype.push=function(){};w_.prototype.get=function(t){let e=this.index[this.B(t)];return e&&e.get(t)};w_.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++)};x_.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++)};$t=w_.prototype;$t.has=x_.prototype.has=function(t){let e=this.index[this.B(t)];return e&&e.has(t)};$t.delete=x_.prototype.delete=function(t){let e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};$t.clear=x_.prototype.clear=function(){this.index=zs(),this.h=[],this.size=0};$t.values=x_.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};$t.keys=x_.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};$t.entries=x_.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};gR=0;yR("add");yR("append");yR("search");yR("update");yR("remove");yR("clear");yR("export");yR("import");gF.prototype.searchCache=Mze;Nze(gF.prototype);yF.prototype.add=function(t,e,r){if(fG(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]:v_(u)&&(u=[u]),Aze(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=zs();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){v_(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 S4(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=zs();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(v_(l)||l.constructor===String){s[l]=e[l];continue}Tze(e,s,l,0,l[0],c)}}this.store.set(t,s||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};fa.prototype.or=function(){return Yde(this,"or",lhn,arguments)};fa.prototype.and=function(){return Yde(this,"and",chn,arguments)};fa.prototype.xor=function(){return Yde(this,"xor",dhn,arguments)};fa.prototype.not=function(){return Yde(this,"not",fhn,arguments)};$t=fa.prototype;$t.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};$t.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};$t.boost=function(t){if(this.await){let e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};$t.resolve=function(t,e,r,n,o){let i=this.await?Dze(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?w4.call(this.index,i):i:jze.call(this.index,i,t||100,e,r)),this.finalize(i,n)};$t.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=Vde(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};zs();yF.prototype.search=function(t,e,r,n){r||(!e&&fG(t)?(r=t,t=""):fG(e)&&(r=e,e=0));let o=[];var i=[];let a,s,u,l,c,d,f=0,p=!0,h;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 m=this.tag&&r.tag;u=r.suggest,p=r.resolve!==!1,c=r.cache,h=p&&this.store&&r.highlight;var g=!!h||p&&this.store&&r.enrich;e=r.limit||e;var y=r.offset||0;if(e||(e=p?100:0),m&&(!this.db||!n)){m.constructor!==Array&&(m=[m]);var _=[];for(let P=0,T;P<m.length;P++)if(T=m[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(m=_,!t){if(i=[],_.length)for(m=0;m<_.length;m+=2){if(this.db){if(n=this.index.get(_[m]),!n)continue;i.push(n=n.db.tag(_[m+1],e,y,g))}else n=mhn.call(this,_[m],_[m+1],e,y,g);o.push(p?{field:_[m],tag:_[m+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 fa(o.length>1?Wde(o,1,0,0,u,l):o[0],P)})}return p?o:new fa(o.length>1?Wde(o,1,0,0,u,l):o[0],this)}}p||a||!(d=d||this.field)||(v_(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(v_(I)||(M=I,I=M.field,t=M.query||t,e=b4(M.limit,e),y=b4(M.offset,y),u=b4(M.suggest,u),h=p&&this.store&&b4(M.highlight,h),g=!!h||p&&this.store&&b4(M.enrich,g),c=b4(M.cache,c)),n)T=n[P];else{w=M||r||{},S=w.enrich;var E=this.index.get(I);if(m&&(this.db&&(w.tag=m,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,m&&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 fa(o,this)}}else for(let D=0,k,F;D<m.length;D+=2){if(k=this.tag.get(m[D]),!k){if(u)continue;return p?o:new fa(o,this)}if(F=(k=k&&k.get(m[D+1]))&&k.length)S++,w.push(k);else if(!u)return p?o:new fa(o,this)}if(S){if(T=phn(T,w,p),N=T.length,!N&&!u)return p?T:new fa(T,this);S--}}if(N)i[f]=I,o.push(T),f++;else if(d.length===1)return p?o:new fa(o,this)}if(_){if(this.db&&m&&m.length&&!C)for(g=0;g<m.length;g+=2){if(i=this.index.get(m[g]),!i){if(u)continue;return p?o:new fa(o,this)}_.push(i.db.tag(m[g+1],e,y,!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 fa(o,this);if(a&&(!g||!this.store))return o=o[0],p?o:new fa(o,this);for(_=[],y=0;y<i.length;y++){if(m=o[y],g&&m.length&&typeof m[0].doc>"u"&&(this.db?_.push(m=this.index.get(this.field[0]).db.enrich(m)):m=w4.call(this,m)),a)return p?h?Vde(t,m,this.index,a,h):m:new fa(m,this);o[y]={field:i[y],result:m}}if(g&&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 h&&(o=Vde(t,o,P.index,a,h)),s?hHt(o):o})}return h&&(o=Vde(t,o,this.index,a,h)),s?hHt(o):o};$t=yF.prototype;$t.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 S_({},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})};$t.commit=async function(){let t=[];for(let e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()};$t.destroy=function(){let t=[];for(let e of this.index.values())t.push(e.destroy());return Promise.all(t)};$t.append=function(t,e){return this.add(t,e,!0)};$t.update=function(t,e){return this.remove(t).add(t,e)};$t.remove=function(t){fG(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};$t.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};$t.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};$t.cleanup=function(){for(let t of this.index.values())t.cleanup();return this};$t.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};$t.set=function(t,e){return typeof t=="object"&&(e=t,t=pG(e,this.key)),this.store.set(t,e),this};$t.searchCache=Mze;$t.export=ghn;$t.import=yhn;Nze(yF.prototype);S_.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 mG(this.map,t),this.depth&&mG(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&THt(this)),this.cache&&this.cache.remove(t),this};bhn={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};S_.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=zs(),d=zs(),f=this.resolution;for(let p=0;p<l;p++){let h=e[this.rtl?l-1-p:p];var o=h.length;if(o&&(n||!d[h])){var i=this.score?this.score(e,h,p,null,0):qde(f,l,p),a="";switch(this.tokenize){case"tolerant":if(HP(this,d,h,i,t,r),o>2){for(let m=1,g,y,_,w;m<o-1;m++)g=h.charAt(m),y=h.charAt(m+1),_=h.substring(0,m)+y,w=h.substring(m+2),a=_+g+w,HP(this,d,a,i,t,r),a=_+w,HP(this,d,a,i,t,r);HP(this,d,h.substring(0,h.length-1),i,t,r)}break;case"full":if(o>2){for(let m=0,g;m<o;m++)for(i=o;i>m;i--){a=h.substring(m,i),g=this.rtl?o-1-m:m;var s=this.score?this.score(e,h,p,a,g):qde(f,l,p,o,g);HP(this,d,a,s,t,r)}break}case"bidirectional":case"reverse":if(o>1){for(s=o-1;s>0;s--){a=h[this.rtl?o-1-s:s]+a;var u=this.score?this.score(e,h,p,a,s):qde(f,l,p,o,s);HP(this,d,a,u,t,r)}a=""}case"forward":if(o>1){for(s=0;s<o;s++)a+=h[this.rtl?o-1-s:s],HP(this,d,a,i,t,r);break}default:if(HP(this,d,h,i,t,r),n&&l>1&&p<l-1)for(o=this.N,a=h,i=Math.min(n+1,this.rtl?p+1:l-p),s=1;s<i;s++){h=e[this.rtl?l-1-p-s:p+s],u=this.bidirectional&&h>a;let m=this.score?this.score(e,a,p,h,s-1):qde(o+(l/2>o?0:1),l,p,i-1,s-1);HP(this,c,u?a:h,m,t,r,u?h:a)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&THt(this)),this};S_.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 bHt.call(this,p[0],"",e,s,u,f,l);if(o===2&&i&&!a)return bHt.call(this,p[1],p[0],e,s,u,f,l);let h=zs(),m=0,g;if(i&&(g=p[0],m=1),d||d===0||(d=g?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 y=this;return async function(){for(let _,w;m<o;m++){if((w=p[m])&&!h[w]){if(h[w]=1,_=await Ize(y,w,g,0,0,!1,!1),_=_Ht(_,n,a,d)){n=_;break}g&&(a&&_&&n.length||(g=w))}a&&g&&m===o-1&&!n.length&&(d=y.resolution,g="",m=-1,h=zs())}return yHt(n,d,e,s,a,c,u)}()}for(let y,_;m<o;m++){if((_=p[m])&&!h[_]){if(h[_]=1,y=Ize(this,_,g,0,0,!1,!1),y=_Ht(y,n,a,d)){n=y;break}g&&(a&&y&&n.length||(g=_))}a&&g&&m===o-1&&!n.length&&(d=this.resolution,g="",m=-1,h=zs())}return yHt(n,d,e,s,a,c,u)};$t=S_.prototype;$t.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};$t.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};$t.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};$t.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};$t.append=function(t,e){return this.add(t,e,!0)};$t.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};$t.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)};$t.cleanup=function(){return this.fastupdate?(mG(this.map),this.depth&&mG(this.ctx),this):this};$t.searchCache=Mze;$t.export=function(t,e,r=0,n=0){let o,i;switch(n){case 0:o="reg",i=EHt(this.reg);break;case 1:o="cfg",i=null;break;case 2:o="map",i=Lze(this.map,this.reg.size);break;case 3:o="ctx",i=CHt(this.ctx,this.reg.size);break;default:return}return Gde.call(this,t,e,o,i,r,n)};$t.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=PHt(e,this.reg);break;case"map":this.map=Fze(e,this.map);break;case"ctx":this.ctx=OHt(e,this.ctx)}};$t.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=gHt(this.map,i),r="index.map=new Map(["+r+"]);";for(let a of this.ctx.entries()){o=a[0];let s=gHt(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};Nze(S_.prototype);AHt=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Jde=["map","ctx","tag","reg","cfg"],mF=zs();$t=Zde.prototype;$t.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};$t.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist(),mF[t.id]||(mF[t.id]=[]),mF[t.id].push(t.field);let e=AHt.open(t.id,1);return e.onupgradeneeded=function(){let r=t.db=this.result;for(let n=0,o;n<Jde.length;n++){o=Jde[n];for(let i=0,a;i<mF[t.id].length;i++)a=mF[t.id][i],r.objectStoreNames.contains(o+(o!=="reg"&&a?":"+a:""))||r.createObjectStore(o+(o!=="reg"&&a?":"+a:""))}},t.db=bR(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};$t.close=function(){this.db&&this.db.close(),this.db=null};$t.destroy=function(){let t=AHt.deleteDatabase(this.id);return bR(t)};$t.clear=function(){let t=[];for(let r=0,n;r<Jde.length;r++){n=Jde[r];for(let o=0,i;o<mF[this.id].length;o++)i=mF[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 bR(e)};$t.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 bR(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})};$t.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 bR(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)})};$t.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]=bR(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})};$t.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),bR(t).then(function(e){return!!e})};$t.search=null;$t.info=function(){};$t.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,bR(o).finally(function(){return o=n=null,i})};$t.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,h,m;p<f;p++)if((m=l[p])&&m.length){if((h=c[p])&&h.length)for(d=0;d<m.length;d++)h.push(m[d]);else c[p]=m;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())};$t.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&&Eze(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Eze(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Eze(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};IHt={Index:S_,Charset:Rze,Encoder:x4,Document:yF,Worker:gF,Resolver:fa,IndexedDB:Zde,Language:{}}});var C4,Xde,RHt=b(()=>{Gt();bt();C4=class C4{constructor(){this.bytesUsed=0;let e=oe(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*C4.MB_TO_BYTES,this.candidateLimit=Math.min(C4.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}};C4.DEFAULT_CANDIDATE_LIMIT=500,C4.MB_TO_BYTES=1024*1024;Xde=C4});var hG,Gp,Qde,NHt=b(()=>{Gt();or();MHt();hG=require("obsidian");Bde();RHt();Gp=class Gp{constructor(e,r){this.app=e;this.indexedChunks=new Set;this.memoryManager=new Xde,this.chunkManager=r||new hR(e),this.index=null}createIndex(){let e=IHt.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:Mj,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*Gp.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=Gp.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 hG.TFile){let h=this.app.metadataCache.getFileCache(p),m=h?(0,hG.getAllTags)(h)??[]:[],g=h?.frontmatter??{},y=this.app.metadataCache.resolvedLinks[p.path]??{},_=this.app.metadataCache.getBacklinksForFile(p)?.data??{},w=Object.keys(y),S=Object.keys(_),C=[...w,...S],E=this.extractPropertyValues(g);d={tags:m,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>Gp.MAX_CONTENT_SIZE&&(B(`FullText: File ${e.path} exceeds size limit (${n.length} bytes), truncating`),n=n.substring(0,Gp.MAX_CONTENT_SIZE));let o=r?(0,hG.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,Gp.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,Gp.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 m=1/(d+1)*u*c,g=n.get(p)||{score:0,fieldMatches:new Set,queriesMatched:new Set,lexicalMatches:[]};g.lexicalMatches.push({field:s,query:e,weight:u});let y={score:g.score+m,fieldMatches:new Set(g.fieldMatches).add(s),queriesMatched:new Set(g.queriesMatched).add(e),lexicalMatches:g.lexicalMatches};n.set(p,y)}}}}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 Gp.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){Bt(`FullTextEngine: Index method call error: ${r}`)}}catch(e){Bt(`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){Bt(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};Gp.MAX_CONTENT_SIZE=10*1024*1024,Gp.BATCH_SIZE=10,Gp.CHUNK_MEMORY_PERCENTAGE=.35,Gp.MAX_ARRAY_ITEMS=10,Gp.MAX_EXTRACTION_DEPTH=2,Gp.FIELD_WEIGHTS={title:3,path:1.5,headings:1.5,tags:1.5,props:1.5,links:1.5,body:1};Qde=Gp});var efe,jHt=b(()=>{efe=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 rfe,tfe,DHt=b(()=>{or();xE();Gt();ir();jHt();rfe=class rfe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??oz,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 Bt(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await Cee(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof a8)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=rfe.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=efe.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}};rfe.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>`;tfe=rfe});var gG,nfe,LHt=b(()=>{Gt();rh();gG=class gG{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=vc(),a=this.app.vault.getMarkdownFiles().filter(d=>_s(d,n,o)),s=new Set,u=gG.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 h=p.path.toLowerCase(),m=!1;for(let g of l)if(h.includes(g)){s.add(p.path),m=!0;break}if(!m){let y=(await this.app.vault.cachedRead(p)).toLowerCase();for(let _ of l)if(y.includes(_)){s.add(p.path);break}}}catch(h){B(`GrepScanner: Skipping file ${p.path}: ${h}`)}})),d%gG.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}}};gG.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};nfe=gG});var _hn,ofe,FHt=b(()=>{Gt();_hn={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},ofe=class{constructor(e){this.config=_hn;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 vhn,ife,kHt=b(()=>{Gt();vhn={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},ife=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...vhn,...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 afe,$Ht=b(()=>{afe=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 whn,sfe,BHt=b(()=>{or();Gt();Bde();NHt();DHt();LHt();FHt();kHt();$Ht();whn=2,sfe=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new nfe(e),this.chunkManager=new hR(e),this.fullTextEngine=new Qde(e,this.chunkManager),this.queryExpander=new tfe({getChatModel:this.getChatModel,maxVariants:3,timeout:oz}),this.folderBoostCalculator=new ofe(e),this.graphBoostCalculator=new ife(e,{enabled:!0,maxCandidates:10,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new afe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){if(!e||typeof e!="string")return Bt("SearchCore: Invalid query provided"),[];let n=e.trim();if(n.length===0)return Bt("SearchCore: Empty query provided"),[];n.length>1e3?(Bt("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 h=await this.executeLexicalSearch(f,c,l,o,s.originalQuery);if(a&&(h=this.folderBoostCalculator.applyBoosts(h),h=this.graphBoostCalculator.applyBoost(h)),h=this.scoreNormalizer.normalize(h),this.fullTextEngine.clear(),h=h.slice(0,o),h.length>0){let m=this.app.vault.getAbstractFileByPath(h[0].id);B(`SearchCore: ${h.length} results found (top: ${m?.name||h[0].id})`)}else B("SearchCore: No results found");return h}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*whn,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 _F,zHt=b(()=>{_F="0.39.0"});function WHt(t,e={auto:!1}){if(UHt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(vF)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${vF}'\``);UHt=e.auto,vF=t.kind,kze=t.fetch,xhn=t.Request,Shn=t.Response,Chn=t.Headers,qHt=t.FormData,Ohn=t.Blob,ufe=t.File,$ze=t.ReadableStream,HHt=t.getMultipartRequestOptions,Bze=t.getDefaultAgent,lfe=t.fileFromPath,VHt=t.isFsReadStream}var UHt,vF,kze,xhn,Shn,Chn,qHt,Ohn,ufe,$ze,HHt,Bze,lfe,VHt,zze=b(()=>{UHt=!1});var cfe,KHt=b(()=>{cfe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function GHt({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 cfe(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 JHt=b(()=>{KHt()});var ZHt=b(()=>{JHt()});var yG=b(()=>{zze();ZHt();zze();vF||WHt(GHt(),{auto:!0})});var Vr,Zc,Kd,_R,O4,bG,_G,vG,wG,xG,SG,CG,OG,C_=b(()=>{VP();Vr=class extends Error{},Zc=class t extends Vr{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 _R({message:n,cause:dfe(r)});let i=r;return e===400?new bG(e,i,n,o):e===401?new _G(e,i,n,o):e===403?new vG(e,i,n,o):e===404?new wG(e,i,n,o):e===409?new xG(e,i,n,o):e===422?new SG(e,i,n,o):e===429?new CG(e,i,n,o):e>=500?new OG(e,i,n,o):new t(e,i,n,o)}},Kd=class extends Zc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},_R=class extends Zc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},O4=class extends _R{constructor({message:e}={}){super({message:e??"Request timed out."})}},bG=class extends Zc{},_G=class extends Zc{},vG=class extends Zc{},wG=class extends Zc{},xG=class extends Zc{},SG=class extends Zc{},CG=class extends Zc{},OG=class extends Zc{}});function Ahn(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 YHt(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 ffe,wF,dg,WP,Uze=b(()=>{C_();ffe=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},wF=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)},WP=class{constructor(){dg.set(this,void 0),this.buffer=new Uint8Array,ffe(this,dg,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=Ahn(this.buffer,wF(this,dg,"f")))!=null;){if(i.carriage&&wF(this,dg,"f")==null){ffe(this,dg,i.index,"f");continue}if(wF(this,dg,"f")!=null&&(i.index!==wF(this,dg,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,wF(this,dg,"f")-1))),this.buffer=this.buffer.slice(wF(this,dg,"f")),ffe(this,dg,null,"f");continue}let a=wF(this,dg,"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),ffe(this,dg,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 Vr(`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 Vr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Vr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};dg=new WeakMap;WP.NEWLINE_CHARS=new Set([`
`,"\r"]);WP.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function EG(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 qze=b(()=>{});async function*Ihn(t,e){if(!t.body)throw e.abort(),new Vr("Attempted to iterate over a response with no body");let r=new Hze,n=new WP,o=EG(t.body);for await(let i of Mhn(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*Mhn(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=YHt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Rhn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var dO,Hze,pfe=b(()=>{yG();C_();Uze();qze();VP();C_();dO=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 Ihn(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,Vze(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 WP,s=EG(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 $ze({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?.()}})}};Hze=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]=Rhn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function XHt(t,e,r){if(t=await t,jhn(t))return t;if(Nhn(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=PG(o)?[await o.arrayBuffer()]:[o];return new ufe(i,e,r)}let n=await Dhn(t);if(e||(e=Fhn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new ufe(n,e,r)}async function Dhn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(PG(t))e.push(await t.arrayBuffer());else if(khn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Lhn(t)}`);return e}function Lhn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function Fhn(t){return Wze(t.name)||Wze(t.filename)||Wze(t.path)?.split(/[\\/]/).pop()}var Nhn,jhn,PG,Wze,khn,Kze,Gze=b(()=>{yG();yG();Nhn=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",jhn=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&PG(t),PG=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";Wze=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},khn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Kze=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody"});async function nVt(t){let{response:e}=t;if(t.options.stream)return E4("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):dO.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 E4("response",e.status,e.url,e.headers,i),oVt(i,e)}let o=await e.text();return E4("response",e.status,e.url,e.headers,o),o}function oVt(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 Hhn(){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 TG(t){if(!t)return!0;for(let e in t)return!1;return!0}function iVt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function rVt(t,e){for(let r in e){if(!iVt(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 E4(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var Bhn,zhn,mfe,gfe,yfe,bfe,Zze,Vze,Uhn,Dy,qhn,QHt,eVt,tVt,Vhn,Whn,Khn,Ghn,Jhn,Jze,dfe,_fe,Zhn,aVt,Yhn,hfe,VP=b(()=>{zHt();pfe();C_();yG();Gze();Bhn=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},zhn=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)};gfe=class t extends Promise{constructor(e,r=nVt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>oVt(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)}},yfe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Jze("maxRetries",r),this.timeout=Jze("timeout",n),this.httpAgent=o,this.fetch=i??kze}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Vhn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Zhn()}`}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&&PG(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:Kze(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&&Jze("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??Bze(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 rVt(i,a),rVt(i,r),Kze(e.body)&&vF!=="node"&&delete i["content-type"],hfe(a,"x-stainless-retry-count")===void 0&&hfe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),hfe(a,"x-stainless-timeout")===void 0&&hfe(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 Vr("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 gfe(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}),E4("request",a,n,i.headers),n.signal?.aborted)throw new Kd;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(dfe);if(l instanceof Error){if(n.signal?.aborted)throw new Kd;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new O4:new _R({cause:l})}let c=Vze(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let g=`retrying, ${r} attempts remaining`;return E4(`response (error; ${g})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(g=>dfe(g).message),f=Whn(d),p=f?void 0:d;throw E4(`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 Zze(this,n,e)}buildURL(e,r){let n=Ghn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return TG(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 Vr(`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 Jhn(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 ${_F}`}},bfe=class{constructor(e,r,n,o){mfe.set(this,void 0),Bhn(this,mfe,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 Vr("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 zhn(this,mfe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(mfe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Zze=class extends gfe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await nVt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Vze=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),Uhn={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},Dy=t=>typeof t=="object"&&t!==null&&!TG(t)&&Object.keys(t).every(e=>iVt(Uhn,e)),qhn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_F,"X-Stainless-OS":eVt(Deno.build.os),"X-Stainless-Arch":QHt(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":_F,"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":_F,"X-Stainless-OS":eVt(process.platform),"X-Stainless-Arch":QHt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Hhn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_F,"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":_F,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};QHt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",eVt=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"),Vhn=()=>tVt??(tVt=qhn()),Whn=t=>{try{return JSON.parse(t)}catch{return}},Khn=/^[a-z][a-z0-9+.-]*:/i,Ghn=t=>Khn.test(t),Jhn=t=>new Promise(e=>setTimeout(e,t)),Jze=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Vr(`${t} must be an integer`);if(e<0)throw new Vr(`${t} must be a positive integer`);return e},dfe=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))},_fe=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};Zhn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),aVt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Yhn=t=>typeof t?.get=="function",hfe=(t,e)=>{let r=e.toLowerCase();if(Yhn(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 fO,AG=b(()=>{VP();fO=class extends bfe{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,KP=b(()=>{Yc=class{constructor(e){this._client=e}}});var xF,P4,Yze=b(()=>{KP();VP();AG();xF=class extends Yc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return Dy(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",P4,{query:e,...r})}},P4=class extends fO{};xF.BetaModelInfosPage=P4});var T4,Xze=b(()=>{C_();qze();Uze();T4=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new WP;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 Vr("Attempted to iterate over a response with no body");return new t(EG(e.body),r)}}});var SF,A4,Qze=b(()=>{KP();VP();AG();Xze();C_();SF=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(Dy(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(Dy(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",A4,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(Dy(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(Dy(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(Dy(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new Vr(`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)=>T4.fromResponse(s.response,s.controller))}},A4=class extends fO{};SF.BetaMessageBatchesPage=A4});var tgn,I4,rgn,ngn,vfe,eUe=b(()=>{tgn=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},I4=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),I4(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),I4(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),I4(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),I4(t);break;case"delimiter":return t=t.slice(0,t.length-1),I4(t);break}return t},rgn=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},ngn=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},vfe=t=>JSON.parse(ngn(rgn(I4(tgn(t)))))});var ep,$n,Ly,vR,IG,wfe,MG,RG,xfe,NG,GP,jG,Sfe,Cfe,M4,Ofe,Efe,tUe,uVt,rUe,nUe,oUe,iUe,lVt,cVt,Pfe,dVt=b(()=>{C_();pfe();eUe();ep=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)},cVt="__json_buf",Pfe=class t{constructor(){Ly.add(this),this.messages=[],this.receivedMessages=[],vR.set(this,void 0),this.controller=new AbortController,IG.set(this,void 0),wfe.set(this,()=>{}),MG.set(this,()=>{}),RG.set(this,void 0),xfe.set(this,()=>{}),NG.set(this,()=>{}),GP.set(this,{}),jG.set(this,!1),Sfe.set(this,!1),Cfe.set(this,!1),M4.set(this,!1),Ofe.set(this,void 0),Efe.set(this,void 0),rUe.set(this,e=>{if(ep(this,Sfe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Kd),e instanceof Kd)return ep(this,Cfe,!0,"f"),this._emit("abort",e);if(e instanceof Vr)return this._emit("error",e);if(e instanceof Error){let r=new Vr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Vr(String(e)))}),ep(this,IG,new Promise((e,r)=>{ep(this,wfe,e,"f"),ep(this,MG,r,"f")}),"f"),ep(this,RG,new Promise((e,r)=>{ep(this,xfe,e,"f"),ep(this,NG,r,"f")}),"f"),$n(this,IG,"f").catch(()=>{}),$n(this,RG,"f").catch(()=>{})}get response(){return $n(this,Ofe,"f")}get request_id(){return $n(this,Efe,"f")}async withResponse(){let e=await $n(this,IG,"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,rUe,"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,Ly,"m",nUe).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,Ly,"m",oUe).call(this,s);if(a.controller.signal?.aborted)throw new Kd;$n(this,Ly,"m",iUe).call(this)}_connected(e){this.ended||(ep(this,Ofe,e,"f"),ep(this,Efe,e?.headers.get("request-id"),"f"),$n(this,wfe,"f").call(this,e),this._emit("connect"))}get ended(){return $n(this,jG,"f")}get errored(){return $n(this,Sfe,"f")}get aborted(){return $n(this,Cfe,"f")}abort(){this.controller.abort()}on(e,r){return($n(this,GP,"f")[e]||($n(this,GP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=$n(this,GP,"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,GP,"f")[e]||($n(this,GP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ep(this,M4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ep(this,M4,!0,"f"),await $n(this,RG,"f")}get currentMessage(){return $n(this,vR,"f")}async finalMessage(){return await this.done(),$n(this,Ly,"m",tUe).call(this)}async finalText(){return await this.done(),$n(this,Ly,"m",uVt).call(this)}_emit(e,...r){if($n(this,jG,"f"))return;e==="end"&&(ep(this,jG,!0,"f"),$n(this,xfe,"f").call(this));let n=$n(this,GP,"f")[e];if(n&&($n(this,GP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!$n(this,M4,"f")&&!n?.length&&Promise.reject(o),$n(this,MG,"f").call(this,o),$n(this,NG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!$n(this,M4,"f")&&!n?.length&&Promise.reject(o),$n(this,MG,"f").call(this,o),$n(this,NG,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",$n(this,Ly,"m",tUe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),$n(this,Ly,"m",nUe).call(this),this._connected(null);let o=dO.fromReadableStream(e,this.controller);for await(let i of o)$n(this,Ly,"m",oUe).call(this,i);if(o.controller.signal?.aborted)throw new Kd;$n(this,Ly,"m",iUe).call(this)}[(vR=new WeakMap,IG=new WeakMap,wfe=new WeakMap,MG=new WeakMap,RG=new WeakMap,xfe=new WeakMap,NG=new WeakMap,GP=new WeakMap,jG=new WeakMap,Sfe=new WeakMap,Cfe=new WeakMap,M4=new WeakMap,Ofe=new WeakMap,Efe=new WeakMap,rUe=new WeakMap,Ly=new WeakSet,tUe=function(){if(this.receivedMessages.length===0)throw new Vr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},uVt=function(){if(this.receivedMessages.length===0)throw new Vr("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 Vr("stream ended without producing a content block with type=text");return r.join(" ")},nUe=function(){this.ended||ep(this,vR,void 0,"f")},oUe=function(r){if(this.ended)return;let n=$n(this,Ly,"m",lVt).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":{ep(this,vR,n,"f");break}case"content_block_start":case"message_delta":break}},iUe=function(){if(this.ended)throw new Vr("stream has ended, this shouldn't happen");let r=$n(this,vR,"f");if(!r)throw new Vr("request ended without sending any chunks");return ep(this,vR,void 0,"f"),r},lVt=function(r){let n=$n(this,vR,"f");if(r.type==="message_start"){if(n)throw new Vr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Vr(`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[cVt]||"";i+=r.delta.partial_json,Object.defineProperty(o,cVt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=vfe(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 dO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var fVt,wR,aUe=b(()=>{KP();Qze();Qze();dVt();fVt={"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"},wR=class extends Yc{constructor(){super(...arguments),this.batches=new SF(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in fVt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${fVt[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 Pfe.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}})}};wR.Batches=SF;wR.BetaMessageBatchesPage=A4});var pO,sUe=b(()=>{KP();Yze();Yze();aUe();aUe();pO=class extends Yc{constructor(){super(...arguments),this.models=new xF(this._client),this.messages=new wR(this._client)}};pO.Models=xF;pO.BetaModelInfosPage=P4;pO.Messages=wR});var CF,uUe=b(()=>{KP();CF=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 OF,R4,lUe=b(()=>{KP();VP();AG();Xze();C_();OF=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 Dy(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",R4,{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 Vr(`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)=>T4.fromResponse(i.response,i.controller))}},R4=class extends fO{};OF.MessageBatchesPage=R4});var tp,Bn,Fy,xR,DG,Tfe,LG,FG,Afe,kG,JP,$G,Ife,Mfe,N4,Rfe,Nfe,cUe,pVt,dUe,fUe,pUe,mUe,mVt,hVt,jfe,gVt=b(()=>{C_();pfe();eUe();tp=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},Bn=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)},hVt="__json_buf",jfe=class t{constructor(){Fy.add(this),this.messages=[],this.receivedMessages=[],xR.set(this,void 0),this.controller=new AbortController,DG.set(this,void 0),Tfe.set(this,()=>{}),LG.set(this,()=>{}),FG.set(this,void 0),Afe.set(this,()=>{}),kG.set(this,()=>{}),JP.set(this,{}),$G.set(this,!1),Ife.set(this,!1),Mfe.set(this,!1),N4.set(this,!1),Rfe.set(this,void 0),Nfe.set(this,void 0),dUe.set(this,e=>{if(tp(this,Ife,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Kd),e instanceof Kd)return tp(this,Mfe,!0,"f"),this._emit("abort",e);if(e instanceof Vr)return this._emit("error",e);if(e instanceof Error){let r=new Vr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Vr(String(e)))}),tp(this,DG,new Promise((e,r)=>{tp(this,Tfe,e,"f"),tp(this,LG,r,"f")}),"f"),tp(this,FG,new Promise((e,r)=>{tp(this,Afe,e,"f"),tp(this,kG,r,"f")}),"f"),Bn(this,DG,"f").catch(()=>{}),Bn(this,FG,"f").catch(()=>{})}get response(){return Bn(this,Rfe,"f")}get request_id(){return Bn(this,Nfe,"f")}async withResponse(){let e=await Bn(this,DG,"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")},Bn(this,dUe,"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())),Bn(this,Fy,"m",fUe).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)Bn(this,Fy,"m",pUe).call(this,s);if(a.controller.signal?.aborted)throw new Kd;Bn(this,Fy,"m",mUe).call(this)}_connected(e){this.ended||(tp(this,Rfe,e,"f"),tp(this,Nfe,e?.headers.get("request-id"),"f"),Bn(this,Tfe,"f").call(this,e),this._emit("connect"))}get ended(){return Bn(this,$G,"f")}get errored(){return Bn(this,Ife,"f")}get aborted(){return Bn(this,Mfe,"f")}abort(){this.controller.abort()}on(e,r){return(Bn(this,JP,"f")[e]||(Bn(this,JP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Bn(this,JP,"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(Bn(this,JP,"f")[e]||(Bn(this,JP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{tp(this,N4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){tp(this,N4,!0,"f"),await Bn(this,FG,"f")}get currentMessage(){return Bn(this,xR,"f")}async finalMessage(){return await this.done(),Bn(this,Fy,"m",cUe).call(this)}async finalText(){return await this.done(),Bn(this,Fy,"m",pVt).call(this)}_emit(e,...r){if(Bn(this,$G,"f"))return;e==="end"&&(tp(this,$G,!0,"f"),Bn(this,Afe,"f").call(this));let n=Bn(this,JP,"f")[e];if(n&&(Bn(this,JP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Bn(this,N4,"f")&&!n?.length&&Promise.reject(o),Bn(this,LG,"f").call(this,o),Bn(this,kG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Bn(this,N4,"f")&&!n?.length&&Promise.reject(o),Bn(this,LG,"f").call(this,o),Bn(this,kG,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Bn(this,Fy,"m",cUe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Bn(this,Fy,"m",fUe).call(this),this._connected(null);let o=dO.fromReadableStream(e,this.controller);for await(let i of o)Bn(this,Fy,"m",pUe).call(this,i);if(o.controller.signal?.aborted)throw new Kd;Bn(this,Fy,"m",mUe).call(this)}[(xR=new WeakMap,DG=new WeakMap,Tfe=new WeakMap,LG=new WeakMap,FG=new WeakMap,Afe=new WeakMap,kG=new WeakMap,JP=new WeakMap,$G=new WeakMap,Ife=new WeakMap,Mfe=new WeakMap,N4=new WeakMap,Rfe=new WeakMap,Nfe=new WeakMap,dUe=new WeakMap,Fy=new WeakSet,cUe=function(){if(this.receivedMessages.length===0)throw new Vr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},pVt=function(){if(this.receivedMessages.length===0)throw new Vr("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 Vr("stream ended without producing a content block with type=text");return r.join(" ")},fUe=function(){this.ended||tp(this,xR,void 0,"f")},pUe=function(r){if(this.ended)return;let n=Bn(this,Fy,"m",mVt).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":{tp(this,xR,n,"f");break}case"content_block_start":case"message_delta":break}},mUe=function(){if(this.ended)throw new Vr("stream has ended, this shouldn't happen");let r=Bn(this,xR,"f");if(!r)throw new Vr("request ended without sending any chunks");return tp(this,xR,void 0,"f"),r},mVt=function(r){let n=Bn(this,xR,"f");if(r.type==="message_start"){if(n)throw new Vr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Vr(`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[hVt]||"";i+=r.delta.partial_json,Object.defineProperty(o,hVt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=vfe(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 dO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var ZP,yVt,hUe=b(()=>{KP();lUe();lUe();gVt();ZP=class extends Yc{constructor(){super(...arguments),this.batches=new OF(this._client)}create(e,r){return e.model in yVt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${yVt[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 jfe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},yVt={"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"};ZP.Batches=OF;ZP.MessageBatchesPage=R4});var SR,EF,gUe=b(()=>{KP();VP();AG();SR=class extends Yc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return Dy(e)?this.list({},e):this._client.getAPIList("/v1/models",EF,{query:e,...r})}},EF=class extends fO{};SR.ModelInfosPage=EF});var bVt=b(()=>{sVt();sUe();uUe();hUe();gUe()});var _Vt,Ri,Qpi,emi,vVt=b(()=>{VP();C_();Gze();bVt();uUe();gUe();sUe();hUe();Ri=class extends yfe{constructor({baseURL:e=_fe("ANTHROPIC_BASE_URL"),apiKey:r=_fe("ANTHROPIC_API_KEY")??null,authToken:n=_fe("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&aVt())throw new Vr(`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 CF(this),this.messages=new ZP(this),this.models=new SR(this),this.beta=new pO(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&&!TG(r)?r:n!=null&&!TG(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};_Vt=Ri;Ri.Anthropic=_Vt;Ri.HUMAN_PROMPT=`
Human:`;Ri.AI_PROMPT=`
Assistant:`;Ri.DEFAULT_TIMEOUT=6e5;Ri.AnthropicError=Vr;Ri.APIError=Zc;Ri.APIConnectionError=_R;Ri.APIConnectionTimeoutError=O4;Ri.APIUserAbortError=Kd;Ri.NotFoundError=wG;Ri.ConflictError=xG;Ri.RateLimitError=CG;Ri.BadRequestError=bG;Ri.AuthenticationError=_G;Ri.InternalServerError=OG;Ri.PermissionDeniedError=vG;Ri.UnprocessableEntityError=SG;Ri.toFile=XHt;Ri.fileFromPath=lfe;Ri.Completions=CF;Ri.Messages=ZP;Ri.Models=SR;Ri.ModelInfosPage=EF;Ri.Beta=pO;({HUMAN_PROMPT:Qpi,AI_PROMPT:emi}=Ri)});function yUe(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 BG,bUe=b(()=>{Db();BG=class extends wj{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 Mh(`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 Mh(`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)?yUe(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 wVt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}var xVt=b(()=>{});function SVt(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 CVt=b(()=>{});function OVt(t){let e=wB({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 sgn(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 Xs({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Xs({content:[{type:"tool_result",content:_Ue(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function EVt(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 _Ue(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(Ib(o))return x6(o,ugn);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=OVt(o.image_url):a=OVt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(SVt(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 Dfe(t){let e=sgn(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(Wi(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(EVt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(EVt)]};{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:_Ue(i.content)}}}else return{role:a,content:_Ue(i.content)}});return{messages:lgn(o),system:r}}function lgn(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 ugn,vUe=b(()=>{$s();CVt();ugn={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=wB({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 PVt(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 Sr({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 Sr({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 Sr({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 Sr({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 Sr({content:[{index:t.index,...r,type:"thinking"}]})}:{chunk:new Sr({content:[{index:t.index,...r,type:"text"}]})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new Sr({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 Sr({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 Sr({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 Sr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}]})}}}}return null}function TVt(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 kn({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=yUe(t);return[{text:"",message:new kn({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}var AVt=b(()=>{$s();bUe()});function Lfe(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function wUe(t){let e;return t.status===400&&t.message.includes("tool")?e=Lfe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=Lfe(t,"MODEL_AUTHENTICATION"):t.status===404?e=Lfe(t,"MODEL_NOT_FOUND"):t.status===429?e=Lfe(t,"MODEL_RATE_LIMIT"):e=t,e}var IVt=b(()=>{});function cgn(t){return!!(t.tools&&t.tools.length>0)}function dgn(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 fgn(t){return!!(t.thinking&&t.thinking.type==="enabled")}function pgn(t){return"input_schema"in t}function mgn(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 xUe,Ffe,MVt=b(()=>{vVt();$s();Zf();no();HC();ig();Kg();Pm();IL();ag();bUe();xVt();vUe();AVt();IVt();xUe=class extends Pu{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(pgn(r))return r;if($d(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Wc(r))return{name:r.name,description:r.description,input_schema:Cv(r.schema)?is(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=wVt(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=Dfe(e),a={...o,...i,stream:!0},s=!cgn(a)&&!dgn(a)&&!fgn(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=PVt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=mgn(f),h=new co({message:new Sr({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 h,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:h})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...Dfe(e)},n),{content:i,...a}=o,s=TVt(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 wUe(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 wUe(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(Cv(n)){let h=is(n);l=[{name:s,description:h.description??"A function available to call.",input_schema:h}],u=new BG({returnSingle:!0,keyName:s,zodSchema:n})}else{let h;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(h=n,s=n.name):h={name:s,description:n.description??"",input_schema:n},l=[h],u=new BG({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let h="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(h),c=this.bind({tools:l});let m=g=>{if(!g.tool_calls||g.tool_calls.length===0)throw new Error(h);return g};c=c.pipe(m)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Lo.assign({parsed:(h,m)=>u.invoke(h.raw,m)}),f=Lo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Li.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},Ffe=class extends xUe{}});var RVt=b(()=>{vUe()});var NVt=b(()=>{MVt();RVt()});var jVt=b(()=>{NVt()});var kfe,$fe,DVt,SUe=b(()=>{kfe="RFC3986",$fe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},DVt="RFC1738"});function FVt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function OUe(t,e){if(hgn(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var hgn,mO,CUe,LVt,kVt=b(()=>{SUe();hgn=Array.isArray,mO=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),CUe=1024,LVt=(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+=CUe){let u=i.length>=CUe?i.slice(s,s+CUe):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===DVt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=mO[d];continue}if(d<2048){l[l.length]=mO[192|d>>6]+mO[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=mO[224|d>>12]+mO[128|d>>6&63]+mO[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=mO[240|d>>18]+mO[128|d>>12&63]+mO[128|d>>6&63]+mO[128|d&63]}a+=l.join("")}return a}});function _gn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function zVt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,h,m,g,y){let _=t,w=y,S=0,C=!1;for(;(w=w.get(EUe))!==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(EUe)>"u"&&(S=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&hO(_)&&(_=OUe(_,function(N){return N instanceof Date?f?.(N):N})),_===null){if(i)return u&&!m?u(e,wc.encoder,g,"key",p):e;_=""}if(_gn(_)||FVt(_)){if(u){let N=m?e:u(e,wc.encoder,g,"key",p);return[h?.(N)+"="+h?.(u(_,wc.encoder,g,"value",p))]}return[h?.(e)+"="+h?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&hO(_))m&&u&&(_=OUe(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(hO(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&&hO(_)&&_.length===1?T+"[]":T;if(o&&hO(_)&&_.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,F=hO(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");y.set(t,S);let K=new WeakMap;K.set(EUe,y),BVt(E,zVt(D,F,r,n,o,i,a,s,r==="comma"&&m&&hO(_)?null:u,l,c,d,f,p,h,m,g,K))}return E}function vgn(t=wc){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||wc.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=kfe;if(typeof t.format<"u"){if(!ggn.call($fe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=$fe[r],o=wc.filter;(typeof t.filter=="function"||hO(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in $Vt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=wc.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:wc.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:wc.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:wc.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:wc.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?wc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:wc.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:wc.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:wc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:wc.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:wc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:wc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:wc.strictNullHandling}}function PUe(t,e={}){let r=t,n=vgn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):hO(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=$Vt[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||BVt(a,zVt(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 ggn,$Vt,hO,ygn,BVt,bgn,wc,EUe,UVt=b(()=>{kVt();SUe();ggn=Object.prototype.hasOwnProperty,$Vt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},hO=Array.isArray,ygn=Array.prototype.push,BVt=function(t,e){ygn.apply(t,hO(e)?e:[e])},bgn=Date.prototype.toISOString,wc={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:LVt,encodeValuesOnly:!1,format:kfe,formatter:$fe[kfe],indices:!1,serializeDate(t){return bgn.call(t)},skipNulls:!1,strictNullHandling:!1};EUe={}});var qVt=b(()=>{UVt()});var PF,HVt=b(()=>{PF="4.95.1"});function WVt(t,e={auto:!1}){if(VVt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(TF)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${TF}'\``);VVt=e.auto,TF=t.kind,TUe=t.fetch,xgn=t.Request,Sgn=t.Response,Cgn=t.Headers,AUe=t.FormData,Ogn=t.Blob,Bfe=t.File,IUe=t.ReadableStream,MUe=t.getMultipartRequestOptions,RUe=t.getDefaultAgent,zfe=t.fileFromPath,NUe=t.isFsReadStream}var VVt,TF,TUe,xgn,Sgn,Cgn,AUe,Ogn,Bfe,IUe,MUe,RUe,zfe,NUe,jUe=b(()=>{VVt=!1});var Ufe,KVt=b(()=>{Ufe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function GVt({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 Ufe(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 JVt=b(()=>{KVt()});var ZVt=b(()=>{JVt()});var DUe,zG=b(()=>{jUe();ZVt();jUe();DUe=()=>{TF||WVt(GVt(),{auto:!0})};DUe()});var Ht,Ru,Ma,YP,fg,j4,D4,L4,F4,k4,$4,B4,z4,U4,q4,oh=b(()=>{yo();Ht=class extends Error{},Ru=class t extends Ht{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 YP({message:n,cause:qfe(r)});let i=r?.error;return e===400?new j4(e,i,n,o):e===401?new D4(e,i,n,o):e===403?new L4(e,i,n,o):e===404?new F4(e,i,n,o):e===409?new k4(e,i,n,o):e===422?new $4(e,i,n,o):e===429?new B4(e,i,n,o):e>=500?new z4(e,i,n,o):new t(e,i,n,o)}},Ma=class extends Ru{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},YP=class extends Ru{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},fg=class extends YP{constructor({message:e}={}){super({message:e??"Request timed out."})}},j4=class extends Ru{},D4=class extends Ru{},L4=class extends Ru{},F4=class extends Ru{},k4=class extends Ru{},$4=class extends Ru{},B4=class extends Ru{},z4=class extends Ru{},U4=class extends Ht{constructor(){super("Could not parse response content as the length limit was reached")}},q4=class extends Ht{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function Agn(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 YVt(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 Hfe,AF,pg,IF,XVt=b(()=>{oh();Hfe=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)},IF=class{constructor(){pg.set(this,void 0),this.buffer=new Uint8Array,Hfe(this,pg,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=Agn(this.buffer,AF(this,pg,"f")))!=null;){if(i.carriage&&AF(this,pg,"f")==null){Hfe(this,pg,i.index,"f");continue}if(AF(this,pg,"f")!=null&&(i.index!==AF(this,pg,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,AF(this,pg,"f")-1))),this.buffer=this.buffer.slice(AF(this,pg,"f")),Hfe(this,pg,null,"f");continue}let a=AF(this,pg,"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),Hfe(this,pg,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 Ht(`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 Ht(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Ht("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};pg=new WeakMap;IF.NEWLINE_CHARS=new Set([`
`,"\r"]);IF.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function LUe(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 QVt=b(()=>{});async function*Ign(t,e){if(!t.body)throw e.abort(),new Ht("Attempted to iterate over a response with no body");let r=new FUe,n=new IF,o=LUe(t.body);for await(let i of Mgn(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*Mgn(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=YVt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Rgn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var gO,FUe,Vfe=b(()=>{zG();oh();XVt();QVt();yo();oh();gO=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 Ign(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 Ru(void 0,s.error,void 0,kUe(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 Ru(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 IF,s=LUe(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 IUe({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?.()}})}};FUe=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]=Rgn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function zUe(t,e,r){if(t=await t,t6t(t))return t;if(e6t(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=UG(o)?[await o.arrayBuffer()]:[o];return new Bfe(i,e,r)}let n=await jgn(t);if(e||(e=Lgn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Bfe(n,e,r)}async function jgn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(UG(t))e.push(await t.arrayBuffer());else if(Fgn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Dgn(t)}`);return e}function Dgn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function Lgn(t){return $Ue(t.name)||$Ue(t.filename)||$Ue(t.path)?.split(/[\\/]/).pop()}var e6t,t6t,UG,Ngn,$Ue,Fgn,UUe,ky,r6t,BUe,Wfe=b(()=>{zG();zG();e6t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",t6t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&UG(t),UG=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",Ngn=t=>t6t(t)||e6t(t)||NUe(t);$Ue=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Fgn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",UUe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",ky=async t=>{let e=await r6t(t.body);return MUe(e,t)},r6t=async t=>{let e=new AUe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>BUe(e,r,n))),e},BUe=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(Ngn(r)){let n=await zUe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>BUe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>BUe(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 u6t(t){let{response:e}=t;if(t.options.stream)return XP("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):gO.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 XP("response",e.status,e.url,e.headers,a),l6t(a,e)}let i=await e.text();return XP("response",e.status,e.url,e.headers,i),i}function l6t(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 qgn(){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 c6t(t){if(!t)return!0;for(let e in t)return!1;return!0}function d6t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a6t(t,e){for(let r in e){if(!d6t(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 XP(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 VG(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var $gn,Bgn,Kfe,Jfe,Zfe,qG,HUe,kUe,zgn,hn,Ugn,n6t,o6t,i6t,Hgn,Vgn,Wgn,Kgn,QP,qUe,qfe,HG,s6t,Ggn,f6t,Jgn,Gfe,p6t,yo=b(()=>{HVt();Vfe();oh();zG();Wfe();Wfe();$gn=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},Bgn=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)};DUe();Jfe=class t extends Promise{constructor(e,r=u6t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>l6t(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)}},Zfe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=qUe("maxRetries",r),this.timeout=qUe("timeout",n),this.httpAgent=o,this.fetch=i??TUe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Hgn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Ggn()}`}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&&UG(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:UUe(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&&qUe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??RUe(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 a6t(i,a),a6t(i,r),UUe(e.body)&&TF!=="node"&&delete i["content-type"],Gfe(a,"x-stainless-retry-count")===void 0&&Gfe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Gfe(a,"x-stainless-timeout")===void 0&&Gfe(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 Ru.generate(e,r,n,o)}request(e,r=null){return new Jfe(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}),XP("request",a,n,i.headers),n.signal?.aborted)throw new Ma;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(qfe);if(l instanceof Error){if(n.signal?.aborted)throw new Ma;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new fg:new YP({cause:l})}let c=kUe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let g=`retrying, ${r} attempts remaining`;return XP(`response (error; ${g})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(g=>qfe(g).message),f=Vgn(d),p=f?void 0:d;throw XP(`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 HUe(this,n,e)}buildURL(e,r){let n=Kgn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return c6t(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 Ht(`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 QP(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}`}},qG=class{constructor(e,r,n,o){Kfe.set(this,void 0),$gn(this,Kfe,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 Ht("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 Bgn(this,Kfe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Kfe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},HUe=class extends Jfe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await u6t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},kUe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),zgn={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},hn=t=>typeof t=="object"&&t!==null&&!c6t(t)&&Object.keys(t).every(e=>d6t(zgn,e)),Ugn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PF,"X-Stainless-OS":o6t(Deno.build.os),"X-Stainless-Arch":n6t(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":o6t(process.platform),"X-Stainless-Arch":n6t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=qgn();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"}};n6t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",o6t=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"),Hgn=()=>i6t??(i6t=Ugn()),Vgn=t=>{try{return JSON.parse(t)}catch{return}},Wgn=/^[a-z][a-z0-9+.-]*:/i,Kgn=t=>Wgn.test(t),QP=t=>new Promise(e=>setTimeout(e,t)),qUe=(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},qfe=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)},HG=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"]);Ggn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),f6t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Jgn=t=>typeof t?.get=="function",Gfe=(t,e)=>{let r=e.toLowerCase();if(Jgn(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},p6t=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 yO,Eo,Xc=b(()=>{yo();yO=class extends qG{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}},Eo=class extends qG{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 ot,On=b(()=>{ot=class{constructor(e){this._client=e}}});var H4,VUe=b(()=>{On();yo();WG();H4=class extends ot{list(e,r={},n){return hn(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,Yfe,{query:r,...n})}}});var OR,ER,Yfe,WG=b(()=>{On();yo();VUe();VUe();Xc();OR=class extends ot{constructor(){super(...arguments),this.messages=new H4(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 hn(e)?this.list({},e):this._client.getAPIList("/chat/completions",ER,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},ER=class extends Eo{},Yfe=class extends Eo{};OR.ChatCompletionsPage=ER;OR.Messages=H4});var eT,WUe=b(()=>{On();WG();WG();eT=class extends ot{constructor(){super(...arguments),this.completions=new OR(this._client)}};eT.Completions=OR;eT.ChatCompletionsPage=ER});var m6t=b(()=>{WUe()});var h6t=b(()=>{});var V4,KUe=b(()=>{On();V4=class extends ot{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var W4,GUe=b(()=>{On();yo();W4=class extends ot{create(e,r){return this._client.post("/audio/transcriptions",ky({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var K4,JUe=b(()=>{On();yo();K4=class extends ot{create(e,r){return this._client.post("/audio/translations",ky({body:e,...r,__metadata:{model:e.model}}))}}});var bO,ZUe=b(()=>{On();KUe();KUe();GUe();GUe();JUe();JUe();bO=class extends ot{constructor(){super(...arguments),this.transcriptions=new W4(this._client),this.translations=new K4(this._client),this.speech=new V4(this._client)}};bO.Transcriptions=W4;bO.Translations=K4;bO.Speech=V4});var PR,MF,YUe=b(()=>{On();yo();Xc();PR=class extends ot{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 hn(e)?this.list({},e):this._client.getAPIList("/batches",MF,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},MF=class extends Eo{};PR.BatchesPage=MF});var RF,G4,XUe=b(()=>{On();yo();Xc();RF=class extends ot{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 hn(e)?this.list({},e):this._client.getAPIList("/assistants",G4,{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}})}},G4=class extends Eo{};RF.AssistantsPage=G4});function QUe(t){return typeof t.parse=="function"}var g6t=b(()=>{});var TR,eqe,tqe,rqe=b(()=>{TR=t=>t?.role==="assistant",eqe=t=>t?.role==="function",tqe=t=>t?.role==="tool"});var O_,vs,nqe,Xfe,Qfe,KG,GG,epe,JG,tT,ZG,tpe,rpe,J4,y6t,AR,npe=b(()=>{oh();O_=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},vs=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)},AR=class{constructor(){nqe.add(this),this.controller=new AbortController,Xfe.set(this,void 0),Qfe.set(this,()=>{}),KG.set(this,()=>{}),GG.set(this,void 0),epe.set(this,()=>{}),JG.set(this,()=>{}),tT.set(this,{}),ZG.set(this,!1),tpe.set(this,!1),rpe.set(this,!1),J4.set(this,!1),O_(this,Xfe,new Promise((e,r)=>{O_(this,Qfe,e,"f"),O_(this,KG,r,"f")}),"f"),O_(this,GG,new Promise((e,r)=>{O_(this,epe,e,"f"),O_(this,JG,r,"f")}),"f"),vs(this,Xfe,"f").catch(()=>{}),vs(this,GG,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},vs(this,nqe,"m",y6t).bind(this))},0)}_connected(){this.ended||(vs(this,Qfe,"f").call(this),this._emit("connect"))}get ended(){return vs(this,ZG,"f")}get errored(){return vs(this,tpe,"f")}get aborted(){return vs(this,rpe,"f")}abort(){this.controller.abort()}on(e,r){return(vs(this,tT,"f")[e]||(vs(this,tT,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=vs(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(vs(this,tT,"f")[e]||(vs(this,tT,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{O_(this,J4,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){O_(this,J4,!0,"f"),await vs(this,GG,"f")}_emit(e,...r){if(vs(this,ZG,"f"))return;e==="end"&&(O_(this,ZG,!0,"f"),vs(this,epe,"f").call(this));let n=vs(this,tT,"f")[e];if(n&&(vs(this,tT,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!vs(this,J4,"f")&&!n?.length&&Promise.reject(o),vs(this,KG,"f").call(this,o),vs(this,JG,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!vs(this,J4,"f")&&!n?.length&&Promise.reject(o),vs(this,KG,"f").call(this,o),vs(this,JG,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Xfe=new WeakMap,Qfe=new WeakMap,KG=new WeakMap,GG=new WeakMap,epe=new WeakMap,JG=new WeakMap,tT=new WeakMap,ZG=new WeakMap,tpe=new WeakMap,rpe=new WeakMap,J4=new WeakMap,nqe=new WeakSet,y6t=function(e){if(O_(this,tpe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ma),e instanceof Ma)return O_(this,rpe,!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 b6t(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function YG(t){return t?.$brand==="auto-parseable-response-format"}function _6t(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 NF(t){return t?.$brand==="auto-parseable-tool"}function v6t(t,e){return!e||!oqe(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}}))}:XG(t,e)}function XG(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new U4;if(n.finish_reason==="content_filter")throw new q4;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>nyn(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?ryn(e,n.message.content):null}}});return{...t,choices:r}}function ryn(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 nyn(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:NF(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function w6t(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return NF(r)||r?.function.strict||!1}function oqe(t){return YG(t.response_format)?!0:t.tools?.some(e=>NF(e)||e.type==="function"&&e.function.strict===!0)??!1}function x6t(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 Z4=b(()=>{oh()});var ih,rp,iqe,ope,aqe,sqe,uqe,C6t,lqe,S6t,Y4,cqe=b(()=>{oh();g6t();rqe();npe();Z4();ih=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)},S6t=10,Y4=class extends AR{constructor(){super(...arguments),rp.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),(eqe(e)||tqe(e))&&e.content)this._emit("functionCallResult",e.content);else if(TR(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(TR(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 Ht("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),ih(this,rp,"m",iqe).call(this)}async finalMessage(){return await this.done(),ih(this,rp,"m",ope).call(this)}async finalFunctionCall(){return await this.done(),ih(this,rp,"m",aqe).call(this)}async finalFunctionCallResult(){return await this.done(),ih(this,rp,"m",sqe).call(this)}async totalUsage(){return await this.done(),ih(this,rp,"m",uqe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=ih(this,rp,"m",ope).call(this);r&&this._emit("finalMessage",r);let n=ih(this,rp,"m",iqe).call(this);n&&this._emit("finalContent",n);let o=ih(this,rp,"m",aqe).call(this);o&&this._emit("finalFunctionCall",o);let i=ih(this,rp,"m",sqe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",ih(this,rp,"m",uqe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),ih(this,rp,"m",C6t).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(XG(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=S6t}=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 h=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new Ht("missing message in ChatCompletion response");if(!h.function_call)return;let{name:m,arguments:g}=h.function_call,y=c[m];if(y){if(u&&u!==m){let C=`Invalid function_call: ${JSON.stringify(m)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:m,content:C});continue}}else{let C=`Invalid function_call: ${JSON.stringify(m)}. Available options are: ${d.map(E=>JSON.stringify(E.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:m,content:C});continue}let _;try{_=QUe(y)?await y.parse(g):g}catch(C){this._addMessage({role:o,name:m,content:C instanceof Error?C.message:String(C)});continue}let w=await y.function(_,this),S=ih(this,rp,"m",lqe).call(this,w);if(this._addMessage({role:o,name:m,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=S6t}=n||{},c=r.tools.map(p=>{if(NF(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 m=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new Ht("missing message in ChatCompletion response");if(!m.tool_calls?.length)return;for(let g of m.tool_calls){if(g.type!=="function")continue;let y=g.id,{name:_,arguments:w}=g.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:y,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:y,content:T});continue}let C;try{C=QUe(S)?await S.parse(w):w}catch(T){let I=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:y,content:I});continue}let E=await S.function(C,this),P=ih(this,rp,"m",lqe).call(this,E);if(this._addMessage({role:o,tool_call_id:y,content:P}),u)return}}}};rp=new WeakSet,iqe=function(){return ih(this,rp,"m",ope).call(this).content??null},ope=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(TR(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 Ht("stream ended without producing a ChatCompletionMessage with role=assistant")},aqe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(TR(r)&&r?.function_call)return r.function_call;if(TR(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(eqe(r)&&r.content!=null||tqe(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}},uqe=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},C6t=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.")},lqe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var QG,O6t=b(()=>{cqe();rqe();QG=class t extends Y4{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),TR(e)&&e.content&&this._emit("content",e.content)}}});function oyn(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 iyn(t.trim(),e)}var Qc,dqe,fqe,iyn,pqe,E6t=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},dqe=class extends Error{},fqe=class extends Error{};iyn=(t,e)=>{let r=t.length,n=0,o=f=>{throw new dqe(`${f} at position ${n}`)},i=f=>{throw new fqe(`${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(h){i(String(h))}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 h=a();Object.defineProperty(f,p,{value:h,writable:!0,enumerable:!0,configurable:!0})}catch(h){if(Qc.OBJ&e)return f;throw h}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(h){i(String(h))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},pqe=t=>oyn(t,Qc.ALL^Qc.NUM)});function ayn(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:h=null,function_call:m,tool_calls:g,...y}=l,_=l.role;if(!_)throw new Ht(`missing role for choice ${d}`);if(m){let{arguments:w,name:S}=m;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:h,function_call:{arguments:w,name:S},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return g?{...p,index:d,finish_reason:c,logprobs:f,message:{...y,role:_,content:h,refusal:l.refusal??null,tool_calls:g.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
${spe(t)}`);if(E==null)throw new Ht(`missing choices[${d}].tool_calls[${S}].type
${spe(t)}`);if(N==null)throw new Ht(`missing choices[${d}].tool_calls[${S}].function.name
${spe(t)}`);if(I==null)throw new Ht(`missing choices[${d}].tool_calls[${S}].function.arguments
${spe(t)}`);return{...T,id:P,type:E,function:{...M,name:N,arguments:I}}})}}:{...p,message:{...y,content:h,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return v6t(u,e)}function spe(t){return JSON.stringify(t)}var X4,Zi,xc,rT,Q4,IR,mqe,ipe,hqe,gqe,yqe,ape,bqe,P6t,e3,_qe=b(()=>{oh();cqe();Vfe();Z4();E6t();X4=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},Zi=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)},e3=class t extends Y4{constructor(e){super(),xc.add(this),rT.set(this,void 0),Q4.set(this,void 0),IR.set(this,void 0),X4(this,rT,e,"f"),X4(this,Q4,[],"f")}get currentChatCompletionSnapshot(){return Zi(this,IR,"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())),Zi(this,xc,"m",mqe).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)Zi(this,xc,"m",hqe).call(this,a);if(i.controller.signal?.aborted)throw new Ma;return this._addChatCompletion(Zi(this,xc,"m",ape).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Zi(this,xc,"m",mqe).call(this),this._connected();let o=gO.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Zi(this,xc,"m",ape).call(this)),Zi(this,xc,"m",hqe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Ma;return this._addChatCompletion(Zi(this,xc,"m",ape).call(this))}[(rT=new WeakMap,Q4=new WeakMap,IR=new WeakMap,xc=new WeakSet,mqe=function(){this.ended||X4(this,IR,void 0,"f")},ipe=function(r){let n=Zi(this,Q4,"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},Zi(this,Q4,"f")[r.index]=n,n)},hqe=function(r){if(this.ended)return;let n=Zi(this,xc,"m",P6t).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=Zi(this,xc,"m",ipe).call(this,i);i.finish_reason&&(Zi(this,xc,"m",yqe).call(this,i),a.current_tool_call_index!=null&&Zi(this,xc,"m",gqe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Zi(this,xc,"m",yqe).call(this,i),a.current_tool_call_index!=null&&Zi(this,xc,"m",gqe).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))}}},gqe=function(r,n){if(Zi(this,xc,"m",ipe).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=Zi(this,rT,"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:NF(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},yqe=function(r){let n=Zi(this,xc,"m",ipe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Zi(this,xc,"m",bqe).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}))},ape=function(){if(this.ended)throw new Ht("stream has ended, this shouldn't happen");let r=Zi(this,IR,"f");if(!r)throw new Ht("request ended without sending any chunks");return X4(this,IR,void 0,"f"),X4(this,Q4,[],"f"),ayn(r,Zi(this,rT,"f"))},bqe=function(){let r=Zi(this,rT,"f")?.response_format;return YG(r)?r:null},P6t=function(r){var n,o,i,a;let s=Zi(this,IR,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=X4(this,IR,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...h}of r.choices){let m=s.choices[f];if(m||(m=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...h}),p)if(!m.logprobs)m.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...T}=p;Object.assign(m.logprobs,T),E&&((n=m.logprobs).content??(n.content=[]),m.logprobs.content.push(...E)),P&&((o=m.logprobs).refusal??(o.refusal=[]),m.logprobs.refusal.push(...P))}if(d&&(m.finish_reason=d,Zi(this,rT,"f")&&oqe(Zi(this,rT,"f")))){if(d==="length")throw new U4;if(d==="content_filter")throw new q4}if(Object.assign(m,h),!c)continue;let{content:g,refusal:y,function_call:_,role:w,tool_calls:S,...C}=c;if(Object.assign(m.message,C),y&&(m.message.refusal=(m.message.refusal||"")+y),w&&(m.message.role=w),_&&(m.message.function_call?(_.name&&(m.message.function_call.name=_.name),_.arguments&&((i=m.message.function_call).arguments??(i.arguments=""),m.message.function_call.arguments+=_.arguments)):m.message.function_call=_),g&&(m.message.content=(m.message.content||"")+g,!m.message.refusal&&Zi(this,xc,"m",bqe).call(this)&&(m.message.parsed=pqe(m.message.content))),S){m.message.tool_calls||(m.message.tool_calls=[]);for(let{index:E,id:P,type:T,function:I,...N}of S){let M=(a=m.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,w6t(Zi(this,rT,"f"),M)&&(M.function.parsed_arguments=pqe(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 gO(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var eJ,T6t=b(()=>{_qe();eJ=class t extends e3{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 tJ,A6t=b(()=>{On();O6t();T6t();_qe();Z4();tJ=class extends ot{parse(e,r){return x6t(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>XG(n,e))}runFunctions(e,r){return e.stream?eJ.runFunctions(this._client,e,r):QG.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?eJ.runTools(this._client,e,r):QG.runTools(this._client,e,r)}stream(e,r){return e3.createChatCompletion(this._client,e,r)}}});var t3,I6t=b(()=>{On();A6t();t3=class extends ot{constructor(){super(...arguments),this.completions=new tJ(this._client)}};(function(t){t.Completions=tJ})(t3||(t3={}))});var r3,vqe=b(()=>{On();r3=class extends ot{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var n3,wqe=b(()=>{On();n3=class extends ot{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var MR,xqe=b(()=>{On();vqe();vqe();wqe();wqe();MR=class extends ot{constructor(){super(...arguments),this.sessions=new r3(this._client),this.transcriptionSessions=new n3(this._client)}};MR.Sessions=r3;MR.TranscriptionSessions=n3});var ar,mg,Gd,Sqe,_O,upe,E_,DF,o3,jF,dpe,hg,lpe,cpe,oJ,rJ,nJ,M6t,R6t,N6t,j6t,D6t,L6t,F6t,vO,Cqe=b(()=>{yo();Vfe();oh();npe();ar=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)},mg=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},vO=class t extends AR{constructor(){super(...arguments),Gd.add(this),Sqe.set(this,[]),_O.set(this,{}),upe.set(this,{}),E_.set(this,void 0),DF.set(this,void 0),o3.set(this,void 0),jF.set(this,void 0),dpe.set(this,void 0),hg.set(this,void 0),lpe.set(this,void 0),cpe.set(this,void 0),oJ.set(this,void 0)}[(Sqe=new WeakMap,_O=new WeakMap,upe=new WeakMap,E_=new WeakMap,DF=new WeakMap,o3=new WeakMap,jF=new WeakMap,dpe=new WeakMap,hg=new WeakMap,lpe=new WeakMap,cpe=new WeakMap,oJ=new WeakMap,Gd=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=gO.fromReadableStream(e,this.controller);for await(let i of o)ar(this,Gd,"m",rJ).call(this,i);if(o.controller.signal?.aborted)throw new Ma;return this._addRun(ar(this,Gd,"m",nJ).call(this))}toReadableStream(){return new gO(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)ar(this,Gd,"m",rJ).call(this,l);if(u.controller.signal?.aborted)throw new Ma;return this._addRun(ar(this,Gd,"m",nJ).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 ar(this,lpe,"f")}currentRun(){return ar(this,cpe,"f")}currentMessageSnapshot(){return ar(this,E_,"f")}currentRunStepSnapshot(){return ar(this,oJ,"f")}async finalRunSteps(){return await this.done(),Object.values(ar(this,_O,"f"))}async finalMessages(){return await this.done(),Object.values(ar(this,upe,"f"))}async finalRun(){if(await this.done(),!ar(this,DF,"f"))throw Error("Final run was not received.");return ar(this,DF,"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)ar(this,Gd,"m",rJ).call(this,s);if(a.controller.signal?.aborted)throw new Ma;return this._addRun(ar(this,Gd,"m",nJ).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)ar(this,Gd,"m",rJ).call(this,u);if(s.controller.signal?.aborted)throw new Ma;return this._addRun(ar(this,Gd,"m",nJ).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(VG(i)&&VG(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(!VG(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)}};rJ=function(e){if(!this.ended)switch(mg(this,lpe,e,"f"),ar(this,Gd,"m",N6t).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":ar(this,Gd,"m",F6t).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":ar(this,Gd,"m",R6t).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":ar(this,Gd,"m",M6t).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},nJ=function(){if(this.ended)throw new Ht("stream has ended, this shouldn't happen");if(!ar(this,DF,"f"))throw Error("Final run has not been received");return ar(this,DF,"f")},M6t=function(e){let[r,n]=ar(this,Gd,"m",D6t).call(this,e,ar(this,E_,"f"));mg(this,E_,r,"f"),ar(this,upe,"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!=ar(this,o3,"f")){if(ar(this,jF,"f"))switch(ar(this,jF,"f").type){case"text":this._emit("textDone",ar(this,jF,"f").text,ar(this,E_,"f"));break;case"image_file":this._emit("imageFileDone",ar(this,jF,"f").image_file,ar(this,E_,"f"));break}mg(this,o3,o.index,"f")}mg(this,jF,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(ar(this,o3,"f")!==void 0){let o=e.data.content[ar(this,o3,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,ar(this,E_,"f"));break;case"text":this._emit("textDone",o.text,ar(this,E_,"f"));break}}ar(this,E_,"f")&&this._emit("messageDone",e.data),mg(this,E_,void 0,"f")}},R6t=function(e){let r=ar(this,Gd,"m",j6t).call(this,e);switch(mg(this,oJ,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==ar(this,dpe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(ar(this,hg,"f")&&this._emit("toolCallDone",ar(this,hg,"f")),mg(this,dpe,i.index,"f"),mg(this,hg,r.step_details.tool_calls[i.index],"f"),ar(this,hg,"f")&&this._emit("toolCallCreated",ar(this,hg,"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":mg(this,oJ,void 0,"f"),e.data.step_details.type=="tool_calls"&&ar(this,hg,"f")&&(this._emit("toolCallDone",ar(this,hg,"f")),mg(this,hg,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},N6t=function(e){ar(this,Sqe,"f").push(e),this._emit("event",e)},j6t=function(e){switch(e.event){case"thread.run.step.created":return ar(this,_O,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=ar(this,_O,"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=vO.accumulateDelta(r,n.delta);ar(this,_O,"f")[e.data.id]=o}return ar(this,_O,"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":ar(this,_O,"f")[e.data.id]=e.data;break}if(ar(this,_O,"f")[e.data.id])return ar(this,_O,"f")[e.data.id];throw new Error("No snapshot available")},D6t=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]=ar(this,Gd,"m",L6t).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")},L6t=function(e,r){return vO.accumulateDelta(r,e)},F6t=function(e){switch(mg(this,cpe,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":mg(this,DF,e.data,"f"),ar(this,hg,"f")&&(this._emit("toolCallDone",ar(this,hg,"f")),mg(this,hg,void 0,"f"));break;case"thread.run.cancelling":break}}});var LF,i3,Oqe=b(()=>{On();yo();Xc();LF=class extends ot{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 hn(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,i3,{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}})}},i3=class extends Eo{};LF.MessagesPage=i3});var FF,a3,Eqe=b(()=>{On();yo();Xc();FF=class extends ot{retrieve(e,r,n,o={},i){return hn(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 hn(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,a3,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},a3=class extends Eo{};FF.RunStepsPage=a3});var nT,s3,Pqe=b(()=>{On();yo();Cqe();yo();Eqe();Eqe();Xc();nT=class extends ot{constructor(){super(...arguments),this.steps=new FF(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 hn(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,s3,{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 vO.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 QP(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return vO.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 vO.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},s3=class extends Eo{};nT.RunsPage=s3;nT.Steps=FF;nT.RunStepsPage=a3});var wO,Tqe=b(()=>{On();yo();Cqe();Oqe();Oqe();Pqe();Pqe();wO=class extends ot{constructor(){super(...arguments),this.runs=new nT(this._client),this.messages=new LF(this._client)}create(e={},r){return hn(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 vO.createThreadAssistantStream(e,this._client.beta.threads,r)}};wO.Runs=nT;wO.RunsPage=s3;wO.Messages=LF;wO.MessagesPage=i3});var P_,Aqe=b(()=>{On();XUe();I6t();XUe();xqe();xqe();Tqe();Tqe();P_=class extends ot{constructor(){super(...arguments),this.realtime=new MR(this._client),this.chat=new t3(this._client),this.assistants=new RF(this._client),this.threads=new wO(this._client)}};P_.Realtime=MR;P_.Assistants=RF;P_.AssistantsPage=G4;P_.Threads=wO});var kF,Iqe=b(()=>{On();kF=class extends ot{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var $F,Mqe=b(()=>{On();yo();$F=class extends ot{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&XP("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(XP("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=p6t(u)}),a)))}}});var BF,u3,Rqe=b(()=>{On();yo();Xc();BF=class extends ot{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return hn(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,u3,{query:n,...o})}},u3=class extends Eo{};BF.OutputItemListResponsesPage=u3});var oT,l3,Nqe=b(()=>{On();yo();Rqe();Rqe();Xc();oT=class extends ot{constructor(){super(...arguments),this.outputItems=new BF(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 hn(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,l3,{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)}},l3=class extends Eo{};oT.RunListResponsesPage=l3;oT.OutputItems=BF;oT.OutputItemListResponsesPage=u3});var xO,zF,jqe=b(()=>{On();yo();Nqe();Nqe();Xc();xO=class extends ot{constructor(){super(...arguments),this.runs=new oT(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 hn(e)?this.list({},e):this._client.getAPIList("/evals",zF,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},zF=class extends Eo{};xO.EvalListResponsesPage=zF;xO.Runs=oT;xO.RunListResponsesPage=l3});var RR,UF,Dqe=b(()=>{On();yo();yo();oh();yo();Xc();RR=class extends ot{create(e,r){return this._client.post("/files",ky({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return hn(e)?this.list({},e):this._client.getAPIList("/files",UF,{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 QP(r),a=await this.retrieve(e),Date.now()-i>n)throw new fg({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},UF=class extends Eo{};RR.FileObjectsPage=UF});var qF,c3,Lqe=b(()=>{On();yo();Xc();qF=class extends ot{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,c3,{body:r,method:"post",...n})}retrieve(e,r={},n){return hn(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)}},c3=class extends yO{};qF.PermissionCreateResponsesPage=c3});var NR,Fqe=b(()=>{On();Lqe();Lqe();NR=class extends ot{constructor(){super(...arguments),this.permissions=new qF(this._client)}};NR.Permissions=qF;NR.PermissionCreateResponsesPage=c3});var HF,d3,kqe=b(()=>{On();yo();Xc();HF=class extends ot{list(e,r={},n){return hn(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,d3,{query:r,...n})}},d3=class extends Eo{};HF.FineTuningJobCheckpointsPage=d3});var SO,f3,p3,$qe=b(()=>{On();yo();kqe();kqe();Xc();SO=class extends ot{constructor(){super(...arguments),this.checkpoints=new HF(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 hn(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",f3,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return hn(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,p3,{query:r,...n})}},f3=class extends Eo{},p3=class extends Eo{};SO.FineTuningJobsPage=f3;SO.FineTuningJobEventsPage=p3;SO.Checkpoints=HF;SO.FineTuningJobCheckpointsPage=d3});var T_,Bqe=b(()=>{On();Fqe();Fqe();$qe();$qe();T_=class extends ot{constructor(){super(...arguments),this.jobs=new SO(this._client),this.checkpoints=new NR(this._client)}};T_.Jobs=SO;T_.FineTuningJobsPage=f3;T_.FineTuningJobEventsPage=p3;T_.Checkpoints=NR});var VF,zqe=b(()=>{On();yo();VF=class extends ot{createVariation(e,r){return this._client.post("/images/variations",ky({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",ky({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var jR,WF,Uqe=b(()=>{On();Xc();jR=class extends ot{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",WF,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},WF=class extends yO{};jR.ModelsPage=WF});var KF,qqe=b(()=>{On();KF=class extends ot{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function k6t(t,e){return!e||!Syn(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)}:Hqe(t,e)}function Hqe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Eyn(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:xyn(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Vqe(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 xyn(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Syn(t){return!!YG(t.text?.format)}function Cyn(t){return t?.$brand==="auto-parseable-tool"}function Oyn(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Eyn(t,e){let r=Oyn(t.tools??[],e.name);return{...e,...e,parsed_arguments:Cyn(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Vqe(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 Wqe=b(()=>{Z4()});var m3,Kqe=b(()=>{On();yo();ppe();m3=class extends ot{list(e,r={},n){return hn(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,fpe,{query:r,...n})}}});function Tyn(t,e){return k6t(t,e)}var h3,DR,g3,mpe,LR,hpe,$6t,B6t,z6t,U6t,gpe,q6t=b(()=>{oh();npe();Wqe();h3=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},DR=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)},gpe=class t extends AR{constructor(e){super(),g3.add(this),mpe.set(this,void 0),LR.set(this,void 0),hpe.set(this,void 0),h3(this,mpe,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())),DR(this,g3,"m",$6t).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)DR(this,g3,"m",B6t).call(this,a);if(i.controller.signal?.aborted)throw new Ma;return DR(this,g3,"m",z6t).call(this)}[(mpe=new WeakMap,LR=new WeakMap,hpe=new WeakMap,g3=new WeakSet,$6t=function(){this.ended||h3(this,LR,void 0,"f")},B6t=function(r){if(this.ended)return;let n=DR(this,g3,"m",U6t).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 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}`);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 Ht(`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}},z6t=function(){if(this.ended)throw new Ht("stream has ended, this shouldn't happen");let r=DR(this,LR,"f");if(!r)throw new Ht("request ended without sending any events");h3(this,LR,void 0,"f");let n=Tyn(r,DR(this,mpe,"f"));return h3(this,hpe,n,"f"),n},U6t=function(r){let n=DR(this,LR,"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=h3(this,LR,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":{h3(this,LR,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=DR(this,hpe,"f");if(!e)throw new Ht("stream ended without producing a ChatCompletion");return e}}});var FR,fpe,ppe=b(()=>{Wqe();yo();On();Kqe();Kqe();q6t();Xc();FR=class extends ot{constructor(){super(...arguments),this.inputItems=new m3(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"&&Vqe(n),n))}retrieve(e,r={},n){return hn(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=>Hqe(n,e))}stream(e,r){return gpe.createResponse(this._client,e,r)}},fpe=class extends Eo{};FR.InputItems=m3});var y3,Gqe=b(()=>{On();yo();y3=class extends ot{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,ky({body:r,...n}))}}});var kR,Jqe=b(()=>{On();Gqe();Gqe();kR=class extends ot{constructor(){super(...arguments),this.parts=new y3(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})}};kR.Parts=y3});var H6t,V6t=b(()=>{H6t=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 $R,BR,b3,ype=b(()=>{On();yo();Xc();$R=class extends ot{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 hn(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,BR,{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 QP(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`,b3,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},BR=class extends Eo{},b3=class extends yO{};$R.VectorStoreFilesPage=BR;$R.FileContentResponsesPage=b3});var _3,Zqe=b(()=>{On();yo();yo();V6t();ype();_3=class extends ot{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 hn(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,BR,{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 QP(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 h=await s.files.create({file:p,purpose:"assistants"},o);l.push(h.id)}}let d=Array(a).fill(u).map(c);return await H6t(d),await this.createAndPoll(e,{file_ids:l})}}});var gg,GF,JF,Yqe=b(()=>{On();yo();Zqe();Zqe();ype();ype();Xc();gg=class extends ot{constructor(){super(...arguments),this.files=new $R(this._client),this.fileBatches=new _3(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 hn(e)?this.list({},e):this._client.getAPIList("/vector_stores",GF,{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`,JF,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},GF=class extends Eo{},JF=class extends yO{};gg.VectorStoresPage=GF;gg.VectorStoreSearchResponsesPage=JF;gg.Files=$R;gg.VectorStoreFilesPage=BR;gg.FileContentResponsesPage=b3;gg.FileBatches=_3});var W6t=b(()=>{m6t();h6t();ZUe();YUe();Aqe();Iqe();Mqe();jqe();Dqe();Bqe();zqe();Uqe();qqe();ppe();Jqe();Yqe()});var K6t,Tr,ZF=b(()=>{qVt();yo();oh();Wfe();W6t();YUe();Iqe();Mqe();Dqe();zqe();Uqe();qqe();ZUe();Aqe();WUe();jqe();Bqe();ppe();Jqe();Yqe();WG();oh();Tr=class extends Zfe{constructor({baseURL:e=HG("OPENAI_BASE_URL"),apiKey:r=HG("OPENAI_API_KEY"),organization:n=HG("OPENAI_ORG_ID")??null,project:o=HG("OPENAI_PROJECT_ID")??null,...i}={}){if(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 a={apiKey:r,organization:n,project:o,...i,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&f6t())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
`);super({baseURL:a.baseURL,timeout:a.timeout??6e5,httpAgent:a.httpAgent,maxRetries:a.maxRetries,fetch:a.fetch}),this.completions=new kF(this),this.chat=new eT(this),this.embeddings=new $F(this),this.files=new RR(this),this.images=new VF(this),this.audio=new bO(this),this.moderations=new KF(this),this.models=new jR(this),this.fineTuning=new T_(this),this.vectorStores=new gg(this),this.beta=new P_(this),this.batches=new PR(this),this.uploads=new kR(this),this.responses=new FR(this),this.evals=new xO(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 PUe(e,{arrayFormat:"brackets"})}};K6t=Tr;Tr.OpenAI=K6t;Tr.DEFAULT_TIMEOUT=6e5;Tr.OpenAIError=Ht;Tr.APIError=Ru;Tr.APIConnectionError=YP;Tr.APIConnectionTimeoutError=fg;Tr.APIUserAbortError=Ma;Tr.NotFoundError=F4;Tr.ConflictError=k4;Tr.RateLimitError=B4;Tr.BadRequestError=j4;Tr.AuthenticationError=D4;Tr.InternalServerError=z4;Tr.PermissionDeniedError=L4;Tr.UnprocessableEntityError=$4;Tr.toFile=zUe;Tr.fileFromPath=zfe;Tr.Completions=kF;Tr.Chat=eT;Tr.ChatCompletionsPage=ER;Tr.Embeddings=$F;Tr.Files=RR;Tr.FileObjectsPage=UF;Tr.Images=VF;Tr.Audio=bO;Tr.Moderations=KF;Tr.Models=jR;Tr.ModelsPage=WF;Tr.FineTuning=T_;Tr.VectorStores=gg;Tr.VectorStoresPage=GF;Tr.VectorStoreSearchResponsesPage=JF;Tr.Beta=P_;Tr.Batches=PR;Tr.BatchesPage=MF;Tr.Uploads=kR;Tr.Responses=FR;Tr.Evals=xO;Tr.EvalListResponsesPage=zF});var J6t,G6t,Z6t,bpe=b(()=>{J6t=Symbol("Let zodToJsonSchema decide on which parser to use"),G6t={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"},Z6t=t=>typeof t=="string"?{...G6t,basePath:["#"],definitions:{},name:t}:{...G6t,basePath:["#"],definitions:{},...t}});function Y6t(t){if(!t)return!0;for(let e in t)return!1;return!0}var iJ,Xqe=b(()=>{iJ=t=>"_def"in t?t._def:t});var X6t,Qqe=b(()=>{bpe();Xqe();X6t=t=>{let e=Z6t(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])=>[iJ(o),{def:iJ(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function e2e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function bo(t,e,r,n,o){t[e]=r,e2e(t,e,n,o)}var zR=b(()=>{});function Q6t(){return{}}var t2e=b(()=>{});function e8t(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=Ar(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&bo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&bo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(bo(r,"minItems",t.exactLength.value,t.exactLength.message,e),bo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var r2e=b(()=>{xd();zR();Nu()});function t8t(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?bo(r,"minimum",n.value,n.message,e):bo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),bo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?bo(r,"maximum",n.value,n.message,e):bo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),bo(r,"maximum",n.value,n.message,e));break;case"multipleOf":bo(r,"multipleOf",n.value,n.message,e);break}return r}var n2e=b(()=>{zR()});function r8t(){return{type:"boolean"}}var o2e=b(()=>{});function n8t(t,e){return Ar(t.type._def,e)}var i2e=b(()=>{Nu()});var o8t,a2e=b(()=>{Nu();o8t=(t,e)=>Ar(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 Nyn(t,e)}}var Nyn,u2e=b(()=>{zR();Nyn=(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":bo(r,"minimum",n.value,n.message,e);break;case"max":bo(r,"maximum",n.value,n.message,e);break}return r}});function i8t(t,e){return{...Ar(t.innerType._def,e),default:t.defaultValue()}}var l2e=b(()=>{Nu()});function a8t(t,e,r){return e.effectStrategy==="input"?Ar(t.schema._def,e,r):{}}var c2e=b(()=>{Nu()});function s8t(t){return{type:"string",enum:[...t.values]}}var d2e=b(()=>{});function u8t(t,e){let r=[Ar(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Ar(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(jyn(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 jyn,f2e=b(()=>{Nu();jyn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function l8t(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 p2e=b(()=>{});function _pe(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Dyn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":bo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":bo(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":A_(r,"email",o.message,e);break;case"format:idn-email":A_(r,"idn-email",o.message,e);break;case"pattern:zod":I_(r,YF.email,o.message,e);break}break;case"url":A_(r,"uri",o.message,e);break;case"uuid":A_(r,"uuid",o.message,e);break;case"regex":I_(r,o.regex,o.message,e);break;case"cuid":I_(r,YF.cuid,o.message,e);break;case"cuid2":I_(r,YF.cuid2,o.message,e);break;case"startsWith":I_(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":I_(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":A_(r,"date-time",o.message,e);break;case"date":A_(r,"date",o.message,e);break;case"time":A_(r,"time",o.message,e);break;case"duration":A_(r,"duration",o.message,e);break;case"length":bo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),bo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{I_(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&A_(r,"ipv4",o.message,e),o.version!=="v4"&&A_(r,"ipv6",o.message,e);break}case"emoji":I_(r,YF.emoji,o.message,e);break;case"ulid":{I_(r,YF.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{A_(r,"binary",o.message,e);break}case"contentEncoding:base64":{bo(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{I_(r,YF.base64,o.message,e);break}}break}case"nanoid":I_(r,YF.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var m2e,YF,Dyn,A_,I_,c8t,vpe=b(()=>{zR();YF={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:()=>(m2e===void 0&&(m2e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),m2e),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}$/};Dyn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),A_=(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}}})):bo(t,"format",e,r,n)},I_=(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:c8t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):bo(t,"pattern",c8t(e,n),r,n)},c8t=(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 wpe(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]:Ar(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Ar(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(_pe(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 xpe=b(()=>{xd();Nu();vpe()});function d8t(t,e){if(e.mapStrategy==="record")return wpe(t,e);let r=Ar(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Ar(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 h2e=b(()=>{Nu();xpe()});function f8t(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 g2e=b(()=>{});function p8t(){return{not:{}}}var y2e=b(()=>{});function m8t(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var b2e=b(()=>{});function g8t(t,e){if(e.target==="openApi3")return h8t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in aJ&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=aJ[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 h8t(t,e)}var aJ,h8t,Spe=b(()=>{Nu();aJ={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};h8t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Ar(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 y8t(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:aJ[t.innerType._def.typeName],nullable:!0}:{type:[aJ[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Ar(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Ar(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var _2e=b(()=>{Nu();Spe()});function b8t(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",e2e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?bo(r,"minimum",n.value,n.message,e):bo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),bo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?bo(r,"maximum",n.value,n.message,e):bo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),bo(r,"maximum",n.value,n.message,e));break;case"multipleOf":bo(r,"multipleOf",n.value,n.message,e);break}return r}var v2e=b(()=>{zR()});function Lyn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Ar(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Ar(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function _8t(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=Ar(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:Lyn(t,e)};return r.required.length||delete r.required,r}var w2e=b(()=>{Nu()});var v8t,x2e=b(()=>{Nu();v8t=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Ar(t.innerType._def,e);let r=Ar(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var w8t,S2e=b(()=>{Nu();w8t=(t,e)=>{if(e.pipeStrategy==="input")return Ar(t.in._def,e);if(e.pipeStrategy==="output")return Ar(t.out._def,e);let r=Ar(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Ar(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function x8t(t,e){return Ar(t.type._def,e)}var C2e=b(()=>{Nu()});function S8t(t,e){let n={type:"array",uniqueItems:!0,items:Ar(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&bo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&bo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var O2e=b(()=>{zR();Nu()});function C8t(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Ar(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Ar(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Ar(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var E2e=b(()=>{Nu()});function O8t(){return{not:{}}}var P2e=b(()=>{});function E8t(){return{}}var T2e=b(()=>{});var P8t,A2e=b(()=>{Nu();P8t=(t,e)=>Ar(t.innerType._def,e)});function Ar(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==J6t)return a}if(n&&!r){let a=Fyn(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=$yn(t,t.typeName,e,r);return i&&Byn(t,e,i),o.jsonSchema=i,i}var Fyn,kyn,$yn,Byn,Nu=b(()=>{xd();t2e();r2e();n2e();o2e();i2e();a2e();u2e();l2e();c2e();d2e();f2e();p2e();h2e();g2e();y2e();b2e();_2e();v2e();w2e();x2e();S2e();C2e();xpe();O2e();vpe();E2e();P2e();Spe();T2e();A2e();bpe();Fyn=(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:kyn(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}},kyn=(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("/")},$yn=(t,e,r,n)=>{switch(e){case re.ZodString:return _pe(t,r);case re.ZodNumber:return b8t(t,r);case re.ZodObject:return _8t(t,r);case re.ZodBigInt:return t8t(t,r);case re.ZodBoolean:return r8t();case re.ZodDate:return s2e(t,r);case re.ZodUndefined:return O8t();case re.ZodNull:return m8t(r);case re.ZodArray:return e8t(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return g8t(t,r);case re.ZodIntersection:return u8t(t,r);case re.ZodTuple:return C8t(t,r);case re.ZodRecord:return wpe(t,r);case re.ZodLiteral:return l8t(t,r);case re.ZodEnum:return s8t(t);case re.ZodNativeEnum:return f8t(t);case re.ZodNullable:return y8t(t,r);case re.ZodOptional:return v8t(t,r);case re.ZodMap:return d8t(t,r);case re.ZodSet:return S8t(t,r);case re.ZodLazy:return Ar(t.getter()._def,r);case re.ZodPromise:return x8t(t,r);case re.ZodNaN:case re.ZodNever:return p8t();case re.ZodEffects:return a8t(t,r,n);case re.ZodAny:return Q6t();case re.ZodUnknown:return E8t();case re.ZodDefault:return i8t(t,r);case re.ZodBranded:return n8t(t,r);case re.ZodReadonly:return P8t(t,r);case re.ZodCatch:return o8t(t,r);case re.ZodPipeline:return w8t(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},Byn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var T8t,A8t=b(()=>{Nu();Qqe();Xqe();T8t=(t,e)=>{let r=X6t(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Ar(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(Y6t(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]=Ar(iJ(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 I8t=b(()=>{bpe();Qqe();zR();Nu();t2e();r2e();n2e();o2e();i2e();a2e();u2e();l2e();c2e();d2e();f2e();p2e();h2e();g2e();y2e();b2e();_2e();v2e();w2e();x2e();S2e();C2e();A2e();xpe();O2e();vpe();E2e();P2e();Spe();T2e();A8t()});function M8t(t,e){return T8t(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Cpe(t,e,r){return b6t({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:M8t(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function Ope(t){return _6t({type:"function",function:{name:t.name,parameters:M8t(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 sJ=b(()=>{Z4();I8t()});function XF(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(()=>{});function uJ(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var R8t=b(()=>{});function QF(t){let e;return t.constructor.name===fg.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ma.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=uJ(t,"INVALID_TOOL_RESULTS"):t.status===401?e=uJ(t,"MODEL_AUTHENTICATION"):t.status===429?e=uJ(t,"MODEL_RATE_LIMIT"):t.status===404?e=uJ(t,"MODEL_NOT_FOUND"):e=t,e}function I2e(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 v3=b(()=>{ZF();Kg();ag();R8t()});function zyn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function N8t(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(j8t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function j8t(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}: ${Epe(o,e)},`):r.push(`${n}?: ${Epe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Epe(t,e){if(zyn(t))return t.anyOf.map(r=>Epe(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["{",j8t(t,e+2),"}"].join(`
`);case"array":return t.items?`${Epe(t.items,e)}[]`:"any[]";default:return""}}var D8t=b(()=>{});function L8t(t,e){let r;if(Wc(t)){let n=Ope({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:BM(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}var F8t=b(()=>{ag();sJ()});function Uyn(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 N2e(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(!Ys.isInstance(t))throw new Error("Invalid generic chat message");return Uyn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function R2e(t,e){return t.flatMap(r=>{let n=N2e(r);n==="system"&&j2e(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=""),Wi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(oO),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 k8t(t,e){return t.flatMap(r=>{let n=N2e(r);if(n==="system"&&j2e(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[w3];if(Wi(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 B8t(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(Qm(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(eh(s,l))}i[w3]??(i[w3]={}),i[w3][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 kn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function qyn(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[w3]={[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=B8t(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 Sr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function M2e(t){return"type"in t&&t.type!=="function"}function Hyn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function $8t(t,e){return $d(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:L8t(t,e)}function j2e(t){return t?.startsWith("o1")||t?.startsWith("o3")}function Ppe(t){return typeof t?.parse=="function"}function Vyn(t){return t!==void 0&&typeof t.schema=="object"}var w3,lJ,Tpe=b(()=>{ZF();$s();Zf();no();HC();ig();Pm();Db();K2();Kg();sJ();UR();v3();D8t();F8t();w3="__openai_function_call_ids__";lJ=class extends Pu{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=>M2e(o)?o:$8t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Ppe(e.json_schema.schema)?Cpe(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=>M2e(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:Hyn(e?.tool_choice)?e?.tool_choice:(()=>{let l=I2e(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=>$8t(s,{strict:n})):void 0,tool_choice:I2e(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),j2e(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(Qm(u,{returnId:!0}))}catch(l){i.push(eh(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 kn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Ys(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 Cp({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 Sr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Ef({content:i,response_metadata:s}):o==="developer"?new Ef({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Eh({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Vg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Sp({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:k8t(e,this.model),stream:!0},r);for await(let c of l){let d=qyn(c);d!=null&&(yield d)}return}let o=R2e(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 h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model),this.logprobs&&(h.logprobs=c.logprobs);let m=new co({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}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 Sr({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=k8t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:B8t(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(M2e),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=R2e(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{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 h of s?.choices??[]){let g={text:h.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(h.message??{role:"assistant"},s)};g.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Wi(g.message)&&(g.message.usage_metadata=o),g.message=new kn(Object.fromEntries(Object.entries(g.message).filter(([y])=>!y.startsWith("lc_")))),p.push(g)}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=N8t(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(N2e(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 QF(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 QF(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 QF(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=XF(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Tr(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;Vyn(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"}}),Ppe(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}}}),Ppe(n)){let f=Sd.fromZodSchema(n);u=Tp.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Cd;else{let f=o??"extract";if(Ppe(n)){let p=is(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=Lo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Lo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Li.from([{raw:s},d])}}});var z8t=b(()=>{no();Tpe();UR()});var D2e=b(()=>{ig();Zf();no();CL();Ay();UR();v3()});var U8t=b(()=>{no();D2e();UR()});var L2e=b(()=>{no();PP();Ay();UR();v3()});var q8t=b(()=>{no();L2e();UR();v3()});var H8t=b(()=>{});var F2e,V8t=b(()=>{no();ZF();zK();F2e=class extends iR{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 Tr(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(F2e,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var W8t=b(()=>{V8t()});var K8t=b(()=>{Tpe()});var G8t=b(()=>{Tpe();z8t();D2e();U8t();q8t();L2e();H8t();v3();UR();W8t();K8t()});var J8t=b(()=>{G8t()});var Ape,Z8t=b(()=>{no();J8t();Ape=class extends lJ{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 Y8t=b(()=>{Z8t()});var X8t=b(()=>{Y8t()});var ek,Q8t=b(()=>{ek="0.5.0"});function t5t(t,e={auto:!1}){if(e5t)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(tk)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${tk}'\``);e5t=e.auto,tk=t.kind,k2e=t.fetch,Wyn=t.Request,Kyn=t.Response,Gyn=t.Headers,$2e=t.FormData,Jyn=t.Blob,Ipe=t.File,B2e=t.ReadableStream,z2e=t.getMultipartRequestOptions,U2e=t.getDefaultAgent,Mpe=t.fileFromPath,q2e=t.isFsReadStream}var e5t,tk,k2e,Wyn,Kyn,Gyn,$2e,Jyn,Ipe,B2e,z2e,U2e,Mpe,q2e,H2e=b(()=>{e5t=!1});var Rpe,r5t=b(()=>{Rpe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function n5t({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 Rpe(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 o5t=b(()=>{r5t()});var i5t=b(()=>{o5t()});var cJ=b(()=>{H2e();i5t();H2e();tk||t5t(n5t(),{auto:!0})});var V2e={};os(V2e,{APIConnectionError:()=>iT,APIConnectionTimeoutError:()=>rk,APIError:()=>Sc,APIUserAbortError:()=>qR,AuthenticationError:()=>S3,BadRequestError:()=>x3,ConflictError:()=>E3,GroqError:()=>ed,InternalServerError:()=>A3,NotFoundError:()=>O3,PermissionDeniedError:()=>C3,RateLimitError:()=>T3,UnprocessableEntityError:()=>P3});var ed,Sc,qR,iT,rk,x3,S3,C3,O3,E3,P3,T3,A3,dJ=b(()=>{fJ();ed=class extends Error{},Sc=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 iT({cause:Npe(r)});let i=r;return e===400?new x3(e,i,n,o):e===401?new S3(e,i,n,o):e===403?new C3(e,i,n,o):e===404?new O3(e,i,n,o):e===409?new E3(e,i,n,o):e===422?new P3(e,i,n,o):e===429?new T3(e,i,n,o):e>=500?new A3(e,i,n,o):new t(e,i,n,o)}},qR=class extends Sc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},iT=class extends Sc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},rk=class extends iT{constructor({message:e}={}){super({message:e??"Request timed out."})}},x3=class extends Sc{constructor(){super(...arguments),this.status=400}},S3=class extends Sc{constructor(){super(...arguments),this.status=401}},C3=class extends Sc{constructor(){super(...arguments),this.status=403}},O3=class extends Sc{constructor(){super(...arguments),this.status=404}},E3=class extends Sc{constructor(){super(...arguments),this.status=409}},P3=class extends Sc{constructor(){super(...arguments),this.status=422}},T3=class extends Sc{constructor(){super(...arguments),this.status=429}},A3=class extends Sc{}});function Xyn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function a5t(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 jpe,W2e,I3,s5t=b(()=>{cJ();dJ();dJ();jpe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new W2e;async function*i(){if(!e.body)throw r.abort(),new ed("Attempted to iterate over a response with no body");let s=new I3,u=a5t(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 Sc(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 I3,s=a5t(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 B2e({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?.()}})}},W2e=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]=Xyn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},I3=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}};I3.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);I3.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function J2e(t,e,r){if(t=await t,r??(r=l5t(t)?{lastModified:t.lastModified,type:t.type}:{}),u5t(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Ipe([o],e,r)}let n=await ebn(t);if(e||(e=rbn(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Ipe(n,e,r)}async function ebn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Dpe(t))e.push(await t.arrayBuffer());else if(nbn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${tbn(t)}`);return e}function tbn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function rbn(t){return K2e(t.name)||K2e(t.filename)||K2e(t.path)?.split(/[\\/]/).pop()}var u5t,l5t,Dpe,Qyn,K2e,nbn,Z2e,pJ,c5t,G2e,Lpe=b(()=>{cJ();cJ();u5t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",l5t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Dpe(t),Dpe=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",Qyn=t=>l5t(t)||u5t(t)||q2e(t);K2e=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},nbn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Z2e=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",pJ=async t=>{let e=await c5t(t.body);return z2e(e,t)},c5t=async t=>{let e=new $2e;return await Promise.all(Object.entries(t||{}).map(([r,n])=>G2e(e,r,n))),e},G2e=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(Qyn(r)){let n=await J2e(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>G2e(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>G2e(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 g5t(t){let{response:e}=t;if(t.options.stream)return M3("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):jpe.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 M3("response",e.status,e.url,e.headers,i),i}let o=await e.text();return M3("response",e.status,e.url,e.headers,o),o}function lbn(){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 hbn(t){if(!t)return!0;for(let e in t)return!1;return!0}function gbn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function h5t(t,e){for(let r in e){if(!gbn(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 M3(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var ibn,abn,Fpe,kpe,$pe,d5t,X2e,sbn,ubn,f5t,p5t,m5t,cbn,dbn,fbn,pbn,mbn,Y2e,Npe,Q2e,ybn,y5t,fJ=b(()=>{Q8t();s5t();dJ();cJ();Lpe();Lpe();ibn=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},abn=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)};kpe=class t extends Promise{constructor(e,r=g5t){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)}},$pe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Y2e("maxRetries",r),this.timeout=Y2e("timeout",n),this.httpAgent=o,this.fetch=i??k2e}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...cbn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${ybn()}`}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&&Dpe(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:Z2e(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&&Y2e("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??U2e(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 h5t(o,i),h5t(o,r),Z2e(e.body)&&tk!=="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 Sc.generate(e,r,n,o)}request(e,r=null){return new kpe(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}),M3("request",i,n,o.headers),n.signal?.aborted)throw new qR;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Npe);if(u instanceof Error){if(n.signal?.aborted)throw new qR;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new rk:new iT({cause:u})}let l=sbn(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let m=`retrying, ${r} attempts remaining`;return M3(`response (error; ${m})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(m=>Npe(m).message),d=dbn(c),f=d?void 0:c;throw M3(`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 X2e(this,n,e)}buildURL(e,r){let n=pbn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return hbn(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 mbn(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 ${ek}`}},d5t=class{constructor(e,r,n,o){Fpe.set(this,void 0),ibn(this,Fpe,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 abn(this,Fpe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Fpe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},X2e=class extends kpe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await g5t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},sbn=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),ubn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ek,"X-Stainless-OS":p5t(Deno.build.os),"X-Stainless-Arch":f5t(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":ek,"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":ek,"X-Stainless-OS":p5t(process.platform),"X-Stainless-Arch":f5t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=lbn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ek,"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":ek,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};f5t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",p5t=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"),cbn=()=>m5t??(m5t=ubn()),dbn=t=>{try{return JSON.parse(t)}catch{return}},fbn=new RegExp("^(?:[a-z]+:)?//","i"),pbn=t=>fbn.test(t),mbn=t=>new Promise(e=>setTimeout(e,t)),Y2e=(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},Npe=t=>t instanceof Error?t:new Error(t),Q2e=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};ybn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),y5t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"});var b5t=b(()=>{});var td,aT=b(()=>{td=class{constructor(e){this._client=e}}});var nk,_5t=b(()=>{aT();fJ();nk=class extends td{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",pJ({body:e,...r}))}};nk||(nk={})});var ok,v5t=b(()=>{aT();fJ();ok=class extends td{create(e,r){return this._client.post("/openai/v1/audio/translations",pJ({body:e,...r}))}};ok||(ok={})});var HR,w5t=b(()=>{aT();_5t();v5t();HR=class extends td{constructor(){super(...arguments),this.transcriptions=new nk(this._client),this.translations=new ok(this._client)}};(function(t){t.Transcriptions=nk,t.Translations=ok})(HR||(HR={}))});var ik,x5t=b(()=>{aT();ik=class extends td{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};ik||(ik={})});var VR,S5t=b(()=>{aT();x5t();VR=class extends td{constructor(){super(...arguments),this.completions=new ik(this._client)}};(function(t){t.Completions=ik})(VR||(VR={}))});var WR,C5t=b(()=>{aT();WR=class extends td{};WR||(WR={})});var KR,O5t=b(()=>{aT();KR=class extends td{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};KR||(KR={})});var GR,E5t=b(()=>{aT();GR=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)}};GR||(GR={})});var P5t=b(()=>{b5t();w5t();S5t();C5t();O5t();E5t()});var T5t,Us,mSi,hSi,gSi,ySi,bSi,_Si,vSi,wSi,xSi,SSi,CSi,OSi,ESi,A5t,I5t=b(()=>{fJ();dJ();Lpe();P5t();Us=class extends $pe{constructor({baseURL:e=Q2e("GROQ_BASE_URL"),apiKey:r=Q2e("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&&y5t())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 WR(this),this.chat=new VR(this),this.embeddings=new KR(this),this.audio=new HR(this),this.models=new GR(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}`}}};T5t=Us;Us.Groq=T5t;Us.GroqError=ed;Us.APIError=Sc;Us.APIConnectionError=iT;Us.APIConnectionTimeoutError=rk;Us.APIUserAbortError=qR;Us.NotFoundError=O3;Us.ConflictError=E3;Us.RateLimitError=T3;Us.BadRequestError=x3;Us.AuthenticationError=S3;Us.InternalServerError=A3;Us.PermissionDeniedError=C3;Us.UnprocessableEntityError=P3;Us.toFile=J2e;Us.fileFromPath=Mpe;({GroqError:mSi,APIError:hSi,APIConnectionError:gSi,APIConnectionTimeoutError:ySi,APIUserAbortError:bSi,NotFoundError:_Si,ConflictError:vSi,RateLimitError:wSi,BadRequestError:xSi,AuthenticationError:SSi,InternalServerError:CSi,PermissionDeniedError:OSi,UnprocessableEntityError:ESi}=V2e);(function(t){t.Completions=WR,t.Chat=VR,t.Embeddings=KR,t.Audio=HR,t.Models=GR})(Us||(Us={}));A5t=Us});function Sbn(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 M5t(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:Sbn(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 Wi(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(oO):(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 Cbn(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(Qm(i,{returnId:!0}))}catch(a){o.push(eh(i,a.message))}return new kn({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Ys(t.content||"",t.role??"unknown")}}function Obn(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 Ebn(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 Cp({content:o})};if(n==="assistant"){let u=Obn(t.tool_calls,e);return{message:new Sr({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 Ef({content:o})}:{message:new Sp({content:o,role:n})}}var Bpe,R5t=b(()=>{Kg();HC();$s();Zf();no();IL();I5t();Pm();Db();K2();ag();Bpe=class extends Pu{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 A5t({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=>qC(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=M5t(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}=Ebn({...d.delta,role:s},d.index,c.x_groq);if(p){let m=p.filter(g=>u.every(y=>y.id!==g.id));u.push(...m),yield new co({message:new Sr({content:"",tool_call_chunks:m}),text:""})}let h=new co({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield h,n?.handleLLMNewToken(h.text??"")}if(l&&("choices"in l&&delete l.choices,yield new co({message:new Sr({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=M5t(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:Cbn(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"}}),Cv(n)?u=Sd.fromZodSchema(n):u=new Cd;else if(Cv(n)){let p=is(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=Lo.assign({parsed:(p,h)=>u.invoke(p.raw,h)}),d=Lo.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Li.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var N5t=b(()=>{R5t()});var j5t=b(()=>{N5t()});function D5t(t,e=0){return(Jd[t[e+0]]+Jd[t[e+1]]+Jd[t[e+2]]+Jd[t[e+3]]+"-"+Jd[t[e+4]]+Jd[t[e+5]]+"-"+Jd[t[e+6]]+Jd[t[e+7]]+"-"+Jd[t[e+8]]+Jd[t[e+9]]+"-"+Jd[t[e+10]]+Jd[t[e+11]]+Jd[t[e+12]]+Jd[t[e+13]]+Jd[t[e+14]]+Jd[t[e+15]]).toLowerCase()}var Jd,zpe,L5t=b(()=>{Jd=[];for(zpe=0;zpe<256;++zpe)Jd.push((zpe+256).toString(16).slice(1))});function e4e(){if(!Upe&&(Upe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Upe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Upe(Pbn)}var Upe,Pbn,F5t=b(()=>{Pbn=new Uint8Array(16)});var Tbn,t4e,k5t=b(()=>{Tbn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),t4e={randomUUID:Tbn}});function Abn(t,e,r){if(t4e.randomUUID&&!e&&!t)return t4e.randomUUID();t=t||{};var n=t.random||(t.rng||e4e)();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 D5t(n)}var qpe,$5t=b(()=>{k5t();F5t();L5t();qpe=Abn});var B5t=b(()=>{$5t()});var Ho=x(r4e=>{"use strict";Object.defineProperty(r4e,"__esModule",{value:!0});r4e.pathToFunc=Mbn;var Ibn=Object.prototype.hasOwnProperty;function Mbn(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!Ibn.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 Hpe=x($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.SDK_METADATA=$y.ServerList=$y.ServerEu=void 0;$y.serverURLFromOptions=Nbn;var Rbn=Ho();$y.ServerEu="eu";$y.ServerList={[$y.ServerEu]:"https://api.mistral.ai"};function Nbn(t){let e=t.serverURL,r={};if(!e){let o=t.server??$y.ServerEu;e=$y.ServerList[o]||""}let n=(0,Rbn.pathToFunc)(e)(r);return new URL(n)}$y.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 o4e=x(n4e=>{"use strict";Object.defineProperty(n4e,"__esModule",{value:!0});n4e.readableStreamToArrayBuffer=jbn;async function jbn(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 z5t=x(Vpe=>{"use strict";Object.defineProperty(Vpe,"__esModule",{value:!0});Vpe.CustomUserAgentHook=void 0;var Dbn=Hpe(),i4e=class{beforeRequest(e,r){let o=`mistral-client-typescript/${Dbn.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};Vpe.CustomUserAgentHook=i4e});var q5t=x(Wpe=>{"use strict";Object.defineProperty(Wpe,"__esModule",{value:!0});Wpe.DeprecationWarningHook=void 0;var U5t="x-model-deprecation-timestamp",a4e=class{afterSuccess(e,r){return r.headers.has(U5t)&&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(U5t)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Wpe.DeprecationWarningHook=a4e});var H5t=x(s4e=>{"use strict";Object.defineProperty(s4e,"__esModule",{value:!0});s4e.initHooks=kbn;var Lbn=z5t(),Fbn=q5t();function kbn(t){let e=new Lbn.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new Fbn.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var V5t=x(Kpe=>{"use strict";Object.defineProperty(Kpe,"__esModule",{value:!0});Kpe.SDKHooks=void 0;var $bn=H5t(),u4e=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,$bn.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}}};Kpe.SDKHooks=u4e});var m4e=x(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.ConnectionError=ah.RequestTimeoutError=ah.RequestAbortedError=ah.InvalidRequestError=ah.UnexpectedClientError=ah.HTTPClientError=void 0;var JR=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)}};ah.HTTPClientError=JR;var l4e=class extends JR{constructor(){super(...arguments),this.name="UnexpectedClientError"}};ah.UnexpectedClientError=l4e;var c4e=class extends JR{constructor(){super(...arguments),this.name="InvalidRequestError"}};ah.InvalidRequestError=c4e;var d4e=class extends JR{constructor(){super(...arguments),this.name="RequestAbortedError"}};ah.RequestAbortedError=d4e;var f4e=class extends JR{constructor(){super(...arguments),this.name="RequestTimeoutError"}};ah.RequestTimeoutError=f4e;var p4e=class extends JR{constructor(){super(...arguments),this.name="ConnectionError"}};ah.ConnectionError=p4e});var By=x(R3=>{"use strict";Object.defineProperty(R3,"__esModule",{value:!0});R3.OK=Bbn;R3.ERR=zbn;R3.unwrap=Ubn;R3.unwrapAsync=qbn;function Bbn(t){return{ok:!0,value:t}}function zbn(t){return{ok:!1,error:t}}function Ubn(t){if(!t.ok)throw t.error;return t.value}async function qbn(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var mJ=x(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.getParsedType=pa.ZodParsedType=pa.objectUtil=pa.util=void 0;var h4e;(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})(h4e||(pa.util=h4e={}));var W5t;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(W5t||(pa.objectUtil=W5t={}));pa.ZodParsedType=h4e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Hbn=t=>{switch(typeof t){case"undefined":return pa.ZodParsedType.undefined;case"string":return pa.ZodParsedType.string;case"number":return Number.isNaN(t)?pa.ZodParsedType.nan:pa.ZodParsedType.number;case"boolean":return pa.ZodParsedType.boolean;case"function":return pa.ZodParsedType.function;case"bigint":return pa.ZodParsedType.bigint;case"symbol":return pa.ZodParsedType.symbol;case"object":return Array.isArray(t)?pa.ZodParsedType.array:t===null?pa.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?pa.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?pa.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?pa.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?pa.ZodParsedType.date:pa.ZodParsedType.object;default:return pa.ZodParsedType.unknown}};pa.getParsedType=Hbn});var Gpe=x(ZR=>{"use strict";Object.defineProperty(ZR,"__esModule",{value:!0});ZR.ZodError=ZR.quotelessJson=ZR.ZodIssueCode=void 0;var K5t=mJ();ZR.ZodIssueCode=K5t.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 Vbn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ZR.quotelessJson=Vbn;var hJ=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,K5t.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()}};ZR.ZodError=hJ;hJ.create=t=>new hJ(t)});var y4e=x(g4e=>{"use strict";Object.defineProperty(g4e,"__esModule",{value:!0});var np=Gpe(),ak=mJ(),Wbn=(t,e)=>{let r;switch(t.code){case np.ZodIssueCode.invalid_type:t.received===ak.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case np.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ak.util.jsonStringifyReplacer)}`;break;case np.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${ak.util.joinValues(t.keys,", ")}`;break;case np.ZodIssueCode.invalid_union:r="Invalid input";break;case np.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ak.util.joinValues(t.options)}`;break;case np.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${ak.util.joinValues(t.options)}, received '${t.received}'`;break;case np.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case np.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case np.ZodIssueCode.invalid_date:r="Invalid date";break;case np.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}"`:ak.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case np.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 np.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 np.ZodIssueCode.custom:r="Invalid input";break;case np.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case np.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case np.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,ak.util.assertNever(t)}return{message:r}};g4e.default=Wbn});var Jpe=x(YR=>{"use strict";var Kbn=YR&&YR.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(YR,"__esModule",{value:!0});YR.defaultErrorMap=void 0;YR.setErrorMap=Gbn;YR.getErrorMap=Jbn;var G5t=Kbn(y4e());YR.defaultErrorMap=G5t.default;var J5t=G5t.default;function Gbn(t){J5t=t}function Jbn(){return J5t}});var _4e=x(Ui=>{"use strict";var Zbn=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=Qbn;var Ybn=Jpe(),Z5t=Zbn(y4e()),Xbn=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=Xbn;Ui.EMPTY_PATH=[];function Qbn(t,e){let r=(0,Ybn.getErrorMap)(),n=(0,Ui.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Z5t.default?void 0:Z5t.default].filter(o=>!!o)});t.common.issues.push(n)}var b4e=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=b4e;Ui.INVALID=Object.freeze({status:"aborted"});var e_n=t=>({status:"dirty",value:t});Ui.DIRTY=e_n;var t_n=t=>({status:"valid",value:t});Ui.OK=t_n;var r_n=t=>t.status==="aborted";Ui.isAborted=r_n;var n_n=t=>t.status==="dirty";Ui.isDirty=n_n;var o_n=t=>t.status==="valid";Ui.isValid=o_n;var i_n=t=>typeof Promise<"u"&&t instanceof Promise;Ui.isAsync=i_n});var X5t=x(Y5t=>{"use strict";Object.defineProperty(Y5t,"__esModule",{value:!0})});var eWt=x(Zpe=>{"use strict";Object.defineProperty(Zpe,"__esModule",{value:!0});Zpe.errorUtil=void 0;var Q5t;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q5t||(Zpe.errorUtil=Q5t={}))});var fWt=x(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.discriminatedUnion=se.date=se.boolean=se.bigint=se.array=se.any=se.coerce=se.ZodFirstPartyTypeKind=se.late=se.ZodSchema=se.Schema=se.ZodReadonly=se.ZodPipeline=se.ZodBranded=se.BRAND=se.ZodNaN=se.ZodCatch=se.ZodDefault=se.ZodNullable=se.ZodOptional=se.ZodTransformer=se.ZodEffects=se.ZodPromise=se.ZodNativeEnum=se.ZodEnum=se.ZodLiteral=se.ZodLazy=se.ZodFunction=se.ZodSet=se.ZodMap=se.ZodRecord=se.ZodTuple=se.ZodIntersection=se.ZodDiscriminatedUnion=se.ZodUnion=se.ZodObject=se.ZodArray=se.ZodVoid=se.ZodNever=se.ZodUnknown=se.ZodAny=se.ZodNull=se.ZodUndefined=se.ZodSymbol=se.ZodDate=se.ZodBoolean=se.ZodBigInt=se.ZodNumber=se.ZodString=se.ZodType=void 0;se.NEVER=se.void=se.unknown=se.union=se.undefined=se.tuple=se.transformer=se.symbol=se.string=se.strictObject=se.set=se.record=se.promise=se.preprocess=se.pipeline=se.ostring=se.optional=se.onumber=se.oboolean=se.object=se.number=se.nullable=se.null=se.never=se.nativeEnum=se.nan=se.map=se.literal=se.lazy=se.intersection=se.instanceof=se.function=se.enum=se.effect=void 0;se.datetimeRegex=iWt;se.custom=sWt;var Ye=Gpe(),Ype=Jpe(),Qt=eWt(),ue=_4e(),it=mJ(),Uy=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}},tWt=(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 Ye.ZodError(t.common.issues);return this._error=r,this._error}}};function gn(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 yn=class{get description(){return this._def.description}_getType(e){return(0,it.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,it.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,it.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,it.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return tWt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,it.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,it.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ue.isAsync)(o)?o:Promise.resolve(o));return tWt(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:Ye.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 yg({schema:this,typeName:Lr.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 zy.create(this,this._def)}nullable(){return OO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lT.create(this)}promise(){return e1.create(this,this._def)}or(e){return pk.create([this,e],this._def)}and(e){return mk.create(this,e,this._def)}transform(e){return new yg({...gn(this._def),schema:this,typeName:Lr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new _k({...gn(this._def),innerType:this,defaultValue:r,typeName:Lr.ZodDefault})}brand(){return new gJ({typeName:Lr.ZodBranded,type:this,...gn(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new vk({...gn(this._def),innerType:this,catchValue:r,typeName:Lr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return yJ.create(this,e)}readonly(){return wk.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};se.ZodType=yn;se.Schema=yn;se.ZodSchema=yn;var a_n=/^c[^\s-]{8,}$/i,s_n=/^[0-9a-z]+$/,u_n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,l_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,c_n=/^[a-z0-9_-]{21}$/i,d_n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,f_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)?)??$/,p_n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,m_n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",v4e,h_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])$/,g_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])$/,y_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]))$/,b_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])$/,__n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,v_n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nWt="((\\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])))",w_n=new RegExp(`^${nWt}$`);function oWt(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 x_n(t){return new RegExp(`^${oWt(t)}$`)}function iWt(t){let e=`${nWt}T${oWt(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 S_n(t,e){return!!((e==="v4"||!e)&&h_n.test(t)||(e==="v6"||!e)&&y_n.test(t))}function C_n(t,e){if(!d_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 O_n(t,e){return!!((e==="v4"||!e)&&g_n.test(t)||(e==="v6"||!e)&&b_n.test(t))}var XR=class t extends yn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==it.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:it.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:Ye.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:Ye.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:Ye.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")p_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"email",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")v4e||(v4e=new RegExp(m_n,"u")),v4e.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"emoji",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")l_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"uuid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")c_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"nanoid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")a_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cuid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")s_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cuid2",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")u_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"ulid",code:Ye.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:Ye.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:Ye.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:Ye.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:Ye.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:Ye.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?iWt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?w_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?x_n(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?f_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"duration",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?S_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"ip",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?C_n(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"jwt",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?O_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"cidr",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?__n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"base64",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?v_n.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ue.addIssueToContext)(o,{validation:"base64url",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):it.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Ye.ZodIssueCode.invalid_string,...Qt.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Qt.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Qt.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Qt.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Qt.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Qt.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Qt.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Qt.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Qt.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Qt.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Qt.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Qt.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Qt.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Qt.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,...Qt.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,...Qt.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Qt.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Qt.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Qt.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Qt.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Qt.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Qt.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Qt.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Qt.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Qt.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}};se.ZodString=XR;XR.create=t=>new XR({checks:[],typeName:Lr.ZodString,coerce:t?.coerce??!1,...gn(t)});function E_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 sk=class t extends yn{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)!==it.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.number,received:i.parsedType}),ue.INVALID}let n,o=new ue.ParseStatus;for(let i of this._def.checks)i.kind==="int"?it.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Ye.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:Ye.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:Ye.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?E_n(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ue.addIssueToContext)(n,{code:Ye.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:Ye.ZodIssueCode.not_finite,message:i.message}),o.dirty()):it.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Qt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Qt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Qt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Qt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Qt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Qt.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Qt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Qt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Qt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Qt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Qt.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Qt.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Qt.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Qt.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"&&it.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)}};se.ZodNumber=sk;sk.create=t=>new sk({checks:[],typeName:Lr.ZodNumber,coerce:t?.coerce||!1,...gn(t)});var uk=class t extends yn{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)!==it.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:Ye.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:Ye.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:Ye.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):it.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.bigint,received:r.parsedType}),ue.INVALID}gte(e,r){return this.setLimit("min",e,!0,Qt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Qt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Qt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Qt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Qt.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:Qt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Qt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Qt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Qt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Qt.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}};se.ZodBigInt=uk;uk.create=t=>new uk({checks:[],typeName:Lr.ZodBigInt,coerce:t?.coerce??!1,...gn(t)});var lk=class extends yn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==it.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.boolean,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodBoolean=lk;lk.create=t=>new lk({typeName:Lr.ZodBoolean,coerce:t?.coerce||!1,...gn(t)});var ck=class t extends yn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==it.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.date,received:i.parsedType}),ue.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(i,{code:Ye.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:Ye.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:Ye.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):it.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:Qt.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Qt.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}};se.ZodDate=ck;ck.create=t=>new ck({checks:[],coerce:t?.coerce||!1,typeName:Lr.ZodDate,...gn(t)});var j3=class extends yn{_parse(e){if(this._getType(e)!==it.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.symbol,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodSymbol=j3;j3.create=t=>new j3({typeName:Lr.ZodSymbol,...gn(t)});var dk=class extends yn{_parse(e){if(this._getType(e)!==it.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.undefined,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodUndefined=dk;dk.create=t=>new dk({typeName:Lr.ZodUndefined,...gn(t)});var fk=class extends yn{_parse(e){if(this._getType(e)!==it.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.null,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodNull=fk;fk.create=t=>new fk({typeName:Lr.ZodNull,...gn(t)});var QR=class extends yn{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ue.OK)(e.data)}};se.ZodAny=QR;QR.create=t=>new QR({typeName:Lr.ZodAny,...gn(t)});var uT=class extends yn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ue.OK)(e.data)}};se.ZodUnknown=uT;uT.create=t=>new uT({typeName:Lr.ZodUnknown,...gn(t)});var M_=class extends yn{_parse(e){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.never,received:r.parsedType}),ue.INVALID}};se.ZodNever=M_;M_.create=t=>new M_({typeName:Lr.ZodNever,...gn(t)});var D3=class extends yn{_parse(e){if(this._getType(e)!==it.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.void,received:n.parsedType}),ue.INVALID}return(0,ue.OK)(e.data)}};se.ZodVoid=D3;D3.create=t=>new D3({typeName:Lr.ZodVoid,...gn(t)});var lT=class t extends yn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==it.ZodParsedType.array)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:it.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?Ye.ZodIssueCode.too_big:Ye.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:Ye.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:Ye.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 Uy(r,a,r.path,s)))).then(a=>ue.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Uy(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:Qt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Qt.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Qt.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};se.ZodArray=lT;lT.create=(t,e)=>new lT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Lr.ZodArray,...gn(e)});function N3(t){if(t instanceof sh){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=zy.create(N3(n))}return new sh({...t._def,shape:()=>e})}else return t instanceof lT?new lT({...t._def,type:N3(t.element)}):t instanceof zy?zy.create(N3(t.unwrap())):t instanceof OO?OO.create(N3(t.unwrap())):t instanceof CO?CO.create(t.items.map(e=>N3(e))):t}var sh=class t extends yn{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=it.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==it.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(l,{code:Ye.ZodIssueCode.invalid_type,expected:it.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 M_&&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 Uy(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof M_){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:Ye.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 Uy(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 Qt.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:Qt.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:Lr.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 it.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 it.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return N3(this)}partial(e){let r={};for(let n of it.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 it.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof zy;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return aWt(it.util.objectKeys(this.shape))}};se.ZodObject=sh;sh.create=(t,e)=>new sh({shape:()=>t,unknownKeys:"strip",catchall:M_.create(),typeName:Lr.ZodObject,...gn(e)});sh.strictCreate=(t,e)=>new sh({shape:()=>t,unknownKeys:"strict",catchall:M_.create(),typeName:Lr.ZodObject,...gn(e)});sh.lazycreate=(t,e)=>new sh({shape:t,unknownKeys:"strip",catchall:M_.create(),typeName:Lr.ZodObject,...gn(e)});var pk=class extends yn{_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 Ye.ZodError(s.ctx.common.issues));return(0,ue.addIssueToContext)(r,{code:Ye.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 Ye.ZodError(u));return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union,unionErrors:s}),ue.INVALID}}get options(){return this._def.options}};se.ZodUnion=pk;pk.create=(t,e)=>new pk({options:t,typeName:Lr.ZodUnion,...gn(e)});var sT=t=>t instanceof hk?sT(t.schema):t instanceof yg?sT(t.innerType()):t instanceof gk?[t.value]:t instanceof yk?t.options:t instanceof bk?it.util.objectValues(t.enum):t instanceof _k?sT(t._def.innerType):t instanceof dk?[void 0]:t instanceof fk?[null]:t instanceof zy?[void 0,...sT(t.unwrap())]:t instanceof OO?[null,...sT(t.unwrap())]:t instanceof gJ||t instanceof wk?sT(t.unwrap()):t instanceof vk?sT(t._def.innerType):[],Xpe=class t extends yn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==it.ZodParsedType.object)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:it.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:Ye.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=sT(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:Lr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...gn(n)})}};se.ZodDiscriminatedUnion=Xpe;function w4e(t,e){let r=(0,it.getParsedType)(t),n=(0,it.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===it.ZodParsedType.object&&n===it.ZodParsedType.object){let o=it.util.objectKeys(e),i=it.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=w4e(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===it.ZodParsedType.array&&n===it.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=w4e(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===it.ZodParsedType.date&&n===it.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var mk=class extends yn{_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=w4e(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:Ye.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}))}};se.ZodIntersection=mk;mk.create=(t,e,r)=>new mk({left:t,right:e,typeName:Lr.ZodIntersection,...gn(r)});var CO=class t extends yn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.ZodParsedType.array)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.array,received:n.parsedType}),ue.INVALID;if(n.data.length<this._def.items.length)return(0,ue.addIssueToContext)(n,{code:Ye.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:Ye.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 Uy(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})}};se.ZodTuple=CO;CO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new CO({items:t,typeName:Lr.ZodTuple,rest:null,...gn(e)})};var Qpe=class t extends yn{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!==it.ZodParsedType.object)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.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 Uy(n,s,n.path,s)),value:a._parse(new Uy(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 yn?new t({keyType:e,valueType:r,typeName:Lr.ZodRecord,...gn(n)}):new t({keyType:XR.create(),valueType:e,typeName:Lr.ZodRecord,...gn(r)})}};se.ZodRecord=Qpe;var L3=class extends yn{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!==it.ZodParsedType.map)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.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 Uy(n,s,n.path,[l,"key"])),value:i._parse(new Uy(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}}}};se.ZodMap=L3;L3.create=(t,e,r)=>new L3({valueType:e,keyType:t,typeName:Lr.ZodMap,...gn(r)});var F3=class t extends yn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.ZodParsedType.set)return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.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:Ye.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:Ye.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 Uy(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:Qt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Qt.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};se.ZodSet=F3;F3.create=(t,e)=>new F3({valueType:t,minSize:null,maxSize:null,typeName:Lr.ZodSet,...gn(e)});var eme=class t extends yn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==it.ZodParsedType.function)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:it.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,Ype.getErrorMap)(),Ype.defaultErrorMap].filter(l=>!!l),issueData:{code:Ye.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,Ype.getErrorMap)(),Ype.defaultErrorMap].filter(l=>!!l),issueData:{code:Ye.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof e1){let s=this;return(0,ue.OK)(async function(...u){let l=new Ye.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 Ye.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 Ye.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:CO.create(e).rest(uT.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||CO.create([]).rest(uT.create()),returns:r||uT.create(),typeName:Lr.ZodFunction,...gn(n)})}};se.ZodFunction=eme;var hk=class extends yn{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})}};se.ZodLazy=hk;hk.create=(t,e)=>new hk({getter:t,typeName:Lr.ZodLazy,...gn(e)});var gk=class extends yn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(r,{received:r.data,code:Ye.ZodIssueCode.invalid_literal,expected:this._def.value}),ue.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};se.ZodLiteral=gk;gk.create=(t,e)=>new gk({value:t,typeName:Lr.ZodLiteral,...gn(e)});function aWt(t,e){return new yk({values:t,typeName:Lr.ZodEnum,...gn(e)})}var yk=class t extends yn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ue.addIssueToContext)(r,{expected:it.util.joinValues(n),received:r.parsedType,code:Ye.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:Ye.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})}};se.ZodEnum=yk;yk.create=aWt;var bk=class extends yn{_parse(e){let r=it.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.ZodParsedType.string&&n.parsedType!==it.ZodParsedType.number){let o=it.util.objectValues(r);return(0,ue.addIssueToContext)(n,{expected:it.util.joinValues(o),received:n.parsedType,code:Ye.ZodIssueCode.invalid_type}),ue.INVALID}if(this._cache||(this._cache=new Set(it.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=it.util.objectValues(r);return(0,ue.addIssueToContext)(n,{received:n.data,code:Ye.ZodIssueCode.invalid_enum_value,options:o}),ue.INVALID}return(0,ue.OK)(e.data)}get enum(){return this._def.values}};se.ZodNativeEnum=bk;bk.create=(t,e)=>new bk({values:t,typeName:Lr.ZodNativeEnum,...gn(e)});var e1=class extends yn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==it.ZodParsedType.promise&&r.common.async===!1)return(0,ue.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.promise,received:r.parsedType}),ue.INVALID;let n=r.parsedType===it.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})))}};se.ZodPromise=e1;e1.create=(t,e)=>new e1({type:t,typeName:Lr.ZodPromise,...gn(e)});var yg=class extends yn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Lr.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);it.util.assertNever(o)}};se.ZodEffects=yg;se.ZodTransformer=yg;yg.create=(t,e,r)=>new yg({schema:t,typeName:Lr.ZodEffects,effect:e,...gn(r)});yg.createWithPreprocess=(t,e,r)=>new yg({schema:e,effect:{type:"preprocess",transform:t},typeName:Lr.ZodEffects,...gn(r)});var zy=class extends yn{_parse(e){return this._getType(e)===it.ZodParsedType.undefined?(0,ue.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};se.ZodOptional=zy;zy.create=(t,e)=>new zy({innerType:t,typeName:Lr.ZodOptional,...gn(e)});var OO=class extends yn{_parse(e){return this._getType(e)===it.ZodParsedType.null?(0,ue.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};se.ZodNullable=OO;OO.create=(t,e)=>new OO({innerType:t,typeName:Lr.ZodNullable,...gn(e)});var _k=class extends yn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===it.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};se.ZodDefault=_k;_k.create=(t,e)=>new _k({innerType:t,typeName:Lr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...gn(e)});var vk=class extends yn{_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 Ye.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ye.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};se.ZodCatch=vk;vk.create=(t,e)=>new vk({innerType:t,typeName:Lr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...gn(e)});var k3=class extends yn{_parse(e){if(this._getType(e)!==it.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ue.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:it.ZodParsedType.nan,received:n.parsedType}),ue.INVALID}return{status:"valid",value:e.data}}};se.ZodNaN=k3;k3.create=t=>new k3({typeName:Lr.ZodNaN,...gn(t)});se.BRAND=Symbol("zod_brand");var gJ=class extends yn{_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}};se.ZodBranded=gJ;var yJ=class t extends yn{_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:Lr.ZodPipeline})}};se.ZodPipeline=yJ;var wk=class extends yn{_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}};se.ZodReadonly=wk;wk.create=(t,e)=>new wk({innerType:t,typeName:Lr.ZodReadonly,...gn(e)});function rWt(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?QR.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=rWt(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=rWt(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):QR.create()}se.late={object:sh.lazycreate};var Lr;(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"})(Lr||(se.ZodFirstPartyTypeKind=Lr={}));var P_n=(t,e={message:`Input not instance of ${t.name}`})=>sWt(r=>r instanceof t,e);se.instanceof=P_n;var uWt=XR.create;se.string=uWt;var lWt=sk.create;se.number=lWt;var T_n=k3.create;se.nan=T_n;var A_n=uk.create;se.bigint=A_n;var cWt=lk.create;se.boolean=cWt;var I_n=ck.create;se.date=I_n;var M_n=j3.create;se.symbol=M_n;var R_n=dk.create;se.undefined=R_n;var N_n=fk.create;se.null=N_n;var j_n=QR.create;se.any=j_n;var D_n=uT.create;se.unknown=D_n;var L_n=M_.create;se.never=L_n;var F_n=D3.create;se.void=F_n;var k_n=lT.create;se.array=k_n;var $_n=sh.create;se.object=$_n;var B_n=sh.strictCreate;se.strictObject=B_n;var z_n=pk.create;se.union=z_n;var U_n=Xpe.create;se.discriminatedUnion=U_n;var q_n=mk.create;se.intersection=q_n;var H_n=CO.create;se.tuple=H_n;var V_n=Qpe.create;se.record=V_n;var W_n=L3.create;se.map=W_n;var K_n=F3.create;se.set=K_n;var G_n=eme.create;se.function=G_n;var J_n=hk.create;se.lazy=J_n;var Z_n=gk.create;se.literal=Z_n;var Y_n=yk.create;se.enum=Y_n;var X_n=bk.create;se.nativeEnum=X_n;var Q_n=e1.create;se.promise=Q_n;var dWt=yg.create;se.effect=dWt;se.transformer=dWt;var evn=zy.create;se.optional=evn;var tvn=OO.create;se.nullable=tvn;var rvn=yg.createWithPreprocess;se.preprocess=rvn;var nvn=yJ.create;se.pipeline=nvn;var ovn=()=>uWt().optional();se.ostring=ovn;var ivn=()=>lWt().optional();se.onumber=ivn;var avn=()=>cWt().optional();se.oboolean=avn;se.coerce={string:t=>XR.create({...t,coerce:!0}),number:t=>sk.create({...t,coerce:!0}),boolean:t=>lk.create({...t,coerce:!0}),bigint:t=>uk.create({...t,coerce:!0}),date:t=>ck.create({...t,coerce:!0})};se.NEVER=ue.INVALID});var x4e=x(qy=>{"use strict";var svn=qy&&qy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$3=qy&&qy.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&svn(e,t,r)};Object.defineProperty(qy,"__esModule",{value:!0});$3(Jpe(),qy);$3(_4e(),qy);$3(X5t(),qy);$3(mJ(),qy);$3(fWt(),qy);$3(Gpe(),qy)});var Ie=x(uh=>{"use strict";var pWt=uh&&uh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uvn=uh&&uh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lvn=uh&&uh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pWt(e,t,r);return uvn(e,t),e},cvn=uh&&uh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pWt(e,t,r)};Object.defineProperty(uh,"__esModule",{value:!0});uh.z=void 0;var mWt=lvn(x4e());uh.z=mWt;cvn(x4e(),uh);uh.default=mWt});var O4e=x(rd=>{"use strict";var dvn=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]}),fvn=rd&&rd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pvn=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)&&dvn(e,t,r);return fvn(e,t),e};Object.defineProperty(rd,"__esModule",{value:!0});rd.zodInbound=rd.zodOutbound=void 0;rd.bytesToBase64=hWt;rd.bytesFromBase64=S4e;rd.stringToBytes=C4e;rd.stringFromBytes=gWt;rd.stringToBase64=mvn;rd.stringFromBase64=hvn;var tme=pvn(Ie());function hWt(t){return btoa(String.fromCodePoint(...t))}function S4e(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function C4e(t){return new TextEncoder().encode(t)}function gWt(t){return new TextDecoder().decode(t)}function mvn(t){return hWt(C4e(t))}function hvn(t){return gWt(S4e(t))}rd.zodOutbound=tme.instanceof(Uint8Array).or(tme.string().transform(C4e));rd.zodInbound=tme.instanceof(Uint8Array).or(tme.string().transform(S4e))});var P4e=x(E4e=>{"use strict";Object.defineProperty(E4e,"__esModule",{value:!0});E4e.isPlainObject=gvn;function gvn(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 Si=x(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.encodeDeepObjectQuery=Po.encodePipeDelimitedQuery=Po.encodeSpaceDelimitedQuery=Po.encodeFormQuery=Po.encodeJSONQuery=Po.encodeSimple=Po.encodePipeDelimited=Po.encodeSpaceDelimited=Po.encodeForm=Po.EncodingError=void 0;Po.encodeMatrix=yvn;Po.encodeLabel=bvn;Po.encodeBodyForm=_vn;Po.encodeDeepObject=bWt;Po.encodeDeepObjectObject=A4e;Po.encodeJSON=_Wt;Po.queryJoin=vWt;Po.queryEncoder=z3;Po.appendForm=wvn;var yWt=O4e(),R_=P4e(),bJ=class extends Error{constructor(e){super(e),this.name="EncodingError"}};Po.EncodingError=bJ;function yvn(t,e,r){let n="",o=r?.explode?_J(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(B3(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=vJ(u,f=>`${a(f)}`)?.join(","):(0,R_.isPlainObject)(u)?c=nme(Object.entries(u),([p,h])=>`,${i(p)},${a(h)}`)?.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 bvn(t,e,r){let n="",o=r?.explode?_J(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(B3(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=vJ(u,c=>`${a(c)}`)?.join("."):(0,R_.isPlainObject)(u)?l=nme(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,R_.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function T4e(t){return(e,r,n)=>{let o="",i=n?.explode?_J(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(B3(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=vJ(c,p=>`${s(p)}`)?.join(u):(0,R_.isPlainObject)(c)?f=nme(Object.entries(c),([p,h])=>`${a(p)}${u}${s(h)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}Po.encodeForm=T4e(",");Po.encodeSpaceDelimited=T4e(" ");Po.encodePipeDelimited=T4e("|");function _vn(t,e,r){let n="",o=r?.explode?_J(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(B3(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,R_.isPlainObject)(u)?c=JSON.stringify(u,rme):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function bWt(t,e,r){if(e!=null){if(!(0,R_.isPlainObject)(e))throw new bJ(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return A4e(t,e,r)}}function A4e(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,R_.isPlainObject)(e))throw new bJ(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,R_.isPlainObject)(a)){let c=A4e(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=vJ(u,c=>`${o(s)}=${o(B3(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function _Wt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,rme));return r?.explode?o:`${n(t)}=${o}`}var vvn=(t,e,r)=>{let n="",o=r?.explode?_J(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(B3(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=vJ(u,c=>`${a(c)}`)?.join(","):(0,R_.isPlainObject)(u)?l=nme(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,R_.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};Po.encodeSimple=vvn;function _J(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,R_.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function B3(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,yWt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,rme):`${t}`}function rme(t,e){return e instanceof Uint8Array?(0,yWt.bytesToBase64)(e):e}function vJ(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 nme(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 vWt(...t){return t.filter(Boolean).join("&")}function z3(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 vWt(...i)}}Po.encodeJSONQuery=z3(_Wt);Po.encodeFormQuery=z3(Po.encodeForm);Po.encodeSpaceDelimitedQuery=z3(Po.encodeSpaceDelimited);Po.encodePipeDelimitedQuery=z3(Po.encodePipeDelimited);Po.encodeDeepObjectQuery=z3(bWt);function wvn(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 wWt=x(I4e=>{"use strict";Object.defineProperty(I4e,"__esModule",{value:!0});I4e.dlv=xvn;function xvn(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 R4e=x(bg=>{"use strict";var Svn=bg&&bg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cvn=bg&&bg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ovn=bg&&bg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Svn(e,t,r);return Cvn(e,t),e};Object.defineProperty(bg,"__esModule",{value:!0});bg.envSchema=void 0;bg.env=Evn;bg.resetEnv=Pvn;var xWt=wWt(),M4e=Ovn(Ie());bg.envSchema=M4e.object({MISTRAL_API_KEY:M4e.string().optional(),MISTRAL_DEBUG:M4e.coerce.boolean().optional()});var wJ;function Evn(){return wJ||(wJ=bg.envSchema.parse((0,xWt.dlv)(globalThis,"process.env")??(0,xWt.dlv)(globalThis,"Deno.env")??{}),wJ)}function Pvn(){wJ=void 0}});var xJ=x(EO=>{"use strict";Object.defineProperty(EO,"__esModule",{value:!0});EO.HTTPClient=void 0;EO.matchContentType=CWt;EO.matchStatusCode=OWt;EO.matchResponse=Ivn;EO.isConnectionError=Mvn;EO.isTimeoutError=Rvn;EO.isAbortError=Nvn;var Tvn=(t,e)=>e==null?fetch(t):fetch(t,e),N4e=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Tvn}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}};EO.HTTPClient=N4e;var SWt=/\s*;\s*/g;function CWt(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(SWt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(SWt),[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 Avn=new RegExp("^[0-9]xx$","i");function OWt(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(!Avn.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 Ivn(t,e,r){return OWt(t,e)&&CWt(t,r)}function Mvn(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 Rvn(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 Nvn(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 PWt=x(Sk=>{"use strict";Object.defineProperty(Sk,"__esModule",{value:!0});Sk.TemporaryError=Sk.PermanentError=void 0;Sk.retry=Dvn;var EWt=xJ(),jvn={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},SJ=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)}};Sk.PermanentError=SJ;var xk=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};Sk.TemporaryError=xk;async function Dvn(t,e){switch(e.config.strategy){case"backoff":return $vn(Lvn(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??jvn);default:return await t()}}function Lvn(t,e){return async()=>{try{let r=await t();if(kvn(r,e.statusCodes))throw new xk("Response failed with retryable status code",r);return r}catch(r){throw r instanceof xk||e.retryConnectionErrors&&((0,EWt.isTimeoutError)(r)||(0,EWt.isConnectionError)(r))?r:new SJ("Permanent error",{cause:r})}}}var Fvn=new RegExp("^[0-9]xx$","i");function kvn(t,e){let r=`${t.status}`;return e.some(n=>{if(!Fvn.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 $vn(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 SJ)throw u.cause;if(Date.now()-a>r){if(u instanceof xk)return u.response;throw u}let c=0;u instanceof xk&&(c=Bvn(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await zvn(d),s++}}function Bvn(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 zvn(t){return new Promise(e=>setTimeout(e,t))}});var _g=x(r1=>{"use strict";var CJ=r1&&r1.__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},Hy=r1&&r1.__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)},ime,PO,cT;Object.defineProperty(r1,"__esModule",{value:!0});r1.ClientSDK=void 0;var TWt=V5t(),U3=m4e(),t1=By(),Uvn=O4e(),AWt=Hpe(),qvn=Si(),Hvn=R4e(),dT=xJ(),Vvn=PWt(),ome=typeof globalThis>"u"?null:globalThis,Wvn=typeof ome=="object"&&ome!=null&&"importScripts"in ome&&typeof ome.importScripts=="function",Kvn=Wvn||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",j4e=class{constructor(e={}){ime.set(this,void 0),PO.set(this,void 0),cT.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof TWt.SDKHooks?CJ(this,PO,r.hooks,"f"):CJ(this,PO,new TWt.SDKHooks,"f"),this._options={...e,hooks:Hy(this,PO,"f")};let n=(0,AWt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Hy(this,PO,"f").sdkInit({baseURL:n,client:e.httpClient||new dT.HTTPClient});this._baseURL=o,CJ(this,ime,i,"f"),CJ(this,cT,e.debugLogger,"f"),!Hy(this,cT,"f")&&(0,Hvn.env)().MISTRAL_DEBUG&&CJ(this,cT,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,t1.ERR)(new U3.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,qvn.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 h=new Headers(s),m=u?.basic.username,g=u?.basic.password;if(m!=null||g!=null){let E=(0,Uvn.stringToBase64)([m||"",g||""].join(":"));h.set("Authorization",`Basic ${E}`)}let y=new Headers(u?.headers||{});for(let[E,P]of y)h.set(E,P);let _=h.get("cookie")||"";for(let[E,P]of Object.entries(u?.cookies||{}))_+=`; ${E}=${P}`;_=_.startsWith("; ")?_.slice(2):_,h.set("cookie",_);let w=new Headers(n?.fetchOptions?.headers);for(let[E,P]of w)h.set(E,P);Kvn||h.set(r.uaHeader??"user-agent",AWt.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=Hy(this,PO,"f").beforeCreateRequest(e,{url:c,options:{...S,body:r.body??null,headers:h,method:o}})}catch(E){return(0,t1.ERR)(new U3.UnexpectedClientError("Create request hook failed to execute",{cause:E}))}return(0,t1.OK)(new Request(C.url,C.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,Vvn.retry)(async()=>{let i=await Hy(this,PO,"f").beforeRequest(n,e.clone());await Gvn(Hy(this,cT,"f"),i).catch(s=>Hy(this,cT,"f")?.log("Failed to log request:",s));let a=await Hy(this,ime,"f").request(i);try{if((0,dT.matchStatusCode)(a,o)){let s=await Hy(this,PO,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Hy(this,PO,"f").afterSuccess(n,a)}finally{await Jvn(Hy(this,cT,"f"),a,i).catch(s=>Hy(this,cT,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,t1.OK)(i),i=>{switch(!0){case(0,dT.isAbortError)(i):return(0,t1.ERR)(new U3.RequestAbortedError("Request aborted by client",{cause:i}));case(0,dT.isTimeoutError)(i):return(0,t1.ERR)(new U3.RequestTimeoutError("Request timed out",{cause:i}));case(0,dT.isConnectionError)(i):return(0,t1.ERR)(new U3.ConnectionError("Unable to make request",{cause:i}));default:return(0,t1.ERR)(new U3.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};r1.ClientSDK=j4e;ime=new WeakMap,PO=new WeakMap,cT=new WeakMap;var IWt=/^application\/(?:.{0,100}\+)?json/;async function Gvn(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 IWt.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 Jvn(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,dT.matchContentType)(e,"application/json")||IWt.test(o)):t.log(await e.clone().json());break;case(0,dT.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,dT.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,dT.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 L4e=x(ame=>{"use strict";Object.defineProperty(ame,"__esModule",{value:!0});ame.SDKError=void 0;var D4e=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"}};ame.SDKError=D4e});var TJ=x(PJ=>{"use strict";Object.defineProperty(PJ,"__esModule",{value:!0});PJ.EventStream=void 0;PJ.discardSentinel=Xvn;var OJ=10,EJ=13,MWt=new Set([OJ,EJ]),Zvn=[new Uint8Array([EJ,OJ,EJ,OJ]),new Uint8Array([EJ,EJ]),new Uint8Array([OJ,OJ])],F4e=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=RWt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=k4e(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=k4e(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};PJ.EventStream=F4e;function RWt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!MWt.has(r)||!MWt.has(n))return null;for(let o of Zvn){let i=Yvn(e,t,o);if(i!=null)return i}return null}function Yvn(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 k4e(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 Xvn(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=RWt(n,d);if(f==null)continue;let p=o,h=n.slice(p,d);o=d+f.length,k4e(h,Qvn)?.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 Qvn(t){return t}});var z4e=x(N_=>{"use strict";var ewn=N_&&N_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),twn=N_&&N_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rwn=N_&&N_.__importStar||function(t){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 twn(e,t),e};Object.defineProperty(N_,"__esModule",{value:!0});N_.SDKValidationError=void 0;N_.formatZodError=B4e;var nwn=rwn(Ie()),$4e=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 nwn.ZodError?`${this.rawMessage}
${B4e(this.cause)}`:this.toString()}};N_.SDKValidationError=$4e;function B4e(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(`${B4e(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var Ce=x(AJ=>{"use strict";Object.defineProperty(AJ,"__esModule",{value:!0});AJ.parse=iwn;AJ.safeParse=awn;AJ.collectExtraKeys=swn;var own=Ie(),jWt=z4e(),NWt=By();function iwn(t,e,r){try{return e(t)}catch(n){throw n instanceof own.ZodError?new jWt.SDKValidationError(r,n,t):n}}function awn(t,e,r){try{return(0,NWt.OK)(e(t))}catch(n){return(0,NWt.ERR)(new jWt.SDKValidationError(r,n,t))}}function swn(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 Ci=x(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.jsonErr=cwn;nd.json=dwn;nd.textErr=fwn;nd.text=pwn;nd.bytesErr=mwn;nd.bytes=hwn;nd.streamErr=gwn;nd.stream=ywn;nd.sseErr=bwn;nd.sse=_wn;nd.nilErr=vwn;nd.nil=wwn;nd.fail=xwn;nd.match=Swn;nd.unpackHeaders=sme;nd.discardResponseBody=$Wt;var DWt=L4e(),uwn=TJ(),LWt=xJ(),FWt=P4e(),kWt=Ce(),lwn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function cwn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function dwn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function fwn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function pwn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function mwn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function hwn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function gwn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function ywn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function bwn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function _wn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function vwn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function wwn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function xwn(t){return{enc:"fail",codes:t}}function Swn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:lwn[l.enc];if(d&&(0,LWt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,LWt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new DWt.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,uwn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await $Wt(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 DWt.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:sme(r.headers)}:null,...(0,FWt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:sme(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:sme(r.headers)}:null,...(0,FWt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,kWt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,kWt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var Cwn=/, */;function sme(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Cwn);return e}async function $Wt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Ke=x(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});Ck.invariant=Own;Ck.remap=Ewn;Ck.combineSignals=Pwn;Ck.abortSignalAny=BWt;Ck.compactMap=Twn;var U4e=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Own(t,e){if(!t)throw new U4e(e)}function Ewn(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 Pwn(...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):BWt(e)}}function BWt(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 Twn(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var Oi=x(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.SecurityError=fT.SecurityErrorCode=void 0;fT.resolveSecurity=zWt;fT.resolveGlobalSecurity=Mwn;fT.extractSecurity=Rwn;var Awn=R4e(),lme;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(lme||(fT.SecurityErrorCode=lme={}));var cme=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(lme.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(lme.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};fT.SecurityError=cme;function zWt(...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":Iwn(e,n);break;case"http:custom":break;case"http:bearer":ume(e,n);break;case"oauth2":ume(e,n);break;case"oauth2:password":ume(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":ume(e,n);break;default:throw cme.unrecognizedType(o)}}),e)}function Iwn(t,e){e.value!=null&&(t.basic=e.value)}function ume(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 Mwn(t){return zWt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Awn.env)().MISTRAL_API_KEY}])}async function Rwn(t){if(t!=null)return typeof t=="function"?t():t}});var q4e=x(ju=>{"use strict";var Nwn=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]}),jwn=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dwn=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)&&Nwn(e,t,r);return jwn(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.ImageURL$=ju.ImageURL$outboundSchema=ju.ImageURL$inboundSchema=void 0;ju.imageURLToJSON=Fwn;ju.imageURLFromJSON=kwn;var n1=Dwn(Ie()),Lwn=Ce();ju.ImageURL$inboundSchema=n1.object({url:n1.string(),detail:n1.nullable(n1.string()).optional()});ju.ImageURL$outboundSchema=n1.object({url:n1.string(),detail:n1.nullable(n1.string()).optional()});var UWt;(function(t){t.inboundSchema=ju.ImageURL$inboundSchema,t.outboundSchema=ju.ImageURL$outboundSchema})(UWt||(ju.ImageURL$=UWt={}));function Fwn(t){return JSON.stringify(ju.ImageURL$outboundSchema.parse(t))}function kwn(t){return(0,Lwn.safeParse)(t,e=>ju.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var H4e=x(Wr=>{"use strict";var $wn=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]}),Bwn=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zwn=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)&&$wn(e,t,r);return Bwn(e,t),e};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.ImageURLChunk$=Wr.ImageURLChunk$outboundSchema=Wr.ImageURLChunk$inboundSchema=Wr.ImageURLChunkType$=Wr.ImageURLChunkType$outboundSchema=Wr.ImageURLChunkType$inboundSchema=Wr.ImageURLChunkImageURL$=Wr.ImageURLChunkImageURL$outboundSchema=Wr.ImageURLChunkImageURL$inboundSchema=Wr.ImageURLChunkType=void 0;Wr.imageURLChunkImageURLToJSON=Uwn;Wr.imageURLChunkImageURLFromJSON=qwn;Wr.imageURLChunkToJSON=Hwn;Wr.imageURLChunkFromJSON=Vwn;var j_=zwn(Ie()),WWt=Ke(),KWt=Ce(),dme=q4e();Wr.ImageURLChunkType={ImageUrl:"image_url"};Wr.ImageURLChunkImageURL$inboundSchema=j_.union([dme.ImageURL$inboundSchema,j_.string()]);Wr.ImageURLChunkImageURL$outboundSchema=j_.union([dme.ImageURL$outboundSchema,j_.string()]);var qWt;(function(t){t.inboundSchema=Wr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Wr.ImageURLChunkImageURL$outboundSchema})(qWt||(Wr.ImageURLChunkImageURL$=qWt={}));function Uwn(t){return JSON.stringify(Wr.ImageURLChunkImageURL$outboundSchema.parse(t))}function qwn(t){return(0,KWt.safeParse)(t,e=>Wr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Wr.ImageURLChunkType$inboundSchema=j_.nativeEnum(Wr.ImageURLChunkType);Wr.ImageURLChunkType$outboundSchema=Wr.ImageURLChunkType$inboundSchema;var HWt;(function(t){t.inboundSchema=Wr.ImageURLChunkType$inboundSchema,t.outboundSchema=Wr.ImageURLChunkType$outboundSchema})(HWt||(Wr.ImageURLChunkType$=HWt={}));Wr.ImageURLChunk$inboundSchema=j_.object({image_url:j_.union([dme.ImageURL$inboundSchema,j_.string()]),type:Wr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,WWt.remap)(t,{image_url:"imageUrl"}));Wr.ImageURLChunk$outboundSchema=j_.object({imageUrl:j_.union([dme.ImageURL$outboundSchema,j_.string()]),type:Wr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,WWt.remap)(t,{imageUrl:"image_url"}));var VWt;(function(t){t.inboundSchema=Wr.ImageURLChunk$inboundSchema,t.outboundSchema=Wr.ImageURLChunk$outboundSchema})(VWt||(Wr.ImageURLChunk$=VWt={}));function Hwn(t){return JSON.stringify(Wr.ImageURLChunk$outboundSchema.parse(t))}function Vwn(t){return(0,KWt.safeParse)(t,e=>Wr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var V4e=x(To=>{"use strict";var Wwn=To&&To.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kwn=To&&To.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gwn=To&&To.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wwn(e,t,r);return Kwn(e,t),e};Object.defineProperty(To,"__esModule",{value:!0});To.ReferenceChunk$=To.ReferenceChunk$outboundSchema=To.ReferenceChunk$inboundSchema=To.ReferenceChunkType$=To.ReferenceChunkType$outboundSchema=To.ReferenceChunkType$inboundSchema=To.ReferenceChunkType=void 0;To.referenceChunkToJSON=Zwn;To.referenceChunkFromJSON=Ywn;var Ok=Gwn(Ie()),ZWt=Ke(),Jwn=Ce();To.ReferenceChunkType={Reference:"reference"};To.ReferenceChunkType$inboundSchema=Ok.nativeEnum(To.ReferenceChunkType);To.ReferenceChunkType$outboundSchema=To.ReferenceChunkType$inboundSchema;var GWt;(function(t){t.inboundSchema=To.ReferenceChunkType$inboundSchema,t.outboundSchema=To.ReferenceChunkType$outboundSchema})(GWt||(To.ReferenceChunkType$=GWt={}));To.ReferenceChunk$inboundSchema=Ok.object({reference_ids:Ok.array(Ok.number().int()),type:To.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,ZWt.remap)(t,{reference_ids:"referenceIds"}));To.ReferenceChunk$outboundSchema=Ok.object({referenceIds:Ok.array(Ok.number().int()),type:To.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,ZWt.remap)(t,{referenceIds:"reference_ids"}));var JWt;(function(t){t.inboundSchema=To.ReferenceChunk$inboundSchema,t.outboundSchema=To.ReferenceChunk$outboundSchema})(JWt||(To.ReferenceChunk$=JWt={}));function Zwn(t){return JSON.stringify(To.ReferenceChunk$outboundSchema.parse(t))}function Ywn(t){return(0,Jwn.safeParse)(t,e=>To.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var fme=x(Ao=>{"use strict";var Xwn=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]}),Qwn=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e0n=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)&&Xwn(e,t,r);return Qwn(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.TextChunk$=Ao.TextChunk$outboundSchema=Ao.TextChunk$inboundSchema=Ao.TextChunkType$=Ao.TextChunkType$outboundSchema=Ao.TextChunkType$inboundSchema=Ao.TextChunkType=void 0;Ao.textChunkToJSON=r0n;Ao.textChunkFromJSON=n0n;var IJ=e0n(Ie()),t0n=Ce();Ao.TextChunkType={Text:"text"};Ao.TextChunkType$inboundSchema=IJ.nativeEnum(Ao.TextChunkType);Ao.TextChunkType$outboundSchema=Ao.TextChunkType$inboundSchema;var YWt;(function(t){t.inboundSchema=Ao.TextChunkType$inboundSchema,t.outboundSchema=Ao.TextChunkType$outboundSchema})(YWt||(Ao.TextChunkType$=YWt={}));Ao.TextChunk$inboundSchema=IJ.object({text:IJ.string(),type:Ao.TextChunkType$inboundSchema.default("text")});Ao.TextChunk$outboundSchema=IJ.object({text:IJ.string(),type:Ao.TextChunkType$outboundSchema.default("text")});var XWt;(function(t){t.inboundSchema=Ao.TextChunk$inboundSchema,t.outboundSchema=Ao.TextChunk$outboundSchema})(XWt||(Ao.TextChunk$=XWt={}));function r0n(t){return JSON.stringify(Ao.TextChunk$outboundSchema.parse(t))}function n0n(t){return(0,t0n.safeParse)(t,e=>Ao.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var q3=x(Du=>{"use strict";var o0n=Du&&Du.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i0n=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a0n=Du&&Du.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o0n(e,t,r);return i0n(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.ContentChunk$=Du.ContentChunk$outboundSchema=Du.ContentChunk$inboundSchema=void 0;Du.contentChunkToJSON=u0n;Du.contentChunkFromJSON=l0n;var lh=a0n(Ie()),s0n=Ce(),e9t=H4e(),t9t=V4e(),r9t=fme();Du.ContentChunk$inboundSchema=lh.union([e9t.ImageURLChunk$inboundSchema.and(lh.object({type:lh.literal("image_url")}).transform(t=>({type:t.type}))),r9t.TextChunk$inboundSchema.and(lh.object({type:lh.literal("text")}).transform(t=>({type:t.type}))),t9t.ReferenceChunk$inboundSchema.and(lh.object({type:lh.literal("reference")}).transform(t=>({type:t.type})))]);Du.ContentChunk$outboundSchema=lh.union([e9t.ImageURLChunk$outboundSchema.and(lh.object({type:lh.literal("image_url")}).transform(t=>({type:t.type}))),r9t.TextChunk$outboundSchema.and(lh.object({type:lh.literal("text")}).transform(t=>({type:t.type}))),t9t.ReferenceChunk$outboundSchema.and(lh.object({type:lh.literal("reference")}).transform(t=>({type:t.type})))]);var QWt;(function(t){t.inboundSchema=Du.ContentChunk$inboundSchema,t.outboundSchema=Du.ContentChunk$outboundSchema})(QWt||(Du.ContentChunk$=QWt={}));function u0n(t){return JSON.stringify(Du.ContentChunk$outboundSchema.parse(t))}function l0n(t){return(0,s0n.safeParse)(t,e=>Du.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var W4e=x(Vo=>{"use strict";var c0n=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]}),d0n=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f0n=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)&&c0n(e,t,r);return d0n(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=p0n;Vo.argumentsFromJSON=m0n;Vo.functionCallToJSON=h0n;Vo.functionCallFromJSON=g0n;var Lu=f0n(Ie()),i9t=Ce();Vo.Arguments$inboundSchema=Lu.union([Lu.record(Lu.any()),Lu.string()]);Vo.Arguments$outboundSchema=Lu.union([Lu.record(Lu.any()),Lu.string()]);var n9t;(function(t){t.inboundSchema=Vo.Arguments$inboundSchema,t.outboundSchema=Vo.Arguments$outboundSchema})(n9t||(Vo.Arguments$=n9t={}));function p0n(t){return JSON.stringify(Vo.Arguments$outboundSchema.parse(t))}function m0n(t){return(0,i9t.safeParse)(t,e=>Vo.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}Vo.FunctionCall$inboundSchema=Lu.object({name:Lu.string(),arguments:Lu.union([Lu.record(Lu.any()),Lu.string()])});Vo.FunctionCall$outboundSchema=Lu.object({name:Lu.string(),arguments:Lu.union([Lu.record(Lu.any()),Lu.string()])});var o9t;(function(t){t.inboundSchema=Vo.FunctionCall$inboundSchema,t.outboundSchema=Vo.FunctionCall$outboundSchema})(o9t||(Vo.FunctionCall$=o9t={}));function h0n(t){return JSON.stringify(Vo.FunctionCall$outboundSchema.parse(t))}function g0n(t){return(0,i9t.safeParse)(t,e=>Vo.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var o1=x(K4e=>{"use strict";Object.defineProperty(K4e,"__esModule",{value:!0});K4e.catchUnrecognizedEnum=y0n;function y0n(t){return t}});var MJ=x(Fu=>{"use strict";var b0n=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]}),_0n=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v0n=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)&&b0n(e,t,r);return _0n(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.ToolTypes$=Fu.ToolTypes$outboundSchema=Fu.ToolTypes$inboundSchema=Fu.ToolTypes=void 0;var Ek=v0n(Ie()),w0n=o1();Fu.ToolTypes={Function:"function"};Fu.ToolTypes$inboundSchema=Ek.union([Ek.nativeEnum(Fu.ToolTypes),Ek.string().transform(w0n.catchUnrecognizedEnum)]);Fu.ToolTypes$outboundSchema=Ek.union([Ek.nativeEnum(Fu.ToolTypes),Ek.string().and(Ek.custom())]);var a9t;(function(t){t.inboundSchema=Fu.ToolTypes$inboundSchema,t.outboundSchema=Fu.ToolTypes$outboundSchema})(a9t||(Fu.ToolTypes$=a9t={}))});var pme=x(ku=>{"use strict";var x0n=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]}),S0n=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C0n=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)&&x0n(e,t,r);return S0n(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.ToolCall$=ku.ToolCall$outboundSchema=ku.ToolCall$inboundSchema=void 0;ku.toolCallToJSON=E0n;ku.toolCallFromJSON=P0n;var H3=C0n(Ie()),O0n=Ce(),u9t=W4e(),l9t=MJ();ku.ToolCall$inboundSchema=H3.object({id:H3.string().default("null"),type:l9t.ToolTypes$inboundSchema.optional(),function:u9t.FunctionCall$inboundSchema,index:H3.number().int().default(0)});ku.ToolCall$outboundSchema=H3.object({id:H3.string().default("null"),type:l9t.ToolTypes$outboundSchema.optional(),function:u9t.FunctionCall$outboundSchema,index:H3.number().int().default(0)});var s9t;(function(t){t.inboundSchema=ku.ToolCall$inboundSchema,t.outboundSchema=ku.ToolCall$outboundSchema})(s9t||(ku.ToolCall$=s9t={}));function E0n(t){return JSON.stringify(ku.ToolCall$outboundSchema.parse(t))}function P0n(t){return(0,O0n.safeParse)(t,e=>ku.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var i1=x(Kr=>{"use strict";var T0n=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]}),A0n=Kr&&Kr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I0n=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)&&T0n(e,t,r);return A0n(e,t),e};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.AssistantMessage$=Kr.AssistantMessage$outboundSchema=Kr.AssistantMessage$inboundSchema=Kr.AssistantMessageRole$=Kr.AssistantMessageRole$outboundSchema=Kr.AssistantMessageRole$inboundSchema=Kr.AssistantMessageContent$=Kr.AssistantMessageContent$outboundSchema=Kr.AssistantMessageContent$inboundSchema=Kr.AssistantMessageRole=void 0;Kr.assistantMessageContentToJSON=M0n;Kr.assistantMessageContentFromJSON=R0n;Kr.assistantMessageToJSON=N0n;Kr.assistantMessageFromJSON=j0n;var ws=I0n(Ie()),p9t=Ke(),m9t=Ce(),mme=q3(),h9t=pme();Kr.AssistantMessageRole={Assistant:"assistant"};Kr.AssistantMessageContent$inboundSchema=ws.union([ws.string(),ws.array(mme.ContentChunk$inboundSchema)]);Kr.AssistantMessageContent$outboundSchema=ws.union([ws.string(),ws.array(mme.ContentChunk$outboundSchema)]);var c9t;(function(t){t.inboundSchema=Kr.AssistantMessageContent$inboundSchema,t.outboundSchema=Kr.AssistantMessageContent$outboundSchema})(c9t||(Kr.AssistantMessageContent$=c9t={}));function M0n(t){return JSON.stringify(Kr.AssistantMessageContent$outboundSchema.parse(t))}function R0n(t){return(0,m9t.safeParse)(t,e=>Kr.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Kr.AssistantMessageRole$inboundSchema=ws.nativeEnum(Kr.AssistantMessageRole);Kr.AssistantMessageRole$outboundSchema=Kr.AssistantMessageRole$inboundSchema;var d9t;(function(t){t.inboundSchema=Kr.AssistantMessageRole$inboundSchema,t.outboundSchema=Kr.AssistantMessageRole$outboundSchema})(d9t||(Kr.AssistantMessageRole$=d9t={}));Kr.AssistantMessage$inboundSchema=ws.object({content:ws.nullable(ws.union([ws.string(),ws.array(mme.ContentChunk$inboundSchema)])).optional(),tool_calls:ws.nullable(ws.array(h9t.ToolCall$inboundSchema)).optional(),prefix:ws.boolean().default(!1),role:Kr.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,p9t.remap)(t,{tool_calls:"toolCalls"}));Kr.AssistantMessage$outboundSchema=ws.object({content:ws.nullable(ws.union([ws.string(),ws.array(mme.ContentChunk$outboundSchema)])).optional(),toolCalls:ws.nullable(ws.array(h9t.ToolCall$outboundSchema)).optional(),prefix:ws.boolean().default(!1),role:Kr.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,p9t.remap)(t,{toolCalls:"tool_calls"}));var f9t;(function(t){t.inboundSchema=Kr.AssistantMessage$inboundSchema,t.outboundSchema=Kr.AssistantMessage$outboundSchema})(f9t||(Kr.AssistantMessage$=f9t={}));function N0n(t){return JSON.stringify(Kr.AssistantMessage$outboundSchema.parse(t))}function j0n(t){return(0,m9t.safeParse)(t,e=>Kr.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var V3=x(Wo=>{"use strict";var D0n=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]}),L0n=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F0n=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)&&D0n(e,t,r);return L0n(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=$0n;Wo.predictionFromJSON=B0n;var Pk=F0n(Ie()),k0n=Ce();Wo.PredictionType={Content:"content"};Wo.PredictionType$inboundSchema=Pk.nativeEnum(Wo.PredictionType);Wo.PredictionType$outboundSchema=Wo.PredictionType$inboundSchema;var g9t;(function(t){t.inboundSchema=Wo.PredictionType$inboundSchema,t.outboundSchema=Wo.PredictionType$outboundSchema})(g9t||(Wo.PredictionType$=g9t={}));Wo.Prediction$inboundSchema=Pk.object({type:Pk.literal("content").default("content"),content:Pk.string().default("")});Wo.Prediction$outboundSchema=Pk.object({type:Pk.literal("content").default("content"),content:Pk.string().default("")});var y9t;(function(t){t.inboundSchema=Wo.Prediction$inboundSchema,t.outboundSchema=Wo.Prediction$outboundSchema})(y9t||(Wo.Prediction$=y9t={}));function $0n(t){return JSON.stringify(Wo.Prediction$outboundSchema.parse(t))}function B0n(t){return(0,k0n.safeParse)(t,e=>Wo.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var G4e=x($u=>{"use strict";var z0n=$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]}),U0n=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q0n=$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)&&z0n(e,t,r);return U0n(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.JsonSchema$=$u.JsonSchema$outboundSchema=$u.JsonSchema$inboundSchema=void 0;$u.jsonSchemaToJSON=V0n;$u.jsonSchemaFromJSON=W0n;var ch=q0n(Ie()),_9t=Ke(),H0n=Ce();$u.JsonSchema$inboundSchema=ch.object({name:ch.string(),description:ch.nullable(ch.string()).optional(),schema:ch.record(ch.any()),strict:ch.boolean().default(!1)}).transform(t=>(0,_9t.remap)(t,{schema:"schemaDefinition"}));$u.JsonSchema$outboundSchema=ch.object({name:ch.string(),description:ch.nullable(ch.string()).optional(),schemaDefinition:ch.record(ch.any()),strict:ch.boolean().default(!1)}).transform(t=>(0,_9t.remap)(t,{schemaDefinition:"schema"}));var b9t;(function(t){t.inboundSchema=$u.JsonSchema$inboundSchema,t.outboundSchema=$u.JsonSchema$outboundSchema})(b9t||($u.JsonSchema$=b9t={}));function V0n(t){return JSON.stringify($u.JsonSchema$outboundSchema.parse(t))}function W0n(t){return(0,H0n.safeParse)(t,e=>$u.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var J4e=x(Bu=>{"use strict";var K0n=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]}),G0n=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J0n=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)&&K0n(e,t,r);return G0n(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.ResponseFormats$=Bu.ResponseFormats$outboundSchema=Bu.ResponseFormats$inboundSchema=Bu.ResponseFormats=void 0;var Z0n=J0n(Ie());Bu.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Bu.ResponseFormats$inboundSchema=Z0n.nativeEnum(Bu.ResponseFormats);Bu.ResponseFormats$outboundSchema=Bu.ResponseFormats$inboundSchema;var v9t;(function(t){t.inboundSchema=Bu.ResponseFormats$inboundSchema,t.outboundSchema=Bu.ResponseFormats$outboundSchema})(v9t||(Bu.ResponseFormats$=v9t={}))});var W3=x(zu=>{"use strict";var Y0n=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]}),X0n=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q0n=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)&&Y0n(e,t,r);return X0n(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.ResponseFormat$=zu.ResponseFormat$outboundSchema=zu.ResponseFormat$inboundSchema=void 0;zu.responseFormatToJSON=txn;zu.responseFormatFromJSON=rxn;var hme=Q0n(Ie()),x9t=Ke(),exn=Ce(),S9t=G4e(),C9t=J4e();zu.ResponseFormat$inboundSchema=hme.object({type:C9t.ResponseFormats$inboundSchema.optional(),json_schema:hme.nullable(S9t.JsonSchema$inboundSchema).optional()}).transform(t=>(0,x9t.remap)(t,{json_schema:"jsonSchema"}));zu.ResponseFormat$outboundSchema=hme.object({type:C9t.ResponseFormats$outboundSchema.optional(),jsonSchema:hme.nullable(S9t.JsonSchema$outboundSchema).optional()}).transform(t=>(0,x9t.remap)(t,{jsonSchema:"json_schema"}));var w9t;(function(t){t.inboundSchema=zu.ResponseFormat$inboundSchema,t.outboundSchema=zu.ResponseFormat$outboundSchema})(w9t||(zu.ResponseFormat$=w9t={}));function txn(t){return JSON.stringify(zu.ResponseFormat$outboundSchema.parse(t))}function rxn(t){return(0,exn.safeParse)(t,e=>zu.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var Tk=x(Gr=>{"use strict";var nxn=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]}),oxn=Gr&&Gr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ixn=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)&&nxn(e,t,r);return oxn(e,t),e};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.SystemMessage$=Gr.SystemMessage$outboundSchema=Gr.SystemMessage$inboundSchema=Gr.Role$=Gr.Role$outboundSchema=Gr.Role$inboundSchema=Gr.SystemMessageContent$=Gr.SystemMessageContent$outboundSchema=Gr.SystemMessageContent$inboundSchema=Gr.Role=void 0;Gr.systemMessageContentToJSON=axn;Gr.systemMessageContentFromJSON=sxn;Gr.systemMessageToJSON=uxn;Gr.systemMessageFromJSON=lxn;var Jp=ixn(Ie()),T9t=Ce(),gme=fme();Gr.Role={System:"system"};Gr.SystemMessageContent$inboundSchema=Jp.union([Jp.string(),Jp.array(gme.TextChunk$inboundSchema)]);Gr.SystemMessageContent$outboundSchema=Jp.union([Jp.string(),Jp.array(gme.TextChunk$outboundSchema)]);var O9t;(function(t){t.inboundSchema=Gr.SystemMessageContent$inboundSchema,t.outboundSchema=Gr.SystemMessageContent$outboundSchema})(O9t||(Gr.SystemMessageContent$=O9t={}));function axn(t){return JSON.stringify(Gr.SystemMessageContent$outboundSchema.parse(t))}function sxn(t){return(0,T9t.safeParse)(t,e=>Gr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Gr.Role$inboundSchema=Jp.nativeEnum(Gr.Role);Gr.Role$outboundSchema=Gr.Role$inboundSchema;var E9t;(function(t){t.inboundSchema=Gr.Role$inboundSchema,t.outboundSchema=Gr.Role$outboundSchema})(E9t||(Gr.Role$=E9t={}));Gr.SystemMessage$inboundSchema=Jp.object({content:Jp.union([Jp.string(),Jp.array(gme.TextChunk$inboundSchema)]),role:Gr.Role$inboundSchema.default("system")});Gr.SystemMessage$outboundSchema=Jp.object({content:Jp.union([Jp.string(),Jp.array(gme.TextChunk$outboundSchema)]),role:Gr.Role$outboundSchema.default("system")});var P9t;(function(t){t.inboundSchema=Gr.SystemMessage$inboundSchema,t.outboundSchema=Gr.SystemMessage$outboundSchema})(P9t||(Gr.SystemMessage$=P9t={}));function uxn(t){return JSON.stringify(Gr.SystemMessage$outboundSchema.parse(t))}function lxn(t){return(0,T9t.safeParse)(t,e=>Gr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var Z4e=x(Uu=>{"use strict";var cxn=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]}),dxn=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fxn=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)&&cxn(e,t,r);return dxn(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.FunctionT$=Uu.FunctionT$outboundSchema=Uu.FunctionT$inboundSchema=void 0;Uu.functionToJSON=mxn;Uu.functionFromJSON=hxn;var Vy=fxn(Ie()),pxn=Ce();Uu.FunctionT$inboundSchema=Vy.object({name:Vy.string(),description:Vy.string().default(""),strict:Vy.boolean().default(!1),parameters:Vy.record(Vy.any())});Uu.FunctionT$outboundSchema=Vy.object({name:Vy.string(),description:Vy.string().default(""),strict:Vy.boolean().default(!1),parameters:Vy.record(Vy.any())});var A9t;(function(t){t.inboundSchema=Uu.FunctionT$inboundSchema,t.outboundSchema=Uu.FunctionT$outboundSchema})(A9t||(Uu.FunctionT$=A9t={}));function mxn(t){return JSON.stringify(Uu.FunctionT$outboundSchema.parse(t))}function hxn(t){return(0,pxn.safeParse)(t,e=>Uu.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var K3=x(qu=>{"use strict";var gxn=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]}),yxn=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bxn=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)&&gxn(e,t,r);return yxn(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.Tool$=qu.Tool$outboundSchema=qu.Tool$inboundSchema=void 0;qu.toolToJSON=vxn;qu.toolFromJSON=wxn;var M9t=bxn(Ie()),_xn=Ce(),R9t=Z4e(),N9t=MJ();qu.Tool$inboundSchema=M9t.object({type:N9t.ToolTypes$inboundSchema.optional(),function:R9t.FunctionT$inboundSchema});qu.Tool$outboundSchema=M9t.object({type:N9t.ToolTypes$outboundSchema.optional(),function:R9t.FunctionT$outboundSchema});var I9t;(function(t){t.inboundSchema=qu.Tool$inboundSchema,t.outboundSchema=qu.Tool$outboundSchema})(I9t||(qu.Tool$=I9t={}));function vxn(t){return JSON.stringify(qu.Tool$outboundSchema.parse(t))}function wxn(t){return(0,_xn.safeParse)(t,e=>qu.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var Y4e=x(Hu=>{"use strict";var xxn=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]}),Sxn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cxn=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)&&xxn(e,t,r);return Sxn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.FunctionName$=Hu.FunctionName$outboundSchema=Hu.FunctionName$inboundSchema=void 0;Hu.functionNameToJSON=Exn;Hu.functionNameFromJSON=Pxn;var yme=Cxn(Ie()),Oxn=Ce();Hu.FunctionName$inboundSchema=yme.object({name:yme.string()});Hu.FunctionName$outboundSchema=yme.object({name:yme.string()});var j9t;(function(t){t.inboundSchema=Hu.FunctionName$inboundSchema,t.outboundSchema=Hu.FunctionName$outboundSchema})(j9t||(Hu.FunctionName$=j9t={}));function Exn(t){return JSON.stringify(Hu.FunctionName$outboundSchema.parse(t))}function Pxn(t){return(0,Oxn.safeParse)(t,e=>Hu.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var G3=x(Vu=>{"use strict";var Txn=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]}),Axn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ixn=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)&&Txn(e,t,r);return Axn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.ToolChoice$=Vu.ToolChoice$outboundSchema=Vu.ToolChoice$inboundSchema=void 0;Vu.toolChoiceToJSON=Rxn;Vu.toolChoiceFromJSON=Nxn;var L9t=Ixn(Ie()),Mxn=Ce(),F9t=Y4e(),k9t=MJ();Vu.ToolChoice$inboundSchema=L9t.object({type:k9t.ToolTypes$inboundSchema.optional(),function:F9t.FunctionName$inboundSchema});Vu.ToolChoice$outboundSchema=L9t.object({type:k9t.ToolTypes$outboundSchema.optional(),function:F9t.FunctionName$outboundSchema});var D9t;(function(t){t.inboundSchema=Vu.ToolChoice$inboundSchema,t.outboundSchema=Vu.ToolChoice$outboundSchema})(D9t||(Vu.ToolChoice$=D9t={}));function Rxn(t){return JSON.stringify(Vu.ToolChoice$outboundSchema.parse(t))}function Nxn(t){return(0,Mxn.safeParse)(t,e=>Vu.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var J3=x(Wu=>{"use strict";var jxn=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]}),Dxn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lxn=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)&&jxn(e,t,r);return Dxn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.ToolChoiceEnum$=Wu.ToolChoiceEnum$outboundSchema=Wu.ToolChoiceEnum$inboundSchema=Wu.ToolChoiceEnum=void 0;var Fxn=Lxn(Ie());Wu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Wu.ToolChoiceEnum$inboundSchema=Fxn.nativeEnum(Wu.ToolChoiceEnum);Wu.ToolChoiceEnum$outboundSchema=Wu.ToolChoiceEnum$inboundSchema;var $9t;(function(t){t.inboundSchema=Wu.ToolChoiceEnum$inboundSchema,t.outboundSchema=Wu.ToolChoiceEnum$outboundSchema})($9t||(Wu.ToolChoiceEnum$=$9t={}))});var Ak=x(Jr=>{"use strict";var kxn=Jr&&Jr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$xn=Jr&&Jr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bxn=Jr&&Jr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kxn(e,t,r);return $xn(e,t),e};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.ToolMessage$=Jr.ToolMessage$outboundSchema=Jr.ToolMessage$inboundSchema=Jr.ToolMessageRole$=Jr.ToolMessageRole$outboundSchema=Jr.ToolMessageRole$inboundSchema=Jr.ToolMessageContent$=Jr.ToolMessageContent$outboundSchema=Jr.ToolMessageContent$inboundSchema=Jr.ToolMessageRole=void 0;Jr.toolMessageContentToJSON=zxn;Jr.toolMessageContentFromJSON=Uxn;Jr.toolMessageToJSON=qxn;Jr.toolMessageFromJSON=Hxn;var Ra=Bxn(Ie()),q9t=Ke(),H9t=Ce(),bme=q3();Jr.ToolMessageRole={Tool:"tool"};Jr.ToolMessageContent$inboundSchema=Ra.union([Ra.string(),Ra.array(bme.ContentChunk$inboundSchema)]);Jr.ToolMessageContent$outboundSchema=Ra.union([Ra.string(),Ra.array(bme.ContentChunk$outboundSchema)]);var B9t;(function(t){t.inboundSchema=Jr.ToolMessageContent$inboundSchema,t.outboundSchema=Jr.ToolMessageContent$outboundSchema})(B9t||(Jr.ToolMessageContent$=B9t={}));function zxn(t){return JSON.stringify(Jr.ToolMessageContent$outboundSchema.parse(t))}function Uxn(t){return(0,H9t.safeParse)(t,e=>Jr.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}Jr.ToolMessageRole$inboundSchema=Ra.nativeEnum(Jr.ToolMessageRole);Jr.ToolMessageRole$outboundSchema=Jr.ToolMessageRole$inboundSchema;var z9t;(function(t){t.inboundSchema=Jr.ToolMessageRole$inboundSchema,t.outboundSchema=Jr.ToolMessageRole$outboundSchema})(z9t||(Jr.ToolMessageRole$=z9t={}));Jr.ToolMessage$inboundSchema=Ra.object({content:Ra.nullable(Ra.union([Ra.string(),Ra.array(bme.ContentChunk$inboundSchema)])),tool_call_id:Ra.nullable(Ra.string()).optional(),name:Ra.nullable(Ra.string()).optional(),role:Jr.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,q9t.remap)(t,{tool_call_id:"toolCallId"}));Jr.ToolMessage$outboundSchema=Ra.object({content:Ra.nullable(Ra.union([Ra.string(),Ra.array(bme.ContentChunk$outboundSchema)])),toolCallId:Ra.nullable(Ra.string()).optional(),name:Ra.nullable(Ra.string()).optional(),role:Jr.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,q9t.remap)(t,{toolCallId:"tool_call_id"}));var U9t;(function(t){t.inboundSchema=Jr.ToolMessage$inboundSchema,t.outboundSchema=Jr.ToolMessage$outboundSchema})(U9t||(Jr.ToolMessage$=U9t={}));function qxn(t){return JSON.stringify(Jr.ToolMessage$outboundSchema.parse(t))}function Hxn(t){return(0,H9t.safeParse)(t,e=>Jr.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var Ik=x(Zr=>{"use strict";var Vxn=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wxn=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kxn=Zr&&Zr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vxn(e,t,r);return Wxn(e,t),e};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.UserMessage$=Zr.UserMessage$outboundSchema=Zr.UserMessage$inboundSchema=Zr.UserMessageRole$=Zr.UserMessageRole$outboundSchema=Zr.UserMessageRole$inboundSchema=Zr.UserMessageContent$=Zr.UserMessageContent$outboundSchema=Zr.UserMessageContent$inboundSchema=Zr.UserMessageRole=void 0;Zr.userMessageContentToJSON=Gxn;Zr.userMessageContentFromJSON=Jxn;Zr.userMessageToJSON=Zxn;Zr.userMessageFromJSON=Yxn;var Zd=Kxn(Ie()),G9t=Ce(),_me=q3();Zr.UserMessageRole={User:"user"};Zr.UserMessageContent$inboundSchema=Zd.union([Zd.string(),Zd.array(_me.ContentChunk$inboundSchema)]);Zr.UserMessageContent$outboundSchema=Zd.union([Zd.string(),Zd.array(_me.ContentChunk$outboundSchema)]);var V9t;(function(t){t.inboundSchema=Zr.UserMessageContent$inboundSchema,t.outboundSchema=Zr.UserMessageContent$outboundSchema})(V9t||(Zr.UserMessageContent$=V9t={}));function Gxn(t){return JSON.stringify(Zr.UserMessageContent$outboundSchema.parse(t))}function Jxn(t){return(0,G9t.safeParse)(t,e=>Zr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Zr.UserMessageRole$inboundSchema=Zd.nativeEnum(Zr.UserMessageRole);Zr.UserMessageRole$outboundSchema=Zr.UserMessageRole$inboundSchema;var W9t;(function(t){t.inboundSchema=Zr.UserMessageRole$inboundSchema,t.outboundSchema=Zr.UserMessageRole$outboundSchema})(W9t||(Zr.UserMessageRole$=W9t={}));Zr.UserMessage$inboundSchema=Zd.object({content:Zd.nullable(Zd.union([Zd.string(),Zd.array(_me.ContentChunk$inboundSchema)])),role:Zr.UserMessageRole$inboundSchema.default("user")});Zr.UserMessage$outboundSchema=Zd.object({content:Zd.nullable(Zd.union([Zd.string(),Zd.array(_me.ContentChunk$outboundSchema)])),role:Zr.UserMessageRole$outboundSchema.default("user")});var K9t;(function(t){t.inboundSchema=Zr.UserMessage$inboundSchema,t.outboundSchema=Zr.UserMessage$outboundSchema})(K9t||(Zr.UserMessage$=K9t={}));function Zxn(t){return JSON.stringify(Zr.UserMessage$outboundSchema.parse(t))}function Yxn(t){return(0,G9t.safeParse)(t,e=>Zr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var nKt=x(sr=>{"use strict";var Xxn=sr&&sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=sr&&sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eSn=sr&&sr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xxn(e,t,r);return Qxn(e,t),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.AgentsCompletionRequest$=sr.AgentsCompletionRequest$outboundSchema=sr.AgentsCompletionRequest$inboundSchema=sr.AgentsCompletionRequestToolChoice$=sr.AgentsCompletionRequestToolChoice$outboundSchema=sr.AgentsCompletionRequestToolChoice$inboundSchema=sr.AgentsCompletionRequestMessages$=sr.AgentsCompletionRequestMessages$outboundSchema=sr.AgentsCompletionRequestMessages$inboundSchema=sr.AgentsCompletionRequestStop$=sr.AgentsCompletionRequestStop$outboundSchema=sr.AgentsCompletionRequestStop$inboundSchema=void 0;sr.agentsCompletionRequestStopToJSON=tSn;sr.agentsCompletionRequestStopFromJSON=rSn;sr.agentsCompletionRequestMessagesToJSON=nSn;sr.agentsCompletionRequestMessagesFromJSON=oSn;sr.agentsCompletionRequestToolChoiceToJSON=iSn;sr.agentsCompletionRequestToolChoiceFromJSON=aSn;sr.agentsCompletionRequestToJSON=sSn;sr.agentsCompletionRequestFromJSON=uSn;var tt=eSn(Ie()),Q9t=Ke(),vme=Ce(),wme=i1(),eKt=V3(),tKt=W3(),xme=Tk(),rKt=K3(),Sme=G3(),Cme=J3(),Ome=Ak(),Eme=Ik();sr.AgentsCompletionRequestStop$inboundSchema=tt.union([tt.string(),tt.array(tt.string())]);sr.AgentsCompletionRequestStop$outboundSchema=tt.union([tt.string(),tt.array(tt.string())]);var J9t;(function(t){t.inboundSchema=sr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=sr.AgentsCompletionRequestStop$outboundSchema})(J9t||(sr.AgentsCompletionRequestStop$=J9t={}));function tSn(t){return JSON.stringify(sr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function rSn(t){return(0,vme.safeParse)(t,e=>sr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}sr.AgentsCompletionRequestMessages$inboundSchema=tt.union([xme.SystemMessage$inboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Eme.UserMessage$inboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),wme.AssistantMessage$inboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),Ome.ToolMessage$inboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))]);sr.AgentsCompletionRequestMessages$outboundSchema=tt.union([xme.SystemMessage$outboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Eme.UserMessage$outboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),wme.AssistantMessage$outboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),Ome.ToolMessage$outboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))]);var Z9t;(function(t){t.inboundSchema=sr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=sr.AgentsCompletionRequestMessages$outboundSchema})(Z9t||(sr.AgentsCompletionRequestMessages$=Z9t={}));function nSn(t){return JSON.stringify(sr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function oSn(t){return(0,vme.safeParse)(t,e=>sr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}sr.AgentsCompletionRequestToolChoice$inboundSchema=tt.union([Sme.ToolChoice$inboundSchema,Cme.ToolChoiceEnum$inboundSchema]);sr.AgentsCompletionRequestToolChoice$outboundSchema=tt.union([Sme.ToolChoice$outboundSchema,Cme.ToolChoiceEnum$outboundSchema]);var Y9t;(function(t){t.inboundSchema=sr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=sr.AgentsCompletionRequestToolChoice$outboundSchema})(Y9t||(sr.AgentsCompletionRequestToolChoice$=Y9t={}));function iSn(t){return JSON.stringify(sr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function aSn(t){return(0,vme.safeParse)(t,e=>sr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}sr.AgentsCompletionRequest$inboundSchema=tt.object({max_tokens:tt.nullable(tt.number().int()).optional(),stream:tt.boolean().default(!1),stop:tt.union([tt.string(),tt.array(tt.string())]).optional(),random_seed:tt.nullable(tt.number().int()).optional(),messages:tt.array(tt.union([xme.SystemMessage$inboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Eme.UserMessage$inboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),wme.AssistantMessage$inboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),Ome.ToolMessage$inboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:tKt.ResponseFormat$inboundSchema.optional(),tools:tt.nullable(tt.array(rKt.Tool$inboundSchema)).optional(),tool_choice:tt.union([Sme.ToolChoice$inboundSchema,Cme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:tt.number().optional(),frequency_penalty:tt.number().optional(),n:tt.nullable(tt.number().int()).optional(),prediction:eKt.Prediction$inboundSchema.optional(),agent_id:tt.string()}).transform(t=>(0,Q9t.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));sr.AgentsCompletionRequest$outboundSchema=tt.object({maxTokens:tt.nullable(tt.number().int()).optional(),stream:tt.boolean().default(!1),stop:tt.union([tt.string(),tt.array(tt.string())]).optional(),randomSeed:tt.nullable(tt.number().int()).optional(),messages:tt.array(tt.union([xme.SystemMessage$outboundSchema.and(tt.object({role:tt.literal("system")}).transform(t=>({role:t.role}))),Eme.UserMessage$outboundSchema.and(tt.object({role:tt.literal("user")}).transform(t=>({role:t.role}))),wme.AssistantMessage$outboundSchema.and(tt.object({role:tt.literal("assistant")}).transform(t=>({role:t.role}))),Ome.ToolMessage$outboundSchema.and(tt.object({role:tt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:tKt.ResponseFormat$outboundSchema.optional(),tools:tt.nullable(tt.array(rKt.Tool$outboundSchema)).optional(),toolChoice:tt.union([Sme.ToolChoice$outboundSchema,Cme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:tt.number().optional(),frequencyPenalty:tt.number().optional(),n:tt.nullable(tt.number().int()).optional(),prediction:eKt.Prediction$outboundSchema.optional(),agentId:tt.string()}).transform(t=>(0,Q9t.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var X9t;(function(t){t.inboundSchema=sr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=sr.AgentsCompletionRequest$outboundSchema})(X9t||(sr.AgentsCompletionRequest$=X9t={}));function sSn(t){return JSON.stringify(sr.AgentsCompletionRequest$outboundSchema.parse(t))}function uSn(t){return(0,vme.safeParse)(t,e=>sr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var fKt=x(ur=>{"use strict";var lSn=ur&&ur.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ur&&ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dSn=ur&&ur.__importStar||function(t){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(ur,"__esModule",{value:!0});ur.AgentsCompletionStreamRequest$=ur.AgentsCompletionStreamRequest$outboundSchema=ur.AgentsCompletionStreamRequest$inboundSchema=ur.AgentsCompletionStreamRequestToolChoice$=ur.AgentsCompletionStreamRequestToolChoice$outboundSchema=ur.AgentsCompletionStreamRequestToolChoice$inboundSchema=ur.AgentsCompletionStreamRequestMessages$=ur.AgentsCompletionStreamRequestMessages$outboundSchema=ur.AgentsCompletionStreamRequestMessages$inboundSchema=ur.AgentsCompletionStreamRequestStop$=ur.AgentsCompletionStreamRequestStop$outboundSchema=ur.AgentsCompletionStreamRequestStop$inboundSchema=void 0;ur.agentsCompletionStreamRequestStopToJSON=fSn;ur.agentsCompletionStreamRequestStopFromJSON=pSn;ur.agentsCompletionStreamRequestMessagesToJSON=mSn;ur.agentsCompletionStreamRequestMessagesFromJSON=hSn;ur.agentsCompletionStreamRequestToolChoiceToJSON=gSn;ur.agentsCompletionStreamRequestToolChoiceFromJSON=ySn;ur.agentsCompletionStreamRequestToJSON=bSn;ur.agentsCompletionStreamRequestFromJSON=_Sn;var rt=dSn(Ie()),uKt=Ke(),Pme=Ce(),Tme=i1(),lKt=V3(),cKt=W3(),Ame=Tk(),dKt=K3(),Ime=G3(),Mme=J3(),Rme=Ak(),Nme=Ik();ur.AgentsCompletionStreamRequestStop$inboundSchema=rt.union([rt.string(),rt.array(rt.string())]);ur.AgentsCompletionStreamRequestStop$outboundSchema=rt.union([rt.string(),rt.array(rt.string())]);var oKt;(function(t){t.inboundSchema=ur.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ur.AgentsCompletionStreamRequestStop$outboundSchema})(oKt||(ur.AgentsCompletionStreamRequestStop$=oKt={}));function fSn(t){return JSON.stringify(ur.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function pSn(t){return(0,Pme.safeParse)(t,e=>ur.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}ur.AgentsCompletionStreamRequestMessages$inboundSchema=rt.union([Ame.SystemMessage$inboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Nme.UserMessage$inboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Tme.AssistantMessage$inboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Rme.ToolMessage$inboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))]);ur.AgentsCompletionStreamRequestMessages$outboundSchema=rt.union([Ame.SystemMessage$outboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Nme.UserMessage$outboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Tme.AssistantMessage$outboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Rme.ToolMessage$outboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))]);var iKt;(function(t){t.inboundSchema=ur.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=ur.AgentsCompletionStreamRequestMessages$outboundSchema})(iKt||(ur.AgentsCompletionStreamRequestMessages$=iKt={}));function mSn(t){return JSON.stringify(ur.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function hSn(t){return(0,Pme.safeParse)(t,e=>ur.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}ur.AgentsCompletionStreamRequestToolChoice$inboundSchema=rt.union([Ime.ToolChoice$inboundSchema,Mme.ToolChoiceEnum$inboundSchema]);ur.AgentsCompletionStreamRequestToolChoice$outboundSchema=rt.union([Ime.ToolChoice$outboundSchema,Mme.ToolChoiceEnum$outboundSchema]);var aKt;(function(t){t.inboundSchema=ur.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=ur.AgentsCompletionStreamRequestToolChoice$outboundSchema})(aKt||(ur.AgentsCompletionStreamRequestToolChoice$=aKt={}));function gSn(t){return JSON.stringify(ur.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function ySn(t){return(0,Pme.safeParse)(t,e=>ur.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}ur.AgentsCompletionStreamRequest$inboundSchema=rt.object({max_tokens:rt.nullable(rt.number().int()).optional(),stream:rt.boolean().default(!0),stop:rt.union([rt.string(),rt.array(rt.string())]).optional(),random_seed:rt.nullable(rt.number().int()).optional(),messages:rt.array(rt.union([Ame.SystemMessage$inboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Nme.UserMessage$inboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Tme.AssistantMessage$inboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Rme.ToolMessage$inboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:cKt.ResponseFormat$inboundSchema.optional(),tools:rt.nullable(rt.array(dKt.Tool$inboundSchema)).optional(),tool_choice:rt.union([Ime.ToolChoice$inboundSchema,Mme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:rt.number().optional(),frequency_penalty:rt.number().optional(),n:rt.nullable(rt.number().int()).optional(),prediction:lKt.Prediction$inboundSchema.optional(),agent_id:rt.string()}).transform(t=>(0,uKt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));ur.AgentsCompletionStreamRequest$outboundSchema=rt.object({maxTokens:rt.nullable(rt.number().int()).optional(),stream:rt.boolean().default(!0),stop:rt.union([rt.string(),rt.array(rt.string())]).optional(),randomSeed:rt.nullable(rt.number().int()).optional(),messages:rt.array(rt.union([Ame.SystemMessage$outboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Nme.UserMessage$outboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Tme.AssistantMessage$outboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),Rme.ToolMessage$outboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:cKt.ResponseFormat$outboundSchema.optional(),tools:rt.nullable(rt.array(dKt.Tool$outboundSchema)).optional(),toolChoice:rt.union([Ime.ToolChoice$outboundSchema,Mme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:rt.number().optional(),frequencyPenalty:rt.number().optional(),n:rt.nullable(rt.number().int()).optional(),prediction:lKt.Prediction$outboundSchema.optional(),agentId:rt.string()}).transform(t=>(0,uKt.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=ur.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=ur.AgentsCompletionStreamRequest$outboundSchema})(sKt||(ur.AgentsCompletionStreamRequest$=sKt={}));function bSn(t){return JSON.stringify(ur.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function _Sn(t){return(0,Pme.safeParse)(t,e=>ur.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var X4e=x(Ku=>{"use strict";var vSn=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]}),wSn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xSn=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)&&vSn(e,t,r);return wSn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.ApiEndpoint$=Ku.ApiEndpoint$outboundSchema=Ku.ApiEndpoint$inboundSchema=Ku.ApiEndpoint=void 0;var Mk=xSn(Ie()),SSn=o1();Ku.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};Ku.ApiEndpoint$inboundSchema=Mk.union([Mk.nativeEnum(Ku.ApiEndpoint),Mk.string().transform(SSn.catchUnrecognizedEnum)]);Ku.ApiEndpoint$outboundSchema=Mk.union([Mk.nativeEnum(Ku.ApiEndpoint),Mk.string().and(Mk.custom())]);var pKt;(function(t){t.inboundSchema=Ku.ApiEndpoint$inboundSchema,t.outboundSchema=Ku.ApiEndpoint$outboundSchema})(pKt||(Ku.ApiEndpoint$=pKt={}))});var gKt=x(Ko=>{"use strict";var CSn=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]}),OSn=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ESn=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)&&CSn(e,t,r);return OSn(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=TSn;Ko.archiveFTModelOutFromJSON=ASn;var pT=ESn(Ie()),PSn=Ce();Ko.ArchiveFTModelOutObject={Model:"model"};Ko.ArchiveFTModelOutObject$inboundSchema=pT.nativeEnum(Ko.ArchiveFTModelOutObject);Ko.ArchiveFTModelOutObject$outboundSchema=Ko.ArchiveFTModelOutObject$inboundSchema;var mKt;(function(t){t.inboundSchema=Ko.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Ko.ArchiveFTModelOutObject$outboundSchema})(mKt||(Ko.ArchiveFTModelOutObject$=mKt={}));Ko.ArchiveFTModelOut$inboundSchema=pT.object({id:pT.string(),object:pT.literal("model").default("model"),archived:pT.boolean().default(!0)});Ko.ArchiveFTModelOut$outboundSchema=pT.object({id:pT.string(),object:pT.literal("model").default("model"),archived:pT.boolean().default(!0)});var hKt;(function(t){t.inboundSchema=Ko.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Ko.ArchiveFTModelOut$outboundSchema})(hKt||(Ko.ArchiveFTModelOut$=hKt={}));function TSn(t){return JSON.stringify(Ko.ArchiveFTModelOut$outboundSchema.parse(t))}function ASn(t){return(0,PSn.safeParse)(t,e=>Ko.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var jme=x(Gu=>{"use strict";var ISn=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]}),MSn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RSn=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)&&ISn(e,t,r);return MSn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.ModelCapabilities$=Gu.ModelCapabilities$outboundSchema=Gu.ModelCapabilities$inboundSchema=void 0;Gu.modelCapabilitiesToJSON=jSn;Gu.modelCapabilitiesFromJSON=DSn;var Wy=RSn(Ie()),bKt=Ke(),NSn=Ce();Gu.ModelCapabilities$inboundSchema=Wy.object({completion_chat:Wy.boolean().default(!0),completion_fim:Wy.boolean().default(!1),function_calling:Wy.boolean().default(!0),fine_tuning:Wy.boolean().default(!1),vision:Wy.boolean().default(!1)}).transform(t=>(0,bKt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Gu.ModelCapabilities$outboundSchema=Wy.object({completionChat:Wy.boolean().default(!0),completionFim:Wy.boolean().default(!1),functionCalling:Wy.boolean().default(!0),fineTuning:Wy.boolean().default(!1),vision:Wy.boolean().default(!1)}).transform(t=>(0,bKt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var yKt;(function(t){t.inboundSchema=Gu.ModelCapabilities$inboundSchema,t.outboundSchema=Gu.ModelCapabilities$outboundSchema})(yKt||(Gu.ModelCapabilities$=yKt={}));function jSn(t){return JSON.stringify(Gu.ModelCapabilities$outboundSchema.parse(t))}function DSn(t){return(0,NSn.safeParse)(t,e=>Gu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var Q4e=x(Go=>{"use strict";var LSn=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]}),FSn=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kSn=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)&&LSn(e,t,r);return FSn(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=BSn;Go.baseModelCardFromJSON=zSn;var _o=kSn(Ie()),wKt=Ke(),$Sn=Ce(),xKt=jme();Go.Type={Base:"base"};Go.Type$inboundSchema=_o.nativeEnum(Go.Type);Go.Type$outboundSchema=Go.Type$inboundSchema;var _Kt;(function(t){t.inboundSchema=Go.Type$inboundSchema,t.outboundSchema=Go.Type$outboundSchema})(_Kt||(Go.Type$=_Kt={}));Go.BaseModelCard$inboundSchema=_o.object({id:_o.string(),object:_o.string().default("model"),created:_o.number().int().optional(),owned_by:_o.string().default("mistralai"),capabilities:xKt.ModelCapabilities$inboundSchema,name:_o.nullable(_o.string()).optional(),description:_o.nullable(_o.string()).optional(),max_context_length:_o.number().int().default(32768),aliases:_o.array(_o.string()).optional(),deprecation:_o.nullable(_o.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:_o.nullable(_o.number()).optional(),type:_o.literal("base").default("base")}).transform(t=>(0,wKt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Go.BaseModelCard$outboundSchema=_o.object({id:_o.string(),object:_o.string().default("model"),created:_o.number().int().optional(),ownedBy:_o.string().default("mistralai"),capabilities:xKt.ModelCapabilities$outboundSchema,name:_o.nullable(_o.string()).optional(),description:_o.nullable(_o.string()).optional(),maxContextLength:_o.number().int().default(32768),aliases:_o.array(_o.string()).optional(),deprecation:_o.nullable(_o.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:_o.nullable(_o.number()).optional(),type:_o.literal("base").default("base")}).transform(t=>(0,wKt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var vKt;(function(t){t.inboundSchema=Go.BaseModelCard$inboundSchema,t.outboundSchema=Go.BaseModelCard$outboundSchema})(vKt||(Go.BaseModelCard$=vKt={}));function BSn(t){return JSON.stringify(Go.BaseModelCard$outboundSchema.parse(t))}function zSn(t){return(0,$Sn.safeParse)(t,e=>Go.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var e3e=x(Ju=>{"use strict";var USn=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]}),qSn=Ju&&Ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HSn=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)&&USn(e,t,r);return qSn(e,t),e};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.BatchError$=Ju.BatchError$outboundSchema=Ju.BatchError$inboundSchema=void 0;Ju.batchErrorToJSON=WSn;Ju.batchErrorFromJSON=KSn;var Z3=HSn(Ie()),VSn=Ce();Ju.BatchError$inboundSchema=Z3.object({message:Z3.string(),count:Z3.number().int().default(1)});Ju.BatchError$outboundSchema=Z3.object({message:Z3.string(),count:Z3.number().int().default(1)});var SKt;(function(t){t.inboundSchema=Ju.BatchError$inboundSchema,t.outboundSchema=Ju.BatchError$outboundSchema})(SKt||(Ju.BatchError$=SKt={}));function WSn(t){return JSON.stringify(Ju.BatchError$outboundSchema.parse(t))}function KSn(t){return(0,VSn.safeParse)(t,e=>Ju.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var PKt=x(Zu=>{"use strict";var GSn=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]}),JSn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZSn=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)&&GSn(e,t,r);return JSn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.BatchJobIn$=Zu.BatchJobIn$outboundSchema=Zu.BatchJobIn$inboundSchema=void 0;Zu.batchJobInToJSON=XSn;Zu.batchJobInFromJSON=QSn;var op=ZSn(Ie()),OKt=Ke(),YSn=Ce(),EKt=X4e();Zu.BatchJobIn$inboundSchema=op.object({input_files:op.array(op.string()),endpoint:EKt.ApiEndpoint$inboundSchema,model:op.string(),metadata:op.nullable(op.record(op.string())).optional(),timeout_hours:op.number().int().default(24)}).transform(t=>(0,OKt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));Zu.BatchJobIn$outboundSchema=op.object({inputFiles:op.array(op.string()),endpoint:EKt.ApiEndpoint$outboundSchema,model:op.string(),metadata:op.nullable(op.record(op.string())).optional(),timeoutHours:op.number().int().default(24)}).transform(t=>(0,OKt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var CKt;(function(t){t.inboundSchema=Zu.BatchJobIn$inboundSchema,t.outboundSchema=Zu.BatchJobIn$outboundSchema})(CKt||(Zu.BatchJobIn$=CKt={}));function XSn(t){return JSON.stringify(Zu.BatchJobIn$outboundSchema.parse(t))}function QSn(t){return(0,YSn.safeParse)(t,e=>Zu.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var t3e=x(Yu=>{"use strict";var eCn=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]}),tCn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rCn=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)&&eCn(e,t,r);return tCn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.BatchJobStatus$=Yu.BatchJobStatus$outboundSchema=Yu.BatchJobStatus$inboundSchema=Yu.BatchJobStatus=void 0;var nCn=rCn(Ie());Yu.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Yu.BatchJobStatus$inboundSchema=nCn.nativeEnum(Yu.BatchJobStatus);Yu.BatchJobStatus$outboundSchema=Yu.BatchJobStatus$inboundSchema;var TKt;(function(t){t.inboundSchema=Yu.BatchJobStatus$inboundSchema,t.outboundSchema=Yu.BatchJobStatus$outboundSchema})(TKt||(Yu.BatchJobStatus$=TKt={}))});var r3e=x(Jo=>{"use strict";var oCn=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]}),iCn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aCn=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)&&oCn(e,t,r);return iCn(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=uCn;Jo.batchJobOutFromJSON=lCn;var Rr=aCn(Ie()),MKt=Ke(),sCn=Ce(),RKt=e3e(),NKt=t3e();Jo.BatchJobOutObject={Batch:"batch"};Jo.BatchJobOutObject$inboundSchema=Rr.nativeEnum(Jo.BatchJobOutObject);Jo.BatchJobOutObject$outboundSchema=Jo.BatchJobOutObject$inboundSchema;var AKt;(function(t){t.inboundSchema=Jo.BatchJobOutObject$inboundSchema,t.outboundSchema=Jo.BatchJobOutObject$outboundSchema})(AKt||(Jo.BatchJobOutObject$=AKt={}));Jo.BatchJobOut$inboundSchema=Rr.object({id:Rr.string(),object:Rr.literal("batch").default("batch"),input_files:Rr.array(Rr.string()),metadata:Rr.nullable(Rr.record(Rr.any())).optional(),endpoint:Rr.string(),model:Rr.string(),output_file:Rr.nullable(Rr.string()).optional(),error_file:Rr.nullable(Rr.string()).optional(),errors:Rr.array(RKt.BatchError$inboundSchema),status:NKt.BatchJobStatus$inboundSchema,created_at:Rr.number().int(),total_requests:Rr.number().int(),completed_requests:Rr.number().int(),succeeded_requests:Rr.number().int(),failed_requests:Rr.number().int(),started_at:Rr.nullable(Rr.number().int()).optional(),completed_at:Rr.nullable(Rr.number().int()).optional()}).transform(t=>(0,MKt.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=Rr.object({id:Rr.string(),object:Rr.literal("batch").default("batch"),inputFiles:Rr.array(Rr.string()),metadata:Rr.nullable(Rr.record(Rr.any())).optional(),endpoint:Rr.string(),model:Rr.string(),outputFile:Rr.nullable(Rr.string()).optional(),errorFile:Rr.nullable(Rr.string()).optional(),errors:Rr.array(RKt.BatchError$outboundSchema),status:NKt.BatchJobStatus$outboundSchema,createdAt:Rr.number().int(),totalRequests:Rr.number().int(),completedRequests:Rr.number().int(),succeededRequests:Rr.number().int(),failedRequests:Rr.number().int(),startedAt:Rr.nullable(Rr.number().int()).optional(),completedAt:Rr.nullable(Rr.number().int()).optional()}).transform(t=>(0,MKt.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 IKt;(function(t){t.inboundSchema=Jo.BatchJobOut$inboundSchema,t.outboundSchema=Jo.BatchJobOut$outboundSchema})(IKt||(Jo.BatchJobOut$=IKt={}));function uCn(t){return JSON.stringify(Jo.BatchJobOut$outboundSchema.parse(t))}function lCn(t){return(0,sCn.safeParse)(t,e=>Jo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var FKt=x(Zo=>{"use strict";var cCn=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]}),dCn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fCn=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)&&cCn(e,t,r);return dCn(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=mCn;Zo.batchJobsOutFromJSON=hCn;var mT=fCn(Ie()),pCn=Ce(),LKt=r3e();Zo.BatchJobsOutObject={List:"list"};Zo.BatchJobsOutObject$inboundSchema=mT.nativeEnum(Zo.BatchJobsOutObject);Zo.BatchJobsOutObject$outboundSchema=Zo.BatchJobsOutObject$inboundSchema;var jKt;(function(t){t.inboundSchema=Zo.BatchJobsOutObject$inboundSchema,t.outboundSchema=Zo.BatchJobsOutObject$outboundSchema})(jKt||(Zo.BatchJobsOutObject$=jKt={}));Zo.BatchJobsOut$inboundSchema=mT.object({data:mT.array(LKt.BatchJobOut$inboundSchema).optional(),object:mT.literal("list").default("list"),total:mT.number().int()});Zo.BatchJobsOut$outboundSchema=mT.object({data:mT.array(LKt.BatchJobOut$outboundSchema).optional(),object:mT.literal("list").default("list"),total:mT.number().int()});var DKt;(function(t){t.inboundSchema=Zo.BatchJobsOut$inboundSchema,t.outboundSchema=Zo.BatchJobsOut$outboundSchema})(DKt||(Zo.BatchJobsOut$=DKt={}));function mCn(t){return JSON.stringify(Zo.BatchJobsOut$outboundSchema.parse(t))}function hCn(t){return(0,pCn.safeParse)(t,e=>Zo.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var qKt=x(lr=>{"use strict";var gCn=lr&&lr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yCn=lr&&lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bCn=lr&&lr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gCn(e,t,r);return yCn(e,t),e};Object.defineProperty(lr,"__esModule",{value:!0});lr.ChatClassificationRequest$=lr.ChatClassificationRequest$outboundSchema=lr.ChatClassificationRequest$inboundSchema=lr.ChatClassificationRequestInputs$=lr.ChatClassificationRequestInputs$outboundSchema=lr.ChatClassificationRequestInputs$inboundSchema=lr.One$=lr.One$outboundSchema=lr.One$inboundSchema=lr.Two$=lr.Two$outboundSchema=lr.Two$inboundSchema=void 0;lr.twoToJSON=_Cn;lr.twoFromJSON=vCn;lr.oneToJSON=wCn;lr.oneFromJSON=xCn;lr.chatClassificationRequestInputsToJSON=SCn;lr.chatClassificationRequestInputsFromJSON=CCn;lr.chatClassificationRequestToJSON=OCn;lr.chatClassificationRequestFromJSON=ECn;var xe=bCn(Ie()),UKt=Ke(),Dme=Ce(),Ky=i1(),Gy=Tk(),Jy=Ak(),Zy=Ik();lr.Two$inboundSchema=xe.union([Gy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);lr.Two$outboundSchema=xe.union([Gy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);var kKt;(function(t){t.inboundSchema=lr.Two$inboundSchema,t.outboundSchema=lr.Two$outboundSchema})(kKt||(lr.Two$=kKt={}));function _Cn(t){return JSON.stringify(lr.Two$outboundSchema.parse(t))}function vCn(t){return(0,Dme.safeParse)(t,e=>lr.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}lr.One$inboundSchema=xe.union([Gy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);lr.One$outboundSchema=xe.union([Gy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))]);var $Kt;(function(t){t.inboundSchema=lr.One$inboundSchema,t.outboundSchema=lr.One$outboundSchema})($Kt||(lr.One$=$Kt={}));function wCn(t){return JSON.stringify(lr.One$outboundSchema.parse(t))}function xCn(t){return(0,Dme.safeParse)(t,e=>lr.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}lr.ChatClassificationRequestInputs$inboundSchema=xe.union([xe.array(xe.union([Gy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([Gy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]);lr.ChatClassificationRequestInputs$outboundSchema=xe.union([xe.array(xe.union([Gy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([Gy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]);var BKt;(function(t){t.inboundSchema=lr.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=lr.ChatClassificationRequestInputs$outboundSchema})(BKt||(lr.ChatClassificationRequestInputs$=BKt={}));function SCn(t){return JSON.stringify(lr.ChatClassificationRequestInputs$outboundSchema.parse(t))}function CCn(t){return(0,Dme.safeParse)(t,e=>lr.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}lr.ChatClassificationRequest$inboundSchema=xe.object({input:xe.union([xe.array(xe.union([Gy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([Gy.SystemMessage$inboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$inboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$inboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$inboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]),model:xe.nullable(xe.string())}).transform(t=>(0,UKt.remap)(t,{input:"inputs"}));lr.ChatClassificationRequest$outboundSchema=xe.object({inputs:xe.union([xe.array(xe.union([Gy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])),xe.array(xe.array(xe.union([Gy.SystemMessage$outboundSchema.and(xe.object({role:xe.literal("system")}).transform(t=>({role:t.role}))),Zy.UserMessage$outboundSchema.and(xe.object({role:xe.literal("user")}).transform(t=>({role:t.role}))),Ky.AssistantMessage$outboundSchema.and(xe.object({role:xe.literal("assistant")}).transform(t=>({role:t.role}))),Jy.ToolMessage$outboundSchema.and(xe.object({role:xe.literal("tool")}).transform(t=>({role:t.role})))])))]),model:xe.nullable(xe.string())}).transform(t=>(0,UKt.remap)(t,{inputs:"input"}));var zKt;(function(t){t.inboundSchema=lr.ChatClassificationRequest$inboundSchema,t.outboundSchema=lr.ChatClassificationRequest$outboundSchema})(zKt||(lr.ChatClassificationRequest$=zKt={}));function OCn(t){return JSON.stringify(lr.ChatClassificationRequest$outboundSchema.parse(t))}function ECn(t){return(0,Dme.safeParse)(t,e=>lr.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Lme=x(Io=>{"use strict";var PCn=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]}),TCn=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ACn=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)&&PCn(e,t,r);return TCn(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.ChatCompletionChoice$=Io.ChatCompletionChoice$outboundSchema=Io.ChatCompletionChoice$inboundSchema=Io.FinishReason$=Io.FinishReason$outboundSchema=Io.FinishReason$inboundSchema=Io.FinishReason=void 0;Io.chatCompletionChoiceToJSON=RCn;Io.chatCompletionChoiceFromJSON=NCn;var D_=ACn(Ie()),WKt=Ke(),ICn=Ce(),MCn=o1(),KKt=i1();Io.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};Io.FinishReason$inboundSchema=D_.union([D_.nativeEnum(Io.FinishReason),D_.string().transform(MCn.catchUnrecognizedEnum)]);Io.FinishReason$outboundSchema=D_.union([D_.nativeEnum(Io.FinishReason),D_.string().and(D_.custom())]);var HKt;(function(t){t.inboundSchema=Io.FinishReason$inboundSchema,t.outboundSchema=Io.FinishReason$outboundSchema})(HKt||(Io.FinishReason$=HKt={}));Io.ChatCompletionChoice$inboundSchema=D_.object({index:D_.number().int(),message:KKt.AssistantMessage$inboundSchema,finish_reason:Io.FinishReason$inboundSchema}).transform(t=>(0,WKt.remap)(t,{finish_reason:"finishReason"}));Io.ChatCompletionChoice$outboundSchema=D_.object({index:D_.number().int(),message:KKt.AssistantMessage$outboundSchema,finishReason:Io.FinishReason$outboundSchema}).transform(t=>(0,WKt.remap)(t,{finishReason:"finish_reason"}));var VKt;(function(t){t.inboundSchema=Io.ChatCompletionChoice$inboundSchema,t.outboundSchema=Io.ChatCompletionChoice$outboundSchema})(VKt||(Io.ChatCompletionChoice$=VKt={}));function RCn(t){return JSON.stringify(Io.ChatCompletionChoice$outboundSchema.parse(t))}function NCn(t){return(0,ICn.safeParse)(t,e=>Io.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var rGt=x(cr=>{"use strict";var jCn=cr&&cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DCn=cr&&cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LCn=cr&&cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jCn(e,t,r);return DCn(e,t),e};Object.defineProperty(cr,"__esModule",{value:!0});cr.ChatCompletionRequest$=cr.ChatCompletionRequest$outboundSchema=cr.ChatCompletionRequest$inboundSchema=cr.ChatCompletionRequestToolChoice$=cr.ChatCompletionRequestToolChoice$outboundSchema=cr.ChatCompletionRequestToolChoice$inboundSchema=cr.Messages$=cr.Messages$outboundSchema=cr.Messages$inboundSchema=cr.Stop$=cr.Stop$outboundSchema=cr.Stop$inboundSchema=void 0;cr.stopToJSON=FCn;cr.stopFromJSON=kCn;cr.messagesToJSON=$Cn;cr.messagesFromJSON=BCn;cr.chatCompletionRequestToolChoiceToJSON=zCn;cr.chatCompletionRequestToolChoiceFromJSON=UCn;cr.chatCompletionRequestToJSON=qCn;cr.chatCompletionRequestFromJSON=HCn;var He=LCn(Ie()),XKt=Ke(),Fme=Ce(),kme=i1(),QKt=V3(),eGt=W3(),$me=Tk(),tGt=K3(),Bme=G3(),zme=J3(),Ume=Ak(),qme=Ik();cr.Stop$inboundSchema=He.union([He.string(),He.array(He.string())]);cr.Stop$outboundSchema=He.union([He.string(),He.array(He.string())]);var GKt;(function(t){t.inboundSchema=cr.Stop$inboundSchema,t.outboundSchema=cr.Stop$outboundSchema})(GKt||(cr.Stop$=GKt={}));function FCn(t){return JSON.stringify(cr.Stop$outboundSchema.parse(t))}function kCn(t){return(0,Fme.safeParse)(t,e=>cr.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}cr.Messages$inboundSchema=He.union([$me.SystemMessage$inboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),qme.UserMessage$inboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),kme.AssistantMessage$inboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Ume.ToolMessage$inboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))]);cr.Messages$outboundSchema=He.union([$me.SystemMessage$outboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),qme.UserMessage$outboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),kme.AssistantMessage$outboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Ume.ToolMessage$outboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))]);var JKt;(function(t){t.inboundSchema=cr.Messages$inboundSchema,t.outboundSchema=cr.Messages$outboundSchema})(JKt||(cr.Messages$=JKt={}));function $Cn(t){return JSON.stringify(cr.Messages$outboundSchema.parse(t))}function BCn(t){return(0,Fme.safeParse)(t,e=>cr.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}cr.ChatCompletionRequestToolChoice$inboundSchema=He.union([Bme.ToolChoice$inboundSchema,zme.ToolChoiceEnum$inboundSchema]);cr.ChatCompletionRequestToolChoice$outboundSchema=He.union([Bme.ToolChoice$outboundSchema,zme.ToolChoiceEnum$outboundSchema]);var ZKt;(function(t){t.inboundSchema=cr.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=cr.ChatCompletionRequestToolChoice$outboundSchema})(ZKt||(cr.ChatCompletionRequestToolChoice$=ZKt={}));function zCn(t){return JSON.stringify(cr.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function UCn(t){return(0,Fme.safeParse)(t,e=>cr.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}cr.ChatCompletionRequest$inboundSchema=He.object({model:He.nullable(He.string()),temperature:He.nullable(He.number()).optional(),top_p:He.number().optional(),max_tokens:He.nullable(He.number().int()).optional(),stream:He.boolean().default(!1),stop:He.union([He.string(),He.array(He.string())]).optional(),random_seed:He.nullable(He.number().int()).optional(),messages:He.array(He.union([$me.SystemMessage$inboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),qme.UserMessage$inboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),kme.AssistantMessage$inboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Ume.ToolMessage$inboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))])),response_format:eGt.ResponseFormat$inboundSchema.optional(),tools:He.nullable(He.array(tGt.Tool$inboundSchema)).optional(),tool_choice:He.union([Bme.ToolChoice$inboundSchema,zme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:He.number().optional(),frequency_penalty:He.number().optional(),n:He.nullable(He.number().int()).optional(),prediction:QKt.Prediction$inboundSchema.optional(),safe_prompt:He.boolean().optional()}).transform(t=>(0,XKt.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"}));cr.ChatCompletionRequest$outboundSchema=He.object({model:He.nullable(He.string()),temperature:He.nullable(He.number()).optional(),topP:He.number().optional(),maxTokens:He.nullable(He.number().int()).optional(),stream:He.boolean().default(!1),stop:He.union([He.string(),He.array(He.string())]).optional(),randomSeed:He.nullable(He.number().int()).optional(),messages:He.array(He.union([$me.SystemMessage$outboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),qme.UserMessage$outboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),kme.AssistantMessage$outboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),Ume.ToolMessage$outboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:eGt.ResponseFormat$outboundSchema.optional(),tools:He.nullable(He.array(tGt.Tool$outboundSchema)).optional(),toolChoice:He.union([Bme.ToolChoice$outboundSchema,zme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:He.number().optional(),frequencyPenalty:He.number().optional(),n:He.nullable(He.number().int()).optional(),prediction:QKt.Prediction$outboundSchema.optional(),safePrompt:He.boolean().optional()}).transform(t=>(0,XKt.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 YKt;(function(t){t.inboundSchema=cr.ChatCompletionRequest$inboundSchema,t.outboundSchema=cr.ChatCompletionRequest$outboundSchema})(YKt||(cr.ChatCompletionRequest$=YKt={}));function qCn(t){return JSON.stringify(cr.ChatCompletionRequest$outboundSchema.parse(t))}function HCn(t){return(0,Fme.safeParse)(t,e=>cr.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var Y3=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}),KCn=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.UsageInfo$=Xu.UsageInfo$outboundSchema=Xu.UsageInfo$inboundSchema=void 0;Xu.usageInfoToJSON=JCn;Xu.usageInfoFromJSON=ZCn;var a1=KCn(Ie()),oGt=Ke(),GCn=Ce();Xu.UsageInfo$inboundSchema=a1.object({prompt_tokens:a1.number().int(),completion_tokens:a1.number().int(),total_tokens:a1.number().int()}).transform(t=>(0,oGt.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));Xu.UsageInfo$outboundSchema=a1.object({promptTokens:a1.number().int(),completionTokens:a1.number().int(),totalTokens:a1.number().int()}).transform(t=>(0,oGt.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var nGt;(function(t){t.inboundSchema=Xu.UsageInfo$inboundSchema,t.outboundSchema=Xu.UsageInfo$outboundSchema})(nGt||(Xu.UsageInfo$=nGt={}));function JCn(t){return JSON.stringify(Xu.UsageInfo$outboundSchema.parse(t))}function ZCn(t){return(0,GCn.safeParse)(t,e=>Xu.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var uGt=x(Qu=>{"use strict";var YCn=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]}),XCn=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QCn=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)&&YCn(e,t,r);return XCn(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.ChatCompletionResponse$=Qu.ChatCompletionResponse$outboundSchema=Qu.ChatCompletionResponse$inboundSchema=void 0;Qu.chatCompletionResponseToJSON=tOn;Qu.chatCompletionResponseFromJSON=rOn;var Yy=QCn(Ie()),eOn=Ce(),aGt=Lme(),sGt=Y3();Qu.ChatCompletionResponse$inboundSchema=Yy.object({id:Yy.string(),object:Yy.string(),model:Yy.string(),usage:sGt.UsageInfo$inboundSchema,created:Yy.number().int().optional(),choices:Yy.array(aGt.ChatCompletionChoice$inboundSchema).optional()});Qu.ChatCompletionResponse$outboundSchema=Yy.object({id:Yy.string(),object:Yy.string(),model:Yy.string(),usage:sGt.UsageInfo$outboundSchema,created:Yy.number().int().optional(),choices:Yy.array(aGt.ChatCompletionChoice$outboundSchema).optional()});var iGt;(function(t){t.inboundSchema=Qu.ChatCompletionResponse$inboundSchema,t.outboundSchema=Qu.ChatCompletionResponse$outboundSchema})(iGt||(Qu.ChatCompletionResponse$=iGt={}));function tOn(t){return JSON.stringify(Qu.ChatCompletionResponse$outboundSchema.parse(t))}function rOn(t){return(0,eOn.safeParse)(t,e=>Qu.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var yGt=x(dr=>{"use strict";var nOn=dr&&dr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oOn=dr&&dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iOn=dr&&dr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nOn(e,t,r);return oOn(e,t),e};Object.defineProperty(dr,"__esModule",{value:!0});dr.ChatCompletionStreamRequest$=dr.ChatCompletionStreamRequest$outboundSchema=dr.ChatCompletionStreamRequest$inboundSchema=dr.ChatCompletionStreamRequestToolChoice$=dr.ChatCompletionStreamRequestToolChoice$outboundSchema=dr.ChatCompletionStreamRequestToolChoice$inboundSchema=dr.ChatCompletionStreamRequestMessages$=dr.ChatCompletionStreamRequestMessages$outboundSchema=dr.ChatCompletionStreamRequestMessages$inboundSchema=dr.ChatCompletionStreamRequestStop$=dr.ChatCompletionStreamRequestStop$outboundSchema=dr.ChatCompletionStreamRequestStop$inboundSchema=void 0;dr.chatCompletionStreamRequestStopToJSON=aOn;dr.chatCompletionStreamRequestStopFromJSON=sOn;dr.chatCompletionStreamRequestMessagesToJSON=uOn;dr.chatCompletionStreamRequestMessagesFromJSON=lOn;dr.chatCompletionStreamRequestToolChoiceToJSON=cOn;dr.chatCompletionStreamRequestToolChoiceFromJSON=dOn;dr.chatCompletionStreamRequestToJSON=fOn;dr.chatCompletionStreamRequestFromJSON=pOn;var Ve=iOn(Ie()),pGt=Ke(),Hme=Ce(),Vme=i1(),mGt=V3(),hGt=W3(),Wme=Tk(),gGt=K3(),Kme=G3(),Gme=J3(),Jme=Ak(),Zme=Ik();dr.ChatCompletionStreamRequestStop$inboundSchema=Ve.union([Ve.string(),Ve.array(Ve.string())]);dr.ChatCompletionStreamRequestStop$outboundSchema=Ve.union([Ve.string(),Ve.array(Ve.string())]);var lGt;(function(t){t.inboundSchema=dr.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=dr.ChatCompletionStreamRequestStop$outboundSchema})(lGt||(dr.ChatCompletionStreamRequestStop$=lGt={}));function aOn(t){return JSON.stringify(dr.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function sOn(t){return(0,Hme.safeParse)(t,e=>dr.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}dr.ChatCompletionStreamRequestMessages$inboundSchema=Ve.union([Wme.SystemMessage$inboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Zme.UserMessage$inboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),Vme.AssistantMessage$inboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Jme.ToolMessage$inboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))]);dr.ChatCompletionStreamRequestMessages$outboundSchema=Ve.union([Wme.SystemMessage$outboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Zme.UserMessage$outboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),Vme.AssistantMessage$outboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Jme.ToolMessage$outboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))]);var cGt;(function(t){t.inboundSchema=dr.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=dr.ChatCompletionStreamRequestMessages$outboundSchema})(cGt||(dr.ChatCompletionStreamRequestMessages$=cGt={}));function uOn(t){return JSON.stringify(dr.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function lOn(t){return(0,Hme.safeParse)(t,e=>dr.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}dr.ChatCompletionStreamRequestToolChoice$inboundSchema=Ve.union([Kme.ToolChoice$inboundSchema,Gme.ToolChoiceEnum$inboundSchema]);dr.ChatCompletionStreamRequestToolChoice$outboundSchema=Ve.union([Kme.ToolChoice$outboundSchema,Gme.ToolChoiceEnum$outboundSchema]);var dGt;(function(t){t.inboundSchema=dr.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=dr.ChatCompletionStreamRequestToolChoice$outboundSchema})(dGt||(dr.ChatCompletionStreamRequestToolChoice$=dGt={}));function cOn(t){return JSON.stringify(dr.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function dOn(t){return(0,Hme.safeParse)(t,e=>dr.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}dr.ChatCompletionStreamRequest$inboundSchema=Ve.object({model:Ve.nullable(Ve.string()),temperature:Ve.nullable(Ve.number()).optional(),top_p:Ve.number().optional(),max_tokens:Ve.nullable(Ve.number().int()).optional(),stream:Ve.boolean().default(!0),stop:Ve.union([Ve.string(),Ve.array(Ve.string())]).optional(),random_seed:Ve.nullable(Ve.number().int()).optional(),messages:Ve.array(Ve.union([Wme.SystemMessage$inboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Zme.UserMessage$inboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),Vme.AssistantMessage$inboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Jme.ToolMessage$inboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))])),response_format:hGt.ResponseFormat$inboundSchema.optional(),tools:Ve.nullable(Ve.array(gGt.Tool$inboundSchema)).optional(),tool_choice:Ve.union([Kme.ToolChoice$inboundSchema,Gme.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ve.number().optional(),frequency_penalty:Ve.number().optional(),n:Ve.nullable(Ve.number().int()).optional(),prediction:mGt.Prediction$inboundSchema.optional(),safe_prompt:Ve.boolean().optional()}).transform(t=>(0,pGt.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"}));dr.ChatCompletionStreamRequest$outboundSchema=Ve.object({model:Ve.nullable(Ve.string()),temperature:Ve.nullable(Ve.number()).optional(),topP:Ve.number().optional(),maxTokens:Ve.nullable(Ve.number().int()).optional(),stream:Ve.boolean().default(!0),stop:Ve.union([Ve.string(),Ve.array(Ve.string())]).optional(),randomSeed:Ve.nullable(Ve.number().int()).optional(),messages:Ve.array(Ve.union([Wme.SystemMessage$outboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),Zme.UserMessage$outboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),Vme.AssistantMessage$outboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),Jme.ToolMessage$outboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:hGt.ResponseFormat$outboundSchema.optional(),tools:Ve.nullable(Ve.array(gGt.Tool$outboundSchema)).optional(),toolChoice:Ve.union([Kme.ToolChoice$outboundSchema,Gme.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ve.number().optional(),frequencyPenalty:Ve.number().optional(),n:Ve.nullable(Ve.number().int()).optional(),prediction:mGt.Prediction$outboundSchema.optional(),safePrompt:Ve.boolean().optional()}).transform(t=>(0,pGt.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 fGt;(function(t){t.inboundSchema=dr.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=dr.ChatCompletionStreamRequest$outboundSchema})(fGt||(dr.ChatCompletionStreamRequest$=fGt={}));function fOn(t){return JSON.stringify(dr.ChatCompletionStreamRequest$outboundSchema.parse(t))}function pOn(t){return(0,Hme.safeParse)(t,e=>dr.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var n3e=x(el=>{"use strict";var mOn=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]}),hOn=el&&el.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gOn=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)&&mOn(e,t,r);return hOn(e,t),e};Object.defineProperty(el,"__esModule",{value:!0});el.MetricOut$=el.MetricOut$outboundSchema=el.MetricOut$inboundSchema=void 0;el.metricOutToJSON=bOn;el.metricOutFromJSON=_On;var dh=gOn(Ie()),_Gt=Ke(),yOn=Ce();el.MetricOut$inboundSchema=dh.object({train_loss:dh.nullable(dh.number()).optional(),valid_loss:dh.nullable(dh.number()).optional(),valid_mean_token_accuracy:dh.nullable(dh.number()).optional()}).transform(t=>(0,_Gt.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));el.MetricOut$outboundSchema=dh.object({trainLoss:dh.nullable(dh.number()).optional(),validLoss:dh.nullable(dh.number()).optional(),validMeanTokenAccuracy:dh.nullable(dh.number()).optional()}).transform(t=>(0,_Gt.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var bGt;(function(t){t.inboundSchema=el.MetricOut$inboundSchema,t.outboundSchema=el.MetricOut$outboundSchema})(bGt||(el.MetricOut$=bGt={}));function bOn(t){return JSON.stringify(el.MetricOut$outboundSchema.parse(t))}function _On(t){return(0,yOn.safeParse)(t,e=>el.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var o3e=x(tl=>{"use strict";var vOn=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]}),wOn=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xOn=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)&&vOn(e,t,r);return wOn(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.CheckpointOut$=tl.CheckpointOut$outboundSchema=tl.CheckpointOut$inboundSchema=void 0;tl.checkpointOutToJSON=COn;tl.checkpointOutFromJSON=OOn;var X3=xOn(Ie()),wGt=Ke(),SOn=Ce(),xGt=n3e();tl.CheckpointOut$inboundSchema=X3.object({metrics:xGt.MetricOut$inboundSchema,step_number:X3.number().int(),created_at:X3.number().int()}).transform(t=>(0,wGt.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));tl.CheckpointOut$outboundSchema=X3.object({metrics:xGt.MetricOut$outboundSchema,stepNumber:X3.number().int(),createdAt:X3.number().int()}).transform(t=>(0,wGt.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var vGt;(function(t){t.inboundSchema=tl.CheckpointOut$inboundSchema,t.outboundSchema=tl.CheckpointOut$outboundSchema})(vGt||(tl.CheckpointOut$=vGt={}));function COn(t){return JSON.stringify(tl.CheckpointOut$outboundSchema.parse(t))}function OOn(t){return(0,SOn.safeParse)(t,e=>tl.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var i3e=x(rl=>{"use strict";var EOn=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]}),POn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TOn=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)&&EOn(e,t,r);return POn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.ClassificationObject$=rl.ClassificationObject$outboundSchema=rl.ClassificationObject$inboundSchema=void 0;rl.classificationObjectToJSON=IOn;rl.classificationObjectFromJSON=MOn;var TO=TOn(Ie()),CGt=Ke(),AOn=Ce();rl.ClassificationObject$inboundSchema=TO.object({categories:TO.record(TO.boolean()).optional(),category_scores:TO.record(TO.number()).optional()}).transform(t=>(0,CGt.remap)(t,{category_scores:"categoryScores"}));rl.ClassificationObject$outboundSchema=TO.object({categories:TO.record(TO.boolean()).optional(),categoryScores:TO.record(TO.number()).optional()}).transform(t=>(0,CGt.remap)(t,{categoryScores:"category_scores"}));var SGt;(function(t){t.inboundSchema=rl.ClassificationObject$inboundSchema,t.outboundSchema=rl.ClassificationObject$outboundSchema})(SGt||(rl.ClassificationObject$=SGt={}));function IOn(t){return JSON.stringify(rl.ClassificationObject$outboundSchema.parse(t))}function MOn(t){return(0,AOn.safeParse)(t,e=>rl.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var AGt=x(Yo=>{"use strict";var ROn=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]}),NOn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jOn=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)&&ROn(e,t,r);return NOn(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=DOn;Yo.classificationRequestInputsFromJSON=LOn;Yo.classificationRequestToJSON=FOn;Yo.classificationRequestFromJSON=kOn;var qs=jOn(Ie()),PGt=Ke(),TGt=Ce();Yo.ClassificationRequestInputs$inboundSchema=qs.union([qs.string(),qs.array(qs.string())]);Yo.ClassificationRequestInputs$outboundSchema=qs.union([qs.string(),qs.array(qs.string())]);var OGt;(function(t){t.inboundSchema=Yo.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Yo.ClassificationRequestInputs$outboundSchema})(OGt||(Yo.ClassificationRequestInputs$=OGt={}));function DOn(t){return JSON.stringify(Yo.ClassificationRequestInputs$outboundSchema.parse(t))}function LOn(t){return(0,TGt.safeParse)(t,e=>Yo.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Yo.ClassificationRequest$inboundSchema=qs.object({input:qs.union([qs.string(),qs.array(qs.string())]),model:qs.nullable(qs.string()).optional()}).transform(t=>(0,PGt.remap)(t,{input:"inputs"}));Yo.ClassificationRequest$outboundSchema=qs.object({inputs:qs.union([qs.string(),qs.array(qs.string())]),model:qs.nullable(qs.string()).optional()}).transform(t=>(0,PGt.remap)(t,{inputs:"input"}));var EGt;(function(t){t.inboundSchema=Yo.ClassificationRequest$inboundSchema,t.outboundSchema=Yo.ClassificationRequest$outboundSchema})(EGt||(Yo.ClassificationRequest$=EGt={}));function FOn(t){return JSON.stringify(Yo.ClassificationRequest$outboundSchema.parse(t))}function kOn(t){return(0,TGt.safeParse)(t,e=>Yo.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var RGt=x(nl=>{"use strict";var $On=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]}),BOn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zOn=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)&&$On(e,t,r);return BOn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.ClassificationResponse$=nl.ClassificationResponse$outboundSchema=nl.ClassificationResponse$inboundSchema=void 0;nl.classificationResponseToJSON=qOn;nl.classificationResponseFromJSON=HOn;var s1=zOn(Ie()),UOn=Ce(),MGt=i3e();nl.ClassificationResponse$inboundSchema=s1.object({id:s1.string().optional(),model:s1.string().optional(),results:s1.array(MGt.ClassificationObject$inboundSchema).optional()});nl.ClassificationResponse$outboundSchema=s1.object({id:s1.string().optional(),model:s1.string().optional(),results:s1.array(MGt.ClassificationObject$outboundSchema).optional()});var IGt;(function(t){t.inboundSchema=nl.ClassificationResponse$inboundSchema,t.outboundSchema=nl.ClassificationResponse$outboundSchema})(IGt||(nl.ClassificationResponse$=IGt={}));function qOn(t){return JSON.stringify(nl.ClassificationResponse$outboundSchema.parse(t))}function HOn(t){return(0,UOn.safeParse)(t,e=>nl.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var a3e=x(Xo=>{"use strict";var VOn=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]}),WOn=Xo&&Xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KOn=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)&&VOn(e,t,r);return WOn(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=GOn;Xo.contentFromJSON=JOn;Xo.deltaMessageToJSON=ZOn;Xo.deltaMessageFromJSON=YOn;var Ja=KOn(Ie()),DGt=Ke(),LGt=Ce(),Yme=q3(),FGt=pme();Xo.Content$inboundSchema=Ja.union([Ja.string(),Ja.array(Yme.ContentChunk$inboundSchema)]);Xo.Content$outboundSchema=Ja.union([Ja.string(),Ja.array(Yme.ContentChunk$outboundSchema)]);var NGt;(function(t){t.inboundSchema=Xo.Content$inboundSchema,t.outboundSchema=Xo.Content$outboundSchema})(NGt||(Xo.Content$=NGt={}));function GOn(t){return JSON.stringify(Xo.Content$outboundSchema.parse(t))}function JOn(t){return(0,LGt.safeParse)(t,e=>Xo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Xo.DeltaMessage$inboundSchema=Ja.object({role:Ja.nullable(Ja.string()).optional(),content:Ja.nullable(Ja.union([Ja.string(),Ja.array(Yme.ContentChunk$inboundSchema)])).optional(),tool_calls:Ja.nullable(Ja.array(FGt.ToolCall$inboundSchema)).optional()}).transform(t=>(0,DGt.remap)(t,{tool_calls:"toolCalls"}));Xo.DeltaMessage$outboundSchema=Ja.object({role:Ja.nullable(Ja.string()).optional(),content:Ja.nullable(Ja.union([Ja.string(),Ja.array(Yme.ContentChunk$outboundSchema)])).optional(),toolCalls:Ja.nullable(Ja.array(FGt.ToolCall$outboundSchema)).optional()}).transform(t=>(0,DGt.remap)(t,{toolCalls:"tool_calls"}));var jGt;(function(t){t.inboundSchema=Xo.DeltaMessage$inboundSchema,t.outboundSchema=Xo.DeltaMessage$outboundSchema})(jGt||(Xo.DeltaMessage$=jGt={}));function ZOn(t){return JSON.stringify(Xo.DeltaMessage$outboundSchema.parse(t))}function YOn(t){return(0,LGt.safeParse)(t,e=>Xo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var s3e=x(Mo=>{"use strict";var XOn=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]}),QOn=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eEn=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)&&XOn(e,t,r);return QOn(e,t),e};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.CompletionResponseStreamChoice$=Mo.CompletionResponseStreamChoice$outboundSchema=Mo.CompletionResponseStreamChoice$inboundSchema=Mo.CompletionResponseStreamChoiceFinishReason$=Mo.CompletionResponseStreamChoiceFinishReason$outboundSchema=Mo.CompletionResponseStreamChoiceFinishReason$inboundSchema=Mo.CompletionResponseStreamChoiceFinishReason=void 0;Mo.completionResponseStreamChoiceToJSON=nEn;Mo.completionResponseStreamChoiceFromJSON=oEn;var vg=eEn(Ie()),BGt=Ke(),tEn=Ce(),rEn=o1(),zGt=a3e();Mo.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};Mo.CompletionResponseStreamChoiceFinishReason$inboundSchema=vg.union([vg.nativeEnum(Mo.CompletionResponseStreamChoiceFinishReason),vg.string().transform(rEn.catchUnrecognizedEnum)]);Mo.CompletionResponseStreamChoiceFinishReason$outboundSchema=vg.union([vg.nativeEnum(Mo.CompletionResponseStreamChoiceFinishReason),vg.string().and(vg.custom())]);var kGt;(function(t){t.inboundSchema=Mo.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=Mo.CompletionResponseStreamChoiceFinishReason$outboundSchema})(kGt||(Mo.CompletionResponseStreamChoiceFinishReason$=kGt={}));Mo.CompletionResponseStreamChoice$inboundSchema=vg.object({index:vg.number().int(),delta:zGt.DeltaMessage$inboundSchema,finish_reason:vg.nullable(Mo.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,BGt.remap)(t,{finish_reason:"finishReason"}));Mo.CompletionResponseStreamChoice$outboundSchema=vg.object({index:vg.number().int(),delta:zGt.DeltaMessage$outboundSchema,finishReason:vg.nullable(Mo.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,BGt.remap)(t,{finishReason:"finish_reason"}));var $Gt;(function(t){t.inboundSchema=Mo.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=Mo.CompletionResponseStreamChoice$outboundSchema})($Gt||(Mo.CompletionResponseStreamChoice$=$Gt={}));function nEn(t){return JSON.stringify(Mo.CompletionResponseStreamChoice$outboundSchema.parse(t))}function oEn(t){return(0,tEn.safeParse)(t,e=>Mo.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var u3e=x(ol=>{"use strict";var iEn=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]}),aEn=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sEn=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)&&iEn(e,t,r);return aEn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.CompletionChunk$=ol.CompletionChunk$outboundSchema=ol.CompletionChunk$inboundSchema=void 0;ol.completionChunkToJSON=lEn;ol.completionChunkFromJSON=cEn;var Xy=sEn(Ie()),uEn=Ce(),qGt=s3e(),HGt=Y3();ol.CompletionChunk$inboundSchema=Xy.object({id:Xy.string(),object:Xy.string().optional(),created:Xy.number().int().optional(),model:Xy.string(),usage:HGt.UsageInfo$inboundSchema.optional(),choices:Xy.array(qGt.CompletionResponseStreamChoice$inboundSchema)});ol.CompletionChunk$outboundSchema=Xy.object({id:Xy.string(),object:Xy.string().optional(),created:Xy.number().int().optional(),model:Xy.string(),usage:HGt.UsageInfo$outboundSchema.optional(),choices:Xy.array(qGt.CompletionResponseStreamChoice$outboundSchema)});var UGt;(function(t){t.inboundSchema=ol.CompletionChunk$inboundSchema,t.outboundSchema=ol.CompletionChunk$outboundSchema})(UGt||(ol.CompletionChunk$=UGt={}));function lEn(t){return JSON.stringify(ol.CompletionChunk$outboundSchema.parse(t))}function cEn(t){return(0,uEn.safeParse)(t,e=>ol.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var KGt=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.CompletionEvent$=il.CompletionEvent$outboundSchema=il.CompletionEvent$inboundSchema=void 0;il.completionEventToJSON=hEn;il.completionEventFromJSON=gEn;var RJ=pEn(Ie()),mEn=Ce(),WGt=u3e();il.CompletionEvent$inboundSchema=RJ.object({data:RJ.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:RJ.ZodIssueCode.custom,message:`malformed json: ${r}`}),RJ.NEVER}}).pipe(WGt.CompletionChunk$inboundSchema)});il.CompletionEvent$outboundSchema=RJ.object({data:WGt.CompletionChunk$outboundSchema});var VGt;(function(t){t.inboundSchema=il.CompletionEvent$inboundSchema,t.outboundSchema=il.CompletionEvent$outboundSchema})(VGt||(il.CompletionEvent$=VGt={}));function hEn(t){return JSON.stringify(il.CompletionEvent$outboundSchema.parse(t))}function gEn(t){return(0,mEn.safeParse)(t,e=>il.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var JGt=x(al=>{"use strict";var yEn=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]}),bEn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_En=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)&&yEn(e,t,r);return bEn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.DeleteFileOut$=al.DeleteFileOut$outboundSchema=al.DeleteFileOut$inboundSchema=void 0;al.deleteFileOutToJSON=wEn;al.deleteFileOutFromJSON=xEn;var u1=_En(Ie()),vEn=Ce();al.DeleteFileOut$inboundSchema=u1.object({id:u1.string(),object:u1.string(),deleted:u1.boolean()});al.DeleteFileOut$outboundSchema=u1.object({id:u1.string(),object:u1.string(),deleted:u1.boolean()});var GGt;(function(t){t.inboundSchema=al.DeleteFileOut$inboundSchema,t.outboundSchema=al.DeleteFileOut$outboundSchema})(GGt||(al.DeleteFileOut$=GGt={}));function wEn(t){return JSON.stringify(al.DeleteFileOut$outboundSchema.parse(t))}function xEn(t){return(0,vEn.safeParse)(t,e=>al.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var YGt=x(sl=>{"use strict";var SEn=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]}),CEn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OEn=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)&&SEn(e,t,r);return CEn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.DeleteModelOut$=sl.DeleteModelOut$outboundSchema=sl.DeleteModelOut$inboundSchema=void 0;sl.deleteModelOutToJSON=PEn;sl.deleteModelOutFromJSON=TEn;var l1=OEn(Ie()),EEn=Ce();sl.DeleteModelOut$inboundSchema=l1.object({id:l1.string(),object:l1.string().default("model"),deleted:l1.boolean().default(!0)});sl.DeleteModelOut$outboundSchema=l1.object({id:l1.string(),object:l1.string().default("model"),deleted:l1.boolean().default(!0)});var ZGt;(function(t){t.inboundSchema=sl.DeleteModelOut$inboundSchema,t.outboundSchema=sl.DeleteModelOut$outboundSchema})(ZGt||(sl.DeleteModelOut$=ZGt={}));function PEn(t){return JSON.stringify(sl.DeleteModelOut$outboundSchema.parse(t))}function TEn(t){return(0,EEn.safeParse)(t,e=>sl.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var l3e=x(ul=>{"use strict";var AEn=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]}),IEn=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MEn=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)&&AEn(e,t,r);return IEn(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.EventOut$=ul.EventOut$outboundSchema=ul.EventOut$inboundSchema=void 0;ul.eventOutToJSON=NEn;ul.eventOutFromJSON=jEn;var Qy=MEn(Ie()),QGt=Ke(),REn=Ce();ul.EventOut$inboundSchema=Qy.object({name:Qy.string(),data:Qy.nullable(Qy.record(Qy.any())).optional(),created_at:Qy.number().int()}).transform(t=>(0,QGt.remap)(t,{created_at:"createdAt"}));ul.EventOut$outboundSchema=Qy.object({name:Qy.string(),data:Qy.nullable(Qy.record(Qy.any())).optional(),createdAt:Qy.number().int()}).transform(t=>(0,QGt.remap)(t,{createdAt:"created_at"}));var XGt;(function(t){t.inboundSchema=ul.EventOut$inboundSchema,t.outboundSchema=ul.EventOut$outboundSchema})(XGt||(ul.EventOut$=XGt={}));function NEn(t){return JSON.stringify(ul.EventOut$outboundSchema.parse(t))}function jEn(t){return(0,REn.safeParse)(t,e=>ul.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var Xme=x(Qo=>{"use strict";var DEn=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]}),LEn=Qo&&Qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FEn=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)&&DEn(e,t,r);return LEn(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=$En;Qo.githubRepositoryOutFromJSON=BEn;var Yd=FEn(Ie()),rJt=Ke(),kEn=Ce();Qo.GithubRepositoryOutType={Github:"github"};Qo.GithubRepositoryOutType$inboundSchema=Yd.nativeEnum(Qo.GithubRepositoryOutType);Qo.GithubRepositoryOutType$outboundSchema=Qo.GithubRepositoryOutType$inboundSchema;var eJt;(function(t){t.inboundSchema=Qo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Qo.GithubRepositoryOutType$outboundSchema})(eJt||(Qo.GithubRepositoryOutType$=eJt={}));Qo.GithubRepositoryOut$inboundSchema=Yd.object({type:Yd.literal("github").default("github"),name:Yd.string(),owner:Yd.string(),ref:Yd.nullable(Yd.string()).optional(),weight:Yd.number().default(1),commit_id:Yd.string()}).transform(t=>(0,rJt.remap)(t,{commit_id:"commitId"}));Qo.GithubRepositoryOut$outboundSchema=Yd.object({type:Yd.literal("github").default("github"),name:Yd.string(),owner:Yd.string(),ref:Yd.nullable(Yd.string()).optional(),weight:Yd.number().default(1),commitId:Yd.string()}).transform(t=>(0,rJt.remap)(t,{commitId:"commit_id"}));var tJt;(function(t){t.inboundSchema=Qo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Qo.GithubRepositoryOut$outboundSchema})(tJt||(Qo.GithubRepositoryOut$=tJt={}));function $En(t){return JSON.stringify(Qo.GithubRepositoryOut$outboundSchema.parse(t))}function BEn(t){return(0,kEn.safeParse)(t,e=>Qo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var Qme=x(ll=>{"use strict";var zEn=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]}),UEn=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qEn=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)&&zEn(e,t,r);return UEn(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.JobMetadataOut$=ll.JobMetadataOut$outboundSchema=ll.JobMetadataOut$inboundSchema=void 0;ll.jobMetadataOutToJSON=VEn;ll.jobMetadataOutFromJSON=WEn;var Ni=qEn(Ie()),oJt=Ke(),HEn=Ce();ll.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,oJt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));ll.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,oJt.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 nJt;(function(t){t.inboundSchema=ll.JobMetadataOut$inboundSchema,t.outboundSchema=ll.JobMetadataOut$outboundSchema})(nJt||(ll.JobMetadataOut$=nJt={}));function VEn(t){return JSON.stringify(ll.JobMetadataOut$outboundSchema.parse(t))}function WEn(t){return(0,HEn.safeParse)(t,e=>ll.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var ehe=x(cl=>{"use strict";var KEn=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]}),GEn=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JEn=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)&&KEn(e,t,r);return GEn(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.TrainingParameters$=cl.TrainingParameters$outboundSchema=cl.TrainingParameters$inboundSchema=void 0;cl.trainingParametersToJSON=YEn;cl.trainingParametersFromJSON=XEn;var Yi=JEn(Ie()),aJt=Ke(),ZEn=Ce();cl.TrainingParameters$inboundSchema=Yi.object({training_steps:Yi.nullable(Yi.number().int()).optional(),learning_rate:Yi.number().default(1e-4),weight_decay:Yi.nullable(Yi.number()).optional(),warmup_fraction:Yi.nullable(Yi.number()).optional(),epochs:Yi.nullable(Yi.number()).optional(),fim_ratio:Yi.nullable(Yi.number()).optional(),seq_len:Yi.nullable(Yi.number().int()).optional()}).transform(t=>(0,aJt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));cl.TrainingParameters$outboundSchema=Yi.object({trainingSteps:Yi.nullable(Yi.number().int()).optional(),learningRate:Yi.number().default(1e-4),weightDecay:Yi.nullable(Yi.number()).optional(),warmupFraction:Yi.nullable(Yi.number()).optional(),epochs:Yi.nullable(Yi.number()).optional(),fimRatio:Yi.nullable(Yi.number()).optional(),seqLen:Yi.nullable(Yi.number().int()).optional()}).transform(t=>(0,aJt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var iJt;(function(t){t.inboundSchema=cl.TrainingParameters$inboundSchema,t.outboundSchema=cl.TrainingParameters$outboundSchema})(iJt||(cl.TrainingParameters$=iJt={}));function YEn(t){return JSON.stringify(cl.TrainingParameters$outboundSchema.parse(t))}function XEn(t){return(0,ZEn.safeParse)(t,e=>cl.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var the=x(ei=>{"use strict";var QEn=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}),tPn=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)&&QEn(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=nPn;ei.wandbIntegrationOutFromJSON=oPn;var Zp=tPn(Ie()),lJt=Ke(),rPn=Ce();ei.WandbIntegrationOutType={Wandb:"wandb"};ei.WandbIntegrationOutType$inboundSchema=Zp.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=Zp.object({type:Zp.literal("wandb").default("wandb"),project:Zp.string(),name:Zp.nullable(Zp.string()).optional(),run_name:Zp.nullable(Zp.string()).optional()}).transform(t=>(0,lJt.remap)(t,{run_name:"runName"}));ei.WandbIntegrationOut$outboundSchema=Zp.object({type:Zp.literal("wandb").default("wandb"),project:Zp.string(),name:Zp.nullable(Zp.string()).optional(),runName:Zp.nullable(Zp.string()).optional()}).transform(t=>(0,lJt.remap)(t,{runName:"run_name"}));var uJt;(function(t){t.inboundSchema=ei.WandbIntegrationOut$inboundSchema,t.outboundSchema=ei.WandbIntegrationOut$outboundSchema})(uJt||(ei.WandbIntegrationOut$=uJt={}));function nPn(t){return JSON.stringify(ei.WandbIntegrationOut$outboundSchema.parse(t))}function oPn(t){return(0,rPn.safeParse)(t,e=>ei.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var vJt=x(wt=>{"use strict";var iPn=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]}),aPn=wt&&wt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sPn=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)&&iPn(e,t,r);return aPn(e,t),e};Object.defineProperty(wt,"__esModule",{value:!0});wt.DetailedJobOut$=wt.DetailedJobOut$outboundSchema=wt.DetailedJobOut$inboundSchema=wt.DetailedJobOutRepositories$=wt.DetailedJobOutRepositories$outboundSchema=wt.DetailedJobOutRepositories$inboundSchema=wt.DetailedJobOutIntegrations$=wt.DetailedJobOutIntegrations$outboundSchema=wt.DetailedJobOutIntegrations$inboundSchema=wt.DetailedJobOutObject$=wt.DetailedJobOutObject$outboundSchema=wt.DetailedJobOutObject$inboundSchema=wt.DetailedJobOutStatus$=wt.DetailedJobOutStatus$outboundSchema=wt.DetailedJobOutStatus$inboundSchema=wt.DetailedJobOutObject=wt.DetailedJobOutStatus=void 0;wt.detailedJobOutIntegrationsToJSON=uPn;wt.detailedJobOutIntegrationsFromJSON=lPn;wt.detailedJobOutRepositoriesToJSON=cPn;wt.detailedJobOutRepositoriesFromJSON=dPn;wt.detailedJobOutToJSON=fPn;wt.detailedJobOutFromJSON=pPn;var _r=sPn(Ie()),hJt=Ke(),c3e=Ce(),gJt=o3e(),yJt=l3e(),rhe=Xme(),bJt=Qme(),_Jt=ehe(),nhe=the();wt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};wt.DetailedJobOutObject={Job:"job"};wt.DetailedJobOutStatus$inboundSchema=_r.nativeEnum(wt.DetailedJobOutStatus);wt.DetailedJobOutStatus$outboundSchema=wt.DetailedJobOutStatus$inboundSchema;var cJt;(function(t){t.inboundSchema=wt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=wt.DetailedJobOutStatus$outboundSchema})(cJt||(wt.DetailedJobOutStatus$=cJt={}));wt.DetailedJobOutObject$inboundSchema=_r.nativeEnum(wt.DetailedJobOutObject);wt.DetailedJobOutObject$outboundSchema=wt.DetailedJobOutObject$inboundSchema;var dJt;(function(t){t.inboundSchema=wt.DetailedJobOutObject$inboundSchema,t.outboundSchema=wt.DetailedJobOutObject$outboundSchema})(dJt||(wt.DetailedJobOutObject$=dJt={}));wt.DetailedJobOutIntegrations$inboundSchema=nhe.WandbIntegrationOut$inboundSchema;wt.DetailedJobOutIntegrations$outboundSchema=nhe.WandbIntegrationOut$outboundSchema;var fJt;(function(t){t.inboundSchema=wt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=wt.DetailedJobOutIntegrations$outboundSchema})(fJt||(wt.DetailedJobOutIntegrations$=fJt={}));function uPn(t){return JSON.stringify(wt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function lPn(t){return(0,c3e.safeParse)(t,e=>wt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}wt.DetailedJobOutRepositories$inboundSchema=rhe.GithubRepositoryOut$inboundSchema;wt.DetailedJobOutRepositories$outboundSchema=rhe.GithubRepositoryOut$outboundSchema;var pJt;(function(t){t.inboundSchema=wt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=wt.DetailedJobOutRepositories$outboundSchema})(pJt||(wt.DetailedJobOutRepositories$=pJt={}));function cPn(t){return JSON.stringify(wt.DetailedJobOutRepositories$outboundSchema.parse(t))}function dPn(t){return(0,c3e.safeParse)(t,e=>wt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}wt.DetailedJobOut$inboundSchema=_r.object({id:_r.string(),auto_start:_r.boolean(),hyperparameters:_Jt.TrainingParameters$inboundSchema,model:_r.string(),status:wt.DetailedJobOutStatus$inboundSchema,job_type:_r.string(),created_at:_r.number().int(),modified_at:_r.number().int(),training_files:_r.array(_r.string()),validation_files:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fine_tuned_model:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(nhe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(rhe.GithubRepositoryOut$inboundSchema).optional(),metadata:_r.nullable(bJt.JobMetadataOut$inboundSchema).optional(),events:_r.array(yJt.EventOut$inboundSchema).optional(),checkpoints:_r.array(gJt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,hJt.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.DetailedJobOut$outboundSchema=_r.object({id:_r.string(),autoStart:_r.boolean(),hyperparameters:_Jt.TrainingParameters$outboundSchema,model:_r.string(),status:wt.DetailedJobOutStatus$outboundSchema,jobType:_r.string(),createdAt:_r.number().int(),modifiedAt:_r.number().int(),trainingFiles:_r.array(_r.string()),validationFiles:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fineTunedModel:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(nhe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(rhe.GithubRepositoryOut$outboundSchema).optional(),metadata:_r.nullable(bJt.JobMetadataOut$outboundSchema).optional(),events:_r.array(yJt.EventOut$outboundSchema).optional(),checkpoints:_r.array(gJt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,hJt.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 mJt;(function(t){t.inboundSchema=wt.DetailedJobOut$inboundSchema,t.outboundSchema=wt.DetailedJobOut$outboundSchema})(mJt||(wt.DetailedJobOut$=mJt={}));function fPn(t){return JSON.stringify(wt.DetailedJobOut$outboundSchema.parse(t))}function pPn(t){return(0,c3e.safeParse)(t,e=>wt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var OJt=x(ti=>{"use strict";var mPn=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]}),hPn=ti&&ti.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gPn=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)&&mPn(e,t,r);return hPn(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=yPn;ti.inputsFromJSON=bPn;ti.embeddingRequestToJSON=_Pn;ti.embeddingRequestFromJSON=vPn;var Za=gPn(Ie()),SJt=Ke(),CJt=Ce();ti.Inputs$inboundSchema=Za.union([Za.string(),Za.array(Za.string())]);ti.Inputs$outboundSchema=Za.union([Za.string(),Za.array(Za.string())]);var wJt;(function(t){t.inboundSchema=ti.Inputs$inboundSchema,t.outboundSchema=ti.Inputs$outboundSchema})(wJt||(ti.Inputs$=wJt={}));function yPn(t){return JSON.stringify(ti.Inputs$outboundSchema.parse(t))}function bPn(t){return(0,CJt.safeParse)(t,e=>ti.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}ti.EmbeddingRequest$inboundSchema=Za.object({input:Za.union([Za.string(),Za.array(Za.string())]),model:Za.string().default("mistral-embed"),encoding_format:Za.nullable(Za.string()).optional()}).transform(t=>(0,SJt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));ti.EmbeddingRequest$outboundSchema=Za.object({inputs:Za.union([Za.string(),Za.array(Za.string())]),model:Za.string().default("mistral-embed"),encodingFormat:Za.nullable(Za.string()).optional()}).transform(t=>(0,SJt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var xJt;(function(t){t.inboundSchema=ti.EmbeddingRequest$inboundSchema,t.outboundSchema=ti.EmbeddingRequest$outboundSchema})(xJt||(ti.EmbeddingRequest$=xJt={}));function _Pn(t){return JSON.stringify(ti.EmbeddingRequest$outboundSchema.parse(t))}function vPn(t){return(0,CJt.safeParse)(t,e=>ti.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var d3e=x(dl=>{"use strict";var wPn=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]}),xPn=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SPn=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)&&wPn(e,t,r);return xPn(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.EmbeddingResponseData$=dl.EmbeddingResponseData$outboundSchema=dl.EmbeddingResponseData$inboundSchema=void 0;dl.embeddingResponseDataToJSON=OPn;dl.embeddingResponseDataFromJSON=EPn;var AO=SPn(Ie()),CPn=Ce();dl.EmbeddingResponseData$inboundSchema=AO.object({object:AO.string().optional(),embedding:AO.array(AO.number()).optional(),index:AO.number().int().optional()});dl.EmbeddingResponseData$outboundSchema=AO.object({object:AO.string().optional(),embedding:AO.array(AO.number()).optional(),index:AO.number().int().optional()});var EJt;(function(t){t.inboundSchema=dl.EmbeddingResponseData$inboundSchema,t.outboundSchema=dl.EmbeddingResponseData$outboundSchema})(EJt||(dl.EmbeddingResponseData$=EJt={}));function OPn(t){return JSON.stringify(dl.EmbeddingResponseData$outboundSchema.parse(t))}function EPn(t){return(0,CPn.safeParse)(t,e=>dl.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var IJt=x(fl=>{"use strict";var PPn=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]}),TPn=fl&&fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),APn=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)&&PPn(e,t,r);return TPn(e,t),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.EmbeddingResponse$=fl.EmbeddingResponse$outboundSchema=fl.EmbeddingResponse$inboundSchema=void 0;fl.embeddingResponseToJSON=MPn;fl.embeddingResponseFromJSON=RPn;var IO=APn(Ie()),IPn=Ce(),TJt=d3e(),AJt=Y3();fl.EmbeddingResponse$inboundSchema=IO.object({id:IO.string(),object:IO.string(),model:IO.string(),usage:AJt.UsageInfo$inboundSchema,data:IO.array(TJt.EmbeddingResponseData$inboundSchema)});fl.EmbeddingResponse$outboundSchema=IO.object({id:IO.string(),object:IO.string(),model:IO.string(),usage:AJt.UsageInfo$outboundSchema,data:IO.array(TJt.EmbeddingResponseData$outboundSchema)});var PJt;(function(t){t.inboundSchema=fl.EmbeddingResponse$inboundSchema,t.outboundSchema=fl.EmbeddingResponse$outboundSchema})(PJt||(fl.EmbeddingResponse$=PJt={}));function MPn(t){return JSON.stringify(fl.EmbeddingResponse$outboundSchema.parse(t))}function RPn(t){return(0,IPn.safeParse)(t,e=>fl.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var NJ=x(pl=>{"use strict";var NPn=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]}),jPn=pl&&pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DPn=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)&&NPn(e,t,r);return jPn(e,t),e};Object.defineProperty(pl,"__esModule",{value:!0});pl.FilePurpose$=pl.FilePurpose$outboundSchema=pl.FilePurpose$inboundSchema=pl.FilePurpose=void 0;var Rk=DPn(Ie()),LPn=o1();pl.FilePurpose={FineTune:"fine-tune",Batch:"batch"};pl.FilePurpose$inboundSchema=Rk.union([Rk.nativeEnum(pl.FilePurpose),Rk.string().transform(LPn.catchUnrecognizedEnum)]);pl.FilePurpose$outboundSchema=Rk.union([Rk.nativeEnum(pl.FilePurpose),Rk.string().and(Rk.custom())]);var MJt;(function(t){t.inboundSchema=pl.FilePurpose$inboundSchema,t.outboundSchema=pl.FilePurpose$outboundSchema})(MJt||(pl.FilePurpose$=MJt={}))});var jJ=x(ml=>{"use strict";var FPn=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]}),kPn=ml&&ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Pn=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)&&FPn(e,t,r);return kPn(e,t),e};Object.defineProperty(ml,"__esModule",{value:!0});ml.SampleType$=ml.SampleType$outboundSchema=ml.SampleType$inboundSchema=ml.SampleType=void 0;var Nk=$Pn(Ie()),BPn=o1();ml.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};ml.SampleType$inboundSchema=Nk.union([Nk.nativeEnum(ml.SampleType),Nk.string().transform(BPn.catchUnrecognizedEnum)]);ml.SampleType$outboundSchema=Nk.union([Nk.nativeEnum(ml.SampleType),Nk.string().and(Nk.custom())]);var RJt;(function(t){t.inboundSchema=ml.SampleType$inboundSchema,t.outboundSchema=ml.SampleType$outboundSchema})(RJt||(ml.SampleType$=RJt={}))});var DJ=x(hl=>{"use strict";var zPn=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]}),UPn=hl&&hl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qPn=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)&&zPn(e,t,r);return UPn(e,t),e};Object.defineProperty(hl,"__esModule",{value:!0});hl.Source$=hl.Source$outboundSchema=hl.Source$inboundSchema=hl.Source=void 0;var jk=qPn(Ie()),HPn=o1();hl.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};hl.Source$inboundSchema=jk.union([jk.nativeEnum(hl.Source),jk.string().transform(HPn.catchUnrecognizedEnum)]);hl.Source$outboundSchema=jk.union([jk.nativeEnum(hl.Source),jk.string().and(jk.custom())]);var NJt;(function(t){t.inboundSchema=hl.Source$inboundSchema,t.outboundSchema=hl.Source$outboundSchema})(NJt||(hl.Source$=NJt={}))});var f3e=x(gl=>{"use strict";var VPn=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]}),WPn=gl&&gl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KPn=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)&&VPn(e,t,r);return WPn(e,t),e};Object.defineProperty(gl,"__esModule",{value:!0});gl.FileSchema$=gl.FileSchema$outboundSchema=gl.FileSchema$inboundSchema=void 0;gl.fileSchemaToJSON=JPn;gl.fileSchemaFromJSON=ZPn;var ip=KPn(Ie()),DJt=Ke(),GPn=Ce(),LJt=NJ(),FJt=jJ(),kJt=DJ();gl.FileSchema$inboundSchema=ip.object({id:ip.string(),object:ip.string(),bytes:ip.number().int(),created_at:ip.number().int(),filename:ip.string(),purpose:LJt.FilePurpose$inboundSchema,sample_type:FJt.SampleType$inboundSchema,num_lines:ip.nullable(ip.number().int()).optional(),source:kJt.Source$inboundSchema}).transform(t=>(0,DJt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));gl.FileSchema$outboundSchema=ip.object({id:ip.string(),object:ip.string(),sizeBytes:ip.number().int(),createdAt:ip.number().int(),filename:ip.string(),purpose:LJt.FilePurpose$outboundSchema,sampleType:FJt.SampleType$outboundSchema,numLines:ip.nullable(ip.number().int()).optional(),source:kJt.Source$outboundSchema}).transform(t=>(0,DJt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var jJt;(function(t){t.inboundSchema=gl.FileSchema$inboundSchema,t.outboundSchema=gl.FileSchema$outboundSchema})(jJt||(gl.FileSchema$=jJt={}));function JPn(t){return JSON.stringify(gl.FileSchema$outboundSchema.parse(t))}function ZPn(t){return(0,GPn.safeParse)(t,e=>gl.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var BJt=x(yl=>{"use strict";var YPn=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]}),XPn=yl&&yl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QPn=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)&&YPn(e,t,r);return XPn(e,t),e};Object.defineProperty(yl,"__esModule",{value:!0});yl.FileSignedURL$=yl.FileSignedURL$outboundSchema=yl.FileSignedURL$inboundSchema=void 0;yl.fileSignedURLToJSON=tTn;yl.fileSignedURLFromJSON=rTn;var ohe=QPn(Ie()),eTn=Ce();yl.FileSignedURL$inboundSchema=ohe.object({url:ohe.string()});yl.FileSignedURL$outboundSchema=ohe.object({url:ohe.string()});var $Jt;(function(t){t.inboundSchema=yl.FileSignedURL$inboundSchema,t.outboundSchema=yl.FileSignedURL$outboundSchema})($Jt||(yl.FileSignedURL$=$Jt={}));function tTn(t){return JSON.stringify(yl.FileSignedURL$outboundSchema.parse(t))}function rTn(t){return(0,eTn.safeParse)(t,e=>yl.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var VJt=x(ri=>{"use strict";var nTn=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]}),oTn=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iTn=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)&&nTn(e,t,r);return oTn(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=aTn;ri.fimCompletionRequestStopFromJSON=sTn;ri.fimCompletionRequestToJSON=uTn;ri.fimCompletionRequestFromJSON=lTn;var Fr=iTn(Ie()),qJt=Ke(),HJt=Ce();ri.FIMCompletionRequestStop$inboundSchema=Fr.union([Fr.string(),Fr.array(Fr.string())]);ri.FIMCompletionRequestStop$outboundSchema=Fr.union([Fr.string(),Fr.array(Fr.string())]);var zJt;(function(t){t.inboundSchema=ri.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=ri.FIMCompletionRequestStop$outboundSchema})(zJt||(ri.FIMCompletionRequestStop$=zJt={}));function aTn(t){return JSON.stringify(ri.FIMCompletionRequestStop$outboundSchema.parse(t))}function sTn(t){return(0,HJt.safeParse)(t,e=>ri.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}ri.FIMCompletionRequest$inboundSchema=Fr.object({model:Fr.nullable(Fr.string()),temperature:Fr.nullable(Fr.number()).optional(),top_p:Fr.number().default(1),max_tokens:Fr.nullable(Fr.number().int()).optional(),stream:Fr.boolean().default(!1),stop:Fr.union([Fr.string(),Fr.array(Fr.string())]).optional(),random_seed:Fr.nullable(Fr.number().int()).optional(),prompt:Fr.string(),suffix:Fr.nullable(Fr.string()).optional(),min_tokens:Fr.nullable(Fr.number().int()).optional()}).transform(t=>(0,qJt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ri.FIMCompletionRequest$outboundSchema=Fr.object({model:Fr.nullable(Fr.string()),temperature:Fr.nullable(Fr.number()).optional(),topP:Fr.number().default(1),maxTokens:Fr.nullable(Fr.number().int()).optional(),stream:Fr.boolean().default(!1),stop:Fr.union([Fr.string(),Fr.array(Fr.string())]).optional(),randomSeed:Fr.nullable(Fr.number().int()).optional(),prompt:Fr.string(),suffix:Fr.nullable(Fr.string()).optional(),minTokens:Fr.nullable(Fr.number().int()).optional()}).transform(t=>(0,qJt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var UJt;(function(t){t.inboundSchema=ri.FIMCompletionRequest$inboundSchema,t.outboundSchema=ri.FIMCompletionRequest$outboundSchema})(UJt||(ri.FIMCompletionRequest$=UJt={}));function uTn(t){return JSON.stringify(ri.FIMCompletionRequest$outboundSchema.parse(t))}function lTn(t){return(0,HJt.safeParse)(t,e=>ri.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var JJt=x(bl=>{"use strict";var cTn=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]}),dTn=bl&&bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fTn=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)&&cTn(e,t,r);return dTn(e,t),e};Object.defineProperty(bl,"__esModule",{value:!0});bl.FIMCompletionResponse$=bl.FIMCompletionResponse$outboundSchema=bl.FIMCompletionResponse$inboundSchema=void 0;bl.fimCompletionResponseToJSON=mTn;bl.fimCompletionResponseFromJSON=hTn;var eb=fTn(Ie()),pTn=Ce(),KJt=Lme(),GJt=Y3();bl.FIMCompletionResponse$inboundSchema=eb.object({id:eb.string(),object:eb.string(),model:eb.string(),usage:GJt.UsageInfo$inboundSchema,created:eb.number().int().optional(),choices:eb.array(KJt.ChatCompletionChoice$inboundSchema).optional()});bl.FIMCompletionResponse$outboundSchema=eb.object({id:eb.string(),object:eb.string(),model:eb.string(),usage:GJt.UsageInfo$outboundSchema,created:eb.number().int().optional(),choices:eb.array(KJt.ChatCompletionChoice$outboundSchema).optional()});var WJt;(function(t){t.inboundSchema=bl.FIMCompletionResponse$inboundSchema,t.outboundSchema=bl.FIMCompletionResponse$outboundSchema})(WJt||(bl.FIMCompletionResponse$=WJt={}));function mTn(t){return JSON.stringify(bl.FIMCompletionResponse$outboundSchema.parse(t))}function hTn(t){return(0,pTn.safeParse)(t,e=>bl.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var e7t=x(ni=>{"use strict";var gTn=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]}),yTn=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bTn=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)&&gTn(e,t,r);return yTn(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=_Tn;ni.fimCompletionStreamRequestStopFromJSON=vTn;ni.fimCompletionStreamRequestToJSON=wTn;ni.fimCompletionStreamRequestFromJSON=xTn;var kr=bTn(Ie()),XJt=Ke(),QJt=Ce();ni.FIMCompletionStreamRequestStop$inboundSchema=kr.union([kr.string(),kr.array(kr.string())]);ni.FIMCompletionStreamRequestStop$outboundSchema=kr.union([kr.string(),kr.array(kr.string())]);var ZJt;(function(t){t.inboundSchema=ni.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ni.FIMCompletionStreamRequestStop$outboundSchema})(ZJt||(ni.FIMCompletionStreamRequestStop$=ZJt={}));function _Tn(t){return JSON.stringify(ni.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function vTn(t){return(0,QJt.safeParse)(t,e=>ni.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}ni.FIMCompletionStreamRequest$inboundSchema=kr.object({model:kr.nullable(kr.string()),temperature:kr.nullable(kr.number()).optional(),top_p:kr.number().default(1),max_tokens:kr.nullable(kr.number().int()).optional(),stream:kr.boolean().default(!0),stop:kr.union([kr.string(),kr.array(kr.string())]).optional(),random_seed:kr.nullable(kr.number().int()).optional(),prompt:kr.string(),suffix:kr.nullable(kr.string()).optional(),min_tokens:kr.nullable(kr.number().int()).optional()}).transform(t=>(0,XJt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ni.FIMCompletionStreamRequest$outboundSchema=kr.object({model:kr.nullable(kr.string()),temperature:kr.nullable(kr.number()).optional(),topP:kr.number().default(1),maxTokens:kr.nullable(kr.number().int()).optional(),stream:kr.boolean().default(!0),stop:kr.union([kr.string(),kr.array(kr.string())]).optional(),randomSeed:kr.nullable(kr.number().int()).optional(),prompt:kr.string(),suffix:kr.nullable(kr.string()).optional(),minTokens:kr.nullable(kr.number().int()).optional()}).transform(t=>(0,XJt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var YJt;(function(t){t.inboundSchema=ni.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=ni.FIMCompletionStreamRequest$outboundSchema})(YJt||(ni.FIMCompletionStreamRequest$=YJt={}));function wTn(t){return JSON.stringify(ni.FIMCompletionStreamRequest$outboundSchema.parse(t))}function xTn(t){return(0,QJt.safeParse)(t,e=>ni.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var p3e=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.FTModelCapabilitiesOut$=_l.FTModelCapabilitiesOut$outboundSchema=_l.FTModelCapabilitiesOut$inboundSchema=void 0;_l.ftModelCapabilitiesOutToJSON=PTn;_l.ftModelCapabilitiesOutFromJSON=TTn;var MO=OTn(Ie()),r7t=Ke(),ETn=Ce();_l.FTModelCapabilitiesOut$inboundSchema=MO.object({completion_chat:MO.boolean().default(!0),completion_fim:MO.boolean().default(!1),function_calling:MO.boolean().default(!1),fine_tuning:MO.boolean().default(!1)}).transform(t=>(0,r7t.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));_l.FTModelCapabilitiesOut$outboundSchema=MO.object({completionChat:MO.boolean().default(!0),completionFim:MO.boolean().default(!1),functionCalling:MO.boolean().default(!1),fineTuning:MO.boolean().default(!1)}).transform(t=>(0,r7t.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var t7t;(function(t){t.inboundSchema=_l.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=_l.FTModelCapabilitiesOut$outboundSchema})(t7t||(_l.FTModelCapabilitiesOut$=t7t={}));function PTn(t){return JSON.stringify(_l.FTModelCapabilitiesOut$outboundSchema.parse(t))}function TTn(t){return(0,ETn.safeParse)(t,e=>_l.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var m3e=x(oi=>{"use strict";var ATn=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]}),ITn=oi&&oi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MTn=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)&&ATn(e,t,r);return ITn(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=NTn;oi.ftModelCardFromJSON=jTn;var En=MTn(Ie()),i7t=Ke(),RTn=Ce(),a7t=jme();oi.FTModelCardType={FineTuned:"fine-tuned"};oi.FTModelCardType$inboundSchema=En.nativeEnum(oi.FTModelCardType);oi.FTModelCardType$outboundSchema=oi.FTModelCardType$inboundSchema;var n7t;(function(t){t.inboundSchema=oi.FTModelCardType$inboundSchema,t.outboundSchema=oi.FTModelCardType$outboundSchema})(n7t||(oi.FTModelCardType$=n7t={}));oi.FTModelCard$inboundSchema=En.object({id:En.string(),object:En.string().default("model"),created:En.number().int().optional(),owned_by:En.string().default("mistralai"),capabilities:a7t.ModelCapabilities$inboundSchema,name:En.nullable(En.string()).optional(),description:En.nullable(En.string()).optional(),max_context_length:En.number().int().default(32768),aliases:En.array(En.string()).optional(),deprecation:En.nullable(En.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:En.nullable(En.number()).optional(),type:En.literal("fine-tuned").default("fine-tuned"),job:En.string(),root:En.string(),archived:En.boolean().default(!1)}).transform(t=>(0,i7t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));oi.FTModelCard$outboundSchema=En.object({id:En.string(),object:En.string().default("model"),created:En.number().int().optional(),ownedBy:En.string().default("mistralai"),capabilities:a7t.ModelCapabilities$outboundSchema,name:En.nullable(En.string()).optional(),description:En.nullable(En.string()).optional(),maxContextLength:En.number().int().default(32768),aliases:En.array(En.string()).optional(),deprecation:En.nullable(En.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:En.nullable(En.number()).optional(),type:En.literal("fine-tuned").default("fine-tuned"),job:En.string(),root:En.string(),archived:En.boolean().default(!1)}).transform(t=>(0,i7t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var o7t;(function(t){t.inboundSchema=oi.FTModelCard$inboundSchema,t.outboundSchema=oi.FTModelCard$outboundSchema})(o7t||(oi.FTModelCard$=o7t={}));function NTn(t){return JSON.stringify(oi.FTModelCard$outboundSchema.parse(t))}function jTn(t){return(0,RTn.safeParse)(t,e=>oi.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var d7t=x(ii=>{"use strict";var DTn=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]}),LTn=ii&&ii.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FTn=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)&&DTn(e,t,r);return LTn(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=$Tn;ii.ftModelOutFromJSON=BTn;var Ei=FTn(Ie()),l7t=Ke(),kTn=Ce(),c7t=p3e();ii.FTModelOutObject={Model:"model"};ii.FTModelOutObject$inboundSchema=Ei.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=Ei.object({id:Ei.string(),object:Ei.literal("model").default("model"),created:Ei.number().int(),owned_by:Ei.string(),root:Ei.string(),archived:Ei.boolean(),name:Ei.nullable(Ei.string()).optional(),description:Ei.nullable(Ei.string()).optional(),capabilities:c7t.FTModelCapabilitiesOut$inboundSchema,max_context_length:Ei.number().int().default(32768),aliases:Ei.array(Ei.string()).optional(),job:Ei.string()}).transform(t=>(0,l7t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));ii.FTModelOut$outboundSchema=Ei.object({id:Ei.string(),object:Ei.literal("model").default("model"),created:Ei.number().int(),ownedBy:Ei.string(),root:Ei.string(),archived:Ei.boolean(),name:Ei.nullable(Ei.string()).optional(),description:Ei.nullable(Ei.string()).optional(),capabilities:c7t.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Ei.number().int().default(32768),aliases:Ei.array(Ei.string()).optional(),job:Ei.string()}).transform(t=>(0,l7t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var u7t;(function(t){t.inboundSchema=ii.FTModelOut$inboundSchema,t.outboundSchema=ii.FTModelOut$outboundSchema})(u7t||(ii.FTModelOut$=u7t={}));function $Tn(t){return JSON.stringify(ii.FTModelOut$outboundSchema.parse(t))}function BTn(t){return(0,kTn.safeParse)(t,e=>ii.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var h3e=x(ai=>{"use strict";var zTn=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]}),UTn=ai&&ai.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qTn=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)&&zTn(e,t,r);return UTn(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=VTn;ai.githubRepositoryInFromJSON=WTn;var Xd=qTn(Ie()),HTn=Ce();ai.GithubRepositoryInType={Github:"github"};ai.GithubRepositoryInType$inboundSchema=Xd.nativeEnum(ai.GithubRepositoryInType);ai.GithubRepositoryInType$outboundSchema=ai.GithubRepositoryInType$inboundSchema;var f7t;(function(t){t.inboundSchema=ai.GithubRepositoryInType$inboundSchema,t.outboundSchema=ai.GithubRepositoryInType$outboundSchema})(f7t||(ai.GithubRepositoryInType$=f7t={}));ai.GithubRepositoryIn$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),token:Xd.string()});ai.GithubRepositoryIn$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),token:Xd.string()});var p7t;(function(t){t.inboundSchema=ai.GithubRepositoryIn$inboundSchema,t.outboundSchema=ai.GithubRepositoryIn$outboundSchema})(p7t||(ai.GithubRepositoryIn$=p7t={}));function VTn(t){return JSON.stringify(ai.GithubRepositoryIn$outboundSchema.parse(t))}function WTn(t){return(0,HTn.safeParse)(t,e=>ai.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var g3e=x(vl=>{"use strict";var KTn=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]}),GTn=vl&&vl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JTn=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)&&KTn(e,t,r);return GTn(e,t),e};Object.defineProperty(vl,"__esModule",{value:!0});vl.TrainingFile$=vl.TrainingFile$outboundSchema=vl.TrainingFile$inboundSchema=void 0;vl.trainingFileToJSON=YTn;vl.trainingFileFromJSON=XTn;var Q3=JTn(Ie()),h7t=Ke(),ZTn=Ce();vl.TrainingFile$inboundSchema=Q3.object({file_id:Q3.string(),weight:Q3.number().default(1)}).transform(t=>(0,h7t.remap)(t,{file_id:"fileId"}));vl.TrainingFile$outboundSchema=Q3.object({fileId:Q3.string(),weight:Q3.number().default(1)}).transform(t=>(0,h7t.remap)(t,{fileId:"file_id"}));var m7t;(function(t){t.inboundSchema=vl.TrainingFile$inboundSchema,t.outboundSchema=vl.TrainingFile$outboundSchema})(m7t||(vl.TrainingFile$=m7t={}));function YTn(t){return JSON.stringify(vl.TrainingFile$outboundSchema.parse(t))}function XTn(t){return(0,ZTn.safeParse)(t,e=>vl.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var y3e=x(wl=>{"use strict";var QTn=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]}),eAn=wl&&wl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tAn=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)&&QTn(e,t,r);return eAn(e,t),e};Object.defineProperty(wl,"__esModule",{value:!0});wl.TrainingParametersIn$=wl.TrainingParametersIn$outboundSchema=wl.TrainingParametersIn$inboundSchema=void 0;wl.trainingParametersInToJSON=nAn;wl.trainingParametersInFromJSON=oAn;var Xi=tAn(Ie()),y7t=Ke(),rAn=Ce();wl.TrainingParametersIn$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,y7t.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));wl.TrainingParametersIn$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,y7t.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var g7t;(function(t){t.inboundSchema=wl.TrainingParametersIn$inboundSchema,t.outboundSchema=wl.TrainingParametersIn$outboundSchema})(g7t||(wl.TrainingParametersIn$=g7t={}));function nAn(t){return JSON.stringify(wl.TrainingParametersIn$outboundSchema.parse(t))}function oAn(t){return(0,rAn.safeParse)(t,e=>wl.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var b3e=x(si=>{"use strict";var iAn=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]}),aAn=si&&si.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sAn=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)&&iAn(e,t,r);return aAn(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=lAn;si.wandbIntegrationFromJSON=cAn;var Qd=sAn(Ie()),v7t=Ke(),uAn=Ce();si.WandbIntegrationType={Wandb:"wandb"};si.WandbIntegrationType$inboundSchema=Qd.nativeEnum(si.WandbIntegrationType);si.WandbIntegrationType$outboundSchema=si.WandbIntegrationType$inboundSchema;var b7t;(function(t){t.inboundSchema=si.WandbIntegrationType$inboundSchema,t.outboundSchema=si.WandbIntegrationType$outboundSchema})(b7t||(si.WandbIntegrationType$=b7t={}));si.WandbIntegration$inboundSchema=Qd.object({type:Qd.literal("wandb").default("wandb"),project:Qd.string(),name:Qd.nullable(Qd.string()).optional(),api_key:Qd.string(),run_name:Qd.nullable(Qd.string()).optional()}).transform(t=>(0,v7t.remap)(t,{api_key:"apiKey",run_name:"runName"}));si.WandbIntegration$outboundSchema=Qd.object({type:Qd.literal("wandb").default("wandb"),project:Qd.string(),name:Qd.nullable(Qd.string()).optional(),apiKey:Qd.string(),runName:Qd.nullable(Qd.string()).optional()}).transform(t=>(0,v7t.remap)(t,{apiKey:"api_key",runName:"run_name"}));var _7t;(function(t){t.inboundSchema=si.WandbIntegration$inboundSchema,t.outboundSchema=si.WandbIntegration$outboundSchema})(_7t||(si.WandbIntegration$=_7t={}));function lAn(t){return JSON.stringify(si.WandbIntegration$outboundSchema.parse(t))}function cAn(t){return(0,uAn.safeParse)(t,e=>si.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var P7t=x(on=>{"use strict";var dAn=on&&on.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fAn=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pAn=on&&on.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dAn(e,t,r);return fAn(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.JobIn$=on.JobIn$outboundSchema=on.JobIn$inboundSchema=on.JobInRepositories$=on.JobInRepositories$outboundSchema=on.JobInRepositories$inboundSchema=on.JobInIntegrations$=on.JobInIntegrations$outboundSchema=on.JobInIntegrations$inboundSchema=void 0;on.jobInIntegrationsToJSON=mAn;on.jobInIntegrationsFromJSON=hAn;on.jobInRepositoriesToJSON=gAn;on.jobInRepositoriesFromJSON=yAn;on.jobInToJSON=bAn;on.jobInFromJSON=_An;var Ya=pAn(Ie()),C7t=Ke(),_3e=Ce(),ihe=h3e(),O7t=g3e(),E7t=y3e(),ahe=b3e();on.JobInIntegrations$inboundSchema=ahe.WandbIntegration$inboundSchema;on.JobInIntegrations$outboundSchema=ahe.WandbIntegration$outboundSchema;var w7t;(function(t){t.inboundSchema=on.JobInIntegrations$inboundSchema,t.outboundSchema=on.JobInIntegrations$outboundSchema})(w7t||(on.JobInIntegrations$=w7t={}));function mAn(t){return JSON.stringify(on.JobInIntegrations$outboundSchema.parse(t))}function hAn(t){return(0,_3e.safeParse)(t,e=>on.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}on.JobInRepositories$inboundSchema=ihe.GithubRepositoryIn$inboundSchema;on.JobInRepositories$outboundSchema=ihe.GithubRepositoryIn$outboundSchema;var x7t;(function(t){t.inboundSchema=on.JobInRepositories$inboundSchema,t.outboundSchema=on.JobInRepositories$outboundSchema})(x7t||(on.JobInRepositories$=x7t={}));function gAn(t){return JSON.stringify(on.JobInRepositories$outboundSchema.parse(t))}function yAn(t){return(0,_3e.safeParse)(t,e=>on.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}on.JobIn$inboundSchema=Ya.object({model:Ya.string(),training_files:Ya.array(O7t.TrainingFile$inboundSchema).optional(),validation_files:Ya.nullable(Ya.array(Ya.string())).optional(),hyperparameters:E7t.TrainingParametersIn$inboundSchema,suffix:Ya.nullable(Ya.string()).optional(),integrations:Ya.nullable(Ya.array(ahe.WandbIntegration$inboundSchema)).optional(),repositories:Ya.array(ihe.GithubRepositoryIn$inboundSchema).optional(),auto_start:Ya.boolean().optional()}).transform(t=>(0,C7t.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));on.JobIn$outboundSchema=Ya.object({model:Ya.string(),trainingFiles:Ya.array(O7t.TrainingFile$outboundSchema).optional(),validationFiles:Ya.nullable(Ya.array(Ya.string())).optional(),hyperparameters:E7t.TrainingParametersIn$outboundSchema,suffix:Ya.nullable(Ya.string()).optional(),integrations:Ya.nullable(Ya.array(ahe.WandbIntegration$outboundSchema)).optional(),repositories:Ya.array(ihe.GithubRepositoryIn$outboundSchema).optional(),autoStart:Ya.boolean().optional()}).transform(t=>(0,C7t.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var S7t;(function(t){t.inboundSchema=on.JobIn$inboundSchema,t.outboundSchema=on.JobIn$outboundSchema})(S7t||(on.JobIn$=S7t={}));function bAn(t){return JSON.stringify(on.JobIn$outboundSchema.parse(t))}function _An(t){return(0,_3e.safeParse)(t,e=>on.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var w3e=x(xt=>{"use strict";var vAn=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]}),wAn=xt&&xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xAn=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)&&vAn(e,t,r);return wAn(e,t),e};Object.defineProperty(xt,"__esModule",{value:!0});xt.JobOut$=xt.JobOut$outboundSchema=xt.JobOut$inboundSchema=xt.Repositories$=xt.Repositories$outboundSchema=xt.Repositories$inboundSchema=xt.Integrations$=xt.Integrations$outboundSchema=xt.Integrations$inboundSchema=xt.ObjectT$=xt.ObjectT$outboundSchema=xt.ObjectT$inboundSchema=xt.Status$=xt.Status$outboundSchema=xt.Status$inboundSchema=xt.ObjectT=xt.Status=void 0;xt.integrationsToJSON=SAn;xt.integrationsFromJSON=CAn;xt.repositoriesToJSON=OAn;xt.repositoriesFromJSON=EAn;xt.jobOutToJSON=PAn;xt.jobOutFromJSON=TAn;var $r=xAn(Ie()),N7t=Ke(),v3e=Ce(),she=Xme(),j7t=Qme(),D7t=ehe(),uhe=the();xt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};xt.ObjectT={Job:"job"};xt.Status$inboundSchema=$r.nativeEnum(xt.Status);xt.Status$outboundSchema=xt.Status$inboundSchema;var T7t;(function(t){t.inboundSchema=xt.Status$inboundSchema,t.outboundSchema=xt.Status$outboundSchema})(T7t||(xt.Status$=T7t={}));xt.ObjectT$inboundSchema=$r.nativeEnum(xt.ObjectT);xt.ObjectT$outboundSchema=xt.ObjectT$inboundSchema;var A7t;(function(t){t.inboundSchema=xt.ObjectT$inboundSchema,t.outboundSchema=xt.ObjectT$outboundSchema})(A7t||(xt.ObjectT$=A7t={}));xt.Integrations$inboundSchema=uhe.WandbIntegrationOut$inboundSchema;xt.Integrations$outboundSchema=uhe.WandbIntegrationOut$outboundSchema;var I7t;(function(t){t.inboundSchema=xt.Integrations$inboundSchema,t.outboundSchema=xt.Integrations$outboundSchema})(I7t||(xt.Integrations$=I7t={}));function SAn(t){return JSON.stringify(xt.Integrations$outboundSchema.parse(t))}function CAn(t){return(0,v3e.safeParse)(t,e=>xt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}xt.Repositories$inboundSchema=she.GithubRepositoryOut$inboundSchema;xt.Repositories$outboundSchema=she.GithubRepositoryOut$outboundSchema;var M7t;(function(t){t.inboundSchema=xt.Repositories$inboundSchema,t.outboundSchema=xt.Repositories$outboundSchema})(M7t||(xt.Repositories$=M7t={}));function OAn(t){return JSON.stringify(xt.Repositories$outboundSchema.parse(t))}function EAn(t){return(0,v3e.safeParse)(t,e=>xt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}xt.JobOut$inboundSchema=$r.object({id:$r.string(),auto_start:$r.boolean(),hyperparameters:D7t.TrainingParameters$inboundSchema,model:$r.string(),status:xt.Status$inboundSchema,job_type:$r.string(),created_at:$r.number().int(),modified_at:$r.number().int(),training_files:$r.array($r.string()),validation_files:$r.nullable($r.array($r.string())).optional(),object:$r.literal("job").default("job"),fine_tuned_model:$r.nullable($r.string()).optional(),suffix:$r.nullable($r.string()).optional(),integrations:$r.nullable($r.array(uhe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:$r.nullable($r.number().int()).optional(),repositories:$r.array(she.GithubRepositoryOut$inboundSchema).optional(),metadata:$r.nullable(j7t.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,N7t.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"}));xt.JobOut$outboundSchema=$r.object({id:$r.string(),autoStart:$r.boolean(),hyperparameters:D7t.TrainingParameters$outboundSchema,model:$r.string(),status:xt.Status$outboundSchema,jobType:$r.string(),createdAt:$r.number().int(),modifiedAt:$r.number().int(),trainingFiles:$r.array($r.string()),validationFiles:$r.nullable($r.array($r.string())).optional(),object:$r.literal("job").default("job"),fineTunedModel:$r.nullable($r.string()).optional(),suffix:$r.nullable($r.string()).optional(),integrations:$r.nullable($r.array(uhe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:$r.nullable($r.number().int()).optional(),repositories:$r.array(she.GithubRepositoryOut$outboundSchema).optional(),metadata:$r.nullable(j7t.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,N7t.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 R7t;(function(t){t.inboundSchema=xt.JobOut$inboundSchema,t.outboundSchema=xt.JobOut$outboundSchema})(R7t||(xt.JobOut$=R7t={}));function PAn(t){return JSON.stringify(xt.JobOut$outboundSchema.parse(t))}function TAn(t){return(0,v3e.safeParse)(t,e=>xt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var $7t=x(ui=>{"use strict";var AAn=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]}),IAn=ui&&ui.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MAn=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)&&AAn(e,t,r);return IAn(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=NAn;ui.jobsOutFromJSON=jAn;var hT=MAn(Ie()),RAn=Ce(),k7t=w3e();ui.JobsOutObject={List:"list"};ui.JobsOutObject$inboundSchema=hT.nativeEnum(ui.JobsOutObject);ui.JobsOutObject$outboundSchema=ui.JobsOutObject$inboundSchema;var L7t;(function(t){t.inboundSchema=ui.JobsOutObject$inboundSchema,t.outboundSchema=ui.JobsOutObject$outboundSchema})(L7t||(ui.JobsOutObject$=L7t={}));ui.JobsOut$inboundSchema=hT.object({data:hT.array(k7t.JobOut$inboundSchema).optional(),object:hT.literal("list").default("list"),total:hT.number().int()});ui.JobsOut$outboundSchema=hT.object({data:hT.array(k7t.JobOut$outboundSchema).optional(),object:hT.literal("list").default("list"),total:hT.number().int()});var F7t;(function(t){t.inboundSchema=ui.JobsOut$inboundSchema,t.outboundSchema=ui.JobsOut$outboundSchema})(F7t||(ui.JobsOut$=F7t={}));function NAn(t){return JSON.stringify(ui.JobsOut$outboundSchema.parse(t))}function jAn(t){return(0,RAn.safeParse)(t,e=>ui.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var q7t=x(li=>{"use strict";var DAn=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]}),LAn=li&&li.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FAn=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)&&DAn(e,t,r);return LAn(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=$An;li.legacyJobMetadataOutFromJSON=BAn;var en=FAn(Ie()),U7t=Ke(),kAn=Ce();li.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};li.LegacyJobMetadataOutObject$inboundSchema=en.nativeEnum(li.LegacyJobMetadataOutObject);li.LegacyJobMetadataOutObject$outboundSchema=li.LegacyJobMetadataOutObject$inboundSchema;var B7t;(function(t){t.inboundSchema=li.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=li.LegacyJobMetadataOutObject$outboundSchema})(B7t||(li.LegacyJobMetadataOutObject$=B7t={}));li.LegacyJobMetadataOut$inboundSchema=en.object({expected_duration_seconds:en.nullable(en.number().int()).optional(),cost:en.nullable(en.number()).optional(),cost_currency:en.nullable(en.string()).optional(),train_tokens_per_step:en.nullable(en.number().int()).optional(),train_tokens:en.nullable(en.number().int()).optional(),data_tokens:en.nullable(en.number().int()).optional(),estimated_start_time:en.nullable(en.number().int()).optional(),deprecated:en.boolean().default(!0),details:en.string(),epochs:en.nullable(en.number()).optional(),training_steps:en.nullable(en.number().int()).optional(),object:en.literal("job.metadata").default("job.metadata")}).transform(t=>(0,U7t.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=en.object({expectedDurationSeconds:en.nullable(en.number().int()).optional(),cost:en.nullable(en.number()).optional(),costCurrency:en.nullable(en.string()).optional(),trainTokensPerStep:en.nullable(en.number().int()).optional(),trainTokens:en.nullable(en.number().int()).optional(),dataTokens:en.nullable(en.number().int()).optional(),estimatedStartTime:en.nullable(en.number().int()).optional(),deprecated:en.boolean().default(!0),details:en.string(),epochs:en.nullable(en.number()).optional(),trainingSteps:en.nullable(en.number().int()).optional(),object:en.literal("job.metadata").default("job.metadata")}).transform(t=>(0,U7t.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 z7t;(function(t){t.inboundSchema=li.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=li.LegacyJobMetadataOut$outboundSchema})(z7t||(li.LegacyJobMetadataOut$=z7t={}));function $An(t){return JSON.stringify(li.LegacyJobMetadataOut$outboundSchema.parse(t))}function BAn(t){return(0,kAn.safeParse)(t,e=>li.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var W7t=x(xl=>{"use strict";var zAn=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]}),UAn=xl&&xl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qAn=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)&&zAn(e,t,r);return UAn(e,t),e};Object.defineProperty(xl,"__esModule",{value:!0});xl.ListFilesOut$=xl.ListFilesOut$outboundSchema=xl.ListFilesOut$inboundSchema=void 0;xl.listFilesOutToJSON=VAn;xl.listFilesOutFromJSON=WAn;var c1=qAn(Ie()),HAn=Ce(),V7t=f3e();xl.ListFilesOut$inboundSchema=c1.object({data:c1.array(V7t.FileSchema$inboundSchema),object:c1.string(),total:c1.number().int()});xl.ListFilesOut$outboundSchema=c1.object({data:c1.array(V7t.FileSchema$outboundSchema),object:c1.string(),total:c1.number().int()});var H7t;(function(t){t.inboundSchema=xl.ListFilesOut$inboundSchema,t.outboundSchema=xl.ListFilesOut$outboundSchema})(H7t||(xl.ListFilesOut$=H7t={}));function VAn(t){return JSON.stringify(xl.ListFilesOut$outboundSchema.parse(t))}function WAn(t){return(0,HAn.safeParse)(t,e=>xl.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var Z7t=x(ci=>{"use strict";var KAn=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]}),GAn=ci&&ci.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAn=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)&&KAn(e,t,r);return GAn(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=ZAn;ci.dataFromJSON=YAn;ci.modelListToJSON=XAn;ci.modelListFromJSON=QAn;var ma=JAn(Ie()),J7t=Ce(),lhe=Q4e(),che=m3e();ci.Data$inboundSchema=ma.union([lhe.BaseModelCard$inboundSchema.and(ma.object({type:ma.literal("base")}).transform(t=>({type:t.type}))),che.FTModelCard$inboundSchema.and(ma.object({type:ma.literal("fine-tuned")}).transform(t=>({type:t.type})))]);ci.Data$outboundSchema=ma.union([lhe.BaseModelCard$outboundSchema.and(ma.object({type:ma.literal("base")}).transform(t=>({type:t.type}))),che.FTModelCard$outboundSchema.and(ma.object({type:ma.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var K7t;(function(t){t.inboundSchema=ci.Data$inboundSchema,t.outboundSchema=ci.Data$outboundSchema})(K7t||(ci.Data$=K7t={}));function ZAn(t){return JSON.stringify(ci.Data$outboundSchema.parse(t))}function YAn(t){return(0,J7t.safeParse)(t,e=>ci.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}ci.ModelList$inboundSchema=ma.object({object:ma.string().default("list"),data:ma.array(ma.union([lhe.BaseModelCard$inboundSchema.and(ma.object({type:ma.literal("base")}).transform(t=>({type:t.type}))),che.FTModelCard$inboundSchema.and(ma.object({type:ma.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});ci.ModelList$outboundSchema=ma.object({object:ma.string().default("list"),data:ma.array(ma.union([lhe.BaseModelCard$outboundSchema.and(ma.object({type:ma.literal("base")}).transform(t=>({type:t.type}))),che.FTModelCard$outboundSchema.and(ma.object({type:ma.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var G7t;(function(t){t.inboundSchema=ci.ModelList$inboundSchema,t.outboundSchema=ci.ModelList$outboundSchema})(G7t||(ci.ModelList$=G7t={}));function XAn(t){return JSON.stringify(ci.ModelList$outboundSchema.parse(t))}function QAn(t){return(0,J7t.safeParse)(t,e=>ci.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var rZt=x(Sl=>{"use strict";var eIn=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]}),tIn=Sl&&Sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rIn=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)&&eIn(e,t,r);return tIn(e,t),e};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.RetrieveFileOut$=Sl.RetrieveFileOut$outboundSchema=Sl.RetrieveFileOut$inboundSchema=void 0;Sl.retrieveFileOutToJSON=oIn;Sl.retrieveFileOutFromJSON=iIn;var od=rIn(Ie()),X7t=Ke(),nIn=Ce(),Q7t=NJ(),eZt=jJ(),tZt=DJ();Sl.RetrieveFileOut$inboundSchema=od.object({id:od.string(),object:od.string(),bytes:od.number().int(),created_at:od.number().int(),filename:od.string(),purpose:Q7t.FilePurpose$inboundSchema,sample_type:eZt.SampleType$inboundSchema,num_lines:od.nullable(od.number().int()).optional(),source:tZt.Source$inboundSchema,deleted:od.boolean()}).transform(t=>(0,X7t.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Sl.RetrieveFileOut$outboundSchema=od.object({id:od.string(),object:od.string(),sizeBytes:od.number().int(),createdAt:od.number().int(),filename:od.string(),purpose:Q7t.FilePurpose$outboundSchema,sampleType:eZt.SampleType$outboundSchema,numLines:od.nullable(od.number().int()).optional(),source:tZt.Source$outboundSchema,deleted:od.boolean()}).transform(t=>(0,X7t.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var Y7t;(function(t){t.inboundSchema=Sl.RetrieveFileOut$inboundSchema,t.outboundSchema=Sl.RetrieveFileOut$outboundSchema})(Y7t||(Sl.RetrieveFileOut$=Y7t={}));function oIn(t){return JSON.stringify(Sl.RetrieveFileOut$outboundSchema.parse(t))}function iIn(t){return(0,nIn.safeParse)(t,e=>Sl.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var iZt=x(Cl=>{"use strict";var aIn=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]}),sIn=Cl&&Cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uIn=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)&&aIn(e,t,r);return sIn(e,t),e};Object.defineProperty(Cl,"__esModule",{value:!0});Cl.Security$=Cl.Security$outboundSchema=Cl.Security$inboundSchema=void 0;Cl.securityToJSON=cIn;Cl.securityFromJSON=dIn;var dhe=uIn(Ie()),oZt=Ke(),lIn=Ce();Cl.Security$inboundSchema=dhe.object({ApiKey:dhe.string().optional()}).transform(t=>(0,oZt.remap)(t,{ApiKey:"apiKey"}));Cl.Security$outboundSchema=dhe.object({apiKey:dhe.string().optional()}).transform(t=>(0,oZt.remap)(t,{apiKey:"ApiKey"}));var nZt;(function(t){t.inboundSchema=Cl.Security$inboundSchema,t.outboundSchema=Cl.Security$outboundSchema})(nZt||(Cl.Security$=nZt={}));function cIn(t){return JSON.stringify(Cl.Security$outboundSchema.parse(t))}function dIn(t){return(0,lIn.safeParse)(t,e=>Cl.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var uZt=x(di=>{"use strict";var fIn=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]}),pIn=di&&di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mIn=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)&&fIn(e,t,r);return pIn(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=gIn;di.unarchiveFTModelOutFromJSON=yIn;var gT=mIn(Ie()),hIn=Ce();di.UnarchiveFTModelOutObject={Model:"model"};di.UnarchiveFTModelOutObject$inboundSchema=gT.nativeEnum(di.UnarchiveFTModelOutObject);di.UnarchiveFTModelOutObject$outboundSchema=di.UnarchiveFTModelOutObject$inboundSchema;var aZt;(function(t){t.inboundSchema=di.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=di.UnarchiveFTModelOutObject$outboundSchema})(aZt||(di.UnarchiveFTModelOutObject$=aZt={}));di.UnarchiveFTModelOut$inboundSchema=gT.object({id:gT.string(),object:gT.literal("model").default("model"),archived:gT.boolean().default(!1)});di.UnarchiveFTModelOut$outboundSchema=gT.object({id:gT.string(),object:gT.literal("model").default("model"),archived:gT.boolean().default(!1)});var sZt;(function(t){t.inboundSchema=di.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=di.UnarchiveFTModelOut$outboundSchema})(sZt||(di.UnarchiveFTModelOut$=sZt={}));function gIn(t){return JSON.stringify(di.UnarchiveFTModelOut$outboundSchema.parse(t))}function yIn(t){return(0,hIn.safeParse)(t,e=>di.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var cZt=x(Ol=>{"use strict";var bIn=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]}),_In=Ol&&Ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vIn=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)&&bIn(e,t,r);return _In(e,t),e};Object.defineProperty(Ol,"__esModule",{value:!0});Ol.UpdateFTModelIn$=Ol.UpdateFTModelIn$outboundSchema=Ol.UpdateFTModelIn$inboundSchema=void 0;Ol.updateFTModelInToJSON=xIn;Ol.updateFTModelInFromJSON=SIn;var RO=vIn(Ie()),wIn=Ce();Ol.UpdateFTModelIn$inboundSchema=RO.object({name:RO.nullable(RO.string()).optional(),description:RO.nullable(RO.string()).optional()});Ol.UpdateFTModelIn$outboundSchema=RO.object({name:RO.nullable(RO.string()).optional(),description:RO.nullable(RO.string()).optional()});var lZt;(function(t){t.inboundSchema=Ol.UpdateFTModelIn$inboundSchema,t.outboundSchema=Ol.UpdateFTModelIn$outboundSchema})(lZt||(Ol.UpdateFTModelIn$=lZt={}));function xIn(t){return JSON.stringify(Ol.UpdateFTModelIn$outboundSchema.parse(t))}function SIn(t){return(0,wIn.safeParse)(t,e=>Ol.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var gZt=x(El=>{"use strict";var CIn=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]}),OIn=El&&El.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EIn=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)&&CIn(e,t,r);return OIn(e,t),e};Object.defineProperty(El,"__esModule",{value:!0});El.UploadFileOut$=El.UploadFileOut$outboundSchema=El.UploadFileOut$inboundSchema=void 0;El.uploadFileOutToJSON=TIn;El.uploadFileOutFromJSON=AIn;var ap=EIn(Ie()),fZt=Ke(),PIn=Ce(),pZt=NJ(),mZt=jJ(),hZt=DJ();El.UploadFileOut$inboundSchema=ap.object({id:ap.string(),object:ap.string(),bytes:ap.number().int(),created_at:ap.number().int(),filename:ap.string(),purpose:pZt.FilePurpose$inboundSchema,sample_type:mZt.SampleType$inboundSchema,num_lines:ap.nullable(ap.number().int()).optional(),source:hZt.Source$inboundSchema}).transform(t=>(0,fZt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));El.UploadFileOut$outboundSchema=ap.object({id:ap.string(),object:ap.string(),sizeBytes:ap.number().int(),createdAt:ap.number().int(),filename:ap.string(),purpose:pZt.FilePurpose$outboundSchema,sampleType:mZt.SampleType$outboundSchema,numLines:ap.nullable(ap.number().int()).optional(),source:hZt.Source$outboundSchema}).transform(t=>(0,fZt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var dZt;(function(t){t.inboundSchema=El.UploadFileOut$inboundSchema,t.outboundSchema=El.UploadFileOut$outboundSchema})(dZt||(El.UploadFileOut$=dZt={}));function TIn(t){return JSON.stringify(El.UploadFileOut$outboundSchema.parse(t))}function AIn(t){return(0,PIn.safeParse)(t,e=>El.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var vZt=x(fi=>{"use strict";var IIn=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]}),MIn=fi&&fi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RIn=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)&&IIn(e,t,r);return MIn(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=NIn;fi.locFromJSON=jIn;fi.validationErrorToJSON=DIn;fi.validationErrorFromJSON=LIn;var Pl=RIn(Ie()),_Zt=Ce();fi.Loc$inboundSchema=Pl.union([Pl.string(),Pl.number().int()]);fi.Loc$outboundSchema=Pl.union([Pl.string(),Pl.number().int()]);var yZt;(function(t){t.inboundSchema=fi.Loc$inboundSchema,t.outboundSchema=fi.Loc$outboundSchema})(yZt||(fi.Loc$=yZt={}));function NIn(t){return JSON.stringify(fi.Loc$outboundSchema.parse(t))}function jIn(t){return(0,_Zt.safeParse)(t,e=>fi.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}fi.ValidationError$inboundSchema=Pl.object({loc:Pl.array(Pl.union([Pl.string(),Pl.number().int()])),msg:Pl.string(),type:Pl.string()});fi.ValidationError$outboundSchema=Pl.object({loc:Pl.array(Pl.union([Pl.string(),Pl.number().int()])),msg:Pl.string(),type:Pl.string()});var bZt;(function(t){t.inboundSchema=fi.ValidationError$inboundSchema,t.outboundSchema=fi.ValidationError$outboundSchema})(bZt||(fi.ValidationError$=bZt={}));function DIn(t){return JSON.stringify(fi.ValidationError$outboundSchema.parse(t))}function LIn(t){return(0,_Zt.safeParse)(t,e=>fi.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var io=x(Je=>{"use strict";var FIn=Je&&Je.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),et=Je&&Je.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&FIn(e,t,r)};Object.defineProperty(Je,"__esModule",{value:!0});et(nKt(),Je);et(fKt(),Je);et(X4e(),Je);et(gKt(),Je);et(i1(),Je);et(Q4e(),Je);et(e3e(),Je);et(PKt(),Je);et(r3e(),Je);et(FKt(),Je);et(t3e(),Je);et(qKt(),Je);et(Lme(),Je);et(rGt(),Je);et(uGt(),Je);et(yGt(),Je);et(o3e(),Je);et(i3e(),Je);et(AGt(),Je);et(RGt(),Je);et(u3e(),Je);et(KGt(),Je);et(s3e(),Je);et(q3(),Je);et(JGt(),Je);et(YGt(),Je);et(a3e(),Je);et(vJt(),Je);et(OJt(),Je);et(IJt(),Je);et(d3e(),Je);et(l3e(),Je);et(NJ(),Je);et(f3e(),Je);et(BJt(),Je);et(VJt(),Je);et(JJt(),Je);et(e7t(),Je);et(p3e(),Je);et(m3e(),Je);et(d7t(),Je);et(Z4e(),Je);et(W4e(),Je);et(Y4e(),Je);et(h3e(),Je);et(Xme(),Je);et(q4e(),Je);et(H4e(),Je);et(P7t(),Je);et(Qme(),Je);et(w3e(),Je);et($7t(),Je);et(G4e(),Je);et(q7t(),Je);et(W7t(),Je);et(n3e(),Je);et(jme(),Je);et(Z7t(),Je);et(V3(),Je);et(V4e(),Je);et(W3(),Je);et(J4e(),Je);et(rZt(),Je);et(jJ(),Je);et(iZt(),Je);et(DJ(),Je);et(Tk(),Je);et(fme(),Je);et(K3(),Je);et(pme(),Je);et(G3(),Je);et(J3(),Je);et(Ak(),Je);et(MJ(),Je);et(g3e(),Je);et(ehe(),Je);et(y3e(),Je);et(uZt(),Je);et(cZt(),Je);et(gZt(),Je);et(Y3(),Je);et(Ik(),Je);et(vZt(),Je);et(b3e(),Je);et(the(),Je)});var CZt=x(id=>{"use strict";var kIn=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]}),$In=id&&id.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xZt=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)&&kIn(e,t,r);return $In(e,t),e};Object.defineProperty(id,"__esModule",{value:!0});id.HTTPValidationError$=id.HTTPValidationError$outboundSchema=id.HTTPValidationError$inboundSchema=id.HTTPValidationError=void 0;var LJ=xZt(Ie()),SZt=xZt(io()),FJ=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=FJ;id.HTTPValidationError$inboundSchema=LJ.object({detail:LJ.array(SZt.ValidationError$inboundSchema).optional()}).transform(t=>new FJ(t));id.HTTPValidationError$outboundSchema=LJ.instanceof(FJ).transform(t=>t.data$).pipe(LJ.object({detail:LJ.array(SZt.ValidationError$outboundSchema).optional()}));var wZt;(function(t){t.inboundSchema=id.HTTPValidationError$inboundSchema,t.outboundSchema=id.HTTPValidationError$outboundSchema})(wZt||(id.HTTPValidationError$=wZt={}))});var wg=x(NO=>{"use strict";var BIn=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]}),fhe=NO&&NO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BIn(e,t,r)};Object.defineProperty(NO,"__esModule",{value:!0});fhe(m4e(),NO);fhe(CZt(),NO);fhe(L4e(),NO);fhe(z4e(),NO)});var PZt=x(yT=>{"use strict";var zIn=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]}),UIn=yT&&yT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x3e=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)&&zIn(e,t,r);return UIn(e,t),e};Object.defineProperty(yT,"__esModule",{value:!0});yT.agentsComplete=GIn;var qIn=Si(),kJ=x3e(Ci()),HIn=Ke(),VIn=Ce(),OZt=Oi(),WIn=Ho(),EZt=x3e(io()),KIn=x3e(wg());async function GIn(t,e,r){let n=(0,VIn.safeParse)(e,_=>EZt.AgentsCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,qIn.encodeJSON)("body",o,{explode:!0}),a=(0,WIn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,HIn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,OZt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,OZt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await kJ.match(kJ.json(200,EZt.ChatCompletionResponse$inboundSchema),kJ.jsonErr(422,KIn.HTTPValidationError$inboundSchema),kJ.fail("4XX"),kJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var IZt=x(bT=>{"use strict";var JIn=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]}),ZIn=bT&&bT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),phe=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)&&JIn(e,t,r);return ZIn(e,t),e};Object.defineProperty(bT,"__esModule",{value:!0});bT.agentsStream=oMn;var YIn=phe(Ie()),XIn=Si(),QIn=TJ(),$J=phe(Ci()),eMn=Ke(),tMn=Ce(),TZt=Oi(),rMn=Ho(),AZt=phe(io()),nMn=phe(wg());async function oMn(t,e,r){let n=(0,tMn.safeParse)(e,_=>AZt.AgentsCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,XIn.encodeJSON)("body",o,{explode:!0}),a=(0,rMn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,eMn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,TZt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,TZt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await $J.match($J.sse(200,YIn.instanceof(ReadableStream).transform(_=>new QIn.EventStream({stream:_,decoder(w){return AZt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),$J.jsonErr(422,nMn.HTTPValidationError$inboundSchema),$J.fail("4XX"),$J.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var RZt=x(mhe=>{"use strict";Object.defineProperty(mhe,"__esModule",{value:!0});mhe.Agents=void 0;var iMn=PZt(),aMn=IZt(),sMn=_g(),MZt=By(),S3e=class extends sMn.ClientSDK{async complete(e,r){return(0,MZt.unwrapAsync)((0,iMn.agentsComplete)(this,e,r))}async stream(e,r){return(0,MZt.unwrapAsync)((0,aMn.agentsStream)(this,e,r))}};mhe.Agents=S3e});var DZt=x(Tl=>{"use strict";var uMn=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]}),lMn=Tl&&Tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cMn=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)&&uMn(e,t,r);return lMn(e,t),e};Object.defineProperty(Tl,"__esModule",{value:!0});Tl.DeleteModelV1ModelsModelIdDeleteRequest$=Tl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Tl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Tl.deleteModelV1ModelsModelIdDeleteRequestToJSON=fMn;Tl.deleteModelV1ModelsModelIdDeleteRequestFromJSON=pMn;var hhe=cMn(Ie()),jZt=Ke(),dMn=Ce();Tl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=hhe.object({model_id:hhe.string()}).transform(t=>(0,jZt.remap)(t,{model_id:"modelId"}));Tl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=hhe.object({modelId:hhe.string()}).transform(t=>(0,jZt.remap)(t,{modelId:"model_id"}));var NZt;(function(t){t.inboundSchema=Tl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Tl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(NZt||(Tl.DeleteModelV1ModelsModelIdDeleteRequest$=NZt={}));function fMn(t){return JSON.stringify(Tl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function pMn(t){return(0,dMn.safeParse)(t,e=>Tl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var kZt=x(Al=>{"use strict";var mMn=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]}),hMn=Al&&Al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gMn=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)&&mMn(e,t,r);return hMn(e,t),e};Object.defineProperty(Al,"__esModule",{value:!0});Al.FilesApiRoutesDeleteFileRequest$=Al.FilesApiRoutesDeleteFileRequest$outboundSchema=Al.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Al.filesApiRoutesDeleteFileRequestToJSON=bMn;Al.filesApiRoutesDeleteFileRequestFromJSON=_Mn;var ghe=gMn(Ie()),FZt=Ke(),yMn=Ce();Al.FilesApiRoutesDeleteFileRequest$inboundSchema=ghe.object({file_id:ghe.string()}).transform(t=>(0,FZt.remap)(t,{file_id:"fileId"}));Al.FilesApiRoutesDeleteFileRequest$outboundSchema=ghe.object({fileId:ghe.string()}).transform(t=>(0,FZt.remap)(t,{fileId:"file_id"}));var LZt;(function(t){t.inboundSchema=Al.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Al.FilesApiRoutesDeleteFileRequest$outboundSchema})(LZt||(Al.FilesApiRoutesDeleteFileRequest$=LZt={}));function bMn(t){return JSON.stringify(Al.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function _Mn(t){return(0,yMn.safeParse)(t,e=>Al.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var zZt=x(Il=>{"use strict";var vMn=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]}),wMn=Il&&Il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xMn=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)&&vMn(e,t,r);return wMn(e,t),e};Object.defineProperty(Il,"__esModule",{value:!0});Il.FilesApiRoutesDownloadFileRequest$=Il.FilesApiRoutesDownloadFileRequest$outboundSchema=Il.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Il.filesApiRoutesDownloadFileRequestToJSON=CMn;Il.filesApiRoutesDownloadFileRequestFromJSON=OMn;var yhe=xMn(Ie()),BZt=Ke(),SMn=Ce();Il.FilesApiRoutesDownloadFileRequest$inboundSchema=yhe.object({file_id:yhe.string()}).transform(t=>(0,BZt.remap)(t,{file_id:"fileId"}));Il.FilesApiRoutesDownloadFileRequest$outboundSchema=yhe.object({fileId:yhe.string()}).transform(t=>(0,BZt.remap)(t,{fileId:"file_id"}));var $Zt;(function(t){t.inboundSchema=Il.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Il.FilesApiRoutesDownloadFileRequest$outboundSchema})($Zt||(Il.FilesApiRoutesDownloadFileRequest$=$Zt={}));function CMn(t){return JSON.stringify(Il.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function OMn(t){return(0,SMn.safeParse)(t,e=>Il.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var HZt=x(Ml=>{"use strict";var EMn=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]}),PMn=Ml&&Ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TMn=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)&&EMn(e,t,r);return PMn(e,t),e};Object.defineProperty(Ml,"__esModule",{value:!0});Ml.FilesApiRoutesGetSignedUrlRequest$=Ml.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Ml.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Ml.filesApiRoutesGetSignedUrlRequestToJSON=IMn;Ml.filesApiRoutesGetSignedUrlRequestFromJSON=MMn;var eH=TMn(Ie()),qZt=Ke(),AMn=Ce();Ml.FilesApiRoutesGetSignedUrlRequest$inboundSchema=eH.object({file_id:eH.string(),expiry:eH.number().int().default(24)}).transform(t=>(0,qZt.remap)(t,{file_id:"fileId"}));Ml.FilesApiRoutesGetSignedUrlRequest$outboundSchema=eH.object({fileId:eH.string(),expiry:eH.number().int().default(24)}).transform(t=>(0,qZt.remap)(t,{fileId:"file_id"}));var UZt;(function(t){t.inboundSchema=Ml.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Ml.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(UZt||(Ml.FilesApiRoutesGetSignedUrlRequest$=UZt={}));function IMn(t){return JSON.stringify(Ml.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function MMn(t){return(0,AMn.safeParse)(t,e=>Ml.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var GZt=x(Nl=>{"use strict";var RMn=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]}),NMn=Nl&&Nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WZt=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)&&RMn(e,t,r);return NMn(e,t),e};Object.defineProperty(Nl,"__esModule",{value:!0});Nl.FilesApiRoutesListFilesRequest$=Nl.FilesApiRoutesListFilesRequest$outboundSchema=Nl.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Nl.filesApiRoutesListFilesRequestToJSON=DMn;Nl.filesApiRoutesListFilesRequestFromJSON=LMn;var Rl=WZt(Ie()),KZt=Ke(),jMn=Ce(),tH=WZt(io());Nl.FilesApiRoutesListFilesRequest$inboundSchema=Rl.object({page:Rl.number().int().default(0),page_size:Rl.number().int().default(100),sample_type:Rl.nullable(Rl.array(tH.SampleType$inboundSchema)).optional(),source:Rl.nullable(Rl.array(tH.Source$inboundSchema)).optional(),search:Rl.nullable(Rl.string()).optional(),purpose:Rl.nullable(tH.FilePurpose$inboundSchema).optional()}).transform(t=>(0,KZt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Nl.FilesApiRoutesListFilesRequest$outboundSchema=Rl.object({page:Rl.number().int().default(0),pageSize:Rl.number().int().default(100),sampleType:Rl.nullable(Rl.array(tH.SampleType$outboundSchema)).optional(),source:Rl.nullable(Rl.array(tH.Source$outboundSchema)).optional(),search:Rl.nullable(Rl.string()).optional(),purpose:Rl.nullable(tH.FilePurpose$outboundSchema).optional()}).transform(t=>(0,KZt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var VZt;(function(t){t.inboundSchema=Nl.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Nl.FilesApiRoutesListFilesRequest$outboundSchema})(VZt||(Nl.FilesApiRoutesListFilesRequest$=VZt={}));function DMn(t){return JSON.stringify(Nl.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function LMn(t){return(0,jMn.safeParse)(t,e=>Nl.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var YZt=x(jl=>{"use strict";var FMn=jl&&jl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=jl&&jl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Mn=jl&&jl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FMn(e,t,r);return kMn(e,t),e};Object.defineProperty(jl,"__esModule",{value:!0});jl.FilesApiRoutesRetrieveFileRequest$=jl.FilesApiRoutesRetrieveFileRequest$outboundSchema=jl.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;jl.filesApiRoutesRetrieveFileRequestToJSON=zMn;jl.filesApiRoutesRetrieveFileRequestFromJSON=UMn;var bhe=$Mn(Ie()),ZZt=Ke(),BMn=Ce();jl.FilesApiRoutesRetrieveFileRequest$inboundSchema=bhe.object({file_id:bhe.string()}).transform(t=>(0,ZZt.remap)(t,{file_id:"fileId"}));jl.FilesApiRoutesRetrieveFileRequest$outboundSchema=bhe.object({fileId:bhe.string()}).transform(t=>(0,ZZt.remap)(t,{fileId:"file_id"}));var JZt;(function(t){t.inboundSchema=jl.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=jl.FilesApiRoutesRetrieveFileRequest$outboundSchema})(JZt||(jl.FilesApiRoutesRetrieveFileRequest$=JZt={}));function zMn(t){return JSON.stringify(jl.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function UMn(t){return(0,BMn.safeParse)(t,e=>jl.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var C3e=x(L_=>{"use strict";var qMn=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]}),HMn=L_&&L_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VMn=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)&&qMn(e,t,r);return HMn(e,t),e};Object.defineProperty(L_,"__esModule",{value:!0});L_.blobLikeSchema=void 0;L_.isBlobLike=XZt;var WMn=VMn(Ie());L_.blobLikeSchema=WMn.custom(XZt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function XZt(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 oYt=x(Ro=>{"use strict";var KMn=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]}),GMn=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tYt=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)&&KMn(e,t,r);return GMn(e,t),e};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.FilesApiRoutesUploadFileMultiPartBodyParams$=Ro.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Ro.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=Ro.FileT$=Ro.FileT$outboundSchema=Ro.FileT$inboundSchema=void 0;Ro.fileToJSON=ZMn;Ro.fileFromJSON=YMn;Ro.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=XMn;Ro.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=QMn;var ad=tYt(Ie()),rYt=Ce(),JMn=C3e(),nYt=tYt(io());Ro.FileT$inboundSchema=ad.object({fileName:ad.string(),content:ad.union([ad.instanceof(ReadableStream),ad.instanceof(Blob),ad.instanceof(ArrayBuffer),ad.instanceof(Uint8Array)])});Ro.FileT$outboundSchema=ad.object({fileName:ad.string(),content:ad.union([ad.instanceof(ReadableStream),ad.instanceof(Blob),ad.instanceof(ArrayBuffer),ad.instanceof(Uint8Array)])});var QZt;(function(t){t.inboundSchema=Ro.FileT$inboundSchema,t.outboundSchema=Ro.FileT$outboundSchema})(QZt||(Ro.FileT$=QZt={}));function ZMn(t){return JSON.stringify(Ro.FileT$outboundSchema.parse(t))}function YMn(t){return(0,rYt.safeParse)(t,e=>Ro.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}Ro.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=ad.object({file:ad.lazy(()=>Ro.FileT$inboundSchema),purpose:nYt.FilePurpose$inboundSchema.optional()});Ro.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=ad.object({file:ad.lazy(()=>Ro.FileT$outboundSchema).or(JMn.blobLikeSchema),purpose:nYt.FilePurpose$outboundSchema.optional()});var eYt;(function(t){t.inboundSchema=Ro.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=Ro.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(eYt||(Ro.FilesApiRoutesUploadFileMultiPartBodyParams$=eYt={}));function XMn(t){return JSON.stringify(Ro.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function QMn(t){return(0,rYt.safeParse)(t,e=>Ro.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var sYt=x(Dl=>{"use strict";var eRn=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]}),tRn=Dl&&Dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rRn=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)&&eRn(e,t,r);return tRn(e,t),e};Object.defineProperty(Dl,"__esModule",{value:!0});Dl.JobsApiRoutesBatchCancelBatchJobRequest$=Dl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Dl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;Dl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=oRn;Dl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=iRn;var _he=rRn(Ie()),aYt=Ke(),nRn=Ce();Dl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=_he.object({job_id:_he.string()}).transform(t=>(0,aYt.remap)(t,{job_id:"jobId"}));Dl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=_he.object({jobId:_he.string()}).transform(t=>(0,aYt.remap)(t,{jobId:"job_id"}));var iYt;(function(t){t.inboundSchema=Dl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=Dl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(iYt||(Dl.JobsApiRoutesBatchCancelBatchJobRequest$=iYt={}));function oRn(t){return JSON.stringify(Dl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function iRn(t){return(0,nRn.safeParse)(t,e=>Dl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var cYt=x(Ll=>{"use strict";var aRn=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]}),sRn=Ll&&Ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uRn=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)&&aRn(e,t,r);return sRn(e,t),e};Object.defineProperty(Ll,"__esModule",{value:!0});Ll.JobsApiRoutesBatchGetBatchJobRequest$=Ll.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Ll.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Ll.jobsApiRoutesBatchGetBatchJobRequestToJSON=cRn;Ll.jobsApiRoutesBatchGetBatchJobRequestFromJSON=dRn;var vhe=uRn(Ie()),lYt=Ke(),lRn=Ce();Ll.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=vhe.object({job_id:vhe.string()}).transform(t=>(0,lYt.remap)(t,{job_id:"jobId"}));Ll.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=vhe.object({jobId:vhe.string()}).transform(t=>(0,lYt.remap)(t,{jobId:"job_id"}));var uYt;(function(t){t.inboundSchema=Ll.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Ll.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(uYt||(Ll.JobsApiRoutesBatchGetBatchJobRequest$=uYt={}));function cRn(t){return JSON.stringify(Ll.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function dRn(t){return(0,lRn.safeParse)(t,e=>Ll.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var hYt=x(Fl=>{"use strict";var fRn=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}),fYt=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)&&fRn(e,t,r);return pRn(e,t),e};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.JobsApiRoutesBatchGetBatchJobsRequest$=Fl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Fl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Fl.jobsApiRoutesBatchGetBatchJobsRequestToJSON=hRn;Fl.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=gRn;var Xa=fYt(Ie()),pYt=Ke(),mRn=Ce(),mYt=fYt(io());Fl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Xa.object({page:Xa.number().int().default(0),page_size:Xa.number().int().default(100),model:Xa.nullable(Xa.string()).optional(),metadata:Xa.nullable(Xa.record(Xa.any())).optional(),created_after:Xa.nullable(Xa.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Xa.boolean().default(!1),status:Xa.nullable(mYt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,pYt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));Fl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Xa.object({page:Xa.number().int().default(0),pageSize:Xa.number().int().default(100),model:Xa.nullable(Xa.string()).optional(),metadata:Xa.nullable(Xa.record(Xa.any())).optional(),createdAfter:Xa.nullable(Xa.date().transform(t=>t.toISOString())).optional(),createdByMe:Xa.boolean().default(!1),status:Xa.nullable(mYt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,pYt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var dYt;(function(t){t.inboundSchema=Fl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Fl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(dYt||(Fl.JobsApiRoutesBatchGetBatchJobsRequest$=dYt={}));function hRn(t){return JSON.stringify(Fl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function gRn(t){return(0,mRn.safeParse)(t,e=>Fl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var bYt=x(kl=>{"use strict";var yRn=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]}),bRn=kl&&kl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Rn=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)&&yRn(e,t,r);return bRn(e,t),e};Object.defineProperty(kl,"__esModule",{value:!0});kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;kl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=wRn;kl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=xRn;var whe=_Rn(Ie()),yYt=Ke(),vRn=Ce();kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=whe.object({model_id:whe.string()}).transform(t=>(0,yYt.remap)(t,{model_id:"modelId"}));kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=whe.object({modelId:whe.string()}).transform(t=>(0,yYt.remap)(t,{modelId:"model_id"}));var gYt;(function(t){t.inboundSchema=kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(gYt||(kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=gYt={}));function wRn(t){return JSON.stringify(kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function xRn(t){return(0,vRn.safeParse)(t,e=>kl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var wYt=x($l=>{"use strict";var SRn=$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]}),CRn=$l&&$l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ORn=$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)&&SRn(e,t,r);return CRn(e,t),e};Object.defineProperty($l,"__esModule",{value:!0});$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;$l.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=PRn;$l.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=TRn;var xhe=ORn(Ie()),vYt=Ke(),ERn=Ce();$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=xhe.object({job_id:xhe.string()}).transform(t=>(0,vYt.remap)(t,{job_id:"jobId"}));$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=xhe.object({jobId:xhe.string()}).transform(t=>(0,vYt.remap)(t,{jobId:"job_id"}));var _Yt;(function(t){t.inboundSchema=$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(_Yt||($l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=_Yt={}));function PRn(t){return JSON.stringify($l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function TRn(t){return(0,ERn.safeParse)(t,e=>$l.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var OYt=x(Bl=>{"use strict";var ARn=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]}),IRn=Bl&&Bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SYt=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)&&ARn(e,t,r);return IRn(e,t),e};Object.defineProperty(Bl,"__esModule",{value:!0});Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Bl.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=RRn;Bl.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=NRn;var CYt=SYt(Ie()),MRn=Ce(),She=SYt(io());Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=CYt.union([She.LegacyJobMetadataOut$inboundSchema,She.JobOut$inboundSchema]);Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=CYt.union([She.LegacyJobMetadataOut$outboundSchema,She.JobOut$outboundSchema]);var xYt;(function(t){t.inboundSchema=Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(xYt||(Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=xYt={}));function RRn(t){return JSON.stringify(Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function NRn(t){return(0,MRn.safeParse)(t,e=>Bl.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var TYt=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]}),DRn=zl&&zl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LRn=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 DRn(e,t),e};Object.defineProperty(zl,"__esModule",{value:!0});zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$=zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;zl.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=kRn;zl.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=$Rn;var Che=LRn(Ie()),PYt=Ke(),FRn=Ce();zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=Che.object({job_id:Che.string()}).transform(t=>(0,PYt.remap)(t,{job_id:"jobId"}));zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Che.object({jobId:Che.string()}).transform(t=>(0,PYt.remap)(t,{jobId:"job_id"}));var EYt;(function(t){t.inboundSchema=zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(EYt||(zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$=EYt={}));function kRn(t){return JSON.stringify(zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function $Rn(t){return(0,FRn.safeParse)(t,e=>zl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var RYt=x(No=>{"use strict";var BRn=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]}),zRn=No&&No.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),URn=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)&&BRn(e,t,r);return zRn(e,t),e};Object.defineProperty(No,"__esModule",{value:!0});No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=No.Status$=No.Status$outboundSchema=No.Status$inboundSchema=No.Status=void 0;No.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=HRn;No.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=VRn;var Pi=URn(Ie()),MYt=Ke(),qRn=Ce();No.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};No.Status$inboundSchema=Pi.nativeEnum(No.Status);No.Status$outboundSchema=No.Status$inboundSchema;var AYt;(function(t){t.inboundSchema=No.Status$inboundSchema,t.outboundSchema=No.Status$outboundSchema})(AYt||(No.Status$=AYt={}));No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Pi.object({page:Pi.number().int().default(0),page_size:Pi.number().int().default(100),model:Pi.nullable(Pi.string()).optional(),created_after:Pi.nullable(Pi.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Pi.boolean().default(!1),status:Pi.nullable(No.Status$inboundSchema).optional(),wandb_project:Pi.nullable(Pi.string()).optional(),wandb_name:Pi.nullable(Pi.string()).optional(),suffix:Pi.nullable(Pi.string()).optional()}).transform(t=>(0,MYt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Pi.object({page:Pi.number().int().default(0),pageSize:Pi.number().int().default(100),model:Pi.nullable(Pi.string()).optional(),createdAfter:Pi.nullable(Pi.date().transform(t=>t.toISOString())).optional(),createdByMe:Pi.boolean().default(!1),status:Pi.nullable(No.Status$outboundSchema).optional(),wandbProject:Pi.nullable(Pi.string()).optional(),wandbName:Pi.nullable(Pi.string()).optional(),suffix:Pi.nullable(Pi.string()).optional()}).transform(t=>(0,MYt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var IYt;(function(t){t.inboundSchema=No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(IYt||(No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=IYt={}));function HRn(t){return JSON.stringify(No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function VRn(t){return(0,qRn.safeParse)(t,e=>No.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var DYt=x(Ul=>{"use strict";var WRn=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]}),KRn=Ul&&Ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GRn=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)&&WRn(e,t,r);return KRn(e,t),e};Object.defineProperty(Ul,"__esModule",{value:!0});Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Ul.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=ZRn;Ul.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=YRn;var Ohe=GRn(Ie()),jYt=Ke(),JRn=Ce();Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=Ohe.object({job_id:Ohe.string()}).transform(t=>(0,jYt.remap)(t,{job_id:"jobId"}));Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Ohe.object({jobId:Ohe.string()}).transform(t=>(0,jYt.remap)(t,{jobId:"job_id"}));var NYt;(function(t){t.inboundSchema=Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(NYt||(Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$=NYt={}));function ZRn(t){return JSON.stringify(Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function YRn(t){return(0,JRn.safeParse)(t,e=>Ul.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var kYt=x(ql=>{"use strict";var XRn=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]}),QRn=ql&&ql.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e1n=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)&&XRn(e,t,r);return QRn(e,t),e};Object.defineProperty(ql,"__esModule",{value:!0});ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;ql.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=r1n;ql.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=n1n;var Ehe=e1n(Ie()),FYt=Ke(),t1n=Ce();ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=Ehe.object({model_id:Ehe.string()}).transform(t=>(0,FYt.remap)(t,{model_id:"modelId"}));ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Ehe.object({modelId:Ehe.string()}).transform(t=>(0,FYt.remap)(t,{modelId:"model_id"}));var LYt;(function(t){t.inboundSchema=ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(LYt||(ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=LYt={}));function r1n(t){return JSON.stringify(ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function n1n(t){return(0,t1n.safeParse)(t,e=>ql.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var qYt=x(Hl=>{"use strict";var o1n=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]}),i1n=Hl&&Hl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BYt=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)&&o1n(e,t,r);return i1n(e,t),e};Object.defineProperty(Hl,"__esModule",{value:!0});Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Hl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=s1n;Hl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=u1n;var Phe=BYt(Ie()),zYt=Ke(),a1n=Ce(),UYt=BYt(io());Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=Phe.object({model_id:Phe.string(),UpdateFTModelIn:UYt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,zYt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Phe.object({modelId:Phe.string(),updateFTModelIn:UYt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,zYt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var $Yt;(function(t){t.inboundSchema=Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})($Yt||(Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=$Yt={}));function s1n(t){return JSON.stringify(Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function u1n(t){return(0,a1n.safeParse)(t,e=>Hl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var JYt=x(pi=>{"use strict";var l1n=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]}),c1n=pi&&pi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WYt=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)&&l1n(e,t,r);return c1n(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=d1n;pi.retrieveModelV1ModelsModelIdGetRequestFromJSON=f1n;pi.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=p1n;pi.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=m1n;var fh=WYt(Ie()),KYt=Ke(),GYt=Ce(),The=WYt(io());pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=fh.object({model_id:fh.string()}).transform(t=>(0,KYt.remap)(t,{model_id:"modelId"}));pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=fh.object({modelId:fh.string()}).transform(t=>(0,KYt.remap)(t,{modelId:"model_id"}));var HYt;(function(t){t.inboundSchema=pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(HYt||(pi.RetrieveModelV1ModelsModelIdGetRequest$=HYt={}));function d1n(t){return JSON.stringify(pi.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function f1n(t){return(0,GYt.safeParse)(t,e=>pi.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=fh.union([The.BaseModelCard$inboundSchema.and(fh.object({type:fh.literal("base")}).transform(t=>({type:t.type}))),The.FTModelCard$inboundSchema.and(fh.object({type:fh.literal("fine-tuned")}).transform(t=>({type:t.type})))]);pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=fh.union([The.BaseModelCard$outboundSchema.and(fh.object({type:fh.literal("base")}).transform(t=>({type:t.type}))),The.FTModelCard$outboundSchema.and(fh.object({type:fh.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var VYt;(function(t){t.inboundSchema=pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(VYt||(pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=VYt={}));function p1n(t){return JSON.stringify(pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function m1n(t){return(0,GYt.safeParse)(t,e=>pi.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Vl=x(Na=>{"use strict";var h1n=Na&&Na.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cc=Na&&Na.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&h1n(e,t,r)};Object.defineProperty(Na,"__esModule",{value:!0});Cc(DZt(),Na);Cc(kZt(),Na);Cc(zZt(),Na);Cc(HZt(),Na);Cc(GZt(),Na);Cc(YZt(),Na);Cc(oYt(),Na);Cc(sYt(),Na);Cc(cYt(),Na);Cc(hYt(),Na);Cc(bYt(),Na);Cc(wYt(),Na);Cc(OYt(),Na);Cc(TYt(),Na);Cc(RYt(),Na);Cc(DYt(),Na);Cc(kYt(),Na);Cc(qYt(),Na);Cc(JYt(),Na)});var YYt=x(_T=>{"use strict";var g1n=_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]}),y1n=_T&&_T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O3e=_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)&&g1n(e,t,r);return y1n(e,t),e};Object.defineProperty(_T,"__esModule",{value:!0});_T.batchJobsCancel=C1n;var b1n=Si(),Ahe=O3e(Ci()),_1n=Ke(),v1n=Ce(),ZYt=Oi(),w1n=Ho(),x1n=O3e(io()),S1n=O3e(Vl());async function C1n(t,e,r){let n=(0,v1n.safeParse)(e,_=>S1n.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,b1n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,w1n.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,_1n.compactMap)({Accept:"application/json"})),l=await(0,ZYt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ZYt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Ahe.match(Ahe.json(200,x1n.BatchJobOut$inboundSchema),Ahe.fail("4XX"),Ahe.fail("5XX"))(g);return y.ok,y}});var tXt=x(vT=>{"use strict";var O1n=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]}),E1n=vT&&vT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eXt=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)&&O1n(e,t,r);return E1n(e,t),e};Object.defineProperty(vT,"__esModule",{value:!0});vT.batchJobsCreate=M1n;var P1n=Si(),Ihe=eXt(Ci()),T1n=Ke(),A1n=Ce(),XYt=Oi(),I1n=Ho(),QYt=eXt(io());async function M1n(t,e,r){let n=(0,A1n.safeParse)(e,y=>QYt.BatchJobIn$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,P1n.encodeJSON)("body",o,{explode:!0}),a=(0,I1n.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,T1n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,XYt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,XYt.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,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[g]=await Ihe.match(Ihe.json(200,QYt.BatchJobOut$inboundSchema),Ihe.fail("4XX"),Ihe.fail("5XX"))(m);return g.ok,g}});var nXt=x(wT=>{"use strict";var R1n=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]}),N1n=wT&&wT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E3e=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)&&R1n(e,t,r);return N1n(e,t),e};Object.defineProperty(wT,"__esModule",{value:!0});wT.batchJobsGet=B1n;var j1n=Si(),Mhe=E3e(Ci()),D1n=Ke(),L1n=Ce(),rXt=Oi(),F1n=Ho(),k1n=E3e(io()),$1n=E3e(Vl());async function B1n(t,e,r){let n=(0,L1n.safeParse)(e,_=>$1n.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,j1n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,F1n.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,D1n.compactMap)({Accept:"application/json"})),l=await(0,rXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,rXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Mhe.match(Mhe.json(200,k1n.BatchJobOut$inboundSchema),Mhe.fail("4XX"),Mhe.fail("5XX"))(g);return y.ok,y}});var iXt=x(xT=>{"use strict";var z1n=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]}),U1n=xT&&xT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P3e=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)&&z1n(e,t,r);return U1n(e,t),e};Object.defineProperty(xT,"__esModule",{value:!0});xT.batchJobsList=J1n;var q1n=Si(),Rhe=P3e(Ci()),H1n=Ke(),V1n=Ce(),oXt=Oi(),W1n=Ho(),K1n=P3e(io()),G1n=P3e(Vl());async function J1n(t,e,r){let n=(0,V1n.safeParse)(e,_=>G1n.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,W1n.pathToFunc)("/v1/batch/jobs")(),s=(0,q1n.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,H1n.compactMap)({Accept:"application/json"})),l=await(0,oXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,oXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Rhe.match(Rhe.json(200,K1n.BatchJobsOut$inboundSchema),Rhe.fail("4XX"),Rhe.fail("5XX"))(g);return y.ok,y}});var aXt=x(jhe=>{"use strict";Object.defineProperty(jhe,"__esModule",{value:!0});jhe.MistralJobs=void 0;var Z1n=YYt(),Y1n=tXt(),X1n=nXt(),Q1n=iXt(),eNn=_g(),Nhe=By(),T3e=class extends eNn.ClientSDK{async list(e,r){return(0,Nhe.unwrapAsync)((0,Q1n.batchJobsList)(this,e,r))}async create(e,r){return(0,Nhe.unwrapAsync)((0,Y1n.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Nhe.unwrapAsync)((0,X1n.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Nhe.unwrapAsync)((0,Z1n.batchJobsCancel)(this,e,r))}};jhe.MistralJobs=T3e});var sXt=x(Dhe=>{"use strict";Object.defineProperty(Dhe,"__esModule",{value:!0});Dhe.Batch=void 0;var tNn=_g(),rNn=aXt(),A3e=class extends tNn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new rNn.MistralJobs(this._options))}};Dhe.Batch=A3e});var cXt=x(ST=>{"use strict";var nNn=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]}),oNn=ST&&ST.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I3e=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)&&nNn(e,t,r);return oNn(e,t),e};Object.defineProperty(ST,"__esModule",{value:!0});ST.chatComplete=cNn;var iNn=Si(),BJ=I3e(Ci()),aNn=Ke(),sNn=Ce(),uXt=Oi(),uNn=Ho(),lXt=I3e(io()),lNn=I3e(wg());async function cNn(t,e,r){let n=(0,sNn.safeParse)(e,_=>lXt.ChatCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,iNn.encodeJSON)("body",o,{explode:!0}),a=(0,uNn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,aNn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,uXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,uXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await BJ.match(BJ.json(200,lXt.ChatCompletionResponse$inboundSchema),BJ.jsonErr(422,lNn.HTTPValidationError$inboundSchema),BJ.fail("4XX"),BJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var pXt=x(CT=>{"use strict";var dNn=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]}),fNn=CT&&CT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lhe=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)&&dNn(e,t,r);return fNn(e,t),e};Object.defineProperty(CT,"__esModule",{value:!0});CT.chatStream=vNn;var pNn=Lhe(Ie()),mNn=Si(),hNn=TJ(),zJ=Lhe(Ci()),gNn=Ke(),yNn=Ce(),dXt=Oi(),bNn=Ho(),fXt=Lhe(io()),_Nn=Lhe(wg());async function vNn(t,e,r){let n=(0,yNn.safeParse)(e,_=>fXt.ChatCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,mNn.encodeJSON)("body",o,{explode:!0}),a=(0,bNn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,gNn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,dXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,dXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await zJ.match(zJ.sse(200,pNn.instanceof(ReadableStream).transform(_=>new hNn.EventStream({stream:_,decoder(w){return fXt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),zJ.jsonErr(422,_Nn.HTTPValidationError$inboundSchema),zJ.fail("4XX"),zJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var Fhe=x(jO=>{"use strict";Object.defineProperty(jO,"__esModule",{value:!0});jO.getDefaultOptions=jO.defaultOptions=jO.ignoreOverride=void 0;jO.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");jO.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 wNn=t=>typeof t=="string"?{...jO.defaultOptions,name:t}:{...jO.defaultOptions,...t};jO.getDefaultOptions=wNn});var M3e=x(khe=>{"use strict";Object.defineProperty(khe,"__esModule",{value:!0});khe.getRefs=void 0;var xNn=Fhe(),SNn=t=>{let e=(0,xNn.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}]))}};khe.getRefs=SNn});var d1=x(rH=>{"use strict";Object.defineProperty(rH,"__esModule",{value:!0});rH.setResponseValueAndErrors=rH.addErrorMessage=void 0;function mXt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}rH.addErrorMessage=mXt;function CNn(t,e,r,n,o){t[e]=r,mXt(t,e,n,o)}rH.setResponseValueAndErrors=CNn});var R3e=x($he=>{"use strict";Object.defineProperty($he,"__esModule",{value:!0});$he.parseAnyDef=void 0;function ONn(){return{}}$he.parseAnyDef=ONn});var N3e=x(zhe=>{"use strict";Object.defineProperty(zhe,"__esModule",{value:!0});zhe.parseArrayDef=void 0;var ENn=Ie(),Bhe=d1(),PNn=Wl();function TNn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==ENn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,PNn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Bhe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Bhe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Bhe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Bhe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}zhe.parseArrayDef=TNn});var j3e=x(Uhe=>{"use strict";Object.defineProperty(Uhe,"__esModule",{value:!0});Uhe.parseBigintDef=void 0;var Dk=d1();function ANn(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,Dk.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,Dk.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,Dk.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,Dk.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,Dk.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,Dk.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,Dk.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Uhe.parseBigintDef=ANn});var D3e=x(qhe=>{"use strict";Object.defineProperty(qhe,"__esModule",{value:!0});qhe.parseBooleanDef=void 0;function INn(){return{type:"boolean"}}qhe.parseBooleanDef=INn});var Vhe=x(Hhe=>{"use strict";Object.defineProperty(Hhe,"__esModule",{value:!0});Hhe.parseBrandedDef=void 0;var MNn=Wl();function RNn(t,e){return(0,MNn.parseDef)(t.type._def,e)}Hhe.parseBrandedDef=RNn});var L3e=x(Whe=>{"use strict";Object.defineProperty(Whe,"__esModule",{value:!0});Whe.parseCatchDef=void 0;var NNn=Wl(),jNn=(t,e)=>(0,NNn.parseDef)(t.innerType._def,e);Whe.parseCatchDef=jNn});var F3e=x(Khe=>{"use strict";Object.defineProperty(Khe,"__esModule",{value:!0});Khe.parseDateDef=void 0;var hXt=d1();function gXt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>gXt(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 DNn(t,e)}}Khe.parseDateDef=gXt;var DNn=(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,hXt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,hXt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var k3e=x(Ghe=>{"use strict";Object.defineProperty(Ghe,"__esModule",{value:!0});Ghe.parseDefaultDef=void 0;var LNn=Wl();function FNn(t,e){return{...(0,LNn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}Ghe.parseDefaultDef=FNn});var $3e=x(Jhe=>{"use strict";Object.defineProperty(Jhe,"__esModule",{value:!0});Jhe.parseEffectsDef=void 0;var kNn=Wl();function $Nn(t,e){return e.effectStrategy==="input"?(0,kNn.parseDef)(t.schema._def,e):{}}Jhe.parseEffectsDef=$Nn});var B3e=x(Zhe=>{"use strict";Object.defineProperty(Zhe,"__esModule",{value:!0});Zhe.parseEnumDef=void 0;function BNn(t){return{type:"string",enum:Array.from(t.values)}}Zhe.parseEnumDef=BNn});var z3e=x(Yhe=>{"use strict";Object.defineProperty(Yhe,"__esModule",{value:!0});Yhe.parseIntersectionDef=void 0;var yXt=Wl(),zNn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function UNn(t,e){let r=[(0,yXt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,yXt.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(zNn(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}Yhe.parseIntersectionDef=UNn});var U3e=x(Xhe=>{"use strict";Object.defineProperty(Xhe,"__esModule",{value:!0});Xhe.parseLiteralDef=void 0;function qNn(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}}Xhe.parseLiteralDef=qNn});var Qhe=x(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.parseStringDef=ef.zodPatterns=void 0;var Lk=d1(),q3e;ef.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:()=>(q3e===void 0&&(q3e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),q3e),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 HNn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,Lk.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,Lk.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":F_(r,"email",n.message,e);break;case"format:idn-email":F_(r,"idn-email",n.message,e);break;case"pattern:zod":Yp(r,ef.zodPatterns.email,n.message,e);break}break;case"url":F_(r,"uri",n.message,e);break;case"uuid":F_(r,"uuid",n.message,e);break;case"regex":Yp(r,n.regex,n.message,e);break;case"cuid":Yp(r,ef.zodPatterns.cuid,n.message,e);break;case"cuid2":Yp(r,ef.zodPatterns.cuid2,n.message,e);break;case"startsWith":Yp(r,RegExp(`^${H3e(n.value,e)}`),n.message,e);break;case"endsWith":Yp(r,RegExp(`${H3e(n.value,e)}$`),n.message,e);break;case"datetime":F_(r,"date-time",n.message,e);break;case"date":F_(r,"date",n.message,e);break;case"time":F_(r,"time",n.message,e);break;case"duration":F_(r,"duration",n.message,e);break;case"length":(0,Lk.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,Lk.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Yp(r,RegExp(H3e(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&F_(r,"ipv4",n.message,e),n.version!=="v4"&&F_(r,"ipv6",n.message,e);break}case"base64url":Yp(r,ef.zodPatterns.base64url,n.message,e);break;case"jwt":Yp(r,ef.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Yp(r,ef.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&Yp(r,ef.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":Yp(r,ef.zodPatterns.emoji(),n.message,e);break;case"ulid":{Yp(r,ef.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{F_(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,Lk.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Yp(r,ef.zodPatterns.base64,n.message,e);break}}break}case"nanoid":Yp(r,ef.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}ef.parseStringDef=HNn;function H3e(t,e){return e.patternStrategy==="escape"?WNn(t):t}var VNn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function WNn(t){let e="";for(let r=0;r<t.length;r++)VNn.has(t[r])||(e+="\\"),e+=t[r];return e}function F_(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,Lk.setResponseValueAndErrors)(t,"format",e,r,n)}function Yp(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:bXt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,Lk.setResponseValueAndErrors)(t,"pattern",bXt(e,n),r,n)}function bXt(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 tge=x(ege=>{"use strict";Object.defineProperty(ege,"__esModule",{value:!0});ege.parseRecordDef=void 0;var UJ=Ie(),_Xt=Wl(),KNn=Qhe(),GNn=Vhe();function JNn(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===UJ.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,_Xt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,_Xt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===UJ.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,KNn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===UJ.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===UJ.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===UJ.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,GNn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}ege.parseRecordDef=JNn});var V3e=x(rge=>{"use strict";Object.defineProperty(rge,"__esModule",{value:!0});rge.parseMapDef=void 0;var vXt=Wl(),ZNn=tge();function YNn(t,e){if(e.mapStrategy==="record")return(0,ZNn.parseRecordDef)(t,e);let r=(0,vXt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,vXt.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}}}rge.parseMapDef=YNn});var W3e=x(nge=>{"use strict";Object.defineProperty(nge,"__esModule",{value:!0});nge.parseNativeEnumDef=void 0;function XNn(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}}nge.parseNativeEnumDef=XNn});var K3e=x(oge=>{"use strict";Object.defineProperty(oge,"__esModule",{value:!0});oge.parseNeverDef=void 0;function QNn(){return{not:{}}}oge.parseNeverDef=QNn});var G3e=x(ige=>{"use strict";Object.defineProperty(ige,"__esModule",{value:!0});ige.parseNullDef=void 0;function ejn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}ige.parseNullDef=ejn});var age=x(f1=>{"use strict";Object.defineProperty(f1,"__esModule",{value:!0});f1.parseUnionDef=f1.primitiveMappings=void 0;var tjn=Wl();f1.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function rjn(t,e){if(e.target==="openApi3")return wXt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in f1.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=f1.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 wXt(t,e)}f1.parseUnionDef=rjn;var wXt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,tjn.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 J3e=x(sge=>{"use strict";Object.defineProperty(sge,"__esModule",{value:!0});sge.parseNullableDef=void 0;var xXt=Wl(),SXt=age();function njn(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:SXt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[SXt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,xXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,xXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}sge.parseNullableDef=njn});var Z3e=x(uge=>{"use strict";Object.defineProperty(uge,"__esModule",{value:!0});uge.parseNumberDef=void 0;var p1=d1();function ojn(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,p1.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,p1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,p1.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,p1.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,p1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,p1.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,p1.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,p1.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}uge.parseNumberDef=ojn});var X3e=x(lge=>{"use strict";Object.defineProperty(lge,"__esModule",{value:!0});lge.parseObjectDef=void 0;var ijn=Ie(),Y3e=Wl();function ajn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,Y3e.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,Y3e.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function sjn(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 ijn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,Y3e.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:ajn(t,e)};return n.required.length||delete n.required,n}lge.parseObjectDef=sjn});var Q3e=x(cge=>{"use strict";Object.defineProperty(cge,"__esModule",{value:!0});cge.parseOptionalDef=void 0;var CXt=Wl(),ujn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,CXt.parseDef)(t.innerType._def,e);let r=(0,CXt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};cge.parseOptionalDef=ujn});var eHe=x(fge=>{"use strict";Object.defineProperty(fge,"__esModule",{value:!0});fge.parsePipelineDef=void 0;var dge=Wl(),ljn=(t,e)=>{if(e.pipeStrategy==="input")return(0,dge.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,dge.parseDef)(t.out._def,e);let r=(0,dge.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,dge.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};fge.parsePipelineDef=ljn});var tHe=x(pge=>{"use strict";Object.defineProperty(pge,"__esModule",{value:!0});pge.parsePromiseDef=void 0;var cjn=Wl();function djn(t,e){return(0,cjn.parseDef)(t.type._def,e)}pge.parsePromiseDef=djn});var rHe=x(mge=>{"use strict";Object.defineProperty(mge,"__esModule",{value:!0});mge.parseSetDef=void 0;var OXt=d1(),fjn=Wl();function pjn(t,e){let n={type:"array",uniqueItems:!0,items:(0,fjn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,OXt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,OXt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}mge.parseSetDef=pjn});var oHe=x(hge=>{"use strict";Object.defineProperty(hge,"__esModule",{value:!0});hge.parseTupleDef=void 0;var nHe=Wl();function mjn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,nHe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,nHe.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,nHe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}hge.parseTupleDef=mjn});var iHe=x(gge=>{"use strict";Object.defineProperty(gge,"__esModule",{value:!0});gge.parseUndefinedDef=void 0;function hjn(){return{not:{}}}gge.parseUndefinedDef=hjn});var aHe=x(yge=>{"use strict";Object.defineProperty(yge,"__esModule",{value:!0});yge.parseUnknownDef=void 0;function gjn(){return{}}yge.parseUnknownDef=gjn});var sHe=x(bge=>{"use strict";Object.defineProperty(bge,"__esModule",{value:!0});bge.parseReadonlyDef=void 0;var yjn=Wl(),bjn=(t,e)=>(0,yjn.parseDef)(t.innerType._def,e);bge.parseReadonlyDef=bjn});var Wl=x(_ge=>{"use strict";Object.defineProperty(_ge,"__esModule",{value:!0});_ge.parseDef=void 0;var ao=Ie(),_jn=R3e(),vjn=N3e(),wjn=j3e(),xjn=D3e(),Sjn=Vhe(),Cjn=L3e(),Ojn=F3e(),Ejn=k3e(),Pjn=$3e(),Tjn=B3e(),Ajn=z3e(),Ijn=U3e(),Mjn=V3e(),Rjn=W3e(),Njn=K3e(),jjn=G3e(),Djn=J3e(),Ljn=Z3e(),Fjn=X3e(),kjn=Q3e(),$jn=eHe(),Bjn=tHe(),zjn=tge(),Ujn=rHe(),qjn=Qhe(),Hjn=oHe(),Vjn=iHe(),Wjn=age(),Kjn=aHe(),Gjn=sHe(),Jjn=Fhe();function EXt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Jjn.ignoreOverride)return a}if(n&&!r){let a=Zjn(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=Xjn(t,t.typeName,e);return i&&Qjn(t,e,i),o.jsonSchema=i,i}_ge.parseDef=EXt;var Zjn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Yjn(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}},Yjn=(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("/")},Xjn=(t,e,r)=>{switch(e){case ao.ZodFirstPartyTypeKind.ZodString:return(0,qjn.parseStringDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodNumber:return(0,Ljn.parseNumberDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodObject:return(0,Fjn.parseObjectDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodBigInt:return(0,wjn.parseBigintDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodBoolean:return(0,xjn.parseBooleanDef)();case ao.ZodFirstPartyTypeKind.ZodDate:return(0,Ojn.parseDateDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodUndefined:return(0,Vjn.parseUndefinedDef)();case ao.ZodFirstPartyTypeKind.ZodNull:return(0,jjn.parseNullDef)(r);case ao.ZodFirstPartyTypeKind.ZodArray:return(0,vjn.parseArrayDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodUnion:case ao.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,Wjn.parseUnionDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodIntersection:return(0,Ajn.parseIntersectionDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodTuple:return(0,Hjn.parseTupleDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodRecord:return(0,zjn.parseRecordDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodLiteral:return(0,Ijn.parseLiteralDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodEnum:return(0,Tjn.parseEnumDef)(t);case ao.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,Rjn.parseNativeEnumDef)(t);case ao.ZodFirstPartyTypeKind.ZodNullable:return(0,Djn.parseNullableDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodOptional:return(0,kjn.parseOptionalDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodMap:return(0,Mjn.parseMapDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodSet:return(0,Ujn.parseSetDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodLazy:return EXt(t.getter()._def,r);case ao.ZodFirstPartyTypeKind.ZodPromise:return(0,Bjn.parsePromiseDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodNaN:case ao.ZodFirstPartyTypeKind.ZodNever:return(0,Njn.parseNeverDef)();case ao.ZodFirstPartyTypeKind.ZodEffects:return(0,Pjn.parseEffectsDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodAny:return(0,_jn.parseAnyDef)();case ao.ZodFirstPartyTypeKind.ZodUnknown:return(0,Kjn.parseUnknownDef)();case ao.ZodFirstPartyTypeKind.ZodDefault:return(0,Ejn.parseDefaultDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodBranded:return(0,Sjn.parseBrandedDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodReadonly:return(0,Gjn.parseReadonlyDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodCatch:return(0,Cjn.parseCatchDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodPipeline:return(0,$jn.parsePipelineDef)(t,r);case ao.ZodFirstPartyTypeKind.ZodFunction:case ao.ZodFirstPartyTypeKind.ZodVoid:case ao.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},Qjn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var uHe=x(vge=>{"use strict";Object.defineProperty(vge,"__esModule",{value:!0});vge.zodToJsonSchema=void 0;var PXt=Wl(),eDn=M3e(),tDn=(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,PXt.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,PXt.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};vge.zodToJsonSchema=tDn});var TXt=x(bn=>{"use strict";var rDn=bn&&bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vo=bn&&bn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rDn(e,t,r)};Object.defineProperty(bn,"__esModule",{value:!0});vo(Fhe(),bn);vo(M3e(),bn);vo(d1(),bn);vo(Wl(),bn);vo(R3e(),bn);vo(N3e(),bn);vo(j3e(),bn);vo(D3e(),bn);vo(Vhe(),bn);vo(L3e(),bn);vo(F3e(),bn);vo(k3e(),bn);vo($3e(),bn);vo(B3e(),bn);vo(z3e(),bn);vo(U3e(),bn);vo(V3e(),bn);vo(W3e(),bn);vo(K3e(),bn);vo(G3e(),bn);vo(J3e(),bn);vo(Z3e(),bn);vo(X3e(),bn);vo(Q3e(),bn);vo(eHe(),bn);vo(tHe(),bn);vo(sHe(),bn);vo(tge(),bn);vo(rHe(),bn);vo(Qhe(),bn);vo(oHe(),bn);vo(iHe(),bn);vo(age(),bn);vo(aHe(),bn);vo(uHe(),bn);var nDn=uHe();bn.default=nDn.zodToJsonSchema});var IXt=x(qJ=>{"use strict";Object.defineProperty(qJ,"__esModule",{value:!0});qJ.transformToChatCompletionRequest=iDn;qJ.convertToParsedChatCompletionResponse=aDn;qJ.responseFormatFromZodObject=AXt;var oDn=TXt();function iDn(t){let{responseFormat:e,...r}=t,n=AXt(e);return{...r,responseFormat:n}}function aDn(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 AXt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,oDn.zodToJsonSchema)(t),strict:!0}}}});var NXt=x(xge=>{"use strict";Object.defineProperty(xge,"__esModule",{value:!0});xge.Chat=void 0;var MXt=cXt(),RXt=pXt(),sDn=_g(),wge=By(),lHe=IXt(),cHe=class extends sDn.ClientSDK{async parse(e,r){let n=(0,lHe.transformToChatCompletionRequest)(e),o=await(0,wge.unwrapAsync)((0,MXt.chatComplete)(this,n,r));return(0,lHe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,lHe.transformToChatCompletionRequest)(e);return(0,wge.unwrapAsync)((0,RXt.chatStream)(this,n,r))}async complete(e,r){return(0,wge.unwrapAsync)((0,MXt.chatComplete)(this,e,r))}async stream(e,r){return(0,wge.unwrapAsync)((0,RXt.chatStream)(this,e,r))}};xge.Chat=cHe});var LXt=x(OT=>{"use strict";var uDn=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]}),lDn=OT&&OT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dHe=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)&&uDn(e,t,r);return lDn(e,t),e};Object.defineProperty(OT,"__esModule",{value:!0});OT.classifiersModerate=hDn;var cDn=Si(),HJ=dHe(Ci()),dDn=Ke(),fDn=Ce(),jXt=Oi(),pDn=Ho(),DXt=dHe(io()),mDn=dHe(wg());async function hDn(t,e,r){let n=(0,fDn.safeParse)(e,_=>DXt.ClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,cDn.encodeJSON)("body",o,{explode:!0}),a=(0,pDn.pathToFunc)("/v1/moderations")(),s=new Headers((0,dDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,jXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,jXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await HJ.match(HJ.json(200,DXt.ClassificationResponse$inboundSchema),HJ.jsonErr(422,mDn.HTTPValidationError$inboundSchema),HJ.fail("4XX"),HJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var $Xt=x(ET=>{"use strict";var gDn=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]}),yDn=ET&&ET.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fHe=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)&&gDn(e,t,r);return yDn(e,t),e};Object.defineProperty(ET,"__esModule",{value:!0});ET.classifiersModerateChat=SDn;var bDn=Si(),VJ=fHe(Ci()),_Dn=Ke(),vDn=Ce(),FXt=Oi(),wDn=Ho(),kXt=fHe(io()),xDn=fHe(wg());async function SDn(t,e,r){let n=(0,vDn.safeParse)(e,_=>kXt.ChatClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,bDn.encodeJSON)("body",o,{explode:!0}),a=(0,wDn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,_Dn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,FXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,FXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await VJ.match(VJ.json(200,kXt.ClassificationResponse$inboundSchema),VJ.jsonErr(422,xDn.HTTPValidationError$inboundSchema),VJ.fail("4XX"),VJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var zXt=x(Sge=>{"use strict";Object.defineProperty(Sge,"__esModule",{value:!0});Sge.Classifiers=void 0;var CDn=LXt(),ODn=$Xt(),EDn=_g(),BXt=By(),pHe=class extends EDn.ClientSDK{async moderate(e,r){return(0,BXt.unwrapAsync)((0,CDn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,BXt.unwrapAsync)((0,ODn.classifiersModerateChat)(this,e,r))}};Sge.Classifiers=pHe});var HXt=x(PT=>{"use strict";var PDn=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]}),TDn=PT&&PT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mHe=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)&&PDn(e,t,r);return TDn(e,t),e};Object.defineProperty(PT,"__esModule",{value:!0});PT.embeddingsCreate=jDn;var ADn=Si(),WJ=mHe(Ci()),IDn=Ke(),MDn=Ce(),UXt=Oi(),RDn=Ho(),qXt=mHe(io()),NDn=mHe(wg());async function jDn(t,e,r){let n=(0,MDn.safeParse)(e,_=>qXt.EmbeddingRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,ADn.encodeJSON)("body",o,{explode:!0}),a=(0,RDn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,IDn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,UXt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,UXt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await WJ.match(WJ.json(200,qXt.EmbeddingResponse$inboundSchema),WJ.jsonErr(422,NDn.HTTPValidationError$inboundSchema),WJ.fail("4XX"),WJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var VXt=x(Cge=>{"use strict";Object.defineProperty(Cge,"__esModule",{value:!0});Cge.Embeddings=void 0;var DDn=HXt(),LDn=_g(),FDn=By(),hHe=class extends LDn.ClientSDK{async create(e,r){return(0,FDn.unwrapAsync)((0,DDn.embeddingsCreate)(this,e,r))}};Cge.Embeddings=hHe});var KXt=x(TT=>{"use strict";var kDn=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]}),$Dn=TT&&TT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gHe=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)&&kDn(e,t,r);return $Dn(e,t),e};Object.defineProperty(TT,"__esModule",{value:!0});TT.filesDelete=WDn;var BDn=Si(),Oge=gHe(Ci()),zDn=Ke(),UDn=Ce(),WXt=Oi(),qDn=Ho(),HDn=gHe(io()),VDn=gHe(Vl());async function WDn(t,e,r){let n=(0,UDn.safeParse)(e,_=>VDn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,BDn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,qDn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,zDn.compactMap)({Accept:"application/json"})),l=await(0,WXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,WXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Oge.match(Oge.json(200,HDn.DeleteFileOut$inboundSchema),Oge.fail("4XX"),Oge.fail("5XX"))(g);return y.ok,y}});var JXt=x(AT=>{"use strict";var KDn=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]}),GDn=AT&&AT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yHe=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)&&KDn(e,t,r);return GDn(e,t),e};Object.defineProperty(AT,"__esModule",{value:!0});AT.filesDownload=tLn;var JDn=yHe(Ie()),ZDn=Si(),Ege=yHe(Ci()),YDn=Ke(),XDn=Ce(),GXt=Oi(),QDn=Ho(),eLn=yHe(Vl());async function tLn(t,e,r){let n=(0,XDn.safeParse)(e,_=>eLn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,ZDn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,QDn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,YDn.compactMap)({Accept:"application/octet-stream"})),l=await(0,GXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,GXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Ege.match(Ege.stream(200,JDn.instanceof(ReadableStream)),Ege.fail("4XX"),Ege.fail("5XX"))(g);return y.ok,y}});var XXt=x(IT=>{"use strict";var rLn=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]}),nLn=IT&&IT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bHe=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)&&rLn(e,t,r);return nLn(e,t),e};Object.defineProperty(IT,"__esModule",{value:!0});IT.filesGetSignedUrl=lLn;var ZXt=Si(),Pge=bHe(Ci()),oLn=Ke(),iLn=Ce(),YXt=Oi(),aLn=Ho(),sLn=bHe(io()),uLn=bHe(Vl());async function lLn(t,e,r){let n=(0,iLn.safeParse)(e,w=>uLn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,ZXt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,aLn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,ZXt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,oLn.compactMap)({Accept:"application/json"})),c=await(0,YXt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,YXt.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"]},h=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(!h.ok)return h;let m=h.value,g=await t._do(m,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!g.ok)return g;let y=g.value,[_]=await Pge.match(Pge.json(200,sLn.FileSignedURL$inboundSchema),Pge.fail("4XX"),Pge.fail("5XX"))(y);return _.ok,_}});var eQt=x(MT=>{"use strict";var cLn=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]}),dLn=MT&&MT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_He=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)&&cLn(e,t,r);return dLn(e,t),e};Object.defineProperty(MT,"__esModule",{value:!0});MT.filesList=bLn;var fLn=Si(),Tge=_He(Ci()),pLn=Ke(),mLn=Ce(),QXt=Oi(),hLn=Ho(),gLn=_He(io()),yLn=_He(Vl());async function bLn(t,e,r){let n=(0,mLn.safeParse)(e,_=>yLn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,hLn.pathToFunc)("/v1/files")(),s=(0,fLn.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,pLn.compactMap)({Accept:"application/json"})),l=await(0,QXt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,QXt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Tge.match(Tge.json(200,gLn.ListFilesOut$inboundSchema),Tge.fail("4XX"),Tge.fail("5XX"))(g);return y.ok,y}});var rQt=x(RT=>{"use strict";var _Ln=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]}),vLn=RT&&RT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vHe=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)&&_Ln(e,t,r);return vLn(e,t),e};Object.defineProperty(RT,"__esModule",{value:!0});RT.filesRetrieve=PLn;var wLn=Si(),Age=vHe(Ci()),xLn=Ke(),SLn=Ce(),tQt=Oi(),CLn=Ho(),OLn=vHe(io()),ELn=vHe(Vl());async function PLn(t,e,r){let n=(0,SLn.safeParse)(e,_=>ELn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,wLn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,CLn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,xLn.compactMap)({Accept:"application/json"})),l=await(0,tQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,tQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Age.match(Age.json(200,OLn.RetrieveFileOut$inboundSchema),Age.fail("4XX"),Age.fail("5XX"))(g);return y.ok,y}});var nQt=x(wHe=>{"use strict";Object.defineProperty(wHe,"__esModule",{value:!0});wHe.isReadableStream=TLn;function TLn(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 iQt=x(NT=>{"use strict";var ALn=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]}),ILn=NT&&NT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xHe=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)&&ALn(e,t,r);return ILn(e,t),e};Object.defineProperty(NT,"__esModule",{value:!0});NT.filesUpload=$Ln;var Ige=Si(),MLn=o4e(),Mge=xHe(Ci()),RLn=Ke(),NLn=Ce(),oQt=Oi(),jLn=Ho(),DLn=xHe(io()),LLn=xHe(Vl()),FLn=C3e(),kLn=nQt();async function $Ln(t,e,r){let n=(0,NLn.safeParse)(e,y=>LLn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,FLn.isBlobLike)(o.file))(0,Ige.appendForm)(i,"file",o.file);else if((0,kLn.isReadableStream)(o.file.content)){let y=await(0,MLn.readableStreamToArrayBuffer)(o.file.content),_=new Blob([y],{type:"application/octet-stream"});(0,Ige.appendForm)(i,"file",_)}else(0,Ige.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,Ige.appendForm)(i,"purpose",o.purpose);let a=(0,jLn.pathToFunc)("/v1/files")(),s=new Headers((0,RLn.compactMap)({Accept:"application/json"})),u=await(0,oQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,oQt.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,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[g]=await Mge.match(Mge.json(200,DLn.UploadFileOut$inboundSchema),Mge.fail("4XX"),Mge.fail("5XX"))(m);return g.ok,g}});var aQt=x(Rge=>{"use strict";Object.defineProperty(Rge,"__esModule",{value:!0});Rge.Files=void 0;var BLn=KXt(),zLn=JXt(),ULn=XXt(),qLn=eQt(),HLn=rQt(),VLn=iQt(),WLn=_g(),nH=By(),SHe=class extends WLn.ClientSDK{async upload(e,r){return(0,nH.unwrapAsync)((0,VLn.filesUpload)(this,e,r))}async list(e,r){return(0,nH.unwrapAsync)((0,qLn.filesList)(this,e,r))}async retrieve(e,r){return(0,nH.unwrapAsync)((0,HLn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,nH.unwrapAsync)((0,BLn.filesDelete)(this,e,r))}async download(e,r){return(0,nH.unwrapAsync)((0,zLn.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,nH.unwrapAsync)((0,ULn.filesGetSignedUrl)(this,e,r))}};Rge.Files=SHe});var lQt=x(jT=>{"use strict";var KLn=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]}),GLn=jT&&jT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CHe=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)&&KLn(e,t,r);return GLn(e,t),e};Object.defineProperty(jT,"__esModule",{value:!0});jT.fimComplete=eFn;var JLn=Si(),KJ=CHe(Ci()),ZLn=Ke(),YLn=Ce(),sQt=Oi(),XLn=Ho(),uQt=CHe(io()),QLn=CHe(wg());async function eFn(t,e,r){let n=(0,YLn.safeParse)(e,_=>uQt.FIMCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,JLn.encodeJSON)("body",o,{explode:!0}),a=(0,XLn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,ZLn.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await KJ.match(KJ.json(200,uQt.FIMCompletionResponse$inboundSchema),KJ.jsonErr(422,QLn.HTTPValidationError$inboundSchema),KJ.fail("4XX"),KJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var fQt=x(DT=>{"use strict";var tFn=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]}),rFn=DT&&DT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nge=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)&&tFn(e,t,r);return rFn(e,t),e};Object.defineProperty(DT,"__esModule",{value:!0});DT.fimStream=cFn;var nFn=Nge(Ie()),oFn=Si(),iFn=TJ(),GJ=Nge(Ci()),aFn=Ke(),sFn=Ce(),cQt=Oi(),uFn=Ho(),dQt=Nge(io()),lFn=Nge(wg());async function cFn(t,e,r){let n=(0,sFn.safeParse)(e,_=>dQt.FIMCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,oFn.encodeJSON)("body",o,{explode:!0}),a=(0,uFn.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,aFn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,cQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,cQt.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,h=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,g={HttpMeta:{Response:m,Request:p}},[y]=await GJ.match(GJ.sse(200,nFn.instanceof(ReadableStream).transform(_=>new iFn.EventStream({stream:_,decoder(w){return dQt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),GJ.jsonErr(422,lFn.HTTPValidationError$inboundSchema),GJ.fail("4XX"),GJ.fail("5XX"))(m,{extraFields:g});return y.ok,y}});var mQt=x(jge=>{"use strict";Object.defineProperty(jge,"__esModule",{value:!0});jge.Fim=void 0;var dFn=lQt(),fFn=fQt(),pFn=_g(),pQt=By(),OHe=class extends pFn.ClientSDK{async complete(e,r){return(0,pQt.unwrapAsync)((0,dFn.fimComplete)(this,e,r))}async stream(e,r){return(0,pQt.unwrapAsync)((0,fFn.fimStream)(this,e,r))}};jge.Fim=OHe});var gQt=x(LT=>{"use strict";var mFn=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]}),hFn=LT&&LT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EHe=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)&&mFn(e,t,r);return hFn(e,t),e};Object.defineProperty(LT,"__esModule",{value:!0});LT.fineTuningJobsCancel=xFn;var gFn=Si(),Dge=EHe(Ci()),yFn=Ke(),bFn=Ce(),hQt=Oi(),_Fn=Ho(),vFn=EHe(io()),wFn=EHe(Vl());async function xFn(t,e,r){let n=(0,bFn.safeParse)(e,_=>wFn.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,gFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,_Fn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,yFn.compactMap)({Accept:"application/json"})),l=await(0,hQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Dge.match(Dge.json(200,vFn.DetailedJobOut$inboundSchema),Dge.fail("4XX"),Dge.fail("5XX"))(g);return y.ok,y}});var bQt=x(FT=>{"use strict";var SFn=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]}),CFn=FT&&FT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PHe=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)&&SFn(e,t,r);return CFn(e,t),e};Object.defineProperty(FT,"__esModule",{value:!0});FT.fineTuningJobsCreate=MFn;var OFn=Si(),Lge=PHe(Ci()),EFn=Ke(),PFn=Ce(),yQt=Oi(),TFn=Ho(),AFn=PHe(io()),IFn=PHe(Vl());async function MFn(t,e,r){let n=(0,PFn.safeParse)(e,y=>AFn.JobIn$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,OFn.encodeJSON)("body",o,{explode:!0}),a=(0,TFn.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,EFn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,yQt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,yQt.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,h=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!h.ok)return h;let m=h.value,[g]=await Lge.match(Lge.json(200,IFn.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Lge.fail("4XX"),Lge.fail("5XX"))(m);return g.ok,g}});var vQt=x(kT=>{"use strict";var RFn=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]}),NFn=kT&&kT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),THe=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)&&RFn(e,t,r);return NFn(e,t),e};Object.defineProperty(kT,"__esModule",{value:!0});kT.fineTuningJobsGet=BFn;var jFn=Si(),Fge=THe(Ci()),DFn=Ke(),LFn=Ce(),_Qt=Oi(),FFn=Ho(),kFn=THe(io()),$Fn=THe(Vl());async function BFn(t,e,r){let n=(0,LFn.safeParse)(e,_=>$Fn.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,jFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,FFn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,DFn.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_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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Fge.match(Fge.json(200,kFn.DetailedJobOut$inboundSchema),Fge.fail("4XX"),Fge.fail("5XX"))(g);return y.ok,y}});var xQt=x($T=>{"use strict";var zFn=$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]}),UFn=$T&&$T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AHe=$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)&&zFn(e,t,r);return UFn(e,t),e};Object.defineProperty($T,"__esModule",{value:!0});$T.fineTuningJobsList=JFn;var qFn=Si(),kge=AHe(Ci()),HFn=Ke(),VFn=Ce(),wQt=Oi(),WFn=Ho(),KFn=AHe(io()),GFn=AHe(Vl());async function JFn(t,e,r){let n=(0,VFn.safeParse)(e,_=>GFn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,WFn.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,qFn.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,HFn.compactMap)({Accept:"application/json"})),l=await(0,wQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await kge.match(kge.json(200,KFn.JobsOut$inboundSchema),kge.fail("4XX"),kge.fail("5XX"))(g);return y.ok,y}});var CQt=x(BT=>{"use strict";var ZFn=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]}),YFn=BT&&BT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IHe=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)&&ZFn(e,t,r);return YFn(e,t),e};Object.defineProperty(BT,"__esModule",{value:!0});BT.fineTuningJobsStart=okn;var XFn=Si(),$ge=IHe(Ci()),QFn=Ke(),ekn=Ce(),SQt=Oi(),tkn=Ho(),rkn=IHe(io()),nkn=IHe(Vl());async function okn(t,e,r){let n=(0,ekn.safeParse)(e,_=>nkn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,XFn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,tkn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,QFn.compactMap)({Accept:"application/json"})),l=await(0,SQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,SQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await $ge.match($ge.json(200,rkn.DetailedJobOut$inboundSchema),$ge.fail("4XX"),$ge.fail("5XX"))(g);return y.ok,y}});var OQt=x(Bge=>{"use strict";Object.defineProperty(Bge,"__esModule",{value:!0});Bge.Jobs=void 0;var ikn=gQt(),akn=bQt(),skn=vQt(),ukn=xQt(),lkn=CQt(),ckn=_g(),JJ=By(),MHe=class extends ckn.ClientSDK{async list(e,r){return(0,JJ.unwrapAsync)((0,ukn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,JJ.unwrapAsync)((0,akn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,JJ.unwrapAsync)((0,skn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,JJ.unwrapAsync)((0,ikn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,JJ.unwrapAsync)((0,lkn.fineTuningJobsStart)(this,e,r))}};Bge.Jobs=MHe});var EQt=x(zge=>{"use strict";Object.defineProperty(zge,"__esModule",{value:!0});zge.FineTuning=void 0;var dkn=_g(),fkn=OQt(),RHe=class extends dkn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new fkn.Jobs(this._options))}};zge.FineTuning=RHe});var TQt=x(zT=>{"use strict";var pkn=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]}),mkn=zT&&zT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NHe=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)&&pkn(e,t,r);return mkn(e,t),e};Object.defineProperty(zT,"__esModule",{value:!0});zT.modelsArchive=wkn;var hkn=Si(),Uge=NHe(Ci()),gkn=Ke(),ykn=Ce(),PQt=Oi(),bkn=Ho(),_kn=NHe(io()),vkn=NHe(Vl());async function wkn(t,e,r){let n=(0,ykn.safeParse)(e,_=>vkn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,hkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,bkn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,gkn.compactMap)({Accept:"application/json"})),l=await(0,PQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,PQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Uge.match(Uge.json(200,_kn.ArchiveFTModelOut$inboundSchema),Uge.fail("4XX"),Uge.fail("5XX"))(g);return y.ok,y}});var IQt=x(UT=>{"use strict";var xkn=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]}),Skn=UT&&UT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qge=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)&&xkn(e,t,r);return Skn(e,t),e};Object.defineProperty(UT,"__esModule",{value:!0});UT.modelsDelete=Mkn;var Ckn=Si(),ZJ=qge(Ci()),Okn=Ke(),Ekn=Ce(),AQt=Oi(),Pkn=Ho(),Tkn=qge(io()),Akn=qge(wg()),Ikn=qge(Vl());async function Mkn(t,e,r){let n=(0,Ekn.safeParse)(e,w=>Ikn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Ckn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Pkn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Okn.compactMap)({Accept:"application/json"})),l=await(0,AQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,AQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,y={HttpMeta:{Response:g,Request:h}},[_]=await ZJ.match(ZJ.json(200,Tkn.DeleteModelOut$inboundSchema),ZJ.jsonErr(422,Akn.HTTPValidationError$inboundSchema),ZJ.fail("4XX"),ZJ.fail("5XX"))(g,{extraFields:y});return _.ok,_}});var RQt=x(qT=>{"use strict";var Rkn=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]}),Nkn=qT&&qT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHe=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)&&Rkn(e,t,r);return Nkn(e,t),e};Object.defineProperty(qT,"__esModule",{value:!0});qT.modelsList=kkn;var YJ=jHe(Ci()),jkn=Ke(),MQt=Oi(),Dkn=Ho(),Lkn=jHe(io()),Fkn=jHe(wg());async function kkn(t,e){let r=(0,Dkn.pathToFunc)("/v1/models")(),n=new Headers((0,jkn.compactMap)({Accept:"application/json"})),o=await(0,MQt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,MQt.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 YJ.match(YJ.json(200,Lkn.ModelList$inboundSchema),YJ.jsonErr(422,Fkn.HTTPValidationError$inboundSchema),YJ.fail("4XX"),YJ.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var DQt=x(HT=>{"use strict";var $kn=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]}),Bkn=HT&&HT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DHe=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)&&$kn(e,t,r);return Bkn(e,t),e};Object.defineProperty(HT,"__esModule",{value:!0});HT.modelsRetrieve=Wkn;var zkn=Si(),XJ=DHe(Ci()),Ukn=Ke(),qkn=Ce(),NQt=Oi(),Hkn=Ho(),Vkn=DHe(wg()),jQt=DHe(Vl());async function Wkn(t,e,r){let n=(0,qkn.safeParse)(e,w=>jQt.RetrieveModelV1ModelsModelIdGetRequest$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,Hkn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Ukn.compactMap)({Accept:"application/json"})),l=await(0,NQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,NQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,y={HttpMeta:{Response:g,Request:h}},[_]=await XJ.match(XJ.json(200,jQt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),XJ.jsonErr(422,Vkn.HTTPValidationError$inboundSchema),XJ.fail("4XX"),XJ.fail("5XX"))(g,{extraFields:y});return _.ok,_}});var FQt=x(VT=>{"use strict";var Kkn=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]}),Gkn=VT&&VT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LHe=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)&&Kkn(e,t,r);return Gkn(e,t),e};Object.defineProperty(VT,"__esModule",{value:!0});VT.modelsUnarchive=t$n;var Jkn=Si(),Hge=LHe(Ci()),Zkn=Ke(),Ykn=Ce(),LQt=Oi(),Xkn=Ho(),Qkn=LHe(io()),e$n=LHe(Vl());async function t$n(t,e,r){let n=(0,Ykn.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,Jkn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Xkn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Zkn.compactMap)({Accept:"application/json"})),l=await(0,LQt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,LQt.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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Hge.match(Hge.json(200,Qkn.UnarchiveFTModelOut$inboundSchema),Hge.fail("4XX"),Hge.fail("5XX"))(g);return y.ok,y}});var BQt=x(WT=>{"use strict";var r$n=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]}),n$n=WT&&WT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FHe=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)&&r$n(e,t,r);return n$n(e,t),e};Object.defineProperty(WT,"__esModule",{value:!0});WT.modelsUpdate=l$n;var kQt=Si(),Vge=FHe(Ci()),o$n=Ke(),i$n=Ce(),$Qt=Oi(),a$n=Ho(),s$n=FHe(io()),u$n=FHe(Vl());async function l$n(t,e,r){let n=(0,i$n.safeParse)(e,_=>u$n.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,kQt.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,kQt.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,a$n.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,o$n.compactMap)({"Content-Type":"application/json",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_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 h=p.value,m=await t._do(h,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!m.ok)return m;let g=m.value,[y]=await Vge.match(Vge.json(200,s$n.FTModelOut$inboundSchema),Vge.fail("4XX"),Vge.fail("5XX"))(g);return y.ok,y}});var zQt=x(Wge=>{"use strict";Object.defineProperty(Wge,"__esModule",{value:!0});Wge.Models=void 0;var c$n=TQt(),d$n=IQt(),f$n=RQt(),p$n=DQt(),m$n=FQt(),h$n=BQt(),g$n=_g(),oH=By(),kHe=class extends g$n.ClientSDK{async list(e){return(0,oH.unwrapAsync)((0,f$n.modelsList)(this,e))}async retrieve(e,r){return(0,oH.unwrapAsync)((0,p$n.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,oH.unwrapAsync)((0,d$n.modelsDelete)(this,e,r))}async update(e,r){return(0,oH.unwrapAsync)((0,h$n.modelsUpdate)(this,e,r))}async archive(e,r){return(0,oH.unwrapAsync)((0,c$n.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,oH.unwrapAsync)((0,m$n.modelsUnarchive)(this,e,r))}};Wge.Models=kHe});var UQt=x(Kge=>{"use strict";Object.defineProperty(Kge,"__esModule",{value:!0});Kge.Mistral=void 0;var y$n=_g(),b$n=RZt(),_$n=sXt(),v$n=NXt(),w$n=zXt(),x$n=VXt(),S$n=aQt(),C$n=mQt(),O$n=EQt(),E$n=zQt(),$He=class extends y$n.ClientSDK{get models(){return this._models??(this._models=new E$n.Models(this._options))}get files(){return this._files??(this._files=new S$n.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new O$n.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new _$n.Batch(this._options))}get chat(){return this._chat??(this._chat=new v$n.Chat(this._options))}get fim(){return this._fim??(this._fim=new C$n.Fim(this._options))}get agents(){return this._agents??(this._agents=new b$n.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new x$n.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new w$n.Classifiers(this._options))}};Kge.Mistral=$He});var VQt=x(ph=>{"use strict";var qQt=ph&&ph.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),P$n=ph&&ph.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HQt=ph&&ph.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qQt(e,t,r)},T$n=ph&&ph.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qQt(e,t,r);return P$n(e,t),e};Object.defineProperty(ph,"__esModule",{value:!0});ph.files=void 0;HQt(Hpe(),ph);ph.files=T$n(o4e());HQt(UQt(),ph)});var BHe=b(()=>{PB()});function I$n(t){return A$n.test(t)}function M$n(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 R$n(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 zHe(t){if(I$n(t))return t;{let e=R$n(t),r=M$n(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function UHe(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 A$n,WQt=b(()=>{A$n=/^[a-zA-Z0-9]{9}$/});function KQt(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(Wi(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:zHe(i.id??"")})).map(oO)};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:zHe(o.tool_call_id)}:Wi(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function N$n(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=UHe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Qm(s,{returnId:!0});i.push({...u,id:u.id??qpe().replace(/-/g,"")})}catch(u){a.push(eh(s,u.message))}return new kn({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 Xs({content:o})}}function j$n(t,e){if(!t.content&&!t.toolCalls)return e?new Sr({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??qpe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=UHe(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 Cp({content:o}):n==="assistant"?new Sr({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 Vg({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new Eh({content:o,additional_kwargs:i}):new Sp({content:o,role:n})}function GQt(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:is(e.schema)}}})}function JQt(t){return typeof t?.parse=="function"}var ZQt,YQt,Gge,XQt=b(()=>{B5t();ZQt=j(VQt(),1),YQt=j(xJ(),1);$s();HC();Zf();BHe();no();Db();K2();Pm();Kg();WQt();Gge=class extends Pu{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?GQt(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:GQt(e),...r})}async completionWithRetry(e,r){let n=new Ph({maxRetries:this.maxRetries}),o=new ZQt.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=KQt(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let h=this._streamResponseChunks(e,r,n),m={};for await(let y of h){let _=y.generationInfo?.completion??0;m[_]===void 0?m[_]=y:m[_]=m[_].concat(y)}return{generations:Object.entries(m).sort(([y],[_])=>parseInt(y,10)-parseInt(_,10)).map(([y,_])=>_),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 h of l?.choices??[]){if("delta"in h)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in h))throw new Error("No message found in the choice.");let m=h.message?.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let g={text:m,message:N$n(h,l?.usage)};h.finishReason&&(g.generationInfo={finishReason:h.finishReason}),p.push(g)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=KQt(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=j$n(c,f?u.usage:null);if(p===null)continue;let h=c.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let m=new co({message:p,text:h,generationInfo:d});yield m,n?.handleLLMNewToken(m.text??"",d,void 0,void 0,void 0,{chunk:m})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new YQt.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"}}),JQt(n)?u=Sd.fromZodSchema(n):u=new Cd;else{let f=o??"extract";if(JQt(n)){let p=is(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=Lo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Lo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Li.from([{raw:s},d])}}});var QQt=b(()=>{no();PP();Ay()});var eer=b(()=>{CL();Zf();no();Ay();BHe()});var ter=b(()=>{XQt();QQt();eer()});var rer=b(()=>{ter()});function Fk(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 m1=b(()=>{});function QJ(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var ner=b(()=>{});function kk(t){let e;return t.constructor.name===fg.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ma.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=QJ(t,"INVALID_TOOL_RESULTS"):t.status===401?e=QJ(t,"MODEL_AUTHENTICATION"):t.status===429?e=QJ(t,"MODEL_RATE_LIMIT"):t.status===404?e=QJ(t,"MODEL_NOT_FOUND"):e=t,e}function qHe(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 iH=b(()=>{ZF();Kg();ag();ner()});function D$n(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function oer(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(ier(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function ier(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}: ${Jge(o,e)},`):r.push(`${n}?: ${Jge(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Jge(t,e){if(D$n(t))return t.anyOf.map(r=>Jge(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["{",ier(t,e+2),"}"].join(`
`);case"array":return t.items?`${Jge(t.items,e)}[]`:"any[]";default:return""}}var aer=b(()=>{});function ser(t,e){let r;if(Wc(t)){let n=Ope({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:BM(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}var uer=b(()=>{ag();sJ()});function L$n(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 WHe(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(!Ys.isInstance(t))throw new Error("Invalid generic chat message");return L$n(t)}default:throw new Error(`Unknown message type: ${e}`)}}function VHe(t,e){return t.flatMap(r=>{let n=WHe(r);n==="system"&&KHe(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=""),Wi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(oO),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 ler(t,e){return t.flatMap(r=>{let n=WHe(r);if(n==="system"&&KHe(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[aH];if(Wi(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 der(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(Qm(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(eh(s,l))}i[aH]??(i[aH]={}),i[aH][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 kn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function F$n(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[aH]={[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=der(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 Sr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function HHe(t){return"type"in t&&t.type!=="function"}function k$n(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function cer(t,e){return $d(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:ser(t,e)}function KHe(t){return t?.startsWith("o1")||t?.startsWith("o3")}function Zge(t){return typeof t?.parse=="function"}function $$n(t){return t!==void 0&&typeof t.schema=="object"}var aH,e7,Yge=b(()=>{ZF();$s();Zf();no();HC();ig();Pm();Db();K2();Kg();sJ();m1();iH();aer();uer();aH="__openai_function_call_ids__";e7=class extends Pu{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=>HHe(o)?o:cer(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Zge(e.json_schema.schema)?Cpe(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=>HHe(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:k$n(e?.tool_choice)?e?.tool_choice:(()=>{let l=qHe(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=>cer(s,{strict:n})):void 0,tool_choice:qHe(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),KHe(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(Qm(u,{returnId:!0}))}catch(l){i.push(eh(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 kn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Ys(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 Cp({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 Sr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Ef({content:i,response_metadata:s}):o==="developer"?new Ef({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Eh({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Vg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Sp({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:ler(e,this.model),stream:!0},r);for await(let c of l){let d=F$n(c);d!=null&&(yield d)}return}let o=VHe(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 h={...p};c.finish_reason!=null&&(h.finish_reason=c.finish_reason,h.system_fingerprint=l.system_fingerprint,h.model_name=l.model),this.logprobs&&(h.logprobs=c.logprobs);let m=new co({message:f,text:f.content,generationInfo:h});yield m,await n?.handleLLMNewToken(m.text??"",p,void 0,void 0,void 0,{chunk:m})}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 Sr({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=ler(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:der(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(HHe),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=VHe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let h of s){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let m=h.generationInfo?.completion??0;u[m]===void 0?u[m]=h:u[m]=u[m].concat(h)}let l=Object.entries(u).sort(([h],[m])=>parseInt(h,10)-parseInt(m,10)).map(([h,m])=>m),{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 h of s?.choices??[]){let g={text:h.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(h.message??{role:"assistant"},s)};g.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Wi(g.message)&&(g.message.usage_metadata=o),g.message=new kn(Object.fromEntries(Object.entries(g.message).filter(([y])=>!y.startsWith("lc_")))),p.push(g)}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=oer(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(WHe(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 kk(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 kk(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 kk(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=Fk(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Tr(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;$$n(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"}}),Zge(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}}}),Zge(n)){let f=Sd.fromZodSchema(n);u=Tp.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Cd;else{let f=o??"extract";if(Zge(n)){let p=is(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=Lo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Lo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Li.from([{raw:s},d])}}});var fer=b(()=>{no();Yge();m1()});var GHe=b(()=>{ig();Zf();no();CL();Ay();m1();iH()});var per=b(()=>{no();GHe();m1()});var JHe=b(()=>{no();PP();Ay();m1();iH()});var mer=b(()=>{no();JHe();m1();iH()});var her=b(()=>{});var ZHe,ger=b(()=>{no();ZF();zK();ZHe=class extends iR{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 Tr(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(ZHe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var yer=b(()=>{ger()});var ber=b(()=>{Yge()});var _er=b(()=>{Yge();fer();GHe();per();mer();JHe();her();iH();m1();yer();ber()});var ver=b(()=>{_er()});var Xge,wer=b(()=>{no();ver();Xge=class extends e7{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 xer=b(()=>{wer()});var Ser=b(()=>{xer()});var Cer={};os(Cer,{default:()=>h1});var Qge,B$n,sd,h1,eye=b(()=>{ua();or();jj();Gt();bt();ir();dK();jVt();cFe();X8t();yFe();j5t();rer();MFe();_ce();Ser();Qge=require("obsidian"),B$n={openai:iO,"azure openai":iO,anthropic:Ffe,cohereai:sle,google:mle,xai:Xge,openrouterai:iO,ollama:_le,"lm-studio":iO,groq:Bpe,"3rd party (openai-format)":iO,"copilot-plus":iO,mistralai:Gge,deepseek:Ape},sd=class sd{constructor(){this.providerApiKeyMap={openai:()=>oe().openAIApiKey,google:()=>oe().googleApiKey,"azure openai":()=>oe().azureOpenAIApiKey,anthropic:()=>oe().anthropicApiKey,cohereai:()=>oe().cohereApiKey,openrouterai:()=>oe().openRouterAiApiKey,groq:()=>oe().groqApiKey,xai:()=>oe().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>oe().plusLicenseKey,mistralai:()=>oe().mistralApiKey,deepseek:()=>oe().deepseekApiKey};this.buildModelMap(),wa(()=>{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=oe(),n=e.name,o=ez(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 So(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?_u:void 0,organization:await So(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await So(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?_u:void 0},...i&&{thinking:{type:"enabled",budget_tokens:2048}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await So(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 So(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?_u:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await So(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await So(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:OL.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:EL.BLOCK_NONE},{category:OL.HARM_CATEGORY_HATE_SPEECH,threshold:EL.BLOCK_NONE},{category:OL.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:EL.BLOCK_NONE},{category:OL.HARM_CATEGORY_HARASSMENT,threshold:EL.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await So(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await So(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?_u:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await So(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await So(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?_u:void 0}},"3rd party (openai-format)":{modelName:n,apiKey:await So(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?_u: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 So(r.plusLicenseKey),configuration:{baseURL:tI,fetch:e.enableCors?_u:void 0}},mistralai:{model:n,apiKey:await So(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await So(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||rz.deepseek.host,fetch:e.enableCors?_u: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=oe(),a=ez(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=oe().activeModels;sd.modelMap={};let r=sd.modelMap;(e??Av).forEach(o=>{if(o.enabled){if(!Object.values(CE).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=tn(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=B$n[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=tn(e);try{let n=await this.createModelInstance(e);sd.chatModel=n,ez(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 Qge.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=tn(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 Qge.Notice(u),new Error(u)}let o=await this.getModelConfig(e),i=ez(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=Dee();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=ez(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 Qge.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: `+eo(n)+`
with CORS Error: `+eo(o);throw new Error(i)}}}findModelByName(e){return oe().activeModels.find(n=>n.name===e)}};sd.REASONING_MODEL_TEMPERATURE=1;h1=sd});var tye={};os(tye,{TieredLexicalRetriever:()=>t7});async function z$n(){try{if(!YHe){let e=await Promise.resolve().then(()=>(eye(),Cer));YHe=()=>e.default.getInstance()}return YHe().getChatModel()}catch{return null}}var XHe,YHe,t7,r7=b(()=>{Gt();bt();ir();tG();wze();XHe=require("obsidian");Bde();BHt();YHe=null;t7=class extends y4{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.searchCore=new sfe(r,z$n),typeof this.searchCore.getChunkManager=="function"?this.chunkManager=this.searchCore.getChunkManager():this.chunkManager=new hR(r)}async getRelevantDocuments(r,n){try{if(this.options.timeRange)return this.getTimeRangeDocuments(r);let o=Jg(r,this.app.vault),i=o.map(f=>f.basename),a=[...new Set([...this.options.salientTerms,...i])];oe().debug&&B("TieredLexicalRetriever: Starting search",{query:r,salientTerms:a,maxK:this.options.maxK});let s=oe(),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 oe().debug&&B("TieredLexicalRetriever: Search complete",{totalResults:d.length,titleMatches:l.length,searchResults:u.length}),d}catch(o){return Bt("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);oe().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=Jg(a,this.app.vault),l=(await this.getTitleMatches(s)).map(m=>(m.metadata.includeInContext=!0,m)),c=this.app.vault.getMarkdownFiles(),d=[],f=Math.min(this.options.maxK,100);for(let m of c)if(m.stat.mtime>=n&&m.stat.mtime<=o){if(s.some(g=>g.path===m.path))continue;if(d.length>=f)break;try{let g=await this.app.vault.cachedRead(m),y=this.app.metadataCache.getFileCache(m),_=(Date.now()-m.stat.mtime)/(1e3*60*60*24),w=Math.max(.3,Math.min(1,1-_/30));d.push(new nh({pageContent:g,metadata:{path:m.path,title:m.basename,mtime:m.stat.mtime,ctime:m.stat.ctime,tags:y?.tags?.map(S=>S.tag)||[],includeInContext:!0,score:w,rerank_score:w,source:"time-filtered"}}))}catch(g){Bt(`TieredLexicalRetriever: Failed to read file ${m.path}`,g)}}let p=new Map;for(let m of l)p.set(m.metadata.path,m);for(let m of d)p.has(m.metadata.path)||p.set(m.metadata.path,{...m,metadata:{...m.metadata,includeInContext:!0}});let h=Array.from(p.values()).sort((m,g)=>{let y=m.metadata.score||0;return(g.metadata.score||0)-y});return oe().debug&&B("TieredLexicalRetriever: Time range search complete",{timeRange:this.options.timeRange,dailyNotesFound:s.length,timeFilteredDocs:d.length,totalResults:h.length}),h}generateDailyNoteDateRange(r,n){let o=[],i=new Date(r),a=new Date(n),s=365;Math.ceil((n-r)/(1e3*60*60*24))>s&&(Bt(`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)try{let i=await this.app.vault.cachedRead(o),a=this.app.metadataCache.getFileCache(o);n.push(new nh({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){Bt(`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 XHe.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 nh({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 XHe.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new nh({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){Bt(`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})}}});var n7,Oer=b(()=>{or();Gt();cG();r7();bt();ir();sG();g4();n7=class extends qP{async run(e,r,n,o,i){let a=new __(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=QB(l),d=e.message;c.length>0&&(d=e.message);let f=oe(),h=await(f.enableSemanticSearchV3?new lG({minSimilarityScore:.01,maxK:f.maxSourceChunks,salientTerms:[]}):new t7(app,{minSimilarityScore:.01,maxK:f.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(d);this.chainManager.storeRetrieverDocuments(h);let m=h.map(E=>`<${rCe}>
${E.pageContent}
</${rCe}>`).join(`
`),g=[],y=Mf(),_=`
Answer the question with as detailed as possible based only on the following context:
`+m,w=y+_,S=this.chainManager.chatModelManager.getChatModel();w&&g.push({role:eI(S),content:w});for(let E of c)g.push({role:E.role,content:E.content});if(e.content&&Array.isArray(e.content)){let E=e.content.map(P=>P.type==="text"?{...P,text:e.message}:P);g.push({role:"user",content:E})}else g.push({role:"user",content:e.message});B(`==== Final Request to AI ====
`,g);let C=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(g,{signal:r.signal}));for await(let E of C){if(r.signal.aborted){B("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(E)}}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=Net(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);e+=`
#### Sources:
`+n}return e}}});async function rye(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 Vd.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return Aj(i.content)})}var QHe=b(()=>{mR();ir()});function k_(){}function Eer(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,h){var m=n[c+h];return m.length>p.length?m: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 Per(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 Ter(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 eVe(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 tVe(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 o7(t,e){return eVe(t,e,"")}function nye(t,e){return tVe(t,e,"")}function Aer(t,e){return e.slice(0,U$n(t,e))}function U$n(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 Mer(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?H$n(t,e,r):a7.diff(t,e,r)}function Ier(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=Per(o,a);t.value=tVe(t.value,a,u),e.value=o7(e.value,u),r.value=o7(r.value,u)}if(n){var l=Ter(i,s);n.value=eVe(n.value,s,l),e.value=nye(e.value,l),r.value=nye(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=Per(c,d);e.value=o7(e.value,p);var h=Ter(o7(c,p),f);e.value=nye(e.value,h),n.value=eVe(n.value,c,h),t.value=tVe(t.value,c,c.slice(0,c.length-h.length))}else if(n){var m=n.value.match(/^\s*/)[0],g=e.value.match(/\s*$/)[0],y=Aer(g,m);e.value=nye(e.value,y)}else if(t){var _=t.value.match(/\s*$/)[0],w=e.value.match(/^\s*/)[0],S=Aer(_,w);e.value=o7(e.value,S)}}function H$n(t,e,r){return Rer.diff(t,e,r)}function V$n(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 Ner(t,e,r){var n=V$n(r,{ignoreWhitespace:!0});return iye.diff(t,e,n)}function rVe(t){"@babel/helpers - typeof";return rVe=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},rVe(t)}function nVe(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]=nVe(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),rVe(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]=nVe(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var oMi,oye,q$n,a7,Rer,iye,W$n,K$n,i7,oVe,iVe=b(()=>{k_.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,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,e,0,o);if(h[0].oldPos+1>=l&&m+1>=u)return s(Eer(a,h[0].lastComponent,r,e,a.useLongestToken));var g=-1/0,y=1/0;function _(){for(var S=Math.max(g,-c);S<=Math.min(y,c);S+=2){var C=void 0,E=h[S-1],P=h[S+1];E&&(h[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){h[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),m=a.extractCommon(C,r,e,S,o),C.oldPos+1>=l&&m+1>=u)return s(Eer(a,C.lastComponent,r,e,a.useLongestToken));h[S]=C,C.oldPos+1>=l&&(y=Math.min(y,S-1)),m+1>=u&&(g=Math.max(g,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}};oMi=new k_;oye="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}",q$n=new RegExp("[".concat(oye,"]+|\\s+|[^").concat(oye,"]"),"ug"),a7=new k_;a7.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};a7.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(q$n)||[];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};a7.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};a7.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)&&Ier(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&Ier(r,o,n,null),t};Rer=new k_;Rer.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(oye,"]+|[^\\S\\n\\r]+|[^").concat(oye,"]"),"ug");return t.match(e)||[]};iye=new k_;iye.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};iye.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))),k_.prototype.equals.call(this,t,e,r)};W$n=new k_;W$n.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};K$n=new k_;K$n.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};i7=new k_;i7.useLongestToken=!0;i7.tokenize=iye.tokenize;i7.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(nVe(t,null,null,o),o," ")};i7.equals=function(t,e,r){return k_.prototype.equals.call(i7,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};oVe=new k_;oVe.tokenize=function(t){return t.slice()};oVe.join=oVe.removeEmpty=function(t){return t}});function jer(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 Der=b(()=>{});var KT,Br,Ler,Fer,s7,aye,ker,G$n,aVe=b(()=>{xn();Gt();iVe();un();KT=require("obsidian"),Br=j(Y()),Ler=j($c());po();Fer=j(Y());Der();s7="obsidian-copilot-apply-view",aye=class extends KT.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return s7}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,Ler.createRoot)(n)),this.root.render(Br.default.createElement(G$n,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},ker=(0,Br.memo)(({oldLine:t,newLine:e})=>{let r=Mer(t,e);return Br.default.createElement(Br.default.Fragment,null,r.map((n,o)=>n.added?Br.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?Br.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):Br.default.createElement("span",{key:o},n.value)))});ker.displayName="WordDiff";G$n=({app:t,state:e,close:r})=>{let[n,o]=(0,Fer.useState)(()=>e.changes.map(h=>({...h,accepted:null}))),i=jer(n),a=(0,Br.useRef)([]);if(!e||!e.changes)return ie("Invalid state:",e),Br.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},Br.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),Br.default.createElement(he,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let s=async()=>{try{let h=n.map(g=>g.accepted===null?{...g,accepted:!0}:g),m=await c(h);r(m?"accepted":"failed")}catch(h){ie("Error applying changes:",h),new KT.Notice(`Error applying changes: ${h.message}`),r("failed")}},u=async()=>{try{let h=n.map(g=>g.accepted===null?{...g,accepted:!1}:g),m=await c(h);r(m?"rejected":"failed")}catch(h){ie("Error applying changes:",h),new KT.Notice(`Error applying changes: ${h.message}`),r("failed")}},l=async h=>{let m=t.vault.getAbstractFileByPath(h);if(m)return m;if(h.includes("/")){let g=h.split("/").slice(0,-1).join("/");t.vault.getAbstractFileByPath(g)||await t.vault.createFolder(g)}return await t.vault.create(h,"")},c=async h=>{let m=h.filter(y=>y.added?y.accepted===!0:y.removed?y.accepted===!1:!0).map(y=>y.value).join(""),g=await l(e.path);return!g||!(g instanceof KT.TFile)?(ie("Error in getting file",e.path),new KT.Notice("Failed to create file"),!1):(await t.vault.modify(g,m),new KT.Notice("Changes applied successfully"),!0)},d=h=>{if(!i)return;let m=-1;for(let g=h+1;g<i.length;g++){let y=i[g],_=y.some(S=>S.added||S.removed),w=y.some(S=>(S.added||S.removed)&&S.accepted===null);if(_&&w){m=g;break}}m!==-1&&a.current[m]&&a.current[m]?.scrollIntoView({behavior:"smooth",block:"center"})},f=h=>{o(m=>{let g=[...m],y=i?.[h];return y&&y.forEach(_=>{let w=g.findIndex(S=>S===_);w!==-1&&(g[w]={...g[w],accepted:!0})}),g}),setTimeout(()=>d(h),0)},p=h=>{o(m=>{let g=[...m],y=i?.[h];return y&&y.forEach(_=>{let w=g.findIndex(S=>S===_);w!==-1&&(g[w]={...g[w],accepted:!1})}),g}),setTimeout(()=>d(h),0)};return Br.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Br.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"},Br.default.createElement(he,{variant:"destructive",size:"sm",onClick:u},Br.default.createElement(vi,{className:"tw-size-4"}),"Reject"),Br.default.createElement(he,{variant:"success",size:"sm",onClick:s},Br.default.createElement(ls,{className:"tw-size-4"}),"Accept")),Br.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),Br.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((h,m)=>{let g=h.some(_=>_.added||_.removed),y=g?h.every(_=>!_.added&&!_.removed||_.accepted===!0)?"accepted":h.every(_=>!_.added&&!_.removed||_.accepted===!1)?"rejected":"undecided":"unchanged";return Br.default.createElement("div",{key:m,ref:_=>a.current[m]=_,className:me("tw-mb-4 tw-overflow-hidden tw-rounded-md")},y==="accepted"?Br.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"},h.filter(_=>!_.removed).map((_,w)=>Br.default.createElement("div",{key:w},_.value))):y==="rejected"?Br.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"},h.filter(_=>!_.added).map((_,w)=>Br.default.createElement("div",{key:w},_.value))):h.map((_,w)=>{if(_.added){let S=h.findIndex((C,E)=>C.removed&&E!==w);if(S!==-1){let C=h[S].value;return Br.default.createElement("div",{key:`${m}-${w}`,className:"tw-relative"},Br.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},Br.default.createElement(ker,{oldLine:C,newLine:_.value})))}}return _.removed&&h.findIndex((C,E)=>C.added&&E!==w)!==-1?null:Br.default.createElement("div",{key:`${m}-${w}`,className:"tw-relative"},Br.default.createElement("div",{className:me("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))}),g&&y==="undecided"&&Br.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"},Br.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Br.default.createElement(he,{variant:"destructive",size:"sm",onClick:()=>p(m)},Br.default.createElement(vi,{className:"tw-size-4"}),"Reject"),Br.default.createElement(he,{variant:"success",size:"sm",onClick:()=>f(m)},Br.default.createElement(ls,{className:"tw-size-4"}),"Accept"))),g&&(y==="accepted"||y==="rejected")&&Br.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"},Br.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Br.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},y==="accepted"?Br.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},Br.default.createElement(ls,{className:"tw-size-4"}),Br.default.createElement("div",null,"Accepted")):Br.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},Br.default.createElement(vi,{className:"tw-size-4"}),Br.default.createElement("div",null,"Rejected"))),Br.default.createElement(he,{variant:"secondary",size:"sm",onClick:()=>{o(_=>{let w=[..._],S=i?.[m];return S&&S.forEach(C=>{let E=w.findIndex(P=>P===C);E!==-1&&(w[E]={...w[E],accepted:null})}),w})}},"Revert"))))})))}});function Kl(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 $er(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]=Ber(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 Ber(t){return t instanceof dt.ZodOptional||t instanceof dt.ZodNullable||t instanceof dt.ZodDefault?Ber(t._def.innerType):t._def.description||""}var bMi,$k=b(()=>{xd();bMi={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 zer(t,e){let r=app.vault.getAbstractFileByPath(t),n=app.workspace.getActiveFile();if(!r){try{await app.vault.create(t,"")}catch(a){let s=app.vault.getAbstractFileByPath(t);if(s&&s instanceof Bk.TFile)r=s;else return console.error(`Failed to create file at ${t}`,a),new Bk.Notice(`Failed to create file: ${t}`),"failed"}if(!r&&(r=app.vault.getAbstractFileByPath(t),!r))return new Bk.Notice(`File not found after creation: ${t}`),"failed"}r&&(!n||n.path!==t)&&(await app.workspace.getLeaf().openFile(r),new Bk.Notice(`Switched to ${r.name}`));let o="";r&&(o=await app.vault.read(r));let i=Ner(o,e,{newlineIsToken:!0});return new Promise(a=>{app.workspace.getLeaf(!0).setViewState({type:s7,active:!0,state:{changes:i,path:t,resultCallback:u=>{a(u)}}})})}function u7(t){return t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function Y$n(t,e,r){let n=(t.match(/\r\n/g)||[]).length,o=(t.match(/(?<!\r)\n/g)||[]).length,i=n>o,a=u7(t),s=u7(e),u=u7(r),l=a.replaceAll(s,u);return i?l.replace(/\n/g,`\r
`):l}function X$n(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 Bk,J$n,sye,Z$n,Uer,sVe=b(()=>{Bk=require("obsidian");aVe();iVe();xd();$k();J$n=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"
}
]
}`)}),sye=Kl({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:J$n,handler:async({path:t,content:e})=>{let r=typeof e=="string"?e:JSON.stringify(e,null,2),n=await zer(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}),Z$n=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`)});Uer=Kl({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:Z$n,handler:async({path:t,diff:e})=>{let r=app.vault.getAbstractFileByPath(t);if(!r||!(r instanceof Bk.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=X$n(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=u7(o),p=u7(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 h=o;o=Y$n(o,c,d),o!==h&&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 zer(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 uVe,qer,DO,l7=b(()=>{uVe=require("obsidian"),qer=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""}},DO=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 uVe.Notice(n.message):new uVe.Notice("An error occurred while executing the tool. Check console for details."),null}}}});function Q$n(t){return"children"in t&&"path"in t}function eBn(t){return"path"in t&&!("children"in t)}function tBn(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function lVe(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=vc();for(let u of t.children)if(eBn(u)){if(_s(u,i,a)){e&&r.push(u.name);let l=tBn(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(Q$n(u)){let l=lVe(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 uye,cVe=b(()=>{rh();xd();$k();uye=t=>Kl({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:dt.void(),handler:async()=>{let e=lVe(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=lVe(t,!1);return r+JSON.stringify(o)}return r+n},isBackground:!0})});var dVe,rBn,nBn,c7,Her,oBn,d7,fVe=b(()=>{QHe();or();My();Gt();bt();xd();$k();dVe=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")}),rBn=Kl({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:dVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=oe(),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(()=>(r7(),tye))).TieredLexicalRetriever(app,{minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:nCe,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(l=>{let c=l.metadata.rerank_score??l.metadata.score??0;return{title:l.metadata.title||"Untitled",content:l.pageContent,path:l.metadata.path||"",score:c,rerank_score:c,includeInContext:l.metadata.includeInContext??!0,source:l.metadata.source,mtime:l.metadata.mtime??null,explanation:l.metadata.explanation??null}});return JSON.stringify(u)}}),nBn=Kl({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:dVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=oe(),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(),$de))).HybridRetriever({minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:nCe,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(l=>{let c=l.metadata.rerank_score??l.metadata.score??0;return{title:l.metadata.title||"Untitled",content:l.pageContent,path:l.metadata.path||"",score:c,rerank_score:c,includeInContext:l.metadata.includeInContext??!0,source:l.metadata.source,mtime:l.metadata.mtime??null,explanation:l.metadata.explanation??null}});return JSON.stringify(u)}}),c7=Kl({name:"localSearch",description:"Search for notes based on the time range and query",schema:dVe,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=oe();return B(`localSearch delegating to ${n.enableSemanticSearchV3?"semantic":"lexical"} search`),n.enableSemanticSearchV3?await nBn.call({timeRange:t,query:e,salientTerms:r}):await rBn.call({timeRange:t,query:e,salientTerms:r})}}),Her=Kl({name:"indexVault",description:"Index the vault to the Copilot index",schema:dt.void(),handler:async()=>{if(oe().enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(Jc(),Qf))).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}),oBn=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")}),d7=Kl({name:"webSearch",description:"Search the web for information",schema:oBn,isPlusOnly:!0,handler:async({query:t,chatHistory:e})=>{try{let r=await rye(t,e),n=await Ji.getInstance().webSearch(r),o=n.response.citations||[],a=[{type:"web_search",content:n.response.choices[0].message.content,citations:o,instruction:"Provide a response based on this information. Include source citations at the end under '#### Sources' as markdown links."}];return JSON.stringify(a)}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}}})});var Ver=x((pVe,mVe)=>{(function(t,e){typeof pVe=="object"&&typeof mVe<"u"?mVe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(pVe,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 g1=x((hVe,gVe)=>{(function(t,e){typeof hVe=="object"&&typeof gVe<"u"?gVe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(hVe,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",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|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,g={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"],F=D%100;return"["+D+(k[(F-20)%10]||k[F]||k[0])+"]"}},y=function(D,k,F){var K=String(D);return!K||K.length>=k?D:""+Array(k+1-K.length).join(F)+D},_={s:y,z:function(D){var k=-D.utcOffset(),F=Math.abs(k),K=Math.floor(F/60),U=F%60;return(k<=0?"+":"-")+y(K,2,"0")+":"+y(U,2,"0")},m:function D(k,F){if(k.date()<F.date())return-D(F,k);var K=12*(F.year()-k.year())+(F.month()-k.month()),U=k.clone().add(K,l),X=F-U<0,ee=k.clone().add(K+(X?-1:1),l);return+(-(K+(F-U)/(X?U-ee:ee-U))||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]=g;var C="$isDayjsObject",E=function(D){return D instanceof N||!(!D||!D[C])},P=function D(k,F,K){var U;if(!k)return w;if(typeof k=="string"){var X=k.toLowerCase();S[X]&&(U=X),F&&(S[X]=F,U=X);var ee=k.split("-");if(!U&&ee.length>1)return D(ee[0])}else{var L=k.name;S[L]=k,U=L}return!K&&U&&(w=U),U||!K&&w},T=function(D,k){if(E(D))return D.clone();var F=typeof k=="object"?k:{};return F.date=D,F.args=arguments,new N(F)},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(F){this.$L=P(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[C]=!0}var k=D.prototype;return k.parse=function(F){this.$d=function(K){var U=K.date,X=K.utc;if(U===null)return new Date(NaN);if(I.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var ee=U.match(h);if(ee){var L=ee[2]-1||0,Q=(ee[7]||"0").substring(0,3);return X?new Date(Date.UTC(ee[1],L,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Q)):new Date(ee[1],L,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,Q)}}return new Date(U)}(F),this.init()},k.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},k.$utils=function(){return I},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(F,K){var U=T(F);return this.startOf(K)<=U&&U<=this.endOf(K)},k.isAfter=function(F,K){return T(F)<this.startOf(K)},k.isBefore=function(F,K){return this.endOf(K)<T(F)},k.$g=function(F,K,U){return I.u(F)?this[K]:this.set(U,F)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(F,K){var U=this,X=!!I.u(K)||K,ee=I.p(F),L=function(Z,de){var pe=I.w(U.$u?Date.UTC(U.$y,de,Z):new Date(U.$y,de,Z),U);return X?pe:pe.endOf(s)},Q=function(Z,de){return I.w(U.toDate()[Z].apply(U.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(de)),U)},z=this.$W,W=this.$M,V=this.$D,q="set"+(this.$u?"UTC":"");switch(ee){case d:return X?L(1,0):L(31,11);case l:return X?L(1,W):L(0,W+1);case u:var H=this.$locale().weekStart||0,G=(z<H?z+7:z)-H;return L(X?V-G:V+(6-G),W);case s:case f:return Q(q+"Hours",0);case a:return Q(q+"Minutes",1);case i:return Q(q+"Seconds",2);case o:return Q(q+"Milliseconds",3);default:return this.clone()}},k.endOf=function(F){return this.startOf(F,!1)},k.$set=function(F,K){var U,X=I.p(F),ee="set"+(this.$u?"UTC":""),L=(U={},U[s]=ee+"Date",U[f]=ee+"Date",U[l]=ee+"Month",U[d]=ee+"FullYear",U[a]=ee+"Hours",U[i]=ee+"Minutes",U[o]=ee+"Seconds",U[n]=ee+"Milliseconds",U)[X],Q=X===s?this.$D+(K-this.$W):K;if(X===l||X===d){var z=this.clone().set(f,1);z.$d[L](Q),z.init(),this.$d=z.set(f,Math.min(this.$D,z.daysInMonth())).$d}else L&&this.$d[L](Q);return this.init(),this},k.set=function(F,K){return this.clone().$set(F,K)},k.get=function(F){return this[I.p(F)]()},k.add=function(F,K){var U,X=this;F=Number(F);var ee=I.p(K),L=function(W){var V=T(X);return I.w(V.date(V.date()+Math.round(W*F)),X)};if(ee===l)return this.set(l,this.$M+F);if(ee===d)return this.set(d,this.$y+F);if(ee===s)return L(1);if(ee===u)return L(7);var Q=(U={},U[i]=e,U[a]=r,U[o]=t,U)[ee]||1,z=this.$d.getTime()+F*Q;return I.w(z,this)},k.subtract=function(F,K){return this.add(-1*F,K)},k.format=function(F){var K=this,U=this.$locale();if(!this.isValid())return U.invalidDate||p;var X=F||"YYYY-MM-DDTHH:mm:ssZ",ee=I.z(this),L=this.$H,Q=this.$m,z=this.$M,W=U.weekdays,V=U.months,q=U.meridiem,H=function(de,pe,ae,Te){return de&&(de[pe]||de(K,X))||ae[pe].slice(0,Te)},G=function(de){return I.s(L%12||12,de,"0")},Z=q||function(de,pe,ae){var Te=de<12?"AM":"PM";return ae?Te.toLowerCase():Te};return X.replace(m,function(de,pe){return pe||function(ae){switch(ae){case"YY":return String(K.$y).slice(-2);case"YYYY":return I.s(K.$y,4,"0");case"M":return z+1;case"MM":return I.s(z+1,2,"0");case"MMM":return H(U.monthsShort,z,V,3);case"MMMM":return H(V,z);case"D":return K.$D;case"DD":return I.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return H(U.weekdaysMin,K.$W,W,2);case"ddd":return H(U.weekdaysShort,K.$W,W,3);case"dddd":return W[K.$W];case"H":return String(L);case"HH":return I.s(L,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return Z(L,Q,!0);case"A":return Z(L,Q,!1);case"m":return String(Q);case"mm":return I.s(Q,2,"0");case"s":return String(K.$s);case"ss":return I.s(K.$s,2,"0");case"SSS":return I.s(K.$ms,3,"0");case"Z":return ee}return null}(de)||ee.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(F,K,U){var X,ee=this,L=I.p(K),Q=T(F),z=(Q.utcOffset()-this.utcOffset())*e,W=this-Q,V=function(){return I.m(ee,Q)};switch(L){case d:X=V()/12;break;case l:X=V();break;case c:X=V()/3;break;case u:X=(W-z)/6048e5;break;case s:X=(W-z)/864e5;break;case a:X=W/r;break;case i:X=W/e;break;case o:X=W/t;break;default:X=W}return U?X:I.a(X)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return S[this.$L]},k.locale=function(F,K){if(!F)return this.$L;var U=this.clone(),X=P(F,K,!0);return X&&(U.$L=X),U},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 jo,Gl,xg,y1=b(()=>{(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(jo||(jo={}));(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"})(Gl||(Gl={}));(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"})(xg||(xg={}))});function Wer(t,e){e=e.add(1,"day"),zk(t,e),sH(t,e)}function $_(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function lye(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",jo.AM):t.assign("meridiem",jo.PM)}function zk(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function sH(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var uH=b(()=>{y1()});function b1(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 Ker(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]??iBn[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,yVe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,yVe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var yVe,iBn,bVe=b(()=>{yVe=j(g1(),1);y1();iBn={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=>Ker(t,xg.MARCH,Gl.SUNDAY,2),dstEnd:t=>Ker(t,xg.OCTOBER,Gl.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=>b1(t,xg.MARCH,Gl.SUNDAY,2,2),dstEnd:t=>b1(t,xg.NOVEMBER,Gl.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=>b1(t,xg.MARCH,Gl.SUNDAY,2,2),dstEnd:t=>b1(t,xg.NOVEMBER,Gl.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=>b1(t,xg.MARCH,Gl.SUNDAY,2,2),dstEnd:t=>b1(t,xg.NOVEMBER,Gl.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=>b1(t,xg.MARCH,Gl.SUNDAY,2,2),dstEnd:t=>b1(t,xg.NOVEMBER,Gl.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 Ger,f7,_1,Do,GT,B_=b(()=>{Ger=j(Ver(),1),f7=j(g1(),1);uH();bVe();f7.default.extend(Ger.default);_1=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}},Do=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,f7.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,f7.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,f7.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?(lye(o,n),$_(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(sH(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}},GT=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 Do(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 aBn(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function tf(t){return`(?:${aBn(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var v1=b(()=>{});function dye(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function w1(t,e,r){let n=(0,Jer.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 Jer,lH=b(()=>{Jer=j(g1(),1)});function sBn(t){let e=t.toLowerCase();return vVe[e]!==void 0?vVe[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 dH(t){let e=t.toLowerCase();return wVe[e]!==void 0?wVe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function S1(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 dye(e)}function rb(t){let e={},r=t,n=Zer.exec(r);for(;n;)lBn(e,n),r=r.substring(n[0].length).trim(),n=Zer.exec(r);return Object.keys(e).length==0?null:e}function lBn(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=sBn(e[1]),n=p7[e[2].toLowerCase()];t[n]=r}var xVe,SVe,tb,vVe,wVe,Yer,p7,Xer,cH,x1,Qer,Zer,uBn,etr,JT,C1,Oc=b(()=>{v1();lH();xVe={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},SVe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},tb={...SVe,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},vVe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},wVe={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},Yer={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"},p7={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",...Yer},Xer=`(?:${tf(vVe)}|[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)?)`;cH=`(?:${tf(wVe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;x1="(?:[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])";Qer=`(${Xer})\\s{0,3}(${tf(p7)})`,Zer=new RegExp(Qer,"i"),uBn=`(${Xer})\\s{0,3}(${tf(Yer)})`,etr="\\s{0,5},?(?:\\s*and)?\\s{0,5}",JT=_Ve("(?:(?:about|around)\\s{0,3})?",Qer,etr),C1=_Ve("(?:(?:about|around)\\s{0,3})?",uBn,etr)});var ji,Xp=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 cBn,dBn,fBn,m7,ttr=b(()=>{Oc();B_();Xp();cBn=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${JT})(?=\\W|$)`,"i"),dBn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${JT})(?=\\W|$)`,"i"),fBn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${C1})(?=\\W|$)`,"i"),m7=class extends ji{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?fBn:e.option.forwardDate?cBn:dBn}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=rb(r[1]);return n?Do.createRelativeFromReference(e.reference,n):null}}});var pBn,rtr,ntr,mBn,otr,h7,itr=b(()=>{lH();Oc();Oc();Oc();v1();Xp();pBn=new RegExp(`(?:on\\s{0,3})?(${cH})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${cH}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${tf(tb)})(?:(?:-|/|,?\\s{0,3})(${x1}(?!\\w)))?(?=\\W|$)`,"i"),rtr=1,ntr=2,mBn=3,otr=4,h7=class extends ji{innerPattern(){return pBn}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=tb[r[mBn].toLowerCase()],i=dH(r[rtr]);if(i>31)return r.index=r.index+r[rtr].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[otr]){let a=S1(r[otr]);n.start.assign("year",a)}else{let a=w1(e.refDate,i,o);n.start.imply("year",a)}if(r[ntr]){let a=dH(r[ntr]);n.end=n.start.clone(),n.end.assign("day",a)}return n}}});var hBn,gBn,atr,CVe,OVe,g7,str=b(()=>{lH();Oc();Oc();Oc();v1();Xp();hBn=new RegExp(`(${tf(tb)})(?:-|/|\\s*,?\\s*)(${cH})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${cH})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${x1}))?(?=\\W|$)(?!\\:\\d)`,"i"),gBn=1,atr=2,CVe=3,OVe=4,g7=class extends ji{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return hBn}innerExtract(e,r){let n=tb[r[gBn].toLowerCase()],o=dH(r[atr]);if(o>31||this.shouldSkipYearLikeDate&&!r[CVe]&&!r[OVe]&&r[atr].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[OVe]){let u=S1(r[OVe]);i.assign("year",u)}else{let u=w1(e.refDate,o,n);i.imply("year",u)}if(!r[CVe])return i;let a=dH(r[CVe]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}}});var yBn,bBn,_Bn,utr,y7,ltr=b(()=>{Oc();lH();v1();Oc();Xp();yBn=new RegExp(`((?:in)\\s*)?(${tf(tb)})\\s*(?:[,-]?\\s*(${x1})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),bBn=1,_Bn=2,utr=3,y7=class extends ji{innerPattern(){return yBn}innerExtract(e,r){let n=r[_Bn].toLowerCase();if(r[0].length<=3&&!SVe[n])return null;let o=e.createParsingResult(r.index+(r[bBn]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=tb[n];if(o.start.assign("month",i),r[utr]){let a=S1(r[utr]);o.start.assign("year",a)}else{let a=w1(e.refDate,1,i);o.start.imply("year",a)}return o}}});var vBn,wBn,xBn,ctr,SBn,b7,dtr=b(()=>{Oc();v1();Xp();vBn=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${tf(tb)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),wBn=1,xBn=2,ctr=3,SBn=4,b7=class extends ji{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return vBn}innerExtract(e,r){let n=parseInt(r[wBn]),o=parseInt(r[SBn]),i=r[ctr]?parseInt(r[ctr]):tb[r[xBn].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 CBn,OBn,EBn,_7,ftr=b(()=>{Xp();CBn=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),OBn=1,EBn=2,_7=class extends ji{innerPattern(){return CBn}innerExtract(e,r){let n=parseInt(r[EBn]),o=parseInt(r[OBn]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}}});function PBn(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 TBn(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 ptr,fH,fye,pye,v7,mye,mtr=b(()=>{y1();ptr=2,fH=3,fye=4,pye=5,v7=6,mye=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[ptr]);if(s>100){if(this.strictMode||r[fH]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[fH]!=null){if(r[fH].length==1&&!r[v7])return null;i=parseInt(r[fH])}if(i>=60)return null;if(s>12&&(a=jo.PM),r[v7]!=null){if(s>12)return null;let u=r[v7][0].toLowerCase();u=="a"&&(a=jo.AM,s==12&&(s=0)),u=="p"&&(a=jo.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",jo.AM):o.imply("meridiem",jo.PM),r[pye]!=null){let u=parseInt(r[pye].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[fye]!=null){let u=parseInt(r[fye]);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[fye]!=null){let u=parseInt(r[fye]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[ptr]),a=0,s=-1;if(r[fH]!=null?a=parseInt(r[fH]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=jo.PM),r[v7]!=null){if(i>12)return null;let u=r[v7][0].toLowerCase();u=="a"&&(s=jo.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=jo.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==jo.AM?(n.start.imply("meridiem",jo.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",jo.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",jo.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",jo.PM)):i>12?o.imply("meridiem",jo.PM):i<=12&&o.imply("meridiem",jo.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=PBn(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=TBn(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}}});var w7,htr=b(()=>{y1();mtr();w7=class extends mye{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",jo.PM)):o<6&&n.assign("meridiem",jo.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",jo.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",jo.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}}});function O1(t){let e={};for(let r in t)e[r]=-t[r];return e}function gtr(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 pH=b(()=>{});var ABn,IBn,x7,ytr=b(()=>{Oc();B_();Xp();pH();ABn=new RegExp(`(${JT})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),IBn=new RegExp(`(${C1})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),x7=class extends ji{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?IBn:ABn}innerExtract(e,r){let n=rb(r[1]);if(!n)return null;let o=O1(n);return Do.createRelativeFromReference(e.reference,o)}}});var MBn,RBn,NBn,S7,btr=b(()=>{Oc();B_();Xp();MBn=new RegExp(`(${JT})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),RBn=new RegExp(`(${C1})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),NBn=1,S7=class extends ji{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?RBn:MBn}innerExtract(e,r){let n=rb(r[NBn]);return n?Do.createRelativeFromReference(e.reference,n):null}}});var hye,nb,Uk=b(()=>{hye=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},nb=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 C7,_tr=b(()=>{Uk();C7=class extends nb{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 O7,vtr=b(()=>{_tr();O7=class extends C7{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function EVe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=wtr(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=wtr(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?$_(s,u):zk(s,u)}r.end=s}return r}function wtr(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")==jo.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 xtr=b(()=>{y1();uH()});var E7,Str=b(()=>{Uk();xtr();E7=class extends nb{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()?EVe(r,n):EVe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}}});var mH,Ctr=b(()=>{Str();mH=class extends E7{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var jBn,P7,Otr=b(()=>{bVe();jBn=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),P7=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=jBn.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 DBn,LBn,FBn,kBn,T7,Etr=b(()=>{DBn=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),LBn=1,FBn=2,kBn=3,T7=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=DBn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[FBn]),s=parseInt(i[kBn]||"0"),u=a*60+s;u>14*60||(i[LBn]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}}});var E1,PVe=b(()=>{E1=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 Ptr,A7,Ttr=b(()=>{Ptr=j(g1(),1);uH();A7=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,Ptr.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),zk(n.start,o),n.end&&n.end.isOnlyTime()&&(zk(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),zk(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 I7,Atr=b(()=>{Uk();I7=class extends hye{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 $Bn,BBn,zBn,UBn,Itr,qBn,Mtr,Rtr,HBn,Ntr,jtr,M7,Dtr=b(()=>{Xp();$Bn=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"),BBn=1,zBn=2,UBn=3,Itr=4,qBn=5,Mtr=6,Rtr=7,HBn=8,Ntr=9,jtr=10,M7=class extends ji{innerPattern(){return $Bn}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[BBn]),month:parseInt(r[zBn]),day:parseInt(r[UBn])});if(r[Itr]!=null&&(n.assign("hour",parseInt(r[Itr])),n.assign("minute",parseInt(r[qBn])),r[Mtr]!=null&&n.assign("second",parseInt(r[Mtr])),r[Rtr]!=null&&n.assign("millisecond",parseInt(r[Rtr])),r[HBn]!=null)){let o=0;if(r[Ntr]){let i=parseInt(r[Ntr]),a=0;r[jtr]!=null&&(a=parseInt(r[jtr])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}}});var R7,Ltr=b(()=>{Uk();R7=class extends nb{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 Ftr(t,e=!1){return t.parsers.unshift(new M7),t.refiners.unshift(new R7),t.refiners.unshift(new T7),t.refiners.unshift(new E1),t.refiners.push(new P7),t.refiners.push(new E1),t.refiners.push(new A7),t.refiners.push(new I7(e)),t}var ktr=b(()=>{Otr();Etr();PVe();Ttr();Atr();Dtr();Ltr()});function $tr(t){let e=(0,hH.default)(t.instant),r=new Do(t,{});return $_(r,e),lye(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function Btr(t){let e=(0,hH.default)(t.instant),r=new Do(t,{});return $_(r,e),sH(r,e),r.addTag("casualReference/today"),r}function ztr(t){return VBn(t,1).addTag("casualReference/yesterday")}function VBn(t,e){return qtr(t,-e)}function Utr(t){return qtr(t,1).addTag("casualReference/tomorrow")}function qtr(t,e){let r=(0,hH.default)(t.instant),n=new Do(t,{});return r=r.add(e,"day"),$_(n,r),sH(n,r),n}function Htr(t,e=22){let r=(0,hH.default)(t.instant),n=new Do(t,{});return $_(n,r),n.imply("hour",e),n.imply("meridiem",jo.PM),n.addTag("casualReference/tonight"),n}function Vtr(t,e=20){let r=new Do(t,{});return r.imply("meridiem",jo.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function Wtr(t){let e=new Do(t,{}),r=(0,hH.default)(t.instant);return r.hour()>2&&Wer(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function Ktr(t,e=6){let r=new Do(t,{});return r.imply("meridiem",jo.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function Gtr(t,e=15){let r=new Do(t,{});return r.imply("meridiem",jo.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function Jtr(t){let e=new Do(t,{});return e.imply("meridiem",jo.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var hH,TVe=b(()=>{B_();hH=j(g1(),1);uH();y1()});var Ytr,WBn,N7,Xtr=b(()=>{Ytr=j(g1(),1);Xp();uH();TVe();WBn=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,N7=class extends ji{innerPattern(e){return WBn}innerExtract(e,r){let n=(0,Ytr.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=$tr(e.reference);break;case"today":i=Btr(e.reference);break;case"yesterday":i=ztr(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=Utr(e.reference);break;case"tonight":i=Htr(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),$_(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}}});var KBn,j7,Qtr=b(()=>{Xp();TVe();KBn=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,j7=class extends ji{innerPattern(){return KBn}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=Gtr(e.reference);break;case"evening":case"night":n=Vtr(e.reference);break;case"midnight":n=Wtr(e.reference);break;case"morning":n=Ktr(e.reference);break;case"noon":case"midday":n=Jtr(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});function err(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=GBn(n,e,r),i=new Do(t);return i=gtr(i,{day:o}),i.assign("weekday",e),i}function GBn(t,e,r){let n=t.getDay();switch(r){case"this":return gye(t,e);case"last":return trr(t,e);case"next":return n==Gl.SUNDAY?e==Gl.SUNDAY?7:e:n==Gl.SATURDAY?e==Gl.SATURDAY?7:e==Gl.SUNDAY?8:1+e:e<n&&e!=Gl.SUNDAY?gye(t,e):gye(t,e)+7}return JBn(t,e)}function JBn(t,e){let r=trr(t,e),n=gye(t,e);return n<-r?n:r}function gye(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function trr(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var rrr=b(()=>{y1();B_();pH()});var ZBn,YBn,XBn,QBn,D7,nrr=b(()=>{Oc();v1();Xp();rrr();ZBn=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${tf(xVe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),YBn=1,XBn=2,QBn=3,D7=class extends ji{innerPattern(){return ZBn}innerExtract(e,r){let n=r[XBn].toLowerCase(),o=xVe[n],i=r[YBn],a=r[QBn],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"),err(e.reference,o,u)}}});var orr,ezn,tzn,rzn,L7,irr=b(()=>{Oc();B_();orr=j(g1(),1);Xp();v1();ezn=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${tf(p7)})(?=\\s*)(?=\\W|$)`,"i"),tzn=1,rzn=2,L7=class extends ji{innerPattern(){return ezn}innerExtract(e,r){let n=r[tzn].toLowerCase(),o=r[rzn].toLowerCase(),i=p7[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,Do.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,Do.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,orr.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 nzn,ozn,izn,arr,srr,AVe,F7,urr=b(()=>{lH();nzn=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"),ozn=1,izn=5,arr=2,srr=3,AVe=4,F7=class{constructor(e){this.groupNumberMonth=e?srr:arr,this.groupNumberDay=e?arr:srr}pattern(){return nzn}extract(e,r){let n=r.index+r[ozn].length,o=r.index+r[0].length-r[izn].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[AVe]&&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[AVe]){let l=parseInt(r[AVe]),c=dye(l);a.start.assign("year",c)}else{let l=w1(e.refDate,u,s);a.start.imply("year",l)}return a}}});var azn,szn,k7,lrr=b(()=>{Oc();B_();Xp();pH();azn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${JT})(?=\\W|$)`,"i"),szn=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${C1})(?=\\W|$)`,"i"),k7=class extends ji{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?azn:szn}innerExtract(e,r){let n=r[1].toLowerCase(),o=rb(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=O1(o);break}return Do.createRelativeFromReference(e.reference,o)}}});function uzn(t){return t.text.match(/^[+-]/i)!=null}function crr(t){return t.text.match(/^-/i)!=null}var $7,drr=b(()=>{Uk();B_();Oc();pH();$7=class extends nb{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?uzn(n)||crr(n):!1}mergeResults(e,r,n,o){let i=rb(n.text);crr(n)&&(i=O1(i));let a=Do.createRelativeFromReference(new _1(r.start.date()),i);return new GT(r.reference,r.index,`${r.text}${e}${n.text}`,a)}}});function frr(t){return t.text.match(/\s+(before|from)$/i)!=null}function lzn(t){return t.text.match(/\s+(after|since)$/i)!=null}var B7,prr=b(()=>{Uk();B_();Oc();pH();B7=class extends nb{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!frr(r)&&!lzn(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=rb(r.text);frr(r)&&(o=O1(o));let i=Do.createRelativeFromReference(new _1(n.start.date()),o);return new GT(n.reference,r.index,`${r.text}${e}${n.text}`,i)}}});var czn,dzn,z7,mrr=b(()=>{Oc();czn=new RegExp(`^\\s*(${x1})`,"i"),dzn=1,z7=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=czn.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=S1(i[dzn]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}}});var qk,IVe=b(()=>{ttr();itr();str();ltr();dtr();ftr();htr();ytr();btr();vtr();Ctr();ktr();Xtr();Qtr();nrr();irr();urr();lrr();drr();prr();PVe();mrr();qk=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new N7),r.parsers.push(new j7),r.parsers.push(new y7),r.parsers.push(new L7),r.parsers.push(new k7),r}createConfiguration(e=!0,r=!1){let n=Ftr({parsers:[new F7(r),new m7(e),new h7,new g7(r),new D7,new _7,new w7(e),new x7(e),new S7(e)],refiners:[new mH]},e);return n.parsers.unshift(new b7(e)),n.refiners.unshift(new B7),n.refiners.unshift(new $7),n.refiners.unshift(new E1),n.refiners.push(new mH),n.refiners.push(new z7),n.refiners.push(new O7),n}}});var gH,MVe,hrr=b(()=>{B_();IVe();gH=class t{constructor(e){this.defaultConfig=new qk,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 MVe(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 GT?c=l:l instanceof Do?(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}},MVe=class{constructor(e,r,n){this.text=e,this.reference=new _1(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Do?e:new Do(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 GT(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 RVe,grr,fzn,kNi,yrr=b(()=>{hrr();IVe();RVe=new qk,grr=new gH(RVe.createCasualConfiguration(!1)),fzn=new gH(RVe.createConfiguration(!0,!1)),kNi=new gH(RVe.createCasualConfiguration(!0))});function NVe(t,e,r){return brr.parse(t,e,r)}function _rr(t,e,r){return brr.parseDate(t,e,r)}var brr,vrr=b(()=>{yrr();brr=grr});var ZT,yye,bye,_ye,z_,yH,Hs,U_,P1=b(()=>{ZT=class extends Error{},yye=class extends ZT{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},bye=class extends ZT{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},_ye=class extends ZT{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},z_=class extends ZT{},yH=class extends ZT{constructor(e){super(`Invalid unit ${e}`)}},Hs=class extends ZT{},U_=class extends ZT{constructor(){super("Zone is an abstract class")}}});var ft,q_,Sg,T1,U7,jVe,q7,H7,V7,W7,K7,G7,J7,Z7,Y7,X7,Q7,eZ,tZ,rZ,DVe,nZ,oZ,iZ,aZ,sZ=b(()=>{ft="numeric",q_="short",Sg="long",T1={year:ft,month:ft,day:ft},U7={year:ft,month:q_,day:ft},jVe={year:ft,month:q_,day:ft,weekday:q_},q7={year:ft,month:Sg,day:ft},H7={year:ft,month:Sg,day:ft,weekday:Sg},V7={hour:ft,minute:ft},W7={hour:ft,minute:ft,second:ft},K7={hour:ft,minute:ft,second:ft,timeZoneName:q_},G7={hour:ft,minute:ft,second:ft,timeZoneName:Sg},J7={hour:ft,minute:ft,hourCycle:"h23"},Z7={hour:ft,minute:ft,second:ft,hourCycle:"h23"},Y7={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:q_},X7={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:Sg},Q7={year:ft,month:ft,day:ft,hour:ft,minute:ft},eZ={year:ft,month:ft,day:ft,hour:ft,minute:ft,second:ft},tZ={year:ft,month:q_,day:ft,hour:ft,minute:ft},rZ={year:ft,month:q_,day:ft,hour:ft,minute:ft,second:ft},DVe={year:ft,month:q_,day:ft,weekday:q_,hour:ft,minute:ft},nZ={year:ft,month:Sg,day:ft,hour:ft,minute:ft,timeZoneName:q_},oZ={year:ft,month:Sg,day:ft,hour:ft,minute:ft,second:ft,timeZoneName:q_},iZ={year:ft,month:Sg,day:ft,weekday:Sg,hour:ft,minute:ft,timeZoneName:Sg},aZ={year:ft,month:Sg,day:ft,weekday:Sg,hour:ft,minute:ft,second:ft,timeZoneName:Sg}});var mh,Hk=b(()=>{P1();mh=class{get type(){throw new U_}get name(){throw new U_}get ianaName(){return this.name}get isUniversal(){throw new U_}offsetName(e,r){throw new U_}formatOffset(e,r){throw new U_}offset(e){throw new U_}equals(e){throw new U_}get isValid(){throw new U_}}});var LVe,A1,wye=b(()=>{Qp();Hk();LVe=null,A1=class t extends mh{static get instance(){return LVe===null&&(LVe=new t),LVe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return xye(e,r,n)}formatOffset(e,r){return I1(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}});function hzn(t){return Cye[t]||(Cye[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"})),Cye[t]}function yzn(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 bzn(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=gzn[i];i==="era"?n[s]=a:br(s)||(n[s]=parseInt(a,10))}return n}var Cye,gzn,Sye,sp,M1=b(()=>{Qp();Hk();Cye={};gzn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};Sye={},sp=class t extends mh{static create(e){return Sye[e]||(Sye[e]=new t(e)),Sye[e]}static resetCache(){Sye={},Cye={}}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 xye(e,r,n,this.name)}formatOffset(e,r){return I1(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=hzn(this.name),[o,i,a,s,u,l,c]=n.formatToParts?bzn(n,r):yzn(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=bH({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,h=p%1e3;return p-=h>=0?h:1e3+h,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}});function _zn(t,e={}){let r=JSON.stringify([t,e]),n=wrr[r];return n||(n=new Intl.ListFormat(t,e),wrr[r]=n),n}function kVe(t,e={}){let r=JSON.stringify([t,e]),n=FVe[r];return n||(n=new Intl.DateTimeFormat(t,e),FVe[r]=n),n}function vzn(t,e={}){let r=JSON.stringify([t,e]),n=$Ve[r];return n||(n=new Intl.NumberFormat(t,e),$Ve[r]=n),n}function wzn(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=BVe[o];return i||(i=new Intl.RelativeTimeFormat(t,e),BVe[o]=i),i}function xzn(){return uZ||(uZ=new Intl.DateTimeFormat().resolvedOptions().locale,uZ)}function Szn(t){let e=xrr[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,xrr[t]=e}return e}function Czn(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=kVe(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=kVe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function Ozn(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Ezn(t){let e=[];for(let r=1;r<=12;r++){let n=Ir.utc(2009,r,1);e.push(t(n))}return e}function Pzn(t){let e=[];for(let r=1;r<=7;r++){let n=Ir.utc(2016,11,13+r);e.push(t(n))}return e}function Oye(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Tzn(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 wrr,FVe,$Ve,BVe,uZ,xrr,zVe,UVe,qVe,Azn,hi,cZ=b(()=>{Qp();Tye();R1();N1();M1();wrr={};FVe={};$Ve={};BVe={};uZ=null;xrr={};zVe=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=vzn(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):_H(e,3);return xs(r,this.padTo)}}},UVe=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&&sp.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=kVe(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()}},qVe=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Eye()&&(this.rtf=wzn(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Srr(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Azn={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":xzn()),u=r||mi.defaultNumberingSystem,l=n||mi.defaultOutputCalendar,c=lZ(o)||mi.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){uZ=null,FVe={},$Ve={},BVe={}}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]=Czn(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=Ozn(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=Tzn(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,lZ(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 Oye(this,e,HVe,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=Ezn(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Oye(this,e,VVe,()=>{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]=Pzn(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Oye(this,void 0,()=>WVe,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ir.utc(2016,11,13,9),Ir.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Oye(this,e,KVe,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ir.utc(-40,1,1),Ir.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 zVe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new UVe(e,this.intl,r)}relFormatter(e={}){return new qVe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return _zn(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:Pye()?Szn(this.locale):Azn}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 JVe,ud,vH=b(()=>{Qp();Hk();JVe=null,ud=class t extends mh{static get utcInstance(){return JVe===null&&(JVe=new t(0)),JVe}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(Vk(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${I1(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${I1(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return I1(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 wH,ZVe=b(()=>{Hk();wH=class extends mh{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 H_(t,e){let r;if(br(t)||t===null)return e;if(t instanceof mh)return t;if(Crr(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?A1.instance:n==="utc"||n==="gmt"?ud.utcInstance:ud.parseSpecifier(n)||sp.create(t)}else return V_(t)?ud.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new wH(t)}var Aye=b(()=>{Hk();M1();vH();ZVe();Qp();wye()});function Err(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(YVe.hanidec)!==-1)e+=Izn.indexOf(t[r]);else for(let o in Orr){let[i,a]=Orr[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}function Prr(){xH={}}function ob({numberingSystem:t},e=""){let r=t||"latn";return xH[r]||(xH[r]={}),xH[r][e]||(xH[r][e]=new RegExp(`${YVe[r]}${e}`)),xH[r][e]}var YVe,Orr,Izn,xH,XVe=b(()=>{YVe={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"},Orr={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]},Izn=YVe.hanidec.replace(/[\[|\]]/g,"").split("");xH={}});var Trr,Arr,Irr,Mrr,Rrr,Nrr,jrr,Drr,mi,R1=b(()=>{wye();M1();cZ();N1();Aye();Qp();XVe();Trr=()=>Date.now(),Arr="system",Irr=null,Mrr=null,Rrr=null,Nrr=60,Drr=null,mi=class{static get now(){return Trr}static set now(e){Trr=e}static set defaultZone(e){Arr=e}static get defaultZone(){return H_(Arr,A1.instance)}static get defaultLocale(){return Irr}static set defaultLocale(e){Irr=e}static get defaultNumberingSystem(){return Mrr}static set defaultNumberingSystem(e){Mrr=e}static get defaultOutputCalendar(){return Rrr}static set defaultOutputCalendar(e){Rrr=e}static get defaultWeekSettings(){return Drr}static set defaultWeekSettings(e){Drr=lZ(e)}static get twoDigitCutoffYear(){return Nrr}static set twoDigitCutoffYear(e){Nrr=e%100}static get throwOnInvalid(){return jrr}static set throwOnInvalid(e){jrr=e}static resetCaches(){hi.resetCache(),sp.resetCache(),Ir.resetCache(),Prr()}}});var ld,dZ=b(()=>{ld=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}});function ib(t,e){return new ld("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Iye(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 krr(t,e,r){return r+(Kk(t)?Frr:Lrr)[e-1]}function $rr(t,e){let r=Kk(t)?Frr:Lrr,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Mye(t,e){return(t-e+7)%7+1}function fZ(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=krr(n,o,i),s=Mye(Iye(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=Wk(l,e,r)):u>Wk(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...mZ(t)}}function QVe(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Mye(Iye(n,1,e),r),s=j1(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=j1(l)):u>s?(l=n+1,u-=j1(n)):l=n;let{month:c,day:d}=$rr(l,u);return{year:l,month:c,day:d,...mZ(t)}}function Rye(t){let{year:e,month:r,day:n}=t,o=krr(e,r,n);return{year:e,ordinal:o,...mZ(t)}}function e6e(t){let{year:e,ordinal:r}=t,{month:n,day:o}=$rr(e,r);return{year:e,month:n,day:o,...mZ(t)}}function t6e(t,e){if(!br(t.localWeekday)||!br(t.localWeekNumber)||!br(t.localWeekYear)){if(!br(t.weekday)||!br(t.weekNumber)||!br(t.weekYear))throw new z_("Cannot mix locale-based week fields with ISO-based week fields");return br(t.localWeekday)||(t.weekday=t.localWeekday),br(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),br(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 Brr(t,e=4,r=1){let n=pZ(t.weekYear),o=Cg(t.weekNumber,1,Wk(t.weekYear,e,r)),i=Cg(t.weekday,1,7);return n?o?i?!1:ib("weekday",t.weekday):ib("week",t.weekNumber):ib("weekYear",t.weekYear)}function zrr(t){let e=pZ(t.year),r=Cg(t.ordinal,1,j1(t.year));return e?r?!1:ib("ordinal",t.ordinal):ib("year",t.year)}function r6e(t){let e=pZ(t.year),r=Cg(t.month,1,12),n=Cg(t.day,1,SH(t.year,t.month));return e?r?n?!1:ib("day",t.day):ib("month",t.month):ib("year",t.year)}function n6e(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=Cg(e,0,23)||e===24&&r===0&&n===0&&o===0,a=Cg(r,0,59),s=Cg(n,0,59),u=Cg(o,0,999);return i?a?s?u?!1:ib("millisecond",o):ib("second",n):ib("minute",r):ib("hour",e)}var Lrr,Frr,o6e=b(()=>{Qp();dZ();P1();Lrr=[0,31,59,90,120,151,181,212,243,273,304,334],Frr=[0,31,60,91,121,152,182,213,244,274,305,335]});function br(t){return typeof t>"u"}function V_(t){return typeof t=="number"}function pZ(t){return typeof t=="number"&&t%1===0}function Crr(t){return typeof t=="string"}function qrr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Eye(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Pye(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Hrr(t){return Array.isArray(t)?t:[t]}function i6e(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 Vrr(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function D1(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function lZ(t){if(t==null)return null;if(typeof t!="object")throw new Hs("Week settings must be an object");if(!Cg(t.firstDay,1,7)||!Cg(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Cg(e,1,7)))throw new Hs("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Cg(t,e,r){return pZ(t)&&t>=e&&t<=r}function Mzn(t,e){return t-e*Math.floor(t/e)}function xs(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function YT(t){if(!(br(t)||t===null||t===""))return parseInt(t,10)}function L1(t){if(!(br(t)||t===null||t===""))return parseFloat(t)}function hZ(t){if(!(br(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function _H(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function Kk(t){return t%4===0&&(t%100!==0||t%400===0)}function j1(t){return Kk(t)?366:365}function SH(t,e){let r=Mzn(e-1,12)+1,n=t+(e-r)/12;return r===2?Kk(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function bH(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 Urr(t,e,r){return-Mye(Iye(t,1,e),r)+e-1}function Wk(t,e=4,r=1){let n=Urr(t,e,r),o=Urr(t+1,e,r);return(j1(t)-n+o)/7}function gZ(t){return t>99?t:t>mi.twoDigitCutoffYear?1900+t:2e3+t}function xye(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 Vk(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 a6e(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Hs(`Invalid unit value ${t}`);return e}function CH(t,e){let r={};for(let n in t)if(D1(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=a6e(o)}return r}function I1(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}${xs(r,2)}:${xs(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${xs(r,2)}${xs(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function mZ(t){return Vrr(t,["hour","minute","second","millisecond"])}var Qp=b(()=>{P1();R1();o6e()});function HVe(t){switch(t){case"narrow":return[...Nzn];case"short":return[...s6e];case"long":return[...Rzn];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 VVe(t){switch(t){case"narrow":return[...jzn];case"short":return[...l6e];case"long":return[...u6e];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}function KVe(t){switch(t){case"narrow":return[...Fzn];case"short":return[...Lzn];case"long":return[...Dzn];default:return null}}function Wrr(t){return WVe[t.hour<12?0:1]}function Krr(t,e){return VVe(e)[t.weekday-1]}function Grr(t,e){return HVe(e)[t.month-1]}function Jrr(t,e){return KVe(e)[t.year<0?0:1]}function Srr(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 Rzn,s6e,Nzn,u6e,l6e,jzn,WVe,Dzn,Lzn,Fzn,Tye=b(()=>{sZ();Qp();Rzn=["January","February","March","April","May","June","July","August","September","October","November","December"],s6e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Nzn=["J","F","M","A","M","J","J","A","S","O","N","D"];u6e=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],l6e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],jzn=["M","T","W","T","F","S","S"];WVe=["AM","PM"],Dzn=["Before Christ","Anno Domini"],Lzn=["BC","AD"],Fzn=["B","A"]});function Zrr(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var kzn,cd,yZ=b(()=>{Tye();sZ();Qp();kzn={D:T1,DD:U7,DDD:q7,DDDD:H7,t:V7,tt:W7,ttt:K7,tttt:G7,T:J7,TT:Z7,TTT:Y7,TTTT:X7,f:Q7,ff:tZ,fff:nZ,ffff:iZ,F:eZ,FF:rZ,FFF:oZ,FFFF:aZ},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 kzn[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 xs(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,h)=>this.loc.extract(e,p,h),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?Wrr(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,h)=>n?Grr(e,p):i(h?{month:p}:{month:p,day:"numeric"},"month"),l=(p,h)=>n?Krr(e,p):i(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let h=t.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(e,h):p},d=p=>n?Jrr(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 Zrr(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 Zrr(i,o(s))}}});function EH(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function PH(...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 TH(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 Qrr(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=YT(e[r+o]);return[n,null,r+o]}}function OH(t,e,r){let n=t[e];return br(n)?r:YT(n)}function Kzn(t,e){return[{year:OH(t,e),month:OH(t,e+1,1),day:OH(t,e+2,1)},null,e+3]}function AH(t,e){return[{hours:OH(t,e,0),minutes:OH(t,e+1,0),seconds:OH(t,e+2,0),milliseconds:hZ(t[e+3])},null,e+4]}function bZ(t,e){let r=!t[e]&&!t[e+1],n=Vk(t[e+1],t[e+2]),o=r?null:ud.instance(n);return[{},o,e+3]}function _Z(t,e){let r=t[e]?sp.create(t[e]):null;return[{},r,e+1]}function Zzn(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,h=!1)=>p!==void 0&&(h||p&&c)?-p:p;return[{years:f(L1(r)),months:f(L1(n)),weeks:f(L1(o)),days:f(L1(i)),hours:f(L1(a)),minutes:f(L1(s)),seconds:f(L1(u),u==="-0"),milliseconds:f(hZ(l),d)}]}function f6e(t,e,r,n,o,i,a){let s={year:e.length===2?gZ(YT(e)):YT(e),month:s6e.indexOf(r)+1,day:YT(n),hour:YT(o),minute:YT(i)};return a&&(s.second=YT(a)),t&&(s.weekday=t.length>3?u6e.indexOf(t)+1:l6e.indexOf(t)+1),s}function Qzn(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=f6e(e,o,n,r,i,a,s),p;return u?p=Yzn[u]:l?p=0:p=Vk(c,d),[f,new ud(p)]}function eUn(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}function Yrr(t){let[,e,r,n,o,i,a,s]=t;return[f6e(e,o,n,r,i,a,s),ud.utcInstance]}function oUn(t){let[,e,r,n,o,i,a,s]=t;return[f6e(e,s,r,n,o,i,a),ud.utcInstance]}function onr(t){return TH(t,[iUn,nnr],[aUn,lUn],[sUn,cUn],[uUn,dUn])}function inr(t){return TH(eUn(t),[Xzn,Qzn])}function anr(t){return TH(t,[tUn,Yrr],[rUn,Yrr],[nUn,oUn])}function snr(t){return TH(t,[Jzn,Zzn])}function unr(t){return TH(t,[Gzn,fUn])}function lnr(t){return TH(t,[pUn,nnr],[mUn,hUn])}var Xrr,enr,$zn,c6e,tnr,d6e,Bzn,zzn,Uzn,qzn,Hzn,Vzn,rnr,Wzn,Gzn,Jzn,Yzn,Xzn,tUn,rUn,nUn,iUn,aUn,sUn,uUn,nnr,lUn,cUn,dUn,fUn,pUn,mUn,hUn,p6e=b(()=>{Qp();Tye();vH();M1();Xrr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;enr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,$zn=`(?:${enr.source}?(?:\\[(${Xrr.source})\\])?)?`,c6e=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,tnr=RegExp(`${c6e.source}${$zn}`),d6e=RegExp(`(?:T${tnr.source})?`),Bzn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,zzn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Uzn=/(\d{4})-?(\d{3})/,qzn=Qrr("weekYear","weekNumber","weekDay"),Hzn=Qrr("year","ordinal"),Vzn=/(\d{4})-(\d\d)-(\d\d)/,rnr=RegExp(`${c6e.source} ?(?:${enr.source}|(${Xrr.source}))?`),Wzn=RegExp(`(?: ${rnr.source})?`);Gzn=RegExp(`^T?${c6e.source}$`),Jzn=/^-?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)?)?)$/;Yzn={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};Xzn=/^(?:(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)))$/;tUn=/^(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$/,rUn=/^(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$/,nUn=/^(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})$/;iUn=EH(Bzn,d6e),aUn=EH(zzn,d6e),sUn=EH(Uzn,d6e),uUn=EH(tnr),nnr=PH(Kzn,AH,bZ,_Z),lUn=PH(qzn,AH,bZ,_Z),cUn=PH(Hzn,AH,bZ,_Z),dUn=PH(AH,bZ,_Z);fUn=PH(AH);pUn=EH(Vzn,Wzn),mUn=EH(rnr),hUn=PH(AH,bZ,_Z)});function F1(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 Ss(n)}function pnr(t,e){let r=e.milliseconds??0;for(let n of bUn.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function dnr(t,e){let r=pnr(t,e)<0?-1:1;Gk.reduceRight((n,o)=>{if(br(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),Gk.reduce((n,o)=>{if(br(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function _Un(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var cnr,fnr,gUn,ab,IH,yUn,Gk,bUn,Ss,vZ=b(()=>{P1();yZ();dZ();cZ();p6e();Qp();R1();N1();cnr="Invalid Duration",fnr={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}},gUn={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},...fnr},ab=146097/400,IH=146097/4800,yUn={years:{quarters:4,months:12,weeks:ab/7,days:ab,hours:ab*24,minutes:ab*24*60,seconds:ab*24*60*60,milliseconds:ab*24*60*60*1e3},quarters:{months:3,weeks:ab/28,days:ab/4,hours:ab*24/4,minutes:ab*24*60/4,seconds:ab*24*60*60/4,milliseconds:ab*24*60*60*1e3/4},months:{weeks:IH/7,days:IH,hours:IH*24,minutes:IH*24*60,seconds:IH*24*60*60,milliseconds:IH*24*60*60*1e3},...fnr},Gk=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],bUn=Gk.slice(0).reverse();Ss=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?yUn:gUn;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 Hs(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:CH(e,t.normalizeUnit),loc:hi.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(V_(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Hs(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=snr(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]=unr(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 Hs("need to specify a reason the Duration is invalid");let n=e instanceof ld?e:new ld(e,r);if(mi.throwOnInvalid)throw new _ye(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 yH(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):cnr}toHuman(e={}){if(!this.isValid)return cnr;let r=Gk.map(n=>{let o=this.values[n];return br(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+=_H(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},Ir.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?pnr(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 Gk)(D1(r.values,o)||D1(this.values,o))&&(n[o]=r.get(o)+this.get(o));return F1(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]=a6e(e(this.values[n],n));return F1(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...CH(e,t.normalizeUnit)};return F1(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 F1(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return dnr(this.matrix,e),F1(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=_Un(this.normalize().shiftToAll().toObject());return F1(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 Gk)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;V_(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else V_(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 dnr(this.matrix,r),F1(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 F1(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 Gk)if(!r(this.values[n],e.values[n]))return!1;return!0}}});function vUn(t,e){return!t||!t.isValid?XT.invalid("missing or invalid start"):!e||!e.isValid?XT.invalid("missing or invalid end"):e<t?XT.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 MH,XT,m6e=b(()=>{N1();vZ();R1();P1();dZ();yZ();sZ();MH="Invalid Interval";XT=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 Hs("need to specify a reason the Interval is invalid");let n=e instanceof ld?e:new ld(e,r);if(mi.throwOnInvalid)throw new bye(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=RH(e),o=RH(r),i=vUn(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=Ss.fromDurationLike(r),o=RH(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=Ss.fromDurationLike(r),o=RH(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=Ir.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Ir.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=Ss.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=Ss.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(RH).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=Ss.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()})`:MH}[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=T1,r={}){return this.isValid?cd.create(this.s.loc.clone(r),e).formatInterval(this):MH}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:MH}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:MH}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:MH}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:MH}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Ss.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}}});var QT,h6e=b(()=>{N1();R1();cZ();M1();Aye();Qp();QT=class{static hasDST(e=mi.defaultZone){let r=Ir.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return sp.isValidZone(e)}static normalizeZone(e){return H_(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:Eye(),localeWeek:Pye()}}}});function mnr(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Ss.fromMillis(n).as("days"))}function wUn(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=mnr(u,l);return(c-c%7)/7}],["days",mnr]],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 hnr(t,e,r,n){let[o,i,a,s]=wUn(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=Ss.fromObject(i,n);return l.length>0?Ss.fromMillis(u,n).shiftTo(...l).plus(c):c}var gnr=b(()=>{vZ()});function Ti(t,e=r=>r){return{regex:t,deser:([r])=>e(Err(r))}}function CUn(t){return t.replace(/\./g,"\\.?").replace(vnr,_nr)}function ynr(t){return t.replace(/\./g,"").replace(vnr," ").toLowerCase()}function W_(t,e){return t===null?null:{regex:RegExp(t.map(CUn).join("|")),deser:([r])=>t.findIndex(n=>ynr(r)===ynr(n))+e}}function bnr(t,e){return{regex:t,deser:([,r,n])=>Vk(r,n),groups:e}}function Nye(t){return{regex:t,deser:([e])=>e}}function OUn(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function EUn(t,e){let r=ob(e),n=ob(e,"{2}"),o=ob(e,"{3}"),i=ob(e,"{4}"),a=ob(e,"{6}"),s=ob(e,"{1,2}"),u=ob(e,"{1,3}"),l=ob(e,"{1,6}"),c=ob(e,"{1,9}"),d=ob(e,"{2,4}"),f=ob(e,"{4,6}"),p=g=>({regex:RegExp(OUn(g.val)),deser:([y])=>y,literal:!0}),m=(g=>{if(t.literal)return p(g);switch(g.val){case"G":return W_(e.eras("short"),0);case"GG":return W_(e.eras("long"),0);case"y":return Ti(l);case"yy":return Ti(d,gZ);case"yyyy":return Ti(i);case"yyyyy":return Ti(f);case"yyyyyy":return Ti(a);case"M":return Ti(s);case"MM":return Ti(n);case"MMM":return W_(e.months("short",!0),1);case"MMMM":return W_(e.months("long",!0),1);case"L":return Ti(s);case"LL":return Ti(n);case"LLL":return W_(e.months("short",!1),1);case"LLLL":return W_(e.months("long",!1),1);case"d":return Ti(s);case"dd":return Ti(n);case"o":return Ti(u);case"ooo":return Ti(o);case"HH":return Ti(n);case"H":return Ti(s);case"hh":return Ti(n);case"h":return Ti(s);case"mm":return Ti(n);case"m":return Ti(s);case"q":return Ti(s);case"qq":return Ti(n);case"s":return Ti(s);case"ss":return Ti(n);case"S":return Ti(u);case"SSS":return Ti(o);case"u":return Nye(c);case"uu":return Nye(s);case"uuu":return Ti(r);case"a":return W_(e.meridiems(),0);case"kkkk":return Ti(i);case"kk":return Ti(d,gZ);case"W":return Ti(s);case"WW":return Ti(n);case"E":case"c":return Ti(r);case"EEE":return W_(e.weekdays("short",!1),1);case"EEEE":return W_(e.weekdays("long",!1),1);case"ccc":return W_(e.weekdays("short",!0),1);case"cccc":return W_(e.weekdays("long",!0),1);case"Z":case"ZZ":return bnr(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return bnr(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Nye(/[a-z_+-/]{1,256}?/i);case" ":return Nye(/[^\S\n\r]/);default:return p(g)}})(t)||{invalidReason:xUn};return m.token=t,m}function TUn(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=PUn[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function AUn(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function IUn(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(D1(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 MUn(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 br(t.z)||(r=sp.create(t.z)),br(t.Z)||(r||(r=new ud(t.Z)),n=t.Z),br(t.q)||(t.M=(t.q-1)*3+1),br(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),br(t.u)||(t.S=hZ(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}function RUn(){return g6e||(g6e=Ir.fromMillis(1555555555555)),g6e}function NUn(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 y6e(t,e){return Array.prototype.concat(...t.map(r=>NUn(r,e)))}function b6e(t,e,r){return new wZ(t,r).explainFromTokens(e)}function wnr(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=b6e(t,e,r);return[n,o,i,a]}function _6e(t,e){if(!t)return null;let n=cd.create(e,t).dtFormatter(RUn()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>TUn(a,t,i))}var xUn,SUn,_nr,vnr,PUn,g6e,wZ,xnr=b(()=>{Qp();yZ();vH();M1();N1();XVe();P1();xUn="missing Intl.DateTimeFormat.formatToParts support";SUn="\xA0",_nr=`[ ${SUn}]`,vnr=new RegExp(_nr,"g");PUn={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"}};g6e=null;wZ=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=y6e(cd.parseFormat(r),e),this.units=this.tokens.map(n=>EUn(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=AUn(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=IUn(e,this.regex,this.handlers),[o,i,a]=n?MUn(n):[null,null,void 0];if(D1(n,"a")&&D1(n,"H"))throw new z_("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 xZ(t){return new ld("unsupported zone",`the zone "${t.name}" is not supported`)}function w6e(t){return t.weekData===null&&(t.weekData=fZ(t.c)),t.weekData}function x6e(t){return t.localWeekData===null&&(t.localWeekData=fZ(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Jk(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Ir({...r,...e,old:r})}function Inr(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 jye(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 Lye(t,e,r){return Inr(bH(t),e,r)}function Cnr(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,SH(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Ss.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=bH(i),[u,l]=Inr(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function NH(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=Ir.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Ir.invalid(new ld("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Dye(t,e,r=!0){return t.isValid?cd.create(hi.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function S6e(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=xs(t.c.year,r?6:4),e?(n+="-",n+=xs(t.c.month),n+="-",n+=xs(t.c.day)):(n+=xs(t.c.month),n+=xs(t.c.day)),n}function Onr(t,e,r,n,o,i){let a=xs(t.c.hour);return e?(a+=":",a+=xs(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=xs(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=xs(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=xs(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=xs(Math.trunc(-t.o/60)),a+=":",a+=xs(Math.trunc(-t.o%60))):(a+="+",a+=xs(Math.trunc(t.o/60)),a+=":",a+=xs(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}function kUn(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 yH(t);return e}function Enr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return kUn(t)}}function $Un(t){return kye[t]||(Fye===void 0&&(Fye=mi.now()),kye[t]=t.offset(Fye)),kye[t]}function Pnr(t,e){let r=H_(e.zone,mi.defaultZone);if(!r.isValid)return Ir.invalid(xZ(r));let n=hi.fromObject(e),o,i;if(br(t.year))o=mi.now();else{for(let u of Rnr)br(t[u])&&(t[u]=Mnr[u]);let a=r6e(t)||n6e(t);if(a)return Ir.invalid(a);let s=$Un(r);[o,i]=Lye(t,s,r)}return new Ir({ts:o,zone:r,loc:n,o:i})}function Tnr(t,e,r){let n=br(r.round)?!0:r.round,o=(a,s)=>(a=_H(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 Anr(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 RH(t){if(Ir.isDateTime(t))return t;if(t&&t.valueOf&&V_(t.valueOf()))return Ir.fromJSDate(t);if(t&&typeof t=="object")return Ir.fromObject(t);throw new Hs(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var v6e,Snr,Mnr,jUn,DUn,Rnr,LUn,FUn,Fye,kye,Ir,N1=b(()=>{vZ();m6e();R1();h6e();yZ();vH();cZ();Qp();Aye();gnr();p6e();xnr();o6e();sZ();P1();dZ();v6e="Invalid DateTime",Snr=864e13;Mnr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},jUn={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},DUn={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Rnr=["year","month","day","hour","minute","second","millisecond"],LUn=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],FUn=["year","ordinal","hour","minute","second","millisecond"];kye={},Ir=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:xZ(r));this.ts=br(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=V_(e.o)&&!e.old?e.o:r.offset(this.ts);o=jye(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]=Anr(arguments),[n,o,i,a,s,u,l]=r;return Pnr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=Anr(arguments),[n,o,i,a,s,u,l]=r;return e.zone=ud.utcInstance,Pnr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=qrr(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=H_(r.zone,mi.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:hi.fromObject(r)}):t.invalid(xZ(o))}static fromMillis(e,r={}){if(V_(e))return e<-Snr||e>Snr?t.invalid("Timestamp out of range"):new t({ts:e,zone:H_(r.zone,mi.defaultZone),loc:hi.fromObject(r)});throw new Hs(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(V_(e))return new t({ts:e*1e3,zone:H_(r.zone,mi.defaultZone),loc:hi.fromObject(r)});throw new Hs("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=H_(r.zone,mi.defaultZone);if(!n.isValid)return t.invalid(xZ(n));let o=hi.fromObject(r),i=CH(e,Enr),{minDaysInFirstWeek:a,startOfWeek:s}=t6e(i,o),u=mi.now(),l=br(r.specificOffset)?n.offset(u):r.specificOffset,c=!br(i.ordinal),d=!br(i.year),f=!br(i.month)||!br(i.day),p=d||f,h=i.weekYear||i.weekNumber;if((p||c)&&h)throw new z_("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new z_("Can't mix ordinal dates with month/day");let m=h||i.weekday&&!p,g,y,_=jye(u,l);m?(g=LUn,y=jUn,_=fZ(_,a,s)):c?(g=FUn,y=DUn,_=Rye(_)):(g=Rnr,y=Mnr);let w=!1;for(let N of g){let M=i[N];br(M)?w?i[N]=y[N]:i[N]=_[N]:w=!0}let S=m?Brr(i,a,s):c?zrr(i):r6e(i),C=S||n6e(i);if(C)return t.invalid(C);let E=m?QVe(i,a,s):c?e6e(i):i,[P,T]=Lye(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]=onr(e);return NH(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=inr(e);return NH(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=anr(e);return NH(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(br(e)||br(r))throw new Hs("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]=wnr(a,e,r);return c?t.invalid(c):NH(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]=lnr(e);return NH(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Hs("need to specify a reason the DateTime is invalid");let n=e instanceof ld?e:new ld(e,r);if(mi.throwOnInvalid)throw new yye(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 y6e(cd.parseFormat(e),hi.fromObject(r)).map(o=>o.val).join("")}static resetCache(){Fye=void 0,kye={}}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?w6e(this).weekYear:NaN}get weekNumber(){return this.isValid?w6e(this).weekNumber:NaN}get weekday(){return this.isValid?w6e(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?x6e(this).weekday:NaN}get localWeekNumber(){return this.isValid?x6e(this).weekNumber:NaN}get localWeekYear(){return this.isValid?x6e(this).weekYear:NaN}get ordinal(){return this.isValid?Rye(this.c).ordinal:NaN}get monthShort(){return this.isValid?QT.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?QT.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?QT.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?QT.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=bH(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=jye(u,a),d=jye(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Jk(this,{ts:u}),Jk(this,{ts:l})]:[this]}get isInLeapYear(){return Kk(this.year)}get daysInMonth(){return SH(this.year,this.month)}get daysInYear(){return this.isValid?j1(this.year):NaN}get weeksInWeekYear(){return this.isValid?Wk(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Wk(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=H_(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]=Lye(a,i,e)}return Jk(this,{ts:o,zone:e})}else return t.invalid(xZ(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return Jk(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=CH(e,Enr),{minDaysInFirstWeek:n,startOfWeek:o}=t6e(r,this.loc),i=!br(r.weekYear)||!br(r.weekNumber)||!br(r.weekday),a=!br(r.ordinal),s=!br(r.year),u=!br(r.month)||!br(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new z_("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new z_("Can't mix ordinal dates with month/day");let d;i?d=QVe({...fZ(this.c,n,o),...r},n,o):br(r.ordinal)?(d={...this.toObject(),...r},br(r.day)&&(d.day=Math.min(SH(d.year,d.month),d.day))):d=e6e({...Rye(this.c),...r});let[f,p]=Lye(d,this.o,this.zone);return Jk(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Ss.fromDurationLike(e);return Jk(this,Cnr(this,r))}minus(e){if(!this.isValid)return this;let r=Ss.fromDurationLike(e).negate();return Jk(this,Cnr(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Ss.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):v6e}toLocaleString(e=T1,r={}){return this.isValid?cd.create(this.loc.clone(r),e).formatDateTime(this):v6e}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=S6e(this,a);return s+="T",s+=Onr(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?S6e(this,e==="extended"):null}toISOWeekDate(){return Dye(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":"")+Onr(this,a==="extended",r,e,n,i):null}toRFC2822(){return Dye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Dye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?S6e(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")),Dye(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():v6e}[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 Ss.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Hrr(r).map(Ss.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=hnr(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?XT.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),Tnr(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?Tnr(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 Hs("min requires all arguments be DateTimes");return i6e(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Hs("max requires all arguments be DateTimes");return i6e(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 b6e(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 wZ(i,e)}static fromFormatParser(e,r,n={}){if(br(e)||br(r))throw new Hs("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 Hs(`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):NH(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return T1}static get DATE_MED(){return U7}static get DATE_MED_WITH_WEEKDAY(){return jVe}static get DATE_FULL(){return q7}static get DATE_HUGE(){return H7}static get TIME_SIMPLE(){return V7}static get TIME_WITH_SECONDS(){return W7}static get TIME_WITH_SHORT_OFFSET(){return K7}static get TIME_WITH_LONG_OFFSET(){return G7}static get TIME_24_SIMPLE(){return J7}static get TIME_24_WITH_SECONDS(){return Z7}static get TIME_24_WITH_SHORT_OFFSET(){return Y7}static get TIME_24_WITH_LONG_OFFSET(){return X7}static get DATETIME_SHORT(){return Q7}static get DATETIME_SHORT_WITH_SECONDS(){return eZ}static get DATETIME_MED(){return tZ}static get DATETIME_MED_WITH_SECONDS(){return rZ}static get DATETIME_MED_WITH_WEEKDAY(){return DVe}static get DATETIME_FULL(){return nZ}static get DATETIME_FULL_WITH_SECONDS(){return oZ}static get DATETIME_HUGE(){return iZ}static get DATETIME_HUGE_WITH_SECONDS(){return aZ}}});var Nnr=b(()=>{N1();vZ();m6e();h6e();Hk();vH();M1();ZVe();wye();R1()});function C6e(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 BUn(t){let e=Ir.now();if(t)try{let i=C6e(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(Ir.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}function zUn(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 UUn(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 qUn(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=NVe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Ir.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 HUn(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=Dnr[r[1]],o=e.year;n>e.month&&o--;let i=Ir.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 VUn(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=Ir.fromObject({year:n,month:1,day:1}),i=Ir.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 WUn(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=Ir.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 KUn(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=Dnr[r[1].toLowerCase()],o=parseInt(r[2]),i=Ir.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 GUn(t){let e=Ir.now(),r=t.toLowerCase().replace("@vault","").trim(),n=zUn(r,e)||UUn(r,e)||qUn(r,e)||HUn(r,e)||KUn(r,e)||WUn(r,e)||VUn(r,e);if(n)return{startTime:SZ(n.start),endTime:SZ(n.end)};let o=NVe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Ir.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Ir.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:SZ(i),endTime:SZ(a)}}console.warn(`Unable to parse time expression: ${t}`)}function SZ(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString(Ir.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}function JUn(t){let e=t.toString().length===10?t*1e3:t,r=Ir.fromMillis(e);return SZ(r)}function ZUn(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 YUn(t="25min"){let e=ZUn(t);return new Promise(r=>{setTimeout(()=>{new jnr.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}async function XUn(t,e,r){let n=C6e(e),o=C6e(r);try{let i=Ir.now().setZone(n),a=_rr(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=Ir.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(Ir.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString(Ir.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString(Ir.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var jnr,$ye,Dnr,Bye,zye,CZ,Uye,O6e=b(()=>{vrr();Nnr();jnr=require("obsidian");xd();$k();$ye=Kl({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})=>BUn(t),isBackground:!0}),Dnr={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};Bye=Kl({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})=>GUn(t),isBackground:!0});zye=Kl({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})=>JUn(t),isBackground:!0});CZ=Kl({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})=>(YUn(t),`Pomodoro timer started. It will end in ${t}.`)});Uye=Kl({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})=>XUn(t,e,r),isBackground:!0})});var Lnr,Fnr,qye,E6e=b(()=>{My();ir();xd();$k();Lnr=5e4,Fnr=Kl({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>Lnr)return JSON.stringify({success:!1,message:`Input too long: Maximum allowed length is ${Lnr} characters`});let r=_ee(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 Ji.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})}}),qye=Kl({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 Ji.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 OZ,Zk,Hye=b(()=>{mR();ua();cVe();fVe();O6e();E6e();l7();ir();My();OZ=["@vault","@composer","@websearch","@youtube","@pomodoro"],Zk=class{static initTools(e){this.tools.length===0&&(this.tools=[$ye,Uye,zye,Bye,c7,Her,CZ,d7,qye,uye(e.getRoot())])}static async analyzeIntent(e){try{let r=await Ji.getInstance().broca(e,Fj());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 DO.callTool(u,l)),u.name=="getFileTree"&&Fj())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:c7,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await Vd.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=QB(c);r.push({tool:d7,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:CZ,args:{interval:l}})}let s=_ee(e);for(let u of s)r.some(c=>c.tool.name===qye.name&&c.args.url===u)||r.push({tool:qye,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!OZ.includes(r.toLowerCase())).join(" ").trim()}};Zk.tools=[]});var jH,P6e=b(()=>{jH=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*<title>([^<]*)<\/title>(?:\s*<path>([^<]*)<\/path>)?(?:\s*<modified>([^<]*)<\/modified>)?[\s\S]*?<\/document>/g,p;for(;(p=f.exec(u))!==null;)d.push({title:p[1]||"Untitled",path:p[2]||"",mtime:p[3]||null});let m=d.slice(0,10).map((y,_)=>{let w=[`${_+1}. ${y.title}`];return y.mtime&&w.push(` \u{1F552} Modified: ${y.mtime}`),y.path&&y.path!==y.title&&w.push(` \u{1F4C1} ${y.path}`),w.join(`
`)}).join(`
`),g=c>10?`
... and ${c-10} more results`:"";return`\u{1F4DA} Found ${c} relevant notes
Top results:
${m}${g}`}}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(Array.isArray(e))return e;if(typeof e=="object"&&e!==null)return[e];if(typeof e=="string"){let r=e.trim();return!r.startsWith("[")&&!r.startsWith("{")?[]:this.tryParseJson(e)}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 Vye,knr=b(()=>{P6e();Vye=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=jH.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 T6e(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=QUn(r);n&&e.push({role:n,content:r.content})}}return e}function QUn(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function Wye(t,e){let r=T6e(t);for(let n of r)e.push({role:n.role,content:n.content})}function $nr(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 A6e=b(()=>{});function I6e(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=>{let o=n.title||"Untitled",i=n.path||"",a=null;if(n.mtime){let s=new Date(n.mtime);isNaN(s.getTime())||(a=s.toISOString())}return`<document>
<title>${o}</title>${i&&i!==o?`
<path>${i}</path>`:""}${a?`
<modified>${a}</modified>`:""}
<content>
${n.content||""}
</content>
</document>`}).filter(n=>n.length>0).join(`
`)}function Bnr(t){try{let e=JSON.parse(t);return Array.isArray(e)?I6e(e):"Invalid search results format."}catch(e){return Bt("Failed to format localSearch result string:",e),"Error processing search results."}}function znr(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})):[]}var Unr=b(()=>{Gt()});async function M6e(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 lO())return{toolName:t.name,result:`Error: ${Yk(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 DO.callTool(o,i):s=await Promise.race([DO.callTool(o,i),new Promise((u,l)=>setTimeout(()=>l(new Error(`Tool execution timed out after ${a}ms`)),a))]),s==null?(Bt(`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: ${eo(o)}`,success:!1}}}function Yk(t){return t==="localSearch"?oe().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 DH(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 qnr(t,e){if(t=="writeToFile"||t=="replaceInFile")return"Accept / reject in the Preview";if(t==="localSearch"&&e?.salientTerms&&!oe().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 R6e(t,e){let r=Yk(t.name),n=DH(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 N6e(t,e){let r=Yk(t),n=DH(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";B(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300;e.result.length>i?B(`Result: ${e.result.substring(0,i)}... (truncated, ${e.result.length} chars total)`):B("Result:",e.result),B("---")}function EZ(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 Kye=b(()=>{Gt();ly();bt();l7();ir()});var LO,Gye=b(()=>{QHe();or();mze();My();Gt();ly();bt();sVe();l7();ir();Hye();sG();knr();A6e();Unr();g4();Kye();LO=class extends qP{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=XSe(r),i=r.split(/\s+/).filter(a=>a!=="@youtube"&&a.length>0);return n&&o!==null&&i.length===1}async processImageUrls(e){let r=[],n=await pF.processUrlBatch(e,r,this.chainManager.app.vault);return pF.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await pF.processChatImageBatch(e,r,this.chainManager.app.vault);return pF.showFailedImagesNotice(r),n}extractNoteContent(e){let r=/<note_context>([\s\S]*?)<\/note_context>/g,n=/<active_note>([\s\S]*?)<\/active_note>/g,o=/<content>([\s\S]*?)<\/content>/g,i="",a;for(;(a=r.exec(e))!==null;){let s=a[1],u;for(;(u=o.exec(s))!==null;)i+=u[1]+`
`}for(;(a=n.exec(e))!==null;){let s=a[1],u;for(;(u=o.exec(s))!==null;)i+=u[1]+`
`}return i.trim()}async extractEmbeddedImages(e,r){let n=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g,o=/!\[.*?\]\(([^)]+)\)/g,i=[],a=[...e.matchAll(n)];for(let u of a){let l=u[1];if(r){let c=app.metadataCache.getFirstLinkpathDest(l,r);c?i.push(c.path):(Bt(`Could not resolve embedded image: ${l} from source: ${r}`),i.push(l))}else i.push(l)}let s=[...e.matchAll(o)];for(let u of s){let l=u[1].trim();if(!l)continue;if(l.match(/^https?:\/\//)){i.push(l);continue}let c=l.replace(/^\.\//,"").replace(/^\//,"");if(r){let d=app.metadataCache.getFirstLinkpathDest(c,r);d?i.push(d.path):i.push(c)}else i.push(c)}return i}async buildMessageContent(e,r){let n=[],o=[],i=oe(),a=[];if(i.passMarkdownImages){let c;if(r.context?.notes&&r.context.notes.length>0)c=r.context.notes[0].path;else{let f=this.chainManager.app?.workspace.getActiveFile();f&&(c=f.path)}let d=this.extractNoteContent(e);if(d){let f=await this.extractEmbeddedImages(d,c);f.length>0&&a.push({urls:f,type:"embedded"})}}for(let c of a){let d=await this.processImageUrls(c.urls);o.push(...d.successfulImages),n.push(...d.failureDescriptions)}let s=r.content;if(s&&s.length>0){let c=await this.processChatInputImages(s);o.push(...c.successfulImages),n.push(...c.failureDescriptions)}let u=e;n.length>0&&(u=`${e}
Note:
${n.join(`
`)}
`);let l=[{type:"text",text:u}];return o.length>0&&l.push(...o),l}hasCapability(e,r){let n=e.modelName||e.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(e){return this.hasCapability(e,"vision")}appendComposerInstructionsIfNeeded(e,r){if(!r.message||!r.message.includes("@composer"))return e;let n=`<OUTPUT_FORMAT>
${Bet}
</OUTPUT_FORMAT>`;return`${e}
${n}`}async streamMultimodalResponse(e,r,n,o){let s=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],u=[],l=await this.getSystemPrompt();s.length>0&&(l+=`
The following is the relevant conversation history. Use this context to maintain consistency in your responses:`);let c=this.chainManager.chatModelManager.getChatModel();l&&u.push({role:eI(c),content:`${l}
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.`}),Wye(s,u);let d=this.chainManager.chatModelManager.getChatModel(),p=this.isMultimodalModel(d)?await this.buildMessageContent(e,r):e;u.push({role:"user",content:p});let h=p instanceof Array?p[0].text:p;B("Enhanced user message: ",h),B(`==== Final Request to AI ====
`,u);let m=new Vye(DO,sye),g=new __(o),y=await Od(()=>this.chainManager.chatModelManager.getChatModel().stream(u,{signal:n.signal}));for await(let _ of y){if(n.signal.aborted){B("CopilotPlus multimodal stream iteration aborted",{reason:n.signal.reason});break}for await(let w of m.processChunk(_))g.processChunk(w)}return g.close()}async run(e,r,n,o,i){let{updateLoadingMessage:a}=i,s="",u=[],l="";if(!await lO({isCopilotPlus:!0}))return await this.handleError(new Error("Invalid license key"),o,n),"";let d=f=>{l=f,n(f)};try{if(this.isYoutubeOnlyMessage(e.message)){let M=XSe(e.message),D="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(M)try{let k=await Ji.getInstance().youtube4llm(M);return k.response.transcript?this.handleResponse(k.response.transcript,e,r,o,n):this.handleResponse(D,e,r,o,n)}catch(k){return ie("Error processing YouTube video:",k),this.handleResponse(D,e,r,o,n)}}B("==== Step 1: Analyzing intent ====");let f,p=e.originalMessage||e.message;try{f=await Zk.analyzeIntent(p)}catch(M){return this.handleResponse(Tet(M),e,r,o,n)}let h=e.message.split(" ").filter(M=>!OZ.includes(M.toLowerCase())).join(" ").trim(),{toolOutputs:m,sources:g}=await this.executeToolCalls(f,a);u=g;let _=m.find(M=>M.tool==="localSearch"&&M.output!=null)&&u.length>0,C=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],E=T6e(C),P=$nr(E),T=h;P.length>0&&(B("==== Condensing Question ===="),T=await rye(h,P),B("Condensed standalone question: ",T));let I=this.prepareEnhancedUserMessage(T,m,f),N=m.some(M=>M.tool!=="localSearch"&&M.output!=null);_&&!N&&(I=`Answer the question with as detailed as possible based only on the following context:
${I}`),I=this.appendComposerInstructionsIfNeeded(I,e),B("==== Invoking LLM with all tool results ===="),s=await this.streamMultimodalResponse(I,e,r,d)}catch(f){a?.(Iv.DEFAULT),f.name==="AbortError"||r.signal.aborted?B("CopilotPlus stream aborted by user",{reason:r.signal.reason}):await this.handleError(f,o,n)}return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(r.signal.aborted&&l&&(s=l),this.handleResponse(s,e,r,o,n,u))}getSources(e){return!e||!Array.isArray(e)?(Bt("No valid documents provided to getSources"),[]):this.sortUniqueDocsByScore(e)}sortUniqueDocsByScore(e){let r=new Map;for(let n of e){if(!n.title||!n?.score&&!n?.rerank_score){Bt("Invalid document structure:",n);continue}let o=n.path||n.title,i=r.get(o),a=n&&"rerank_score"in n,s=a?n.rerank_score:n.score;(!i||s>(i.score??0))&&r.set(o,{title:n.title,path:n.path||n.title,score:s,isReranked:a,explanation:n.explanation||null})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r){let n=[],o=[];for(let i of e){B(`==== Step 2: Calling tool: ${i.tool.name} ====`),i.tool.name==="localSearch"?r?.(Iv.READING_FILES):i.tool.name==="webSearch"?r?.(Iv.SEARCHING_WEB):i.tool.name==="getFileTree"&&r?.(Iv.READING_FILE_TREE);let a=await DO.callTool(i.tool,i.args);if(i.tool.name==="localSearch"){let u={result:typeof a=="string"?a:JSON.stringify(a),success:a!=null},l=this.getTimeExpression(e),c=this.processLocalSearchResult(u,l);o.push(...c.sources),n.push({tool:i.tool.name,output:c.formattedForLLM})}else n.push({tool:i.tool.name,output:a})}return{toolOutputs:n,sources:EZ(o)}}prepareEnhancedUserMessage(e,r,n){let o="",i=!1,a=r.find(s=>s.tool==="localSearch"&&s.output!=null);if(a&&typeof a.output=="string")try{let s=JSON.parse(a.output);Array.isArray(s)&&s.length>0&&(i=!0)}catch{}if(r.length>0){let s=r.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&&r.filter(s=>s.output!=null).length===1?`${o}
Question: ${e}`:`${e}${o}`}getTimeExpression(e){let r=e.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(e,r){let n=e.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+(u.content?.length||0),0),i=n;if(o>oCe){let s=oCe/o;B("Truncating document contents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content?.slice(0,Math.floor((u.content?.length||0)*s))||""}))}let a=I6e(i);return r?`<localSearch timeRange="${r}">
${a}
</localSearch>`:`<localSearch>
${a}
</localSearch>`}processLocalSearchResult(e,r){let n=[],o;if(!e.success)return o=`<localSearch>
Search failed.
</localSearch>`,{formattedForLLM:o,sources:n};try{let i=JSON.parse(e.result);if(!Array.isArray(i))return o=`<localSearch>
Invalid search results format.
</localSearch>`,{formattedForLLM:o,sources:n};n=znr(i),o=this.prepareLocalSearchResult(i,r||"")}catch(i){Bt("Failed to parse localSearch results:",i);let a=Bnr(e.result);o=r?`<localSearch timeRange="${r}">
${a}
</localSearch>`:`<localSearch>
${a}
</localSearch>`}return{formattedForLLM:o,sources:n}}async getSystemPrompt(){return Mf()}}});var PZ,Vnr=b(()=>{ua();bt();mR();Gye();PZ=class extends LO{async getSystemPrompt(){let e=Mf(),r=wu();if(!r)return e;let n=await Vd.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 FO,Jye=b(()=>{FO=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)}getToolMetadata(e){return this.tools.get(e)?.metadata}clear(){this.tools.clear()}}});function tqn(t){FO.getInstance().register({tool:uye(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 Zye(t){let e=FO.getInstance(),r=e.getToolMetadata("getFileTree")!==void 0,n=t!==void 0;(e.getAllTools().length===0||r!==n)&&(e.clear(),e.registerAll(eqn),t&&tqn(t))}var eqn,j6e=b(()=>{Jye();fVe();O6e();E6e();sVe();cVe();eqn=[{tool:c7,metadata:{id:"localSearch",displayName:"Vault Search",description:"Search through your vault notes",category:"search",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:d7,metadata:{id:"webSearch",displayName:"Web Search",description:"Search the internet for information",category:"search",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:$ye,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:zye,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:Bye,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:Uye,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:CZ,metadata:{id:"pomodoro",displayName:"Pomodoro Timer",description:"Manage time with Pomodoro technique",category:"time"}},{tool:sye,metadata:{id:"writeToFile",displayName:"Write to File",description:"Create or modify files in your vault",category:"file",requiresVault:!0,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:Uer,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:Fnr,metadata:{id:"youtubeTranscription",displayName:"YouTube Transcription",description:"Get transcripts from YouTube videos",category:"media",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 rqn(){return 1e4}function nqn(t,e){let r=e??rqn();if(!t||t.length<=r)return t;let n=t.substring(0,r),o=t.length-r;return`${n}
... (truncated ${o.toLocaleString()} characters)`}function oqn(t,e,r){let n=nqn(e,r);return`Tool '${t}' result: ${n}`}function D6e(t,e=!1){return t.map(r=>e?oqn(r.toolName,r.result):`Tool '${r.toolName}' result: ${r.result}`).join(`
`)}var Wnr=b(()=>{});function Knr(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 $6e,Xk,L6e,F6e,k6e,TZ,Gnr=b(()=>{Gt();$6e=50,Xk=class{constructor(e){this.modelName=e}buildToolSpecificInstructions(e){let r=[];for(let n of e)n.customPromptInstructions&&r.push(n.customPromptInstructions);return r.length>0?r.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}},L6e=class extends Xk{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}},F6e=class extends Xk{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>$6e}},k6e=class extends Xk{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}},TZ=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(B(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new L6e(r);return n.isGPT5Model()?B("Using GPTModelAdapter with GPT-5 specific enhancements"):B("Using GPTModelAdapter"),n}return r.includes("claude")?(B("Using ClaudeModelAdapter"),new F6e(r)):r.includes("gemini")||r.includes("google/gemini")?(B("Using GeminiModelAdapter"),new k6e(r)):r.includes("copilot-plus")?(B("Using BaseModelAdapter for Copilot Plus"),new Xk(r)):(B("Using BaseModelAdapter (default)"),new Xk(r))}}});function Yye(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){Bt("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]=B6e(f,d))}e.push({name:a,args:s})}}}catch(r){return ie("Error parsing XML tool calls:",r),[]}return e}function B6e(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 B6e(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,B6e(u)])}return i.length>0?Object.fromEntries(i):t}function Jnr(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 AZ(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 z6e=b(()=>{Gt()});var IZ,Znr=b(()=>{Gt();ly();bt();j6e();$k();Jye();ir();Wnr();Gye();A6e();Gnr();g4();h4();Kye();z6e();IZ=class t extends LO{constructor(){super(...arguments);this.llmFormattedMessages=[]}getAvailableTools(){let r=oe(),n=FO.getInstance();n.getAllTools().length===0&&Zye(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=$er(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=Mf(),i=t.generateToolDescriptions(r),a=r.map(l=>l.name),s=FO.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=TZ.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 lO({isAutonomousAgent:!0}))return await this.handleError(new Error("Invalid license key"),i,o),"";try{let g=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],y=this.generateSystemPrompt(),_=this.chainManager.chatModelManager.getChatModel(),w=TZ.createAdapter(_);y&&u.push({role:eI(_),content:y}),Wye(g,u);let S=this.isMultimodalModel(_),C=Knr(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=oe().autonomousAgentMaxIterations,N=0;for(;N<I&&!n.signal.aborted;){N++,B(`=== Autonomous Agent Iteration ${N} ===`);let M=[],D=await this.streamResponse(u,n,V=>{let q=AZ(V),H=[];H.push(...l),q.trim()&&H.push(q);let G=Yye(V),Z=[];G.length>0&&(Z=G.map(Ae=>Ae.name));let de=this.getAvailableTools(),pe=new Set(de.filter(Ae=>Ae.isBackground).map(Ae=>Ae.name)),ae=Jnr(V);if(ae){let Ae=V.lastIndexOf(ae);V.length-Ae>$6e&&Z.push(ae)}Z=Z.filter(Ae=>!pe.has(Ae));for(let Ae=0;Ae<Z.length;Ae++){let ke=Z[Ae],Ot=this.getTemporaryToolCallId(ke,Ae);if(M.findIndex(Vn=>Vn.includes(Ot))!==-1)continue;let Mr=Fde(Ot,ke,Yk(ke),DH(ke),"",!0,"","");M.push(Mr)}M.length>0&&H.push(M.join(`
`));let Te=H.join(`
`);o(Te)},w);if(!D)break;let k=Yye(D),F=w.detectPrematureResponse?.(D);if(F?.hasPremature&&N===1&&(F.type==="before"?(Bt("\u26A0\uFE0F Model provided premature response BEFORE tool calls!"),Bt("Sanitizing response to keep only tool calls for first iteration")):F.type==="after"&&(Bt("\u26A0\uFE0F Model provided hallucinated response AFTER tool calls!"),Bt("Truncating response at last tool call for first iteration"))),k.length===0){let V=AZ(D),q=[...l];V.trim()&&q.push(V),s=q.join(`
`),this.llmFormattedMessages.push(D);break}let K=D;w.sanitizeResponse&&F?.hasPremature&&(K=w.sanitizeResponse(D,N));let U=AZ(K);U.trim()&&l.push(U);let X=[],ee=new Map;M.splice(k.length);for(let V=0;V<k.length;V++){let q=k[V];if(n.signal.aborted)break;R6e(q,N);let H=this.getAvailableTools(),Z=H.find(ae=>ae.name===q.name)?.isBackground||!1,de;if(!Z){let ae=DH(q.name),Te=Yk(q.name),Ae=qnr(q.name);de=`${q.name}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,ee.set(V,de);let ke=Fde(de,q.name,Te,ae,Ae||"",!0,"",""),Ot=M.findIndex(Mr=>Mr.includes(this.getTemporaryToolCallId(q.name,V)));Ot!==-1?M[Ot]=ke:(M.push(ke),Bt("Created tool call marker for tool call that was not created during streaming",q.name));let jr=[...l,...M].join(`
`);o(jr)}let pe=await M6e(q,H,T);if(q.name==="localSearch"){let ae=this.processLocalSearchResult(pe);c.push(...ae.sources),pe.result=ae.formattedForLLM}if(X.push(pe),de&&!Z){let ae=M.findIndex(Ae=>Ae.includes(de));ae!==-1&&(M[ae]=vze(M[ae],de,pe.result));let Te=[...l,...M].join(`
`);o(Te)}N6e(q.name,pe)}if(M.length>0){let V=M.join(`
`);l.push(V)}if(this.llmFormattedMessages.push(D),X.length>0){let V=D6e(X,!0);V&&this.llmFormattedMessages.push(V)}let{ensureEncodedToolCallMarkerResults:L}=await Promise.resolve().then(()=>(h4(),kde)),Q=L(D);u.push({role:"assistant",content:Q});let z=D6e(X,!1);u.push({role:"user",content:z});let W=z.length>500?z.substring(0,500)+"... (truncated)":z;B("Tool results added to conversation:",W)}if(N>=I&&!s){Bt(`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(h){if(h.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:",h);try{return await new LO(this.chainManager).run(r,n,o,i,a)}catch(m){return ie("Fallback to regular Plus mode also failed:",m),await this.handleError(m,i,o),""}}}let f=EZ(c),p=this.llmFormattedMessages.join(`
`);return!s&&l.length>0&&(Bt("fullAIResponse was empty, using iteration history"),s=l.join(`
`)),await Promise.resolve().then(()=>(h4(),kde)),this.handleResponse(s,r,n,i,o,f.length>0?f:void 0,p)}async streamResponse(r,n,o,i){let a=new __(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 Ynr=b(()=>{sG();aHt();Oer();Gye();Vnr();Znr();g4();z6e();Kye()});var LH,Xnr,Xye,U6e,Qnr=b(()=>{LH=class{},Xnr=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},Xye=(t,e)=>{let r=Xnr(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},U6e=(t,e)=>{let r=Xnr(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 MZ=b(()=>{Qnr()});var q6e,FH,eor=b(()=>{cj();vj();q6e=class extends ym{addUserMessage(e){return this.addMessage(new Xs(e))}addAIChatMessage(e){return this.addMessage(new kn(e))}addAIMessage(e){return this.addMessage(new kn(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},FH=class extends q6e{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 tor=b(()=>{eor()});var H6e=b(()=>{tor()});var K_,k1=b(()=>{MZ();H6e();K_=class extends LH{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 FH,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(Xye(e,this.inputKey)),await this.chatHistory.addAIChatMessage(U6e(r,this.outputKey))}async clear(){await this.chatHistory.clear()}}});var RZ,ror=b(()=>{$s();k1();RZ=class extends K_{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]:Op(r,this.humanPrefix,this.aiPrefix)}}}});var nor=b(()=>{MZ();$s()});var oor=b(()=>{UA()});var ior=b(()=>{Zf();oor();Pm();ig()});var aor=b(()=>{Db()});var V6e=b(()=>{ig();ZA();Pm();ior();aor()});var Qye=b(()=>{ZA()});var W6e=b(()=>{$s();V6e();Qye();k1()});var NZ,sor=b(()=>{$s();k1();NZ=class extends K_{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]:Op(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}}});var uor=b(()=>{tG();MZ();PSe()});var lor=b(()=>{cj()});var cor=b(()=>{lor()});var dor=b(()=>{cor()});var por=b(()=>{MZ();$s();dor();V6e();Qye();k1()});var mor=b(()=>{k1()});var hor=b(()=>{$s();W6e()});var gor=b(()=>{$s();k1()});var yor=b(()=>{ror();nor();W6e();sor();k1();H6e();uor();por();Qye();mor();hor();gor()});var K6e=b(()=>{yor()});var jZ,bor=b(()=>{bt();K6e();jZ=class t{constructor(){this.initMemory(),wa(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=oe().contextTurns;this.memory=new NZ({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 DZ,_or=b(()=>{bt();ZA();ua();DZ=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),wa(()=>{this.initChatPrompt(),this.initQAPrompt()}),cz(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=Mf(),r=wu();r&&Fj()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Em.fromMessages([JA.fromTemplate(n),new Pv("history"),Tv.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=Em.fromMessages([JA.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 ebe,LZ,vor=b(()=>{ua();vu();or();Ynr();Gt();bt();ir();ZA();ebe=require("obsidian");eye();bor();_or();LZ=class{constructor(e){this.retrievedDocuments=[];this.app=e,this.memoryManager=jZ.getInstance(),this.chatModelManager=h1.getInstance(),this.promptManager=DZ.getInstance(),this.initialize(),wa(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 ebe.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!Iet(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",ey()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=ey(),o=wu();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:Dee();if(!i)throw new ebe.Notice("No model key found"),new Error("No model key found");try{if(r){let a=vee(i,oe().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=Av[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=oe().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new ebe.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}),Dj("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=oe(),s=a.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(cG(),$de))).HybridRetriever({minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[]}):new(await Promise.resolve().then(()=>(r7(),tye))).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:Mf()},this.storeRetrieverDocuments.bind(this),oe().debug),Dj("vault_qa"),oe().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}),Dj("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=c8.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Dj("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=ey(),r=oe();switch(e){case"llm_chain":return new uG(this);case"vault_qa":return new n7(this);case"copilot_plus":return r.enableAutonomousAgent?new IZ(this):new LO(this);case"project":return new PZ(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&oe().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().indexVaultToVectorStore(!1)}async runChain(e,r,n,o,i={}){let{debug:a=!1,ignoreSystemMessage:s=!1}=i;a&&console.log(`==== Step 0: Initial user message ====
`,e),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(s||l8(u)){let c=Em.fromMessages([new Pv("history"),Tv.fromTemplate("{input}")]);l8(u)&&(c=Em.fromMessages([[Fo,Mf()||""],c])),this.createChainWithNewModel({prompt:c},!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===Fo&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}}});var tbe,wor=b(()=>{ua();Gt();bt();ir();oG();tbe=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){wtt({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=UP(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":eo(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){Ki.set(y8,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){Nv("processingFiles",r=>r.filter(n=>n!==e)),Nv("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){Nv("processingFiles",o=>o.filter(i=>i!==e)),Nv("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])];Nv("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){Nv("total",r=>r.includes(e)?r:[...r,e]),Nv("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){Nv("total",o=>o.includes(e)?o:[...o,e]),Nv("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 Qk,Vd,mR=b(()=>{ua();nG();vu();or();Gt();Mde();rh();bt();Lde();ir();oG();Qk=require("obsidian");My();vor();wor();Vd=class t{constructor(e,r){this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new LZ(e),this.projectContextCache=b_.getInstance(),this.fileParserManager=new pR(Ji.getInstance(),this.app.vault,!0,null),this.loadTracker=tbe.getInstance(this.app),htt(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),gtt(async()=>{if(Fj())return;let n=oe(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(ey()==="vault_qa"||ey()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),cz(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){wa(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),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(),TE(!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 pR(Ji.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{TE(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e){this.loadTracker.clearAllLoadStates(),TE(!0);try{if(!e.contextSource)return Bt(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;B(`[loadProjectContext] Starting for project: ${e.name}`),B(`[loadProjectContext] Project ${e.name}: Cleared all project context load states`);let r=await this.projectContextCache.getOrInitializeCache(e),n=this.getProjectAllFiles(e);this.loadTracker.preComputeAllItems(e,n),this.loadTracker.markAllCachedItemsAsSuccess(e,r,n);let[o]=await Promise.all([this.processMarkdownFiles(e,r,n),this.processWebUrls(e,r),this.processYoutubeUrls(e,r)]);return o.timestamp=Date.now(),await this.projectContextCache.setCacheSafely(e,o),await this.processNonMarkdownFiles(e,n),B(`[loadProjectContext] Completed for project: ${e.name}.`),o}catch(r){throw ie(`[loadProjectContext] Failed for project ${e.name}:`,r),r}}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(h=>h.trim()),p=l.split(`
`).filter(h=>h.trim());await this.projectContextCache.removeWebUrls(r,f.filter(h=>!p.includes(h)))}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(`
`).filter(h=>h.trim()),p=d.split(`
`).filter(h=>h.trim());await this.projectContextCache.removeYoutubeUrls(r,f.filter(h=>!p.includes(h)))}}catch(n){ie(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(Ns)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=oe().projectList.find(o=>o.id===e);if(!r)return Bt(`[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);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: ${eo(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&&Bt(`[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&&Bt(`[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=fR.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()=>Ji.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 Qk.Notice(`Failed to process YouTube URL ${e}: ${eo(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 pR(Ji.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),UP(s))throw s}}o>0&&B(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){Bt("[retryFailedItem] No current project, aborting retry");return}let r=oe().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:Bt(`[retryFailedItem] Unknown item type: ${e.type}`);return}B(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new Qk.Notice(`Retry successful: ${e.path}`)}catch(r){ie(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new Qk.Notice(`Retry failed: ${eo(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){Bt(`[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){Bt(`[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 Qk.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 Qk.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}=vc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>_s(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}}});var xor={};os(xor,{AutocompleteCache:()=>FZ});var FZ,G6e=b(()=>{Gt();FZ=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 Elr=x((y6i,Olr)=>{"use strict";var ZHn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Olr.exports=ZHn});var Ilr=x((b6i,Alr)=>{"use strict";var YHn=Elr();function Plr(){}function Tlr(){}Tlr.resetWarningCache=Plr;Alr.exports=function(){function t(n,o,i,a,s,u){if(u!==YHn){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:Tlr,resetWarningCache:Plr};return r.PropTypes=r,r}});var Rlr=x((w6i,Mlr)=>{Mlr.exports=Ilr()();var _6i,v6i});var klr=x(K5e=>{"use strict";K5e.__esModule=!0;K5e.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 kGn={};os(kGn,{default:()=>ewe});module.exports=Nc(kGn);My();mR();ua();or();Gt();bt();G6e();or();My();Gt();bt();var sb=require("@codemirror/view"),eA=require("@codemirror/state");function Sor(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 uqn=Object.defineProperty,lqn=(t,e,r)=>e in t?uqn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kH=(t,e,r)=>(lqn(t,typeof e!="symbol"?e+"":e,r),r),rbe=eA.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(Q6e));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),Q6e=eA.StateEffect.define();function cqn(t,e){let r=t.state.selection.main.head,n=[],o=sb.Decoration.widget({widget:new J6e(e),side:1});return n.push(o.range(r)),sb.Decoration.set(n)}var J6e=class extends sb.WidgetType{constructor(e){super(),kH(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}},Z6e=t=>{let e=0;return sb.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:Q6e.of({suggestion:i,doc:n})})}}})},Y6e=class{constructor(){kH(this,"decorations"),this.decorations=sb.Decoration.none}update(e){var r;let n=(r=e.state.field(rbe))==null?void 0:r.suggestion;if(!n){this.decorations=sb.Decoration.none;return}this.decorations=cqn(e.view,n.display_suggestion)}},Cor=sb.ViewPlugin.fromClass(Y6e,{decorations:t=>t.decorations}),X6e=class{constructor(e,r){kH(this,"suggestFn"),kH(this,"keymap"),kH(this,"completionId"),kH(this,"run",n=>{var o,i;let a=(o=n.state.field(rbe))==null?void 0:o.suggestion;return a?(n.dispatch({...dqn(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:Q6e.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=eA.Prec.highest(sb.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function dqn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:eA.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:eA.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function Oor(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function fqn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield Oor(r);return}for await(let n of r)yield Oor(n)}}function nbe(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=fqn(t.fetchFn),{debounced:o,force:i}=Sor(n,e);return{extension:r?[rbe,Z6e(o),Cor,new X6e(t.continue_suggesting?n:null,r).keymap]:[rbe,Z6e(o),Cor],force_fetch:i}}var o8e=require("obsidian");var e8e=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"))}},t8e=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}},r8e=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}},obe=class{constructor(){this.processors=[];this.processors.push(new r8e),this.processors.push(new e8e),this.processors.push(new t8e)}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}};d8();var Eor=require("obsidian");function Por(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 Tor(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 Eor.TFile&&(r.push(i),r.length>=e))break}return r}Ede();bt();var n8e=require("obsidian"),pqn=.4,mqn=20,Aor=.7,ibe=.3;async function hqn(t,e){let r=oe().debug,n=await BP.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 gqn(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 yqn(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 bqn({db:t,filePath:e}){let r=oe().debug,n=await hqn(e,t),o=gqn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await BP.getDocsByEmbedding(t,o,{limit:mqn,similarity:pqn});return yqn(i,e)}function _qn(t){let e=new Map,n=Por(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=Tor(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 vqn(t,e){let r=new Map,n=Aor+ibe;for(let[o,i]of t)r.set(o,i*Aor/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=ibe:(i.links||i.backlinks)&&(a=ibe*.8),r.set(o,(r.get(o)??0)+a)}return r}async function sbe({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof n8e.TFile))return[];let n=await bqn({db:t,filePath:e}),o=_qn(r),i=vqn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=abe(n.get(l)??0),f=abe(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 n8e.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 abe(t){return t>.7?3:t>.55?2:1}var Ior=require("obsidian"),wqn={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 xqn(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function Mor(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(wqn).some(n=>xqn(r,n)))return!0;return!1}function Ror(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 $1=class $1{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return $1.instance||($1.instance=new $1),$1.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(()=>(Jc(),Qf))).default.getInstance().getDb();a&&(r=await sbe({db:a,filePath:e.path}))}catch(i){console.warn("Failed to fetch relevant notes for autocomplete:",i)}let n=r.slice(0,$1.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 Ior.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=[]}};$1.MAX_RELEVANT_NOTES=3;var ube=$1;var e$=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 kZ=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}};Gt();var Nor=require("obsidian");var $Z=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new e$}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 Nor.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")}};Gt();var G_=class G_{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...G_.DEFAULT_SETTINGS},this.performance={...G_.DEFAULT_PERFORMANCE},this.tokenizer=new e$,this.trie=new kZ(this.performance.maxTrieSize),this.scanner=new $Z(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return G_.instance||(G_.instance=new G_(e)),G_.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(),G_.instance=null}};G_.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},G_.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var t$=G_;Gt();var Sqn=require("obsidian");var lbe=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=FZ.getInstance(),this.client=Ji.getInstance(),this.postProcessor=new obe,this.wordCompletionManager=t$.getInstance(app.vault);let r=oe().autocompleteAcceptKey||Yg.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=wa(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(oe().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){ie("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=nbe({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(o8e.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 Mor(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(o8e.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=Ror(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=oe();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(g=>g.word===c),h=f.some(g=>g.word.length-c.length>=2);if(p&&!h)return;let m=p?f.filter(g=>g.word!==c):f;if(m.length===0)return;try{let g=m.map(P=>P.word),y=o.slice(-1e3),_=a.slice(0,500),w,S,C;if(this.cacheEnabled&&(S=this.cache.generateWordKey(y,_,g),C=this.cache.get(S)),C)w=C;else{let P=this.client.wordcomplete(y,_,g);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(g){this.activeRequests.delete(d),ie("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",g);let y=m[0],_=this.generateCaseMatchedCompletion(y.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 ube.getInstance().getRelevantNotes(e.file));let h=e.file?.basename||"",m=h?`[[${h}]]:
${c}`:c,g,y,_;if(this.cacheEnabled&&(y=this.cache.generateSentenceKey(m,i,p),_=this.cache.get(y)),_)g=_;else{let C=this.client.autocomplete(m,i,p);this.activeRequests.set(d,C),this.lastRequestTime=s,g=await C,this.cacheEnabled&&y&&this.cache.set(y,g),this.activeRequests.delete(d)}let w=g.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 cbe=class t{constructor(e){this.plugin=e;let r=oe();this.cmIntegration=lbe.getInstance({delay:Yg.DELAY_MS,minTriggerLength:Yg.MIN_TRIGGER_LENGTH,maxContextLength:Yg.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=wa((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()}};or();ir();zN();function jor(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:dm(),sender:n===Fo?Fo:Zg,message:o.trim(),isVisible:!0,timestamp:i?GSe(i):null}),n=a.startsWith("**user**:")?Fo:Zg,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:dm(),sender:n===Fo?Fo:Zg,message:o.trim(),isVisible:!0,timestamp:i?GSe(i):null}),r}async function Dor(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Fo){let o=t[r+1];o?.sender===Zg&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}ua();cze();nG();vu();Gt();var fir=require("obsidian");po();var dbe=j(Y());xn();var gi=dbe.forwardRef(({className:t,type:e,...r},n)=>dbe.createElement("input",{type:e,className:me("!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 fbe=j(Y());var zor=j(Y(),1);var For=j(Y(),1),kor=j(za(),1);var rf=j(Y(),1);var Lor=j(Y(),1);function Cqn(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function r$(...t){return e=>t.forEach(r=>Cqn(r,e))}function Vs(...t){return Lor.useCallback(r$(...t),t)}var $H=j(st(),1),a8e=rf.forwardRef((t,e)=>{let{children:r,...n}=t,o=rf.Children.toArray(r),i=o.find(Eqn);if(i){let a=i.props.children,s=o.map(u=>u===i?rf.Children.count(a)>1?rf.Children.only(null):rf.isValidElement(a)?a.props.children:null:u);return(0,$H.jsx)(i8e,{...n,ref:e,children:rf.isValidElement(a)?rf.cloneElement(a,void 0,s):null})}return(0,$H.jsx)(i8e,{...n,ref:e,children:r})});a8e.displayName="Slot";var i8e=rf.forwardRef((t,e)=>{let{children:r,...n}=t;if(rf.isValidElement(r)){let o=Tqn(r);return rf.cloneElement(r,{...Pqn(n,r.props),ref:e?r$(e,o):o})}return rf.Children.count(r)>1?rf.Children.only(null):null});i8e.displayName="SlotClone";var Oqn=({children:t})=>(0,$H.jsx)($H.Fragment,{children:t});function Eqn(t){return rf.isValidElement(t)&&t.type===Oqn}function Pqn(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 Tqn(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 $or=j(st(),1),Aqn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],qi=Aqn.reduce((t,e)=>{let r=For.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?a8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,$or.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Bor(t,e){t&&kor.flushSync(()=>t.dispatchEvent(e))}var Uor=j(st(),1),Iqn="Label",qor=zor.forwardRef((t,e)=>(0,Uor.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())}}));qor.displayName=Iqn;var s8e=qor;ire();xn();var Rqn=zz("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),em=fbe.forwardRef(({className:t,...e},r)=>fbe.createElement(s8e,{ref:r,className:me(Rqn(),t),...e}));em.displayName=s8e.displayName;var UH=j(Y());var Og=j(Y(),1);var Vor=j(Y(),1);function Hor(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function u8e(...t){return e=>{let r=!1,n=t.map(o=>{let i=Hor(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():Hor(t[o],null)}}}}function Wor(...t){return Vor.useCallback(u8e(...t),t)}var ub=j(Y(),1),l8e=j(st(),1);function Kor(t,e){let r=ub.createContext(e),n=i=>{let{children:a,...s}=i,u=ub.useMemo(()=>s,Object.values(s));return(0,l8e.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=ub.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 Qa(t,e=[]){let r=[];function n(i,a){let s=ub.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=ub.useMemo(()=>h,Object.values(h));return(0,l8e.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=ub.useContext(p);if(h)return h;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=>ub.createContext(a));return function(s){let u=s?.[t]||i;return ub.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Nqn(o,...e)]}function Nqn(...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 ub.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function c8e(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var B1=j(Y(),1);var BH=j(Y(),1);function cn(t){let e=BH.useRef(t);return BH.useEffect(()=>{e.current=t}),BH.useMemo(()=>(...r)=>e.current?.(...r),[])}function tm({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=jqn({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=cn(r),u=B1.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 jqn({defaultProp:t,onChange:e}){let r=B1.useState(t),[n]=r,o=B1.useRef(n),i=cn(e);return B1.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var pbe=j(Y(),1);function mbe(t){let e=pbe.useRef({value:t,previous:t});return pbe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Jor=j(Y(),1);var Gor=j(Y(),1),wo=globalThis?.document?Gor.useLayoutEffect:()=>{};function z1(t){let[e,r]=Jor.useState(void 0);return wo(()=>{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 hh=j(Y(),1);var Yor=j(Y(),1);function Zor(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Dqn(...t){return e=>{let r=!1,n=t.map(o=>{let i=Zor(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():Zor(t[o],null)}}}}function Xor(...t){return Yor.useCallback(Dqn(...t),t)}var Qor=j(Y(),1);function Lqn(t,e){return Qor.useReducer((r,n)=>e[r][n]??r,t)}var nf=t=>{let{present:e,children:r}=t,n=Fqn(e),o=typeof r=="function"?r({present:n.isPresent}):hh.Children.only(r),i=Xor(n.ref,kqn(o));return typeof r=="function"||n.isPresent?hh.cloneElement(o,{ref:i}):null};nf.displayName="Presence";function Fqn(t){let[e,r]=hh.useState(),n=hh.useRef({}),o=hh.useRef(t),i=hh.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Lqn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return hh.useEffect(()=>{let l=hbe(n.current);i.current=s==="mounted"?l:"none"},[s]),wo(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=hbe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),wo(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=hbe(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=hbe(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:hh.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function hbe(t){return t?.animationName||"none"}function kqn(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 eir=j(Y(),1),qqn=j(za(),1);var of=j(Y(),1);var zH=j(st(),1),f8e=of.forwardRef((t,e)=>{let{children:r,...n}=t,o=of.Children.toArray(r),i=o.find(Bqn);if(i){let a=i.props.children,s=o.map(u=>u===i?of.Children.count(a)>1?of.Children.only(null):of.isValidElement(a)?a.props.children:null:u);return(0,zH.jsx)(d8e,{...n,ref:e,children:of.isValidElement(a)?of.cloneElement(a,void 0,s):null})}return(0,zH.jsx)(d8e,{...n,ref:e,children:r})});f8e.displayName="Slot";var d8e=of.forwardRef((t,e)=>{let{children:r,...n}=t;if(of.isValidElement(r)){let o=Uqn(r);return of.cloneElement(r,{...zqn(n,r.props),ref:e?u8e(e,o):o})}return of.Children.count(r)>1?of.Children.only(null):null});d8e.displayName="SlotClone";var $qn=({children:t})=>(0,zH.jsx)(zH.Fragment,{children:t});function Bqn(t){return of.isValidElement(t)&&t.type===$qn}function zqn(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 Uqn(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 tir=j(st(),1),Hqn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],p8e=Hqn.reduce((t,e)=>{let r=eir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?f8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,tir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var q1=j(st(),1),m8e="Checkbox",[Vqn,mUi]=Qa(m8e),[Wqn,Kqn]=Vqn(m8e),rir=Og.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]=Og.useState(null),h=Wor(e,S=>p(S)),m=Og.useRef(!1),g=f?c||!!f.closest("form"):!0,[y=!1,_]=tm({prop:o,defaultProp:i,onChange:l}),w=Og.useRef(y);return Og.useEffect(()=>{let S=f?.form;if(S){let C=()=>_(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[f,_]),(0,q1.jsxs)(Wqn,{scope:r,state:y,disabled:s,children:[(0,q1.jsx)(p8e.button,{type:"button",role:"checkbox","aria-checked":U1(y)?"mixed":y,"aria-required":a,"data-state":iir(y),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:h,onKeyDown:c8e(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:c8e(t.onClick,S=>{_(C=>U1(C)?!0:!C),g&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),g&&(0,q1.jsx)(Gqn,{control:f,bubbles:!m.current,name:n,value:u,checked:y,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:U1(i)?!1:i})]})});rir.displayName=m8e;var nir="CheckboxIndicator",oir=Og.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=Kqn(nir,r);return(0,q1.jsx)(nf,{present:n||U1(i.state)||i.state===!0,children:(0,q1.jsx)(p8e.span,{"data-state":iir(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});oir.displayName=nir;var Gqn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=Og.useRef(null),s=mbe(r),u=z1(e);Og.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let h=new Event("click",{bubbles:n});c.indeterminate=U1(r),p.call(c,U1(r)?!1:r),c.dispatchEvent(h)}},[s,r,n]);let l=Og.useRef(U1(r)?!1:r);return(0,q1.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 U1(t){return t==="indeterminate"}function iir(t){return U1(t)?"indeterminate":t?"checked":"unchecked"}var h8e=rir,air=oir;un();xn();var Ec=UH.forwardRef(({className:t,...e},r)=>UH.createElement(h8e,{ref:r,className:me("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},UH.createElement(air,{className:me("tw-flex tw-items-center tw-justify-center tw-text-current")},UH.createElement(ls,{className:"tw-size-4"}))));Ec.displayName=h8e.displayName;var lb=j(Y());xn();var J_=lb.forwardRef(({className:t,value:e,...r},n)=>{let o=lb.useRef(null),i=lb.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);lb.useLayoutEffect(()=>{i()},[e,i]),lb.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 lb.createElement("textarea",{className:me("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})});J_.displayName="Textarea";var yi=j(Y()),pir=j($c());bt();var kO=j(Y());ir();un();or();var g8e=({capabilities:t=[],iconSize:e=16})=>kO.default.createElement(kO.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return kO.default.createElement(qE,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return kO.default.createElement(UE,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return kO.default.createElement(Wb,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),y8e=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return kO.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-1"},kO.default.createElement("span",{className:"tw-truncate tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&kO.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-0.5"},kO.default.createElement(g8e,{capabilities:t.capabilities,iconSize:e})))},gbe=t=>{let e=t.displayName||t.name,r=`(${Mp(t.provider)})`;return`${e} ${r}`},qH=t=>{let e=t.displayName||t.name,r=`(${Mp(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}`};xn();un();Gt();var $O=j(Y());function sir(){return $O.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},$O.default.createElement("li",null,$O.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),$O.default.createElement("li",null,$O.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),$O.default.createElement("li",null,$O.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),$O.default.createElement("li",null,$O.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 b8e="{copilot-selection}";var HH="copilotquickcommand",BO={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},tA="copilot-command-context-menu-enabled",rA="copilot-command-slash-enabled",zO="copilot-command-context-menu-order",nA="copilot-command-model-key",oA="copilot-command-last-used",uir=[{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 VH=require("obsidian");bt();o8();o8();var n$=WB(),o$=Rh([]),_8e=new Set;function i$(t){_8e.add(t)}function a$(t){_8e.delete(t)}function BZ(t){return _8e.has(t)}function zZ(t){let e=n$.get(o$);n$.set(o$,e.filter(r=>r.title!==t))}function s$(t,e){let r=n$.get(o$),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],n$.set(o$,n)}function ybe(t){n$.set(o$,t)}function lir(){return n8(o$,{store:n$})}function up(){return n$.get(o$)}d8();ir();or();function bbe(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 WH(t){return encodeURIComponent(t.toLowerCase())}function H1(){return(0,VH.normalizePath)(oe().customPromptsFolder)}function KH(t){return`${H1()}/${t}.md`}function GH(t){if(!(t instanceof VH.TFile)||t.extension!=="md")return!1;let e=H1();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function Zqn(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}function cir(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[zO]!=null}async function UZ(t){let e=await app.vault.read(t),r=Zqn(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[tA]??BO.showInContextMenu,i=n?.frontmatter?.[rA]??BO.showInSlashMenu,a=n?.frontmatter?.[oA]??BO.lastUsedMs,s=n?.frontmatter?.[zO]??BO.order,u=n?.frontmatter?.[nA]??BO.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function _be(){let t=app.vault.getFiles().filter(r=>GH(r)),e=await Promise.all(t.map(UZ));return ybe(e),e}function qZ(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function Yqn(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function Xqn(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function vbe(t){switch(oe().promptSortStrategy){case"timestamp":return Yqn(t);case"alphabetical":return Xqn(t);case"manual":return qZ(t);default:return t}}async function v8e(t,e,r=!1){let o=(await w8e(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${Tm}}`)||r)return o;let i=o.indexOf(b8e);return i===-1&&e.trim()?o+`
<`+Tm+">"+e+"</"+Tm+">":o.slice(0,i)+e+o.slice(i+b8e.length)}var Qqn=/\{(?!copilot-selection\})([^}]+)\}/g;async function e2n(t,e,r){let n=new Map,o=new Set,i;for(;(i=Qqn.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await YB(r,e);u&&(s.content=`<${Ij}>
## ${bee(r)}
${u}
</${Ij}>`,s.files.push(r))}else new VH.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await Aet(e,u),c=[];for(let d of l){let f=await YB(d,e);f&&(c.push(`<${Ij}>
## ${bee(d)}
${f}
</${Ij}>`),s.files.push(d))}s.content=c.join(`
`)}else{let u=Ret(a),l=await KSe(e,u),c=[];for(let d of l){let f=await YB(d,e);f&&(c.push(`<${Ij}>
## ${bee(d)}
${f}
</${Ij}>`),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 w8e(t,e,r,n){let o=oe(),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 e2n(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,`{${Tm}}`),e?l+=`<${Tm}>
${e}
</${Tm}>`:n?(c=await YB(n,r),l+=`<${Tm} type="active_note">
${c||""}
</${Tm}>`,i.add(n)):l+=`<${Tm}>
(No selected text or active note available)
</${Tm}>`);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=Jg(u,r);for(let f of d)if(!i.has(f)){let p=await YB(f,r);if(p){let h=await r.adapter.stat(f.path),m=h?new Date(h.ctime).toISOString():"Unknown",g=h?new Date(h.mtime).toISOString():"Unknown",y=`<${f8}>
<title>${f.basename}</title>
<path>${f.path}</path>
<ctime>${m}</ctime>
<mtime>${g}</mtime>
<content>
${p}
</content>
</${f8}>`;l&&(l+=`
`),l+=`${y}`,i.add(f)}}return{processedPrompt:l?`${u}
${l}`:`${u}
`,includedFiles:Array.from(i)}}function dir(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 wbe(){let e=up().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function x8e(t,e){try{i$(t.path),await app.fileManager.processFrontMatter(t,r=>{r[tA]==null&&(r[tA]=e.showInContextMenu),r[rA]==null&&(r[rA]=e.showInSlashMenu),r[zO]==null&&(r[zO]=e.order),r[nA]==null&&(r[nA]=e.modelKey),r[oA]==null&&(r[oA]=e.lastUsedMs)})}finally{a$(t.path)}}function xbe(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()===`\`\`\`${HH}`){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 t2n({commands:t,command:e,onConfirm:r,onCancel:n}){let i=vn().activeModels.filter(f=>f.enabled).map(f=>({label:gbe(f),value:tn(f)})),[a,s]=(0,yi.useState)(e),[u,l]=(0,yi.useState)({}),c=(f,p)=>{s(h=>({...h,[f]:p})),l(h=>({...h,[f]:void 0}))},d=()=>{let f={},p=bbe(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(em,{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(em,{htmlFor:"content"},"Prompt"),yi.default.createElement(sir,null),yi.default.createElement(J_,{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(em,{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(m=>m.value===p)){ie(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:me("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:me("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(ki,{className:"tw-size-4"})))),yi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yi.default.createElement(Ec,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),yi.default.createElement(em,{htmlFor:"showInContextMenu"},"Show in context menu")),yi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yi.default.createElement(Ec,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),yi.default.createElement(em,{htmlFor:"showInSlashMenu"},"Show in slash menu")),yi.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},yi.default.createElement(he,{variant:"secondary",onClick:n},"Cancel"),yi.default.createElement(he,{variant:"default",onClick:d},"Save")))}var u$=class extends fir.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,pir.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(yi.default.createElement(t2n,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var HZ=require("obsidian");xE();var Pc=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=KH(e.title);try{i$(o);let i=e.order;n.autoOrder&&(i=wbe()),e={...e,order:i};let a=H1();await app.vault.adapter.exists(a)||await app.vault.createFolder(a);let u=app.vault.getAbstractFileByPath(o);!u||!(u instanceof HZ.TFile)?u=await app.vault.create(o,e.content):await app.vault.modify(u,e.content),await app.fileManager.processFrontMatter(u,l=>{l[tA]=e.showInContextMenu,l[rA]=e.showInSlashMenu,l[zO]=e.order,l[nA]=e.modelKey,l[oA]=e.lastUsedMs}),n.skipStoreUpdate||s$(e,e.title)}finally{a$(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=KH(e.title),i=KH(r),a=e.title!==r;try{i$(o),a&&i$(i),n||s$(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new rn("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof HZ.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(KH(e.title))),s instanceof HZ.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[tA]=e.showInContextMenu,u[rA]=e.showInSlashMenu,u[zO]=e.order,u[nA]=e.modelKey,u[oA]=e.lastUsedMs}))}finally{a$(o),a&&a$(i)}}async updateCommands(e){ybe(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=KH(e.title);try{i$(r),zZ(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof HZ.TFile&&await app.vault.delete(n)}finally{a$(r)}}};var Cbe=require("obsidian");ua();po();eye();Gt();ir();ZA();Pm();K6e();un();var Z_=require("obsidian"),Nt=j(Y()),mir=j($c());bt();function r2n(t,e){let[r]=(0,Nt.useState)(new RZ({returnMessages:!0,memoryKey:"history"})),[n,o]=(0,Nt.useState)(null);return(0,Nt.useEffect)(()=>{async function i(){let a=await h1.getInstance().createModelInstance(t),u=Em.fromMessages([JA.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new Pv("history"),Tv.fromTemplate("{input}")]),l=Li.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 n2n({originalText:t,command:e,onInsert:r,onReplace:n,systemPrompt:o}){let[i,a]=(0,Nt.useState)(null),[s,u]=(0,Nt.useState)(null),[l,c]=(0,Nt.useState)(""),d=(0,Nt.useRef)(null),f=(0,Nt.useRef)(null),[p,h]=(0,Nt.useState)(!0),[m]=oI(),g=vn(),y=(0,Nt.useMemo)(()=>vee(e.modelKey||m,g.activeModels),[e.modelKey,m,g.activeModels]),{chatChain:_,chatMemory:w}=r2n(y,o),S=e.title,C=(0,Nt.useCallback)(async(M,D)=>{if(!_)return console.error("Chat chain not initialized"),new Z_.Notice("Chat engine not ready. Please try again."),h(!1),null;try{a(null),u(null),h(!0);let k="",K=await _.bind({signal:D.signal}).stream({input:M});for await(let U of K){if(D.signal.aborted)break;let X=typeof U.content=="string"?U.content:"";k+=X,a(k)}if(!D.signal.aborted){let U=k.trim();return u(U),h(!1),await w.saveContext({input:M},{output:U}),U}return null}catch(k){return ie("Error generating response:",k),h(!1),null}},[_,w]);(0,Nt.useEffect)(()=>{let M=new AbortController;E.current=M;async function D(){if(_)try{let k=await v8e(e.content,t);await C(k,M)}catch(k){ie("Error in initial response:",k),h(!1)}}return D(),()=>{M.abort()}},[e.content,t,_,C]);let E=(0,Nt.useRef)(null),P=async()=>{if(!l.trim()||!_){_||new Z_.Notice("Chat engine not ready. Please try again.");return}let M=new AbortController;E.current=M;let D=await v8e(l,t,!0);try{await C(D,M)&&c("")}finally{M.signal.aborted&&(h(!1),u(i??"")),E.current=null}},T=()=>{E.current&&(E.current.abort(),E.current=null,h(!1))},I=M=>{M.nativeEvent.isComposing||(!p&&s&&!N&&(M.key==="Enter"&&(Z_.Platform.isMacOS?M.metaKey:M.ctrlKey)&&!M.shiftKey&&(M.preventDefault(),n(s)),M.key==="Enter"&&(Z_.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,Nt.useEffect)(()=>{if(d.current&&i&&p){let M=d.current;M.scrollTop=M.scrollHeight}},[i,p]);let N=!p&&l.trim().length>0;return Nt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:I},Nt.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Nt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},S&&Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Nt.default.createElement(Hv,{className:"tw-size-4"}),S)),Nt.default.createElement("div",{className:"tw-group tw-relative"},Nt.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&&Nt.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 Z_.Notice("Copied to clipboard")}},Nt.default.createElement(Uh,{className:"tw-size-4 hover:tw-text-accent"}))),!p&&s&&Nt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nt.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)})),Nt.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Nt.default.createElement(eD,{className:"tw-size-4"}),gbe(y)),Nt.default.createElement("div",{className:"tw-flex tw-gap-2"},p?Nt.default.createElement(he,{size:"sm",variant:"secondary",onClick:T},"Stop"):N?Nt.default.createElement(he,{size:"sm",onClick:P,className:"tw-flex tw-items-center tw-gap-1"},Nt.default.createElement("span",null,"Submit"),Nt.default.createElement(Vb,{className:"tw-size-3"})):Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement(he,{size:"sm",onClick:()=>r(s??""),className:"tw-flex tw-items-center tw-gap-1"},Nt.default.createElement("span",null,"Insert"),Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},Z_.Platform.isMacOS?Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement(MI,{className:"tw-size-3"}),Nt.default.createElement(Hz,{className:"tw-size-3"}),Nt.default.createElement(Vb,{className:"tw-size-3"})):Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Nt.default.createElement(Hz,{className:"tw-size-3"}),Nt.default.createElement(Vb,{className:"tw-size-3"})))),Nt.default.createElement(he,{size:"sm",onClick:()=>n(s??""),className:"tw-flex tw-items-center tw-gap-1"},Nt.default.createElement("span",null,"Replace"),Nt.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},Z_.Platform.isMacOS?Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement(MI,{className:"tw-size-3"}),Nt.default.createElement(Vb,{className:"tw-size-3"})):Nt.default.createElement(Nt.default.Fragment,null,Nt.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Nt.default.createElement(Vb,{className:"tw-size-3"}))))))))}var V1=class extends Z_.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,mir.createRoot)(r);let{selectedText:n,command:o,systemPrompt:i}=this.configs,a=u=>{u8(u),this.close()},s=u=>{u8(u,!0),this.close()};this.root.render(Nt.default.createElement(n2n,{originalText:n,command:o,onInsert:a,onReplace:s,systemPrompt:i}))}onClose(){this.root.unmount()}};var Sbe=class extends Cbe.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=up();this.commands=vbe(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(Cbe.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){Pc.getInstance().recordUsage(e),new V1(this.app,{selectedText:r,command:e}).open()}};rh();bt();ir();var Qi=require("obsidian");zN();or();function gh(t,e,r){t.addCommand({id:e,name:Oee[e],callback:r})}function hir(t,e,r){t.addCommand({id:e,name:Oee[e],editorCallback:r})}function o2n(t,e,r){t.addCommand({id:e,name:Oee[e],checkCallback:r})}function S8e(t,e,r){hir(t,pn.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 Qi.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),gh(t,pn.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await tze(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Qi.Notice(`Total tokens in your vault: ${o}`)}catch(n){ie("Error counting tokens: ",n),new Qi.Notice("An error occurred while counting tokens.")}}),gh(t,pn.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),gh(t,pn.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),gh(t,pn.NEW_CHAT,()=>{t.newChat()}),o2n(t,pn.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(Qi.MarkdownView);if(n)return!!(!eCe()&&o&&o.editor);if(eCe())return new Qi.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new Qi.Notice("No active editor found."),!1;let i=o.editor;if(!i.getSelection().trim())return new Qi.Notice("Please select some text first. Selected text is required for quick commands."),!1;xbe(i);let u=i.getCursor("from").line,l=`\`\`\`${HH}
\`\`\`
`;return i.replaceRange(l,{line:u,ch:0}),!0}),gh(t,pn.CLEAR_LOCAL_COPILOT_INDEX,async()=>{try{await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().clearIndex(),new Qi.Notice("Cleared local Copilot semantic index.")}catch(n){ie("Error clearing semantic index:",n),new Qi.Notice("Failed to clear semantic index.")}}),gh(t,pn.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().garbageCollectVectorStore();new Qi.Notice(`Garbage collection completed. Removed ${o} stale documents.`)}catch(n){ie("Error during garbage collection:",n),new Qi.Notice("Failed to garbage collect semantic index.")}}),gh(t,pn.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(bt(),i8));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().indexVaultToVectorStore(!1);new Qi.Notice(`Semantic search index refreshed with ${a} documents.`)}else new Qi.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error building index:",n),new Qi.Notice("An error occurred while building the index.")}}),gh(t,pn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(bt(),i8));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().indexVaultToVectorStore(!0);new Qi.Notice(`Semantic search index rebuilt with ${a} documents.`)}else new Qi.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error rebuilding index:",n),new Qi.Notice("An error occurred while rebuilding the index.")}}),gh(t,pn.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),gh(t,pn.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(rh(),P3t)),{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 w of l){if(!a(w,s,u)){f.add(w.path);continue}let S=await t.app.vault.cachedRead(w);!S||S.trim().length===0?c.add(w.path):p.has(w.path)||d.add(w.path)}let h=["# 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(w=>`- [[${w}]]`):["No indexed files found."],"","## Unindexed Files",...d.size>0?Array.from(d).sort().map(w=>`- [[${w}]]`):["No unindexed files found."],"","## Empty Files",...c.size>0?Array.from(c).sort().map(w=>`- [[${w}]]`):["No empty files found."],"","## Excluded Files (based on settings)",...f.size>0?Array.from(f).sort().map(w=>`- [[${w}]]`):["No excluded files."]].join(`
`),g=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,y=t.app.vault.getAbstractFileByPath(g);y?await t.app.vault.modify(y,h):await t.app.vault.create(g,h);let _=t.app.vault.getAbstractFileByPath(g);_&&(await t.app.workspace.getLeaf().openFile(_),new Qi.Notice(`Listed ${p.size} indexed files`))}catch(n){ie("Error listing indexed files:",n),new Qi.Notice("Failed to list indexed files.")}}),gh(t,pn.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await b_.getInstance().clearAllCache(),await p4.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(G6e(),xor));o.getInstance().clear(),new Qi.Notice("All Copilot caches cleared successfully")}catch(n){ie("Error clearing Copilot caches:",n),new Qi.Notice("Failed to clear Copilot caches")}}),gh(t,pn.TOGGLE_AUTOCOMPLETE,()=>{let o=!oe().enableAutocomplete;nt("enableAutocomplete",o),new Qi.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),hir(t,pn.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=ey();if(o!=="copilot_plus"&&o!=="project"){new Qi.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new Qi.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new Qi.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new Qi.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:dm(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};ytt(c),t.activateView()}),gh(t,pn.ADD_CUSTOM_COMMAND,async()=>{let n=up(),o={...BO};new u$(t.app,n,o,async a=>{await Pc.getInstance().createCommand(a)}).open()}),gh(t,pn.APPLY_CUSTOM_COMMAND,()=>{new Sbe(t.app).open()})}ua();vu();vu();ua();function Obe(){let[t]=Rp(),[e]=Lee(),[r]=Fee();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"})()}Gt();ua();nG();vu();po();var gir=require("obsidian"),l$=j(Y()),yir=j($c());function i2n({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return l$.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},l$.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),l$.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&l$.default.createElement(he,{variant:"secondary",onClick:r},o),n&&l$.default.createElement(he,{variant:"default",onClick:e},n)))}var Tc=class extends gir.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,yir.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(l$.default.createElement(i2n,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};po();var sa=j(Y());var Ac=j(Y(),1);function VZ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var a2n=j(Y(),1);function bir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ebe(...t){return e=>{let r=!1,n=t.map(o=>{let i=bir(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():bir(t[o],null)}}}}var _ir=j(Y(),1),d2n=j(za(),1);var af=j(Y(),1);var JH=j(st(),1),O8e=af.forwardRef((t,e)=>{let{children:r,...n}=t,o=af.Children.toArray(r),i=o.find(u2n);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)(C8e,{...n,ref:e,children:af.isValidElement(a)?af.cloneElement(a,void 0,s):null})}return(0,JH.jsx)(C8e,{...n,ref:e,children:r})});O8e.displayName="Slot";var C8e=af.forwardRef((t,e)=>{let{children:r,...n}=t;if(af.isValidElement(r)){let o=c2n(r);return af.cloneElement(r,{...l2n(n,r.props),ref:e?Ebe(e,o):o})}return af.Children.count(r)>1?af.Children.only(null):null});C8e.displayName="SlotClone";var s2n=({children:t})=>(0,JH.jsx)(JH.Fragment,{children:t});function u2n(t){return af.isValidElement(t)&&t.type===s2n}function l2n(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 c2n(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 vir=j(st(),1),f2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],wir=f2n.reduce((t,e)=>{let r=_ir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?O8e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,vir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var er=j(Y(),1);function ha(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var K1=j(Y(),1);var Sir=j(Y(),1);function xir(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function WZ(...t){return e=>{let r=!1,n=t.map(o=>{let i=xir(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():xir(t[o],null)}}}}function sf(...t){return Sir.useCallback(WZ(...t),t)}var uf=j(Y(),1);var ZH=j(st(),1),W1=uf.forwardRef((t,e)=>{let{children:r,...n}=t,o=uf.Children.toArray(r),i=o.find(m2n);if(i){let a=i.props.children,s=o.map(u=>u===i?uf.Children.count(a)>1?uf.Children.only(null):uf.isValidElement(a)?a.props.children:null:u);return(0,ZH.jsx)(E8e,{...n,ref:e,children:uf.isValidElement(a)?uf.cloneElement(a,void 0,s):null})}return(0,ZH.jsx)(E8e,{...n,ref:e,children:r})});W1.displayName="Slot";var E8e=uf.forwardRef((t,e)=>{let{children:r,...n}=t;if(uf.isValidElement(r)){let o=g2n(r);return uf.cloneElement(r,{...h2n(n,r.props),ref:e?WZ(e,o):o})}return uf.Children.count(r)>1?uf.Children.only(null):null});E8e.displayName="SlotClone";var p2n=({children:t})=>(0,ZH.jsx)(ZH.Fragment,{children:t});function m2n(t){return uf.isValidElement(t)&&t.type===p2n}function h2n(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 g2n(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 Pbe=j(st(),1);function Cir(t){let e=t+"CollectionProvider",[r,n]=Qa(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,g=K1.default.useRef(null),y=K1.default.useRef(new Map).current;return(0,Pbe.jsx)(o,{scope:h,itemMap:y,collectionRef:g,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=K1.default.forwardRef((p,h)=>{let{scope:m,children:g}=p,y=i(s,m),_=sf(h,y.collectionRef);return(0,Pbe.jsx)(W1,{ref:_,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=K1.default.forwardRef((p,h)=>{let{scope:m,children:g,...y}=p,_=K1.default.useRef(null),w=sf(h,_),S=i(l,m);return K1.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...y}),()=>void S.itemMap.delete(_))),(0,Pbe.jsx)(W1,{[c]:"",ref:w,children:g})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return K1.default.useCallback(()=>{let g=h.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((S,C)=>y.indexOf(S.ref.current)-y.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Tbe=j(Y(),1),y2n=j(st(),1),b2n=Tbe.createContext(void 0);function YH(t){let e=Tbe.useContext(b2n);return t||e||"ltr"}var Cs=j(Y(),1);var Oir=j(Y(),1),Eir=j(za(),1);var Pir=j(st(),1),_2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],dd=_2n.reduce((t,e)=>{let r=Oir.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?W1:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Pir.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Abe(t,e){t&&Eir.flushSync(()=>t.dispatchEvent(e))}var Tir=j(Y(),1);function G1(t,e=globalThis?.document){let r=cn(t);Tir.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 T8e=j(st(),1),v2n="DismissableLayer",P8e="dismissableLayer.update",w2n="dismissableLayer.pointerDownOutside",x2n="dismissableLayer.focusOutside",Air,Mir=Cs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),A8e=Cs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Cs.useContext(Mir),[c,d]=Cs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Cs.useState({}),h=sf(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=O2n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=E2n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return G1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Cs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Air=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Iir(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Air)}},[c,f,r,l]),Cs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Iir())},[c,l]),Cs.useEffect(()=>{let P=()=>p({});return document.addEventListener(P8e,P),()=>document.removeEventListener(P8e,P)},[]),(0,T8e.jsx)(dd.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:ha(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ha(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ha(t.onPointerDownCapture,C.onPointerDownCapture)})});A8e.displayName=v2n;var S2n="DismissableLayerBranch",C2n=Cs.forwardRef((t,e)=>{let r=Cs.useContext(Mir),n=Cs.useRef(null),o=sf(e,n);return Cs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,T8e.jsx)(dd.div,{...t,ref:o})});C2n.displayName=S2n;function O2n(t,e=globalThis?.document){let r=cn(t),n=Cs.useRef(!1),o=Cs.useRef(()=>{});return Cs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Rir(w2n,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 E2n(t,e=globalThis?.document){let r=cn(t),n=Cs.useRef(!1);return Cs.useEffect(()=>{let o=i=>{i.target&&!n.current&&Rir(x2n,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 Iir(){let t=new CustomEvent(P8e);document.dispatchEvent(t)}function Rir(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?Abe(o,i):o.dispatchEvent(i)}var jir=j(Y(),1),I8e=0;function J1(){jir.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Nir()),document.body.insertAdjacentElement("beforeend",t[1]??Nir()),I8e++,()=>{I8e===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),I8e--}},[])}function Nir(){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 cb=j(Y(),1);var $ir=j(st(),1),M8e="focusScope.autoFocusOnMount",R8e="focusScope.autoFocusOnUnmount",Dir={bubbles:!1,cancelable:!0},P2n="FocusScope",N8e=cb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=cb.useState(null),l=cn(o),c=cn(i),d=cb.useRef(null),f=sf(e,m=>u(m)),p=cb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;cb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:Z1(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||Z1(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&Z1(s)};var m=_,g=w,y=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]),cb.useEffect(()=>{if(s){Fir.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(M8e,Dir);s.addEventListener(M8e,l),s.dispatchEvent(y),y.defaultPrevented||(T2n(N2n(Bir(s)),{select:!0}),document.activeElement===m&&Z1(s))}return()=>{s.removeEventListener(M8e,l),setTimeout(()=>{let y=new CustomEvent(R8e,Dir);s.addEventListener(R8e,c),s.dispatchEvent(y),y.defaultPrevented||Z1(m??document.body,{select:!0}),s.removeEventListener(R8e,c),Fir.remove(p)},0)}}},[s,l,c,p]);let h=cb.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=A2n(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&Z1(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&Z1(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,$ir.jsx)(dd.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});N8e.displayName=P2n;function T2n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(Z1(n,{select:e}),document.activeElement!==r)return}function A2n(t){let e=Bir(t),r=Lir(e,t),n=Lir(e.reverse(),t);return[r,n]}function Bir(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 Lir(t,e){for(let r of t)if(!I2n(r,{upTo:e}))return r}function I2n(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 M2n(t){return t instanceof HTMLInputElement&&"select"in t}function Z1(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&M2n(t)&&e&&t.select()}}var Fir=R2n();function R2n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=kir(t,e),t.unshift(e)},remove(e){t=kir(t,e),t[0]?.resume()}}}function kir(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function N2n(t){return t.filter(e=>e.tagName!=="A")}var Ibe=j(Y(),1);var j2n=Ibe.useId||(()=>{}),D2n=0;function Jl(t){let[e,r]=Ibe.useState(j2n());return wo(()=>{t||r(n=>n??String(D2n++))},[t]),t||(e?`radix-${e}`:"")}var Eg=j(Y(),1);var zir=["top","right","bottom","left"];var UO=Math.min,rm=Math.max,GZ=Math.round,JZ=Math.floor,Y_=t=>({x:t,y:t}),L2n={left:"right",right:"left",bottom:"top",top:"bottom"},F2n={start:"end",end:"start"};function Rbe(t,e,r){return rm(t,UO(e,r))}function qO(t,e){return typeof t=="function"?t(e):t}function HO(t){return t.split("-")[0]}function c$(t){return t.split("-")[1]}function Nbe(t){return t==="x"?"y":"x"}function jbe(t){return t==="y"?"height":"width"}function iA(t){return["top","bottom"].includes(HO(t))?"y":"x"}function Dbe(t){return Nbe(iA(t))}function Uir(t,e,r){r===void 0&&(r=!1);let n=c$(t),o=Dbe(t),i=jbe(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=KZ(a)),[a,KZ(a)]}function qir(t){let e=KZ(t);return[Mbe(t),e,Mbe(e)]}function Mbe(t){return t.replace(/start|end/g,e=>F2n[e])}function k2n(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 Hir(t,e,r,n){let o=c$(t),i=k2n(HO(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Mbe)))),i}function KZ(t){return t.replace(/left|right|bottom|top/g,e=>L2n[e])}function $2n(t){return{top:0,right:0,bottom:0,left:0,...t}}function j8e(t){return typeof t!="number"?$2n(t):{top:t,right:t,bottom:t,left:t}}function d$(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 Vir(t,e,r){let{reference:n,floating:o}=t,i=iA(e),a=Dbe(e),s=jbe(a),u=HO(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(c$(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var Gir=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}=Vir(l,n,u),f=n,p={},h=0;for(let m=0;m<s.length;m++){let{name:g,fn:y}=s[m],{x:_,y:w,data:S,reset:C}=await y({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,[g]:{...p[g],...S}},C&&h<=50&&(h++,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}=Vir(l,f,u)),m=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function XH(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}=qO(e,t),h=j8e(p),g=s[f?d==="floating"?"reference":"floating":d],y=d$(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(g)))==null||r?g:g.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=d$(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:w,strategy:u}):_);return{top:(y.top-C.top+h.top)/S.y,bottom:(C.bottom-y.bottom+h.bottom)/S.y,left:(y.left-C.left+h.left)/S.x,right:(C.right-y.right+h.right)/S.x}}var Jir=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}=qO(t,e)||{};if(l==null)return{};let d=j8e(c),f={x:r,y:n},p=Dbe(o),h=jbe(p),m=await a.getDimensions(l),g=p==="y",y=g?"top":"left",_=g?"bottom":"right",w=g?"clientHeight":"clientWidth",S=i.reference[h]+i.reference[p]-f[p]-i.floating[h],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[h]);let T=S/2-C/2,I=P/2-m[h]/2-1,N=UO(d[y],I),M=UO(d[_],I),D=N,k=P-m[h]-M,F=P/2-m[h]/2+T,K=Rbe(D,F,k),U=!u.arrow&&c$(o)!=null&&F!==K&&i.reference[h]/2-(F<D?N:M)-m[h]/2<0,X=U?F<D?F-D:F-k:0;return{[p]:f[p]+X,data:{[p]:K,centerOffset:F-K-X,...U&&{alignmentOffset:X}},reset:U}}});var Zir=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:h="none",flipAlignment:m=!0,...g}=qO(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let y=HO(o),_=iA(s),w=HO(s)===s,S=await(u.isRTL==null?void 0:u.isRTL(l.floating)),C=f||(w||!m?[KZ(s)]:qir(s)),E=h!=="none";!f&&E&&C.push(...Hir(s,m,h,S));let P=[s,...C],T=await XH(e,g),I=[],N=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(T[y]),d){let F=Uir(o,a,S);I.push(T[F[0]],T[F[1]])}if(N=[...N,{placement:o,overflows:I}],!I.every(F=>F<=0)){var M,D;let F=(((M=i.flip)==null?void 0:M.index)||0)+1,K=P[F];if(K)return{data:{index:F,overflows:N},reset:{placement:K}};let U=(D=N.filter(X=>X.overflows[0]<=0).sort((X,ee)=>X.overflows[1]-ee.overflows[1])[0])==null?void 0:D.placement;if(!U)switch(p){case"bestFit":{var k;let X=(k=N.filter(ee=>{if(E){let L=iA(ee.placement);return L===_||L==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(L=>L>0).reduce((L,Q)=>L+Q,0)]).sort((ee,L)=>ee[1]-L[1])[0])==null?void 0:k[0];X&&(U=X);break}case"initialPlacement":U=s;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function Wir(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Kir(t){return zir.some(e=>t[e]>=0)}var Yir=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=qO(t,e);switch(n){case"referenceHidden":{let i=await XH(e,{...o,elementContext:"reference"}),a=Wir(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Kir(a)}}}case"escaped":{let i=await XH(e,{...o,altBoundary:!0}),a=Wir(i,r.floating);return{data:{escapedOffsets:a,escaped:Kir(a)}}}default:return{}}}}};async function B2n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=HO(r),s=c$(r),u=iA(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=qO(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(p=s==="end"?h*-1:h),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var Xir=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 B2n(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}}}}},Qir=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:g=>{let{x:y,y:_}=g;return{x:y,y:_}}},...u}=qO(t,e),l={x:r,y:n},c=await XH(e,u),d=iA(HO(o)),f=Nbe(d),p=l[f],h=l[d];if(i){let g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",_=p+c[g],w=p-c[y];p=Rbe(_,p,w)}if(a){let g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",_=h+c[g],w=h-c[y];h=Rbe(_,h,w)}let m=s.fn({...e,[f]:p,[d]:h});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[f]:i,[d]:a}}}}}},ear=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}=qO(t,e),c={x:r,y:n},d=iA(o),f=Nbe(d),p=c[f],h=c[d],m=qO(s,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(u){let w=f==="y"?"height":"width",S=i.reference[f]-i.floating[w]+g.mainAxis,C=i.reference[f]+i.reference[w]-g.mainAxis;p<S?p=S:p>C&&(p=C)}if(l){var y,_;let w=f==="y"?"width":"height",S=["top","left"].includes(HO(o)),C=i.reference[d]-i.floating[w]+(S&&((y=a.offset)==null?void 0:y[d])||0)+(S?0:g.crossAxis),E=i.reference[d]+i.reference[w]+(S?0:((_=a.offset)==null?void 0:_[d])||0)-(S?g.crossAxis:0);h<C?h=C:h>E&&(h=E)}return{[f]:p,[d]:h}}}},tar=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}=qO(t,e),c=await XH(e,l),d=HO(o),f=c$(o),p=iA(o)==="y",{width:h,height:m}=i.floating,g,y;d==="top"||d==="bottom"?(g=d,y=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,g=f==="end"?"top":"bottom");let _=m-c.top-c.bottom,w=h-c.left-c.right,S=UO(m-c[g],_),C=UO(h-c[y],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=rm(c.left,0),M=rm(c.right,0),D=rm(c.top,0),k=rm(c.bottom,0);p?T=h-2*(N!==0||M!==0?N+M:rm(c.left,c.right)):P=m-2*(D!==0||k!==0?D+k:rm(c.top,c.bottom))}await u({...e,availableWidth:T,availableHeight:P});let I=await a.getDimensions(s.floating);return h!==I.width||m!==I.height?{reset:{rects:!0}}:{}}}};function Lbe(){return typeof window<"u"}function p$(t){return nar(t)?(t.nodeName||"").toLowerCase():"#document"}function yh(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function X_(t){var e;return(e=(nar(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function nar(t){return Lbe()?t instanceof Node||t instanceof yh(t).Node:!1}function db(t){return Lbe()?t instanceof Element||t instanceof yh(t).Element:!1}function Q_(t){return Lbe()?t instanceof HTMLElement||t instanceof yh(t).HTMLElement:!1}function rar(t){return!Lbe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof yh(t).ShadowRoot}function QH(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=fb(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function oar(t){return["table","td","th"].includes(p$(t))}function ZZ(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Fbe(t){let e=kbe(),r=db(t)?fb(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 iar(t){let e=aA(t);for(;Q_(e)&&!m$(e);){if(Fbe(e))return e;if(ZZ(e))return null;e=aA(e)}return null}function kbe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function m$(t){return["html","body","#document"].includes(p$(t))}function fb(t){return yh(t).getComputedStyle(t)}function YZ(t){return db(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function aA(t){if(p$(t)==="html")return t;let e=t.assignedSlot||t.parentNode||rar(t)&&t.host||X_(t);return rar(e)?e.host:e}function aar(t){let e=aA(t);return m$(e)?t.ownerDocument?t.ownerDocument.body:t.body:Q_(e)&&QH(e)?e:aar(e)}function f$(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=aar(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=yh(o);if(i){let s=$be(a);return e.concat(a,a.visualViewport||[],QH(o)?o:[],s&&r?f$(s):[])}return e.concat(o,f$(o,[],r))}function $be(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function lar(t){let e=fb(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=Q_(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=GZ(r)!==i||GZ(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function L8e(t){return db(t)?t:t.contextElement}function eV(t){let e=L8e(t);if(!Q_(e))return Y_(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=lar(e),a=(i?GZ(r.width):r.width)/n,s=(i?GZ(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var z2n=Y_(0);function car(t){let e=yh(t);return!kbe()||!e.visualViewport?z2n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function U2n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==yh(t)?!1:e}function h$(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=L8e(t),a=Y_(1);e&&(n?db(n)&&(a=eV(n)):a=eV(t));let s=U2n(i,r,n)?car(i):Y_(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=yh(i),p=n&&db(n)?yh(n):n,h=f,m=$be(h);for(;m&&n&&p!==h;){let g=eV(m),y=m.getBoundingClientRect(),_=fb(m),w=y.left+(m.clientLeft+parseFloat(_.paddingLeft))*g.x,S=y.top+(m.clientTop+parseFloat(_.paddingTop))*g.y;u*=g.x,l*=g.y,c*=g.x,d*=g.y,u+=w,l+=S,h=yh(m),m=$be(h)}}return d$({width:c,height:d,x:u,y:l})}function F8e(t,e){let r=YZ(t).scrollLeft;return e?e.left+r:h$(X_(t)).left+r}function dar(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:F8e(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function q2n(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=X_(n),s=e?ZZ(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=Y_(1),c=Y_(0),d=Q_(n);if((d||!d&&!i)&&((p$(n)!=="body"||QH(a))&&(u=YZ(n)),Q_(n))){let p=h$(n);l=eV(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?dar(a,u,!0):Y_(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 H2n(t){return Array.from(t.getClientRects())}function V2n(t){let e=X_(t),r=YZ(t),n=t.ownerDocument.body,o=rm(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rm(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+F8e(t),s=-r.scrollTop;return fb(n).direction==="rtl"&&(a+=rm(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function W2n(t,e){let r=yh(t),n=X_(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=kbe();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function K2n(t,e){let r=h$(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Q_(t)?eV(t):Y_(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 sar(t,e,r){let n;if(e==="viewport")n=W2n(t,r);else if(e==="document")n=V2n(X_(t));else if(db(e))n=K2n(e,r);else{let o=car(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return d$(n)}function far(t,e){let r=aA(t);return r===e||!db(r)||m$(r)?!1:fb(r).position==="fixed"||far(r,e)}function G2n(t,e){let r=e.get(t);if(r)return r;let n=f$(t,[],!1).filter(s=>db(s)&&p$(s)!=="body"),o=null,i=fb(t).position==="fixed",a=i?aA(t):t;for(;db(a)&&!m$(a);){let s=fb(a),u=Fbe(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||QH(a)&&!u&&far(t,a))?n=n.filter(c=>c!==a):o=s,a=aA(a)}return e.set(t,n),n}function J2n(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?ZZ(e)?[]:G2n(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=sar(e,c,o);return l.top=rm(d.top,l.top),l.right=UO(d.right,l.right),l.bottom=UO(d.bottom,l.bottom),l.left=rm(d.left,l.left),l},sar(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Z2n(t){let{width:e,height:r}=lar(t);return{width:e,height:r}}function Y2n(t,e,r){let n=Q_(e),o=X_(e),i=r==="fixed",a=h$(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=Y_(0);if(n||!n&&!i)if((p$(e)!=="body"||QH(o))&&(s=YZ(e)),n){let f=h$(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=F8e(o));let l=o&&!n&&!i?dar(o,s):Y_(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 D8e(t){return fb(t).position==="static"}function uar(t,e){if(!Q_(t)||fb(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return X_(t)===r&&(r=r.ownerDocument.body),r}function par(t,e){let r=yh(t);if(ZZ(t))return r;if(!Q_(t)){let o=aA(t);for(;o&&!m$(o);){if(db(o)&&!D8e(o))return o;o=aA(o)}return r}let n=uar(t,e);for(;n&&oar(n)&&D8e(n);)n=uar(n,e);return n&&m$(n)&&D8e(n)&&!Fbe(n)?r:n||iar(t)||r}var X2n=async function(t){let e=this.getOffsetParent||par,r=this.getDimensions,n=await r(t.floating);return{reference:Y2n(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Q2n(t){return fb(t).direction==="rtl"}var mar={convertOffsetParentRelativeRectToViewportRelativeRect:q2n,getDocumentElement:X_,getClippingRect:J2n,getOffsetParent:par,getElementRects:X2n,getClientRects:H2n,getDimensions:Z2n,getScale:eV,isElement:db,isRTL:Q2n};function e4n(t,e){let r=null,n,o=X_(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=JZ(c),h=JZ(o.clientWidth-(l+d)),m=JZ(o.clientHeight-(c+f)),g=JZ(l),_={rootMargin:-p+"px "+-h+"px "+-m+"px "+-g+"px",threshold:rm(0,UO(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 sA(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=L8e(t),c=o||i?[...l?f$(l):[],...f$(e)]:[];c.forEach(y=>{o&&y.addEventListener("scroll",r,{passive:!0}),i&&y.addEventListener("resize",r)});let d=l&&s?e4n(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(y=>{let[_]=y;_&&_.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 h,m=u?h$(t):null;u&&g();function g(){let y=h$(t);m&&(y.x!==m.x||y.y!==m.y||y.width!==m.width||y.height!==m.height)&&r(),m=y,h=requestAnimationFrame(g)}return r(),()=>{var y;c.forEach(_=>{o&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),d?.(),(y=p)==null||y.disconnect(),p=null,u&&cancelAnimationFrame(h)}}var har=Xir;var gar=Qir,yar=Zir,bar=tar,_ar=Yir,k8e=Jir;var war=ear,$8e=(t,e,r)=>{let n=new Map,o={platform:mar,...r},i={...o.platform,_c:n};return Gir(t,e,{...o,platform:i})};var Zl=j(Y(),1),Ube=j(Y(),1),Sar=j(za(),1),Bbe=typeof document<"u"?Ube.useLayoutEffect:Ube.useEffect;function zbe(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(!zbe(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)&&!zbe(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Car(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function xar(t,e){let r=Car(t);return Math.round(e*r)/r}function B8e(t){let e=Zl.useRef(t);return Bbe(()=>{e.current=t}),e}function Y1(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]=Zl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=Zl.useState(n);zbe(f,n)||p(n);let[h,m]=Zl.useState(null),[g,y]=Zl.useState(null),_=Zl.useCallback(ee=>{ee!==E.current&&(E.current=ee,m(ee))},[]),w=Zl.useCallback(ee=>{ee!==P.current&&(P.current=ee,y(ee))},[]),S=i||h,C=a||g,E=Zl.useRef(null),P=Zl.useRef(null),T=Zl.useRef(c),I=u!=null,N=B8e(u),M=B8e(o),D=B8e(l),k=Zl.useCallback(()=>{if(!E.current||!P.current)return;let ee={placement:e,strategy:r,middleware:f};M.current&&(ee.platform=M.current),$8e(E.current,P.current,ee).then(L=>{let Q={...L,isPositioned:D.current!==!1};F.current&&!zbe(T.current,Q)&&(T.current=Q,Sar.flushSync(()=>{d(Q)}))})},[f,e,r,M,D]);Bbe(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(ee=>({...ee,isPositioned:!1})))},[l]);let F=Zl.useRef(!1);Bbe(()=>(F.current=!0,()=>{F.current=!1}),[]),Bbe(()=>{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 K=Zl.useMemo(()=>({reference:E,floating:P,setReference:_,setFloating:w}),[_,w]),U=Zl.useMemo(()=>({reference:S,floating:C}),[S,C]),X=Zl.useMemo(()=>{let ee={position:r,left:0,top:0};if(!U.floating)return ee;let L=xar(U.floating,c.x),Q=xar(U.floating,c.y);return s?{...ee,transform:"translate("+L+"px, "+Q+"px)",...Car(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:Q}},[r,s,U.floating,c.x,c.y]);return Zl.useMemo(()=>({...c,update:k,refs:K,elements:U,floatingStyles:X}),[c,k,K,U,X])}var t4n=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?k8e({element:n.current,padding:o}).fn(r):{}:n?k8e({element:n,padding:o}).fn(r):{}}}},X1=(t,e)=>({...har(t),options:[t,e]}),Q1=(t,e)=>({...gar(t),options:[t,e]}),eN=(t,e)=>({...war(t),options:[t,e]}),tN=(t,e)=>({...yar(t),options:[t,e]}),rN=(t,e)=>({...bar(t),options:[t,e]});var nN=(t,e)=>({..._ar(t),options:[t,e]});var oN=(t,e)=>({...t4n(t),options:[t,e]});var Oar=j(Y(),1);var z8e=j(st(),1),r4n="Arrow",Ear=Oar.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,z8e.jsx)(dd.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,z8e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Ear.displayName=r4n;var Par=Ear;var iN=j(st(),1);var U8e="Popper",[Tar,q8e]=Qa(U8e),[o4n,Aar]=Tar(U8e),Iar=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Eg.useState(null);return(0,iN.jsx)(o4n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Iar.displayName=U8e;var Mar="PopperAnchor",Rar=Eg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Aar(Mar,r),a=Eg.useRef(null),s=sf(e,a);return Eg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,iN.jsx)(dd.div,{...o,ref:s})});Rar.displayName=Mar;var H8e="PopperContent",[i4n,a4n]=Tar(H8e),Nar=Eg.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:h,...m}=t,g=Aar(H8e,r),[y,_]=Eg.useState(null),w=sf(e,Z=>_(Z)),[S,C]=Eg.useState(null),E=z1(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(u4n),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:X,middlewareData:ee}=Y1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>sA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[X1({mainAxis:o+T,alignmentAxis:a}),u&&Q1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?eN():void 0,...k}),u&&tN({...k}),rN({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&oN({element:S,padding:s}),l4n({arrowWidth:P,arrowHeight:T}),f&&nN({strategy:"referenceHidden",...k})]}),[L,Q]=Lar(U),z=cn(h);wo(()=>{X&&z?.()},[X,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Eg.useState();return wo(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,iN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:X?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,iN.jsx)(i4n,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,iN.jsx)(dd.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:X?void 0:"none"}})})})});Nar.displayName=H8e;var jar="PopperArrow",s4n={top:"bottom",right:"left",bottom:"top",left:"right"},Dar=Eg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=a4n(jar,n),a=s4n[i.placedSide];return(0,iN.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,iN.jsx)(Par,{...o,ref:r,style:{...o.style,display:"block"}})})});Dar.displayName=jar;function u4n(t){return t!==null}var l4n=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]=Lar(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Lar(t){let[e,r="center"]=t.split("-");return[e,r]}var V8e=Iar,Far=Rar,kar=Nar,$ar=Dar;var qbe=j(Y(),1),Bar=j(za(),1);var zar=j(st(),1),d4n="Portal",W8e=qbe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=qbe.useState(!1);wo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Bar.default.createPortal((0,zar.jsx)(dd.div,{...n,ref:e}),a):null});W8e.displayName=d4n;var fd=j(Y(),1);function g$(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var aN=j(Y(),1);var qar=j(Y(),1);function Uar(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function K8e(...t){return e=>{let r=!1,n=t.map(o=>{let i=Uar(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():Uar(t[o],null)}}}}function XZ(...t){return qar.useCallback(K8e(...t),t)}var lf=j(Y(),1);var tV=j(st(),1),rV=lf.forwardRef((t,e)=>{let{children:r,...n}=t,o=lf.Children.toArray(r),i=o.find(p4n);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,tV.jsx)(G8e,{...n,ref:e,children:lf.isValidElement(a)?lf.cloneElement(a,void 0,s):null})}return(0,tV.jsx)(G8e,{...n,ref:e,children:r})});rV.displayName="Slot";var G8e=lf.forwardRef((t,e)=>{let{children:r,...n}=t;if(lf.isValidElement(r)){let o=h4n(r);return lf.cloneElement(r,{...m4n(n,r.props),ref:e?K8e(e,o):o})}return lf.Children.count(r)>1?lf.Children.only(null):null});G8e.displayName="SlotClone";var f4n=({children:t})=>(0,tV.jsx)(tV.Fragment,{children:t});function p4n(t){return lf.isValidElement(t)&&t.type===f4n}function m4n(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 h4n(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 Hbe=j(st(),1);function Har(t){let e=t+"CollectionProvider",[r,n]=Qa(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,g=aN.default.useRef(null),y=aN.default.useRef(new Map).current;return(0,Hbe.jsx)(o,{scope:h,itemMap:y,collectionRef:g,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=aN.default.forwardRef((p,h)=>{let{scope:m,children:g}=p,y=i(s,m),_=XZ(h,y.collectionRef);return(0,Hbe.jsx)(rV,{ref:_,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=aN.default.forwardRef((p,h)=>{let{scope:m,children:g,...y}=p,_=aN.default.useRef(null),w=XZ(h,_),S=i(l,m);return aN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...y}),()=>void S.itemMap.delete(_))),(0,Hbe.jsx)(rV,{[c]:"",ref:w,children:g})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return aN.default.useCallback(()=>{let g=h.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((S,C)=>y.indexOf(S.ref.current)-y.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Var=j(Y(),1),g4n=j(za(),1);var War=j(st(),1),y4n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],J8e=y4n.reduce((t,e)=>{let r=Var.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?rV:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,War.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var sN=j(st(),1),Z8e="rovingFocusGroup.onEntryFocus",b4n={bubbles:!1,cancelable:!0},Vbe="RovingFocusGroup",[Y8e,Kar,_4n]=Har(Vbe),[v4n,X8e]=Qa(Vbe,[_4n]),[w4n,x4n]=v4n(Vbe),Gar=fd.forwardRef((t,e)=>(0,sN.jsx)(Y8e.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,sN.jsx)(Y8e.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,sN.jsx)(S4n,{...t,ref:e})})}));Gar.displayName=Vbe;var S4n=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=XZ(e,f),h=YH(i),[m=null,g]=tm({prop:a,defaultProp:s,onChange:u}),[y,_]=fd.useState(!1),w=cn(l),S=Kar(r),C=fd.useRef(!1),[E,P]=fd.useState(0);return fd.useEffect(()=>{let T=f.current;if(T)return T.addEventListener(Z8e,w),()=>T.removeEventListener(Z8e,w)},[w]),(0,sN.jsx)(w4n,{scope:r,orientation:n,dir:h,loop:o,currentTabStopId:m,onItemFocus:fd.useCallback(T=>g(T),[g]),onItemShiftTab:fd.useCallback(()=>_(!0),[]),onFocusableItemAdd:fd.useCallback(()=>P(T=>T+1),[]),onFocusableItemRemove:fd.useCallback(()=>P(T=>T-1),[]),children:(0,sN.jsx)(J8e.div,{tabIndex:y||E===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:g$(t.onMouseDown,()=>{C.current=!0}),onFocus:g$(t.onFocus,T=>{let I=!C.current;if(T.target===T.currentTarget&&I&&!y){let N=new CustomEvent(Z8e,b4n);if(T.currentTarget.dispatchEvent(N),!N.defaultPrevented){let M=S().filter(U=>U.focusable),D=M.find(U=>U.active),k=M.find(U=>U.id===m),K=[D,k,...M].filter(Boolean).map(U=>U.ref.current);Yar(K,c)}}C.current=!1}),onBlur:g$(t.onBlur,()=>_(!1))})})}),Jar="RovingFocusGroupItem",Zar=fd.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=Jl(),u=i||s,l=x4n(Jar,r),c=l.currentTabStopId===u,d=Kar(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return fd.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,sN.jsx)(Y8e.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,sN.jsx)(J8e.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:g$(t.onMouseDown,h=>{n?l.onItemFocus(u):h.preventDefault()}),onFocus:g$(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:g$(t.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;let m=E4n(h,l.orientation,l.dir);if(m!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let y=d().filter(_=>_.focusable).map(_=>_.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();let _=y.indexOf(h.currentTarget);y=l.loop?P4n(y,_+1):y.slice(_+1)}setTimeout(()=>Yar(y))}})})})});Zar.displayName=Jar;var C4n={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function O4n(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function E4n(t,e,r){let n=O4n(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return C4n[n]}function Yar(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function P4n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Xar=Gar,Qar=Zar;var A4n=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},nV=new WeakMap,Wbe=new WeakMap,Kbe={},Q8e=0,esr=function(t){return t&&(t.host||esr(t.parentNode))},I4n=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=esr(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})},M4n=function(t,e,r,n){var o=I4n(e,Array.isArray(t)?t:[t]);Kbe[r]||(Kbe[r]=new WeakMap);var i=Kbe[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),h=p!==null&&p!=="false",m=(nV.get(f)||0)+1,g=(i.get(f)||0)+1;nV.set(f,m),i.set(f,g),a.push(f),m===1&&h&&Wbe.set(f,!0),g===1&&f.setAttribute(r,"true"),h||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return c(e),s.clear(),Q8e++,function(){a.forEach(function(d){var f=nV.get(d)-1,p=i.get(d)-1;nV.set(d,f),i.set(d,p),f||(Wbe.has(d)||d.removeAttribute(n),Wbe.delete(d)),p||d.removeAttribute(r)}),Q8e--,Q8e||(nV=new WeakMap,nV=new WeakMap,Wbe=new WeakMap,Kbe={})}},uN=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||A4n(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),M4n(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 lN(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 oV(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 Xbe=j(Y());var lp=j(Y());var ev="right-scroll-bar-position",tv="width-before-scroll-bar",e5e="with-scroll-bars-hidden",t5e="--removed-body-scroll-bar-size";function Gbe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var tsr=j(Y());function rsr(t,e){var r=(0,tsr.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 Jbe=j(Y());var R4n=typeof window<"u"?Jbe.useLayoutEffect:Jbe.useEffect,nsr=new WeakMap;function y$(t,e){var r=rsr(e||null,function(n){return t.forEach(function(o){return Gbe(o,n)})});return R4n(function(){var n=nsr.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||Gbe(s,null)}),i.forEach(function(s){o.has(s)||Gbe(s,a)})}nsr.set(r,t)},[t]),r}function N4n(t){return t}function j4n(t,e){e===void 0&&(e=N4n);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 b$(t){t===void 0&&(t={});var e=j4n(null);return e.options=Di({async:!0,ssr:!1},t),e}var osr=j(Y()),isr=function(t){var e=t.sideCar,r=lN(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 osr.createElement(n,Di({},r))};isr.isSideCarExport=!0;function _$(t,e){return t.useMedium(e),isr}var Zbe=b$();var r5e=function(){},QZ=lp.forwardRef(function(t,e){var r=lp.useRef(null),n=lp.useState({onScrollCapture:r5e,onWheelCapture:r5e,onTouchMoveCapture:r5e}),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,h=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,_=t.gapMode,w=lN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=y$([r,e]),E=Di(Di({},w),o);return lp.createElement(lp.Fragment,null,c&&lp.createElement(S,{sideCar:Zbe,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?lp.cloneElement(lp.Children.only(s),Di(Di({},E),{ref:C})):lp.createElement(y,Di({},E,{className:u,ref:C}),s))});QZ.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};QZ.classNames={fullWidth:tv,zeroRight:ev};var ja=j(Y());var aV=j(Y());var usr=j(Y());var asr;var ssr=function(){if(asr)return asr;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function D4n(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=ssr();return e&&t.setAttribute("nonce",e),t}function L4n(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function F4n(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var n5e=function(){var t=0,e=null;return{add:function(r){t==0&&(e=D4n())&&(L4n(e,r),F4n(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var o5e=function(){var t=n5e();return function(e,r){usr.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var uA=function(){var t=o5e(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var k4n={left:0,top:0,right:0,gap:0},i5e=function(t){return parseInt(t||"",10)||0},$4n=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[i5e(r),i5e(n),i5e(o)]},a5e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return k4n;var e=$4n(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 B4n=uA(),iV="data-scroll-locked",z4n=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(e5e,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(iV,`] {
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(ev,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(tv,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(ev," .").concat(ev,` {
right: 0 `).concat(n,`;
}
.`).concat(tv," .").concat(tv,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(iV,`] {
`).concat(t5e,": ").concat(s,`px;
}
`)},lsr=function(){var t=parseInt(document.body.getAttribute(iV)||"0",10);return isFinite(t)?t:0},U4n=function(){aV.useEffect(function(){return document.body.setAttribute(iV,(lsr()+1).toString()),function(){var t=lsr()-1;t<=0?document.body.removeAttribute(iV):document.body.setAttribute(iV,t.toString())}},[])},v$=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;U4n();var i=aV.useMemo(function(){return a5e(o)},[o]);return aV.createElement(B4n,{styles:z4n(i,!e,o,r?"":"!important")})};var s5e=!1;if(typeof window<"u")try{eY=Object.defineProperty({},"passive",{get:function(){return s5e=!0,!0}}),window.addEventListener("test",eY,eY),window.removeEventListener("test",eY,eY)}catch{s5e=!1}var eY,w$=s5e?{passive:!1}:!1;var q4n=function(t){return t.tagName==="TEXTAREA"},csr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!q4n(t)&&r[e]==="visible")},H4n=function(t){return csr(t,"overflowY")},V4n=function(t){return csr(t,"overflowX")},u5e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=dsr(t,n);if(o){var i=fsr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},W4n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},K4n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},dsr=function(t,e){return t==="v"?H4n(e):V4n(e)},fsr=function(t,e){return t==="v"?W4n(e):K4n(e)},G4n=function(t,e){return t==="h"&&e==="rtl"?-1:1},psr=function(t,e,r,n,o){var i=G4n(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=fsr(t,s),h=p[0],m=p[1],g=p[2],y=m-g-i*h;(h||y)&&dsr(t,s)&&(d+=y,f+=h),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 Ybe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},msr=function(t){return[t.deltaX,t.deltaY]},hsr=function(t){return t&&"current"in t?t.current:t},J4n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Z4n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Y4n=0,sV=[];function gsr(t){var e=ja.useRef([]),r=ja.useRef([0,0]),n=ja.useRef(),o=ja.useState(Y4n++)[0],i=ja.useState(uA)[0],a=ja.useRef(t);ja.useEffect(function(){a.current=t},[t]),ja.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=oV([t.lockRef.current],(t.shards||[]).map(hsr),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ja.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var y=Ybe(m),_=r.current,w="deltaX"in m?m.deltaX:_[0]-y[0],S="deltaY"in m?m.deltaY:_[1]-y[1],C,E=m.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&E.type==="range")return!1;var T=u5e(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=u5e(P,E)),!T)return!1;if(!n.current&&"changedTouches"in m&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return psr(I,g,m,I==="h"?w:S,!0)},[]),u=ja.useCallback(function(m){var g=m;if(!(!sV.length||sV[sV.length-1]!==i)){var y="deltaY"in g?msr(g):Ybe(g),_=e.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&J4n(C.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(hsr).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=w.length>0?s(g,w[0]):!a.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=ja.useCallback(function(m,g,y,_){var w={name:m,delta:g,target:y,should:_,shadowParent:X4n(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=ja.useCallback(function(m){r.current=Ybe(m),n.current=void 0},[]),d=ja.useCallback(function(m){l(m.type,msr(m),m.target,s(m,t.lockRef.current))},[]),f=ja.useCallback(function(m){l(m.type,Ybe(m),m.target,s(m,t.lockRef.current))},[]);ja.useEffect(function(){return sV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,w$),document.addEventListener("touchmove",u,w$),document.addEventListener("touchstart",c,w$),function(){sV=sV.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,w$),document.removeEventListener("touchmove",u,w$),document.removeEventListener("touchstart",c,w$)}},[]);var p=t.removeScrollBar,h=t.inert;return ja.createElement(ja.Fragment,null,h?ja.createElement(i,{styles:Z4n(o)}):null,p?ja.createElement(v$,{gapMode:t.gapMode}):null)}function X4n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var ysr=_$(Zbe,gsr);var bsr=Xbe.forwardRef(function(t,e){return Xbe.createElement(QZ,Di({},t,{ref:e,sideCar:ysr}))});bsr.classNames=QZ.classNames;var l5e=bsr;var Yr=j(st(),1),c5e=["Enter"," "],Q4n=["ArrowDown","PageUp","Home"],vsr=["ArrowUp","PageDown","End"],e3n=[...Q4n,...vsr],t3n={ltr:[...c5e,"ArrowRight"],rtl:[...c5e,"ArrowLeft"]},r3n={ltr:["ArrowLeft"],rtl:["ArrowRight"]},oY="Menu",[rY,n3n,o3n]=Cir(oY),[x$,d5e]=Qa(oY,[o3n,q8e,X8e]),iY=q8e(),wsr=X8e(),[xsr,cN]=x$(oY),[i3n,aY]=x$(oY),Ssr=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=iY(e),[u,l]=er.useState(null),c=er.useRef(!1),d=cn(i),f=YH(o);return er.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},h=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),(0,Yr.jsx)(V8e,{...s,children:(0,Yr.jsx)(xsr,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Yr.jsx)(i3n,{scope:e,onClose:er.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};Ssr.displayName=oY;var a3n="MenuAnchor",f5e=er.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=iY(r);return(0,Yr.jsx)(Far,{...o,...n,ref:e})});f5e.displayName=a3n;var p5e="MenuPortal",[s3n,Csr]=x$(p5e,{forceMount:void 0}),Osr=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=cN(p5e,e);return(0,Yr.jsx)(s3n,{scope:e,forceMount:r,children:(0,Yr.jsx)(nf,{present:r||i.open,children:(0,Yr.jsx)(W8e,{asChild:!0,container:o,children:n})})})};Osr.displayName=p5e;var pb="MenuContent",[u3n,m5e]=x$(pb),Esr=er.forwardRef((t,e)=>{let r=Csr(pb,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=cN(pb,t.__scopeMenu),a=aY(pb,t.__scopeMenu);return(0,Yr.jsx)(rY.Provider,{scope:t.__scopeMenu,children:(0,Yr.jsx)(nf,{present:n||i.open,children:(0,Yr.jsx)(rY.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Yr.jsx)(l3n,{...o,ref:e}):(0,Yr.jsx)(c3n,{...o,ref:e})})})})}),l3n=er.forwardRef((t,e)=>{let r=cN(pb,t.__scopeMenu),n=er.useRef(null),o=sf(e,n);return er.useEffect(()=>{let i=n.current;if(i)return uN(i)},[]),(0,Yr.jsx)(h5e,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ha(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),c3n=er.forwardRef((t,e)=>{let r=cN(pb,t.__scopeMenu);return(0,Yr.jsx)(h5e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),h5e=er.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:h,...m}=t,g=cN(pb,r),y=aY(pb,r),_=iY(r),w=wsr(r),S=n3n(r),[C,E]=er.useState(null),P=er.useRef(null),T=sf(e,P,g.onContentChange),I=er.useRef(0),N=er.useRef(""),M=er.useRef(0),D=er.useRef(null),k=er.useRef("right"),F=er.useRef(0),K=h?l5e:er.Fragment,U=h?{as:W1,allowPinchZoom:!0}:void 0,X=L=>{let Q=N.current+L,z=S().filter(Z=>!Z.disabled),W=document.activeElement,V=z.find(Z=>Z.ref.current===W)?.textValue,q=z.map(Z=>Z.textValue),H=S3n(q,Q,V),G=z.find(Z=>Z.textValue===H)?.ref.current;(function Z(de){N.current=de,window.clearTimeout(I.current),de!==""&&(I.current=window.setTimeout(()=>Z(""),1e3))})(Q),G&&setTimeout(()=>G.focus())};er.useEffect(()=>()=>window.clearTimeout(I.current),[]),J1();let ee=er.useCallback(L=>k.current===D.current?.side&&O3n(L,D.current?.area),[]);return(0,Yr.jsx)(u3n,{scope:r,searchRef:N,onItemEnter:er.useCallback(L=>{ee(L)&&L.preventDefault()},[ee]),onItemLeave:er.useCallback(L=>{ee(L)||(P.current?.focus(),E(null))},[ee]),onTriggerLeave:er.useCallback(L=>{ee(L)&&L.preventDefault()},[ee]),pointerGraceTimerRef:M,onPointerGraceIntentChange:er.useCallback(L=>{D.current=L},[]),children:(0,Yr.jsx)(K,{...U,children:(0,Yr.jsx)(N8e,{asChild:!0,trapped:o,onMountAutoFocus:ha(i,L=>{L.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Yr.jsx)(A8e,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Yr.jsx)(Xar,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:C,onCurrentTabStopIdChange:E,onEntryFocus:ha(u,L=>{y.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Yr.jsx)(kar,{role:"menu","aria-orientation":"vertical","data-state":Usr(g.open),"data-radix-menu-content":"",dir:y.dir,..._,...m,ref:T,style:{outline:"none",...m.style},onKeyDown:ha(m.onKeyDown,L=>{let z=L.target.closest("[data-radix-menu-content]")===L.currentTarget,W=L.ctrlKey||L.altKey||L.metaKey,V=L.key.length===1;z&&(L.key==="Tab"&&L.preventDefault(),!W&&V&&X(L.key));let q=P.current;if(L.target!==q||!e3n.includes(L.key))return;L.preventDefault();let G=S().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);vsr.includes(L.key)&&G.reverse(),w3n(G)}),onBlur:ha(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(I.current),N.current="")}),onPointerMove:ha(t.onPointerMove,nY(L=>{let Q=L.target,z=F.current!==L.clientX;if(L.currentTarget.contains(Q)&&z){let W=L.clientX>F.current?"right":"left";k.current=W,F.current=L.clientX}}))})})})})})})});Esr.displayName=pb;var d3n="MenuGroup",g5e=er.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Yr.jsx)(dd.div,{role:"group",...n,ref:e})});g5e.displayName=d3n;var f3n="MenuLabel",Psr=er.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Yr.jsx)(dd.div,{...n,ref:e})});Psr.displayName=f3n;var Qbe="MenuItem",_sr="menu.itemSelect",t_e=er.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=er.useRef(null),a=aY(Qbe,t.__scopeMenu),s=m5e(Qbe,t.__scopeMenu),u=sf(e,i),l=er.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(_sr,{bubbles:!0,cancelable:!0});d.addEventListener(_sr,p=>n?.(p),{once:!0}),Abe(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Yr.jsx)(Tsr,{...o,ref:u,disabled:r,onClick:ha(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:ha(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:ha(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||c5e.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});t_e.displayName=Qbe;var Tsr=er.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=m5e(Qbe,r),s=wsr(r),u=er.useRef(null),l=sf(e,u),[c,d]=er.useState(!1),[f,p]=er.useState("");return er.useEffect(()=>{let h=u.current;h&&p((h.textContent??"").trim())},[i.children]),(0,Yr.jsx)(rY.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Yr.jsx)(Qar,{asChild:!0,...s,focusable:!n,children:(0,Yr.jsx)(dd.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:ha(t.onPointerMove,nY(h=>{n?a.onItemLeave(h):(a.onItemEnter(h),h.defaultPrevented||h.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ha(t.onPointerLeave,nY(h=>a.onItemLeave(h))),onFocus:ha(t.onFocus,()=>d(!0)),onBlur:ha(t.onBlur,()=>d(!1))})})})}),p3n="MenuCheckboxItem",Asr=er.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Yr.jsx)(jsr,{scope:t.__scopeMenu,checked:r,children:(0,Yr.jsx)(t_e,{role:"menuitemcheckbox","aria-checked":e_e(r)?"mixed":r,...o,ref:e,"data-state":_5e(r),onSelect:ha(o.onSelect,()=>n?.(e_e(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Asr.displayName=p3n;var Isr="MenuRadioGroup",[m3n,h3n]=x$(Isr,{value:void 0,onValueChange:()=>{}}),Msr=er.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=cn(n);return(0,Yr.jsx)(m3n,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Yr.jsx)(g5e,{...o,ref:e})})});Msr.displayName=Isr;var Rsr="MenuRadioItem",Nsr=er.forwardRef((t,e)=>{let{value:r,...n}=t,o=h3n(Rsr,t.__scopeMenu),i=r===o.value;return(0,Yr.jsx)(jsr,{scope:t.__scopeMenu,checked:i,children:(0,Yr.jsx)(t_e,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":_5e(i),onSelect:ha(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});Nsr.displayName=Rsr;var y5e="MenuItemIndicator",[jsr,g3n]=x$(y5e,{checked:!1}),Dsr=er.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=g3n(y5e,r);return(0,Yr.jsx)(nf,{present:n||e_e(i.checked)||i.checked===!0,children:(0,Yr.jsx)(dd.span,{...o,ref:e,"data-state":_5e(i.checked)})})});Dsr.displayName=y5e;var y3n="MenuSeparator",Lsr=er.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Yr.jsx)(dd.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});Lsr.displayName=y3n;var b3n="MenuArrow",Fsr=er.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=iY(r);return(0,Yr.jsx)($ar,{...o,...n,ref:e})});Fsr.displayName=b3n;var b5e="MenuSub",[_3n,ksr]=x$(b5e),v3n=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=cN(b5e,e),a=iY(e),[s,u]=er.useState(null),[l,c]=er.useState(null),d=cn(o);return er.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Yr.jsx)(V8e,{...a,children:(0,Yr.jsx)(xsr,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Yr.jsx)(_3n,{scope:e,contentId:Jl(),triggerId:Jl(),trigger:s,onTriggerChange:u,children:r})})})};v3n.displayName=b5e;var tY="MenuSubTrigger",$sr=er.forwardRef((t,e)=>{let r=cN(tY,t.__scopeMenu),n=aY(tY,t.__scopeMenu),o=ksr(tY,t.__scopeMenu),i=m5e(tY,t.__scopeMenu),a=er.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=er.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return er.useEffect(()=>c,[c]),er.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Yr.jsx)(f5e,{asChild:!0,...l,children:(0,Yr.jsx)(Tsr,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":Usr(r.open),...t,ref:WZ(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ha(t.onPointerMove,nY(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:ha(t.onPointerLeave,nY(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,h=p==="right",m=h?-5:5,g=f[h?"left":"right"],y=f[h?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:g,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:g,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:ha(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||t3n[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});$sr.displayName=tY;var Bsr="MenuSubContent",zsr=er.forwardRef((t,e)=>{let r=Csr(pb,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=cN(pb,t.__scopeMenu),a=aY(pb,t.__scopeMenu),s=ksr(Bsr,t.__scopeMenu),u=er.useRef(null),l=sf(e,u);return(0,Yr.jsx)(rY.Provider,{scope:t.__scopeMenu,children:(0,Yr.jsx)(nf,{present:n||i.open,children:(0,Yr.jsx)(rY.Slot,{scope:t.__scopeMenu,children:(0,Yr.jsx)(h5e,{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:ha(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ha(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ha(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=r3n[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});zsr.displayName=Bsr;function Usr(t){return t?"open":"closed"}function e_e(t){return t==="indeterminate"}function _5e(t){return e_e(t)?"indeterminate":t?"checked":"unchecked"}function w3n(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function x3n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function S3n(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=x3n(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 C3n(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 O3n(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return C3n(r,e)}function nY(t){return e=>e.pointerType==="mouse"?t(e):void 0}var qsr=Ssr,Hsr=f5e,Vsr=Osr,Wsr=Esr,Ksr=g5e,Gsr=Psr,Jsr=t_e,Zsr=Asr,Ysr=Msr,Xsr=Nsr,Qsr=Dsr,eur=Lsr,tur=Fsr;var rur=$sr,nur=zsr;var pd=j(st(),1),v5e="DropdownMenu",[P3n,lHi]=Qa(v5e,[d5e]),nm=d5e(),[T3n,our]=P3n(v5e),sY=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=nm(e),l=Ac.useRef(null),[c=!1,d]=tm({prop:o,defaultProp:i,onChange:a});return(0,pd.jsx)(T3n,{scope:e,triggerId:Jl(),triggerRef:l,contentId:Jl(),open:c,onOpenChange:d,onOpenToggle:Ac.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,pd.jsx)(qsr,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};sY.displayName=v5e;var iur="DropdownMenuTrigger",uY=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=our(iur,r),a=nm(r);return(0,pd.jsx)(Hsr,{asChild:!0,...a,children:(0,pd.jsx)(wir.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:Ebe(e,i.triggerRef),onPointerDown:VZ(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:VZ(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});uY.displayName=iur;var A3n="DropdownMenuPortal",aur=t=>{let{__scopeDropdownMenu:e,...r}=t,n=nm(e);return(0,pd.jsx)(Vsr,{...n,...r})};aur.displayName=A3n;var sur="DropdownMenuContent",uur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=our(sur,r),i=nm(r),a=Ac.useRef(!1);return(0,pd.jsx)(Wsr,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:VZ(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:VZ(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)"}})});uur.displayName=sur;var I3n="DropdownMenuGroup",M3n=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Ksr,{...o,...n,ref:e})});M3n.displayName=I3n;var R3n="DropdownMenuLabel",lur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Gsr,{...o,...n,ref:e})});lur.displayName=R3n;var N3n="DropdownMenuItem",cur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Jsr,{...o,...n,ref:e})});cur.displayName=N3n;var j3n="DropdownMenuCheckboxItem",dur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Zsr,{...o,...n,ref:e})});dur.displayName=j3n;var D3n="DropdownMenuRadioGroup",L3n=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Ysr,{...o,...n,ref:e})});L3n.displayName=D3n;var F3n="DropdownMenuRadioItem",fur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Xsr,{...o,...n,ref:e})});fur.displayName=F3n;var k3n="DropdownMenuItemIndicator",pur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(Qsr,{...o,...n,ref:e})});pur.displayName=k3n;var $3n="DropdownMenuSeparator",mur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(eur,{...o,...n,ref:e})});mur.displayName=$3n;var B3n="DropdownMenuArrow",z3n=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(tur,{...o,...n,ref:e})});z3n.displayName=B3n;var U3n="DropdownMenuSubTrigger",hur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(rur,{...o,...n,ref:e})});hur.displayName=U3n;var q3n="DropdownMenuSubContent",gur=Ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=nm(r);return(0,pd.jsx)(nur,{...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)"}})});gur.displayName=q3n;var yur=sY,bur=uY,_ur=aur,w5e=uur;var x5e=lur,S5e=cur,C5e=dur;var O5e=fur,E5e=pur,P5e=mur;var T5e=hur,A5e=gur;un();xn();var lA=yur,cA=bur;var V3n=sa.forwardRef(({className:t,inset:e,children:r,...n},o)=>sa.createElement(T5e,{ref:o,className:me("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,sa.createElement(Lm,{className:"tw-ml-auto"})));V3n.displayName=T5e.displayName;var W3n=sa.forwardRef(({className:t,...e},r)=>sa.createElement(A5e,{ref:r,className:me("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}));W3n.displayName=A5e.displayName;var Pg=sa.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>sa.createElement(_ur,{container:r??activeDocument.body},sa.createElement(w5e,{ref:o,sideOffset:e,className:me("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})));Pg.displayName=w5e.displayName;var Zn=sa.forwardRef(({className:t,inset:e,...r},n)=>sa.createElement(S5e,{ref:n,className:me("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}));Zn.displayName=S5e.displayName;var K3n=sa.forwardRef(({className:t,children:e,checked:r,...n},o)=>sa.createElement(C5e,{ref:o,className:me("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},sa.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},sa.createElement(E5e,null,sa.createElement(ls,{className:"tw-size-4"}))),e));K3n.displayName=C5e.displayName;var G3n=sa.forwardRef(({className:t,children:e,...r},n)=>sa.createElement(O5e,{ref:n,className:me("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},sa.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},sa.createElement(E5e,null,sa.createElement(h5,{className:"tw-size-2 tw-fill-current"}))),e));G3n.displayName=O5e.displayName;var J3n=sa.forwardRef(({className:t,inset:e,...r},n)=>sa.createElement(x5e,{ref:n,className:me("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));J3n.displayName=x5e.displayName;var Z3n=sa.forwardRef(({className:t,...e},r)=>sa.createElement(P5e,{ref:r,className:me("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));Z3n.displayName=P5e.displayName;var Y3n=({className:t,...e})=>sa.createElement("span",{className:me("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});Y3n.displayName="DropdownMenuShortcut";var lY=j(Y());xn();var uV=lY.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 lY.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:me("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},lY.createElement("div",{className:me("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")}))});uV.displayName="SettingSwitch";var fY=j(Y());var _n=j(Y(),1);function rv(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var wur=j(Y(),1);function vur(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function X3n(...t){return e=>{let r=!1,n=t.map(o=>{let i=vur(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():vur(t[o],null)}}}}function nv(...t){return wur.useCallback(X3n(...t),t)}var dA=j(Y(),1),xur=j(st(),1);function r_e(t,e=[]){let r=[];function n(i,a){let s=dA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=dA.useMemo(()=>h,Object.values(h));return(0,xur.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=dA.useContext(p);if(h)return h;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=>dA.createContext(a));return function(s){let u=s?.[t]||i;return dA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Q3n(o,...e)]}function Q3n(...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 dA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Os=j(Y(),1);var Sur=j(Y(),1),Cur=j(za(),1);Bv();var Our=j(st(),1),eHn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mb=eHn.reduce((t,e)=>{let r=kf(`Primitive.${e}`),n=Sur.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Our.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Eur(t,e){t&&Cur.flushSync(()=>t.dispatchEvent(e))}var lV=j(Y(),1);function S$(t){let e=lV.useRef(t);return lV.useEffect(()=>{e.current=t}),lV.useMemo(()=>(...r)=>e.current?.(...r),[])}var Pur=j(Y(),1);function Tur(t,e=globalThis?.document){let r=S$(t);Pur.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 M5e=j(st(),1),tHn="DismissableLayer",I5e="dismissableLayer.update",rHn="dismissableLayer.pointerDownOutside",nHn="dismissableLayer.focusOutside",Aur,Mur=Os.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R5e=Os.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Os.useContext(Mur),[c,d]=Os.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Os.useState({}),h=nv(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=aHn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=sHn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return Tur(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Os.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Aur=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Iur(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Aur)}},[c,f,r,l]),Os.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Iur())},[c,l]),Os.useEffect(()=>{let P=()=>p({});return document.addEventListener(I5e,P),()=>document.removeEventListener(I5e,P)},[]),(0,M5e.jsx)(mb.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:rv(t.onFocusCapture,E.onFocusCapture),onBlurCapture:rv(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:rv(t.onPointerDownCapture,C.onPointerDownCapture)})});R5e.displayName=tHn;var oHn="DismissableLayerBranch",iHn=Os.forwardRef((t,e)=>{let r=Os.useContext(Mur),n=Os.useRef(null),o=nv(e,n);return Os.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,M5e.jsx)(mb.div,{...t,ref:o})});iHn.displayName=oHn;function aHn(t,e=globalThis?.document){let r=S$(t),n=Os.useRef(!1),o=Os.useRef(()=>{});return Os.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Rur(rHn,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 sHn(t,e=globalThis?.document){let r=S$(t),n=Os.useRef(!1);return Os.useEffect(()=>{let o=i=>{i.target&&!n.current&&Rur(nHn,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 Iur(){let t=new CustomEvent(I5e);document.dispatchEvent(t)}function Rur(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?Eur(o,i):o.dispatchEvent(i)}var N5e=j(Y(),1);var Nur=j(Y(),1),bh=globalThis?.document?Nur.useLayoutEffect:()=>{};var uHn=N5e[" useId ".trim().toString()]||(()=>{}),lHn=0;function jur(t){let[e,r]=N5e.useState(uHn());return bh(()=>{t||r(n=>n??String(lHn++))},[t]),t||(e?`radix-${e}`:"")}var Tg=j(Y(),1);var Dur=j(Y(),1);var j5e=j(st(),1),cHn="Arrow",Lur=Dur.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,j5e.jsx)(mb.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,j5e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Lur.displayName=cHn;var Fur=Lur;var kur=j(Y(),1);function $ur(t){let[e,r]=kur.useState(void 0);return bh(()=>{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 dN=j(st(),1);var D5e="Popper",[Bur,L5e]=r_e(D5e),[fHn,zur]=Bur(D5e),Uur=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Tg.useState(null);return(0,dN.jsx)(fHn,{scope:e,anchor:n,onAnchorChange:o,children:r})};Uur.displayName=D5e;var qur="PopperAnchor",Hur=Tg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=zur(qur,r),a=Tg.useRef(null),s=nv(e,a);return Tg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,dN.jsx)(mb.div,{...o,ref:s})});Hur.displayName=qur;var F5e="PopperContent",[pHn,mHn]=Bur(F5e),Vur=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:h,...m}=t,g=zur(F5e,r),[y,_]=Tg.useState(null),w=nv(e,Z=>_(Z)),[S,C]=Tg.useState(null),E=$ur(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(gHn),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:X,middlewareData:ee}=Y1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>sA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[X1({mainAxis:o+T,alignmentAxis:a}),u&&Q1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?eN():void 0,...k}),u&&tN({...k}),rN({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&oN({element:S,padding:s}),yHn({arrowWidth:P,arrowHeight:T}),f&&nN({strategy:"referenceHidden",...k})]}),[L,Q]=Gur(U),z=S$(h);bh(()=>{X&&z?.()},[X,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Tg.useState();return bh(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,dN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:X?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,dN.jsx)(pHn,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,dN.jsx)(mb.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:X?void 0:"none"}})})})});Vur.displayName=F5e;var Wur="PopperArrow",hHn={top:"bottom",right:"left",bottom:"top",left:"right"},Kur=Tg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=mHn(Wur,n),a=hHn[i.placedSide];return(0,dN.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,dN.jsx)(Fur,{...o,ref:r,style:{...o.style,display:"block"}})})});Kur.displayName=Wur;function gHn(t){return t!==null}var yHn=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]=Gur(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Gur(t){let[e,r="center"]=t.split("-");return[e,r]}var Jur=Uur,Zur=Hur,Yur=Vur,Xur=Kur;var n_e=j(Y(),1),Qur=j(za(),1);var elr=j(st(),1),_Hn="Portal",k5e=n_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=n_e.useState(!1);bh(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Qur.default.createPortal((0,elr.jsx)(mb.div,{...n,ref:e}),a):null});k5e.displayName=_Hn;var _h=j(Y(),1);var tlr=j(Y(),1);function vHn(t,e){return tlr.useReducer((r,n)=>e[r][n]??r,t)}var i_e=t=>{let{present:e,children:r}=t,n=wHn(e),o=typeof r=="function"?r({present:n.isPresent}):_h.Children.only(r),i=nv(n.ref,xHn(o));return typeof r=="function"||n.isPresent?_h.cloneElement(o,{ref:i}):null};i_e.displayName="Presence";function wHn(t){let[e,r]=_h.useState(),n=_h.useRef(null),o=_h.useRef(t),i=_h.useRef("none"),a=t?"mounted":"unmounted",[s,u]=vHn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _h.useEffect(()=>{let l=o_e(n.current);i.current=s==="mounted"?l:"none"},[s]),bh(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=o_e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),bh(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=o_e(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=o_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:_h.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function o_e(t){return t?.animationName||"none"}function xHn(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)}Bv();var hb=j(Y(),1);var a_e=j(Y(),1);var SHn=hb[" useInsertionEffect ".trim().toString()]||bh;function rlr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=CHn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=hb.useRef(t!==void 0);hb.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=hb.useCallback(c=>{if(s){let d=OHn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function CHn({defaultProp:t,onChange:e}){let[r,n]=hb.useState(t),o=hb.useRef(r),i=hb.useRef(e);return SHn(()=>{i.current=e},[e]),hb.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function OHn(t){return typeof t=="function"}var XHi=Symbol("RADIX:SYNC_STATE");var alr=j(Y(),1);var nlr=j(Y(),1),EHn=j(za(),1);Bv();var olr=j(st(),1),PHn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ilr=PHn.reduce((t,e)=>{let r=kf(`Primitive.${e}`),n=nlr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,olr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var slr=j(st(),1),THn=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"}),AHn="VisuallyHidden",ulr=alr.forwardRef((t,e)=>(0,slr.jsx)(ilr.span,{...t,ref:e,style:{...THn,...t.style}}));ulr.displayName=AHn;var llr=ulr;var Yl=j(st(),1),[s_e,mVi]=r_e("Tooltip",[L5e]),u_e=L5e(),clr="TooltipProvider",MHn=700,$5e="tooltip.open",[RHn,z5e]=s_e(clr),dlr=t=>{let{__scopeTooltip:e,delayDuration:r=MHn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=_n.useRef(!0),s=_n.useRef(!1),u=_n.useRef(0);return _n.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,Yl.jsx)(RHn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:_n.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:_n.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:_n.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};dlr.displayName=clr;var cY="Tooltip",[NHn,dY]=s_e(cY),flr=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=z5e(cY,t.__scopeTooltip),l=u_e(e),[c,d]=_n.useState(null),f=jur(),p=_n.useRef(0),h=a??u.disableHoverableContent,m=s??u.delayDuration,g=_n.useRef(!1),[y,_]=rlr({prop:n,defaultProp:o??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent($5e))):u.onClose(),i?.(P)},caller:cY}),w=_n.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),S=_n.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,_(!0)},[_]),C=_n.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),E=_n.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,_(!0),p.current=0},m)},[m,_]);return _n.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,Yl.jsx)(Jur,{...l,children:(0,Yl.jsx)(NHn,{scope:e,contentId:f,open:y,stateAttribute:w,trigger:c,onTriggerChange:d,onTriggerEnter:_n.useCallback(()=>{u.isOpenDelayedRef.current?E():S()},[u.isOpenDelayedRef,E,S]),onTriggerLeave:_n.useCallback(()=>{h?C():(window.clearTimeout(p.current),p.current=0)},[C,h]),onOpen:S,onClose:C,disableHoverableContent:h,children:r})})};flr.displayName=cY;var B5e="TooltipTrigger",plr=_n.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=dY(B5e,r),i=z5e(B5e,r),a=u_e(r),s=_n.useRef(null),u=nv(e,s,o.onTriggerChange),l=_n.useRef(!1),c=_n.useRef(!1),d=_n.useCallback(()=>l.current=!1,[]);return _n.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,Yl.jsx)(Zur,{asChild:!0,...a,children:(0,Yl.jsx)(mb.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:rv(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:rv(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:rv(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:rv(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:rv(t.onBlur,o.onClose),onClick:rv(t.onClick,o.onClose)})})});plr.displayName=B5e;var U5e="TooltipPortal",[jHn,DHn]=s_e(U5e,{forceMount:void 0}),mlr=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=dY(U5e,e);return(0,Yl.jsx)(jHn,{scope:e,forceMount:r,children:(0,Yl.jsx)(i_e,{present:r||i.open,children:(0,Yl.jsx)(k5e,{asChild:!0,container:o,children:n})})})};mlr.displayName=U5e;var cV="TooltipContent",hlr=_n.forwardRef((t,e)=>{let r=DHn(cV,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=dY(cV,t.__scopeTooltip);return(0,Yl.jsx)(i_e,{present:n||a.open,children:a.disableHoverableContent?(0,Yl.jsx)(glr,{side:o,...i,ref:e}):(0,Yl.jsx)(LHn,{side:o,...i,ref:e})})}),LHn=_n.forwardRef((t,e)=>{let r=dY(cV,t.__scopeTooltip),n=z5e(cV,t.__scopeTooltip),o=_n.useRef(null),i=nv(e,o),[a,s]=_n.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=_n.useCallback(()=>{s(null),d(!1)},[d]),p=_n.useCallback((h,m)=>{let g=h.currentTarget,y={x:h.clientX,y:h.clientY},_=zHn(y,g.getBoundingClientRect()),w=UHn(y,_),S=qHn(m.getBoundingClientRect()),C=VHn([...w,...S]);s(C),d(!0)},[d]);return _n.useEffect(()=>()=>f(),[f]),_n.useEffect(()=>{if(u&&c){let h=g=>p(g,c),m=g=>p(g,u);return u.addEventListener("pointerleave",h),c.addEventListener("pointerleave",m),()=>{u.removeEventListener("pointerleave",h),c.removeEventListener("pointerleave",m)}}},[u,c,p,f]),_n.useEffect(()=>{if(a){let h=m=>{let g=m.target,y={x:m.clientX,y:m.clientY},_=u?.contains(g)||c?.contains(g),w=!HHn(y,a);_?f():w&&(f(),l())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[u,c,a,l,f]),(0,Yl.jsx)(glr,{...t,ref:i})}),[FHn,kHn]=s_e(cY,{isInside:!1}),$Hn=Yot("TooltipContent"),glr=_n.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=dY(cV,r),l=u_e(r),{onClose:c}=u;return _n.useEffect(()=>(document.addEventListener($5e,c),()=>document.removeEventListener($5e,c)),[c]),_n.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,Yl.jsx)(R5e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,Yl.jsxs)(Yur,{"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,Yl.jsx)($Hn,{children:n}),(0,Yl.jsx)(FHn,{scope:r,isInside:!0,children:(0,Yl.jsx)(llr,{id:u.contentId,role:"tooltip",children:o||n})})]})})});hlr.displayName=cV;var ylr="TooltipArrow",BHn=_n.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=u_e(r);return kHn(ylr,r).isInside?null:(0,Yl.jsx)(Xur,{...o,...n,ref:e})});BHn.displayName=ylr;function zHn(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 UHn(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 qHn(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 HHn(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 VHn(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),WHn(e)}function WHn(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 l_e=dlr,blr=flr,_lr=plr,vlr=mlr,q5e=hlr;xn();var so=l_e,St=blr,Ct=_lr,_t=fY.forwardRef(({className:t,sideOffset:e=4,...r},n)=>fY.createElement(vlr,{container:activeDocument.body},fY.createElement(q5e,{ref:n,sideOffset:e,className:me("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})));_t.displayName=q5e.displayName;or();Gt();ly();bt();Lde();oG();un();var om=require("obsidian"),Vt=j(Y());async function KHn(){try{let{getSettings:t}=await Promise.resolve().then(()=>(bt(),i8));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().indexVaultToVectorStore(!1);new om.Notice(`Semantic search index refreshed with ${n} documents.`)}else new om.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new om.Notice("Failed to refresh vault index. Check console for details.")}}async function GHn(){try{let{getSettings:t}=await Promise.resolve().then(()=>(bt(),i8));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().indexVaultToVectorStore(!0);new om.Notice(`Semantic search index rebuilt with ${n} documents.`)}else new om.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new om.Notice("Failed to force reindex vault. Check console for details.")}}async function c_e(){let t=wu();if(!t){new om.Notice("No project is currently selected to reload.");return}try{TE(!0),await b_.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new om.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),UP(e)||new om.Notice("Failed to reload project context. Check console for details.")}finally{TE(!1)}}async function JHn(){let t=wu();if(!t){new om.Notice("No project is currently selected to rebuild.");return}new Tc(app,async()=>{try{TE(!0),new om.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),iG.resetRateLimitNoticeTimer(),await b_.getInstance().clearForProject(t),new om.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 om.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),UP(r)||new om.Notice("Failed to force rebuild project context. Check console for details.")}finally{TE(!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 xlr({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=vn(),[a,s]=Rp(),u=f4(),l=c=>{s(c),n(c),c!=="project"&&(Lj(null),o?.())};return Vt.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Vt.default.createElement("div",{className:"tw-flex-1"},Vt.default.createElement(sY,null,Vt.default.createElement(uY,{asChild:!0},Vt.default.createElement(he,{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"&&Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Vt.default.createElement($f,{className:"tw-size-4"}),"copilot plus"),a==="project"&&"projects (alpha)",Vt.default.createElement(ki,{className:"tw-mt-0.5 tw-size-5"}))),Vt.default.createElement(Pg,{align:"start"},Vt.default.createElement(Zn,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Vt.default.createElement(Zn,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Vt.default.createElement(Zn,{onSelect:()=>{l("copilot_plus")}},Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Vt.default.createElement($f,{className:"tw-size-4"}),"copilot plus")):Vt.default.createElement(Zn,{onSelect:()=>{oD(EE.CHAT_MODE_SELECT),o?.()}},"copilot plus",Vt.default.createElement(HE,{className:"tw-size-3"})),u?Vt.default.createElement(Zn,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Vt.default.createElement(rD,{className:"tw-size-4"}),"projects (alpha)"):Vt.default.createElement(Zn,{onSelect:()=>{oD(EE.CHAT_MODE_SELECT),o?.()}},"copilot plus",Vt.default.createElement(HE,{className:"tw-size-3"}))))),Vt.default.createElement("div",null,Vt.default.createElement(St,null,Vt.default.createElement(Ct,{asChild:!0},Vt.default.createElement(he,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Vt.default.createElement(A5,{className:"tw-size-4"}))),Vt.default.createElement(_t,null,"New Chat")),!i.autosaveChat&&Vt.default.createElement(St,null,Vt.default.createElement(Ct,{asChild:!0},Vt.default.createElement(he,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Vt.default.createElement(b5,{className:"tw-size-4"}))),Vt.default.createElement(_t,null,"Save Chat as Note")),Vt.default.createElement(St,null,Vt.default.createElement(Ct,{asChild:!0},Vt.default.createElement(he,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Vt.default.createElement(E5,{className:"tw-size-4"}))),Vt.default.createElement(_t,null,"Chat History")),Vt.default.createElement(sY,null,Vt.default.createElement(uY,{asChild:!0},Vt.default.createElement(he,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Vt.default.createElement(RI,{className:"tw-size-4"}))),Vt.default.createElement(Pg,{align:"end",className:"tw-w-64"},Vt.default.createElement(Zn,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),nt("showSuggestedPrompts",!i.showSuggestedPrompts)}},Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vt.default.createElement($f,{className:"tw-size-4"}),"Suggested Prompt"),Vt.default.createElement(uV,{checked:i.showSuggestedPrompts})),Vt.default.createElement(Zn,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),nt("showRelevantNotes",!i.showRelevantNotes)}},Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vt.default.createElement(Fm,{className:"tw-size-4"}),"Relevant Note"),Vt.default.createElement(uV,{checked:i.showRelevantNotes})),a==="project"?Vt.default.createElement(Vt.default.Fragment,null,Vt.default.createElement(Zn,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>c_e()},Vt.default.createElement(Vv,{className:"tw-size-4"}),"Reload Current Project"),Vt.default.createElement(Zn,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>JHn()},Vt.default.createElement(Lp,{className:"tw-size-4"}),"Force Rebuild Context")):Vt.default.createElement(Vt.default.Fragment,null,Vt.default.createElement(Zn,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>KHn()},Vt.default.createElement(Vv,{className:"tw-size-4"}),"Refresh Vault Index"),Vt.default.createElement(Zn,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new Tc(app,()=>GHn(),"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()}},Vt.default.createElement(Lp,{className:"tw-size-4"}),"Force Reindex Vault"))))))}ua();vu();var f_e=require("obsidian");var d_e=require("obsidian");ir();vu();var dV=class extends d_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 d_e.TFile&&XB(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>XB(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&XB(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}};vu();ir();or();var fN=class extends dV{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(!XB(e,this.chainType)){new f_e.Notice(iz.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof f_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 p_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 Slr=require("obsidian"),pY=class extends Slr.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)}};po();var vh=j(Y()),H5e=require("obsidian");po();bt();ir();un();xn();function m_e({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,vh.useState)(null),u=vn(),l=u.activeModels.find(c=>c.enabled&&tn(c)===o);return vh.default.createElement(lA,null,vh.default.createElement(cA,{asChild:!0},vh.default.createElement(he,{variant:r,size:e,disabled:t,className:me("tw-min-w-0 tw-justify-start tw-text-muted",n)},vh.default.createElement("div",{className:"tw-min-w-0 tw-flex-1 tw-truncate"},a?vh.default.createElement("span",{className:"tw-truncate tw-text-error"},"Model Load Failed"):l?vh.default.createElement(y8e,{model:l,iconSize:8}):vh.default.createElement("span",{className:"tw-truncate"},"Select Model")),!t&&vh.default.createElement(ki,{className:"tw-mt-0.5 tw-size-5 tw-shrink-0"}))),vh.default.createElement(Pg,{align:"start"},u.activeModels.filter(c=>c.enabled).map(c=>{let{hasApiKey:d,errorNotice:f}=tz(c,u);return vh.default.createElement(Zn,{key:tn(c),onSelect:async p=>{if(!d&&f){p.preventDefault(),new H5e.Notice(f);return}try{s(null),i(tn(c))}catch(h){let m="Model switch failed: "+eo(h);s(m),new H5e.Notice(m);let g=u.activeModels.find(y=>y.enabled&&tn(y)===o);g&&i(tn(g))}},className:d?"":"tw-cursor-not-allowed tw-opacity-50"},vh.default.createElement(y8e,{model:c,iconSize:12}))})))}var gt=j(Y());un();po();vu();xn();bt();ir();var Clr=({vaultToggle:t,setVaultToggle:e,webToggle:r,setWebToggle:n,composerToggle:o,setComposerToggle:i,autonomousAgentToggle:a,setAutonomousAgentToggle:s,currentChain:u})=>{let l=jh(u),c=l&&u!=="project",d=()=>{let f=!a;s(f),nt("enableAutonomousAgent",f)};return l?gt.default.createElement(so,{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(St,null,gt.default.createElement(Ct,{asChild:!0},gt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:d,className:me("tw-text-muted hover:tw-text-accent",a&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement(Vz,{className:"tw-size-4"}))),gt.default.createElement(_t,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!a&&gt.default.createElement(gt.default.Fragment,null,gt.default.createElement(St,null,gt.default.createElement(Ct,{asChild:!0},gt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>e(!t),className:me("tw-text-muted hover:tw-text-accent",t&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement(BE,{className:"tw-size-4"}))),gt.default.createElement(_t,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),gt.default.createElement(St,null,gt.default.createElement(Ct,{asChild:!0},gt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>n(!r),className:me("tw-text-muted hover:tw-text-accent",r&&"tw-text-accent tw-bg-accent/10")},gt.default.createElement(Wb,{className:"tw-size-4"}))),gt.default.createElement(_t,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),gt.default.createElement(St,null,gt.default.createElement(Ct,{asChild:!0},gt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>i(!o),className:me("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($f,{className:"tw-size-2"}),gt.default.createElement(qh,{className:"tw-size-3"})))),gt.default.createElement(_t,{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(lA,null,gt.default.createElement(cA,{asChild:!0},gt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent"},gt.default.createElement(VE,{className:"tw-size-4"}))),gt.default.createElement(Pg,{align:"end",className:"tw-w-56"},c&&gt.default.createElement(Zn,{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(Vz,{className:"tw-size-4"}),gt.default.createElement("span",null,"Autonomous Agent")),a&&gt.default.createElement(ls,{className:"tw-size-4"})),!a&&gt.default.createElement(gt.default.Fragment,null,gt.default.createElement(Zn,{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(BE,{className:"tw-size-4"}),gt.default.createElement("span",null,"Vault Search")),t&&gt.default.createElement(ls,{className:"tw-size-4"})),gt.default.createElement(Zn,{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(Wb,{className:"tw-size-4"}),gt.default.createElement("span",null,"Web Search")),r&&gt.default.createElement(ls,{className:"tw-size-4"})),gt.default.createElement(Zn,{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($f,{className:"tw-size-2"}),gt.default.createElement(qh,{className:"tw-size-3"})),gt.default.createElement("span",null,"Composer")),o&&gt.default.createElement(ls,{className:"tw-size-4"}))),a&&gt.default.createElement(gt.default.Fragment,null,gt.default.createElement(Zn,{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(BE,{className:"tw-size-4"}),gt.default.createElement("span",null,"Vault Search"))),gt.default.createElement(Zn,{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(Wb,{className:"tw-size-4"}),gt.default.createElement("span",null,"Web Search"))),gt.default.createElement(Zn,{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($f,{className:"tw-size-2"}),gt.default.createElement(qh,{className:"tw-size-3"})),gt.default.createElement("span",null,"Composer")))))))):null};ua();or();ir();var h_e=require("obsidian");or();var fV=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 h_e.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
<${m8}>
<name>${s}</name>
<content>
${l}
</content>
</${m8}>
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
<${m8}>
<name>${s}</name>
<error>Could not process PDF</error>
</${m8}>
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=f8)=>{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(!jh(s)&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new h_e.Notice(iz.NON_MARKDOWN_FILES_RESTRICTED);return}let p=await r.parseFile(d,n);d.extension==="md"&&jh(s)&&(p=await this.processEmbeddedPDFs(p,n,r));let h=await n.adapter.stat(d.path),m=h?new Date(h.ctime).toISOString():"Unknown",g=h?new Date(h.mtime).toISOString():"Unknown";u+=`
<${f}>
<title>${d.basename}</title>
<path>${d.path}</path>
<ctime>${m}</ctime>
<mtime>${g}</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+=`
<${Tm}>
<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>
</${Tm}>`;return r}};Hye();ir();bt();l7();ir();un();var iWe=require("obsidian"),Lt=j(Y());var zn=j(Y()),ea=j(Rlr());function pN(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 XHn=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 C$(t,e,r){let n=QHn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&Nlr(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),Nlr(n,"relativePath",i),n}function QHn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=XHn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function Nlr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var eVn=[".DS_Store","Thumbs.db"];function W5e(t){return pN(this,void 0,void 0,function*(){return g_e(t)&&tVn(t.dataTransfer)?iVn(t.dataTransfer,t.type):rVn(t)?nVn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?oVn(t):[]})}function tVn(t){return g_e(t)}function rVn(t){return g_e(t)&&g_e(t.target)}function g_e(t){return typeof t=="object"&&t!==null}function nVn(t){return V5e(t.target.files).map(e=>C$(e))}function oVn(t){return pN(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>C$(r))})}function iVn(t,e){return pN(this,void 0,void 0,function*(){if(t.items){let r=V5e(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(aVn));return jlr(Llr(n))}return jlr(V5e(t.files).map(r=>C$(r)))})}function jlr(t){return t.filter(e=>eVn.indexOf(e.name)===-1)}function V5e(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 aVn(t){if(typeof t.webkitGetAsEntry!="function")return Dlr(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?Flr(e):Dlr(t,e)}function Llr(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?Llr(r):[r]],[])}function Dlr(t,e){return pN(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,C$(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return C$(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function sVn(t){return pN(this,void 0,void 0,function*(){return t.isDirectory?Flr(t):uVn(t)})}function Flr(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>pN(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(sVn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function uVn(t){return pN(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=C$(n,t.fullPath);e(o)},n=>{r(n)})})})}var y_e=j(klr());function $lr(t){return dVn(t)||cVn(t)||Vlr(t)||lVn()}function lVn(){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 cVn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function dVn(t){if(Array.isArray(t))return G5e(t)}function Blr(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 zlr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Blr(Object(r),!0).forEach(function(n){Hlr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Blr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Hlr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mY(t,e){return mVn(t)||pVn(t,e)||Vlr(t,e)||fVn()}function fVn(){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 Vlr(t,e){if(t){if(typeof t=="string")return G5e(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 G5e(t,e)}}function G5e(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 pVn(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 mVn(t){if(Array.isArray(t))return t}var hVn=typeof y_e.default=="function"?y_e.default:y_e.default.default,gVn="file-invalid-type",yVn="file-too-large",bVn="file-too-small",_Vn="too-many-files";var vVn=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:gVn,message:"File type must be ".concat(n)}},Ulr=function(e){return{code:yVn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},qlr=function(e){return{code:bVn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},Wlr={code:_Vn,message:"Too many files"};function J5e(t,e){var r=t.type==="application/x-moz-file"||hVn(t,e);return[r,r?null:vVn(e)]}function Z5e(t,e,r){if(O$(t.size))if(O$(e)&&O$(r)){if(t.size>r)return[!1,Ulr(r)];if(t.size<e)return[!1,qlr(e)]}else{if(O$(e)&&t.size<e)return[!1,qlr(e)];if(O$(r)&&t.size>r)return[!1,Ulr(r)]}return[!0,null]}function O$(t){return t!=null}function Klr(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=J5e(u,r),c=mY(l,1),d=c[0],f=Z5e(u,n,o),p=mY(f,1),h=p[0],m=s?s(u):null;return d&&h&&!m})}function hY(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function gY(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 Y5e(t){t.preventDefault()}function wVn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function xVn(t){return t.indexOf("Edge/")!==-1}function Glr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return wVn(t)||xVn(t)}function ov(){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!hY(n)&&s&&s.apply(void 0,[n].concat(i)),hY(n)})}}function Jlr(){return"showOpenFilePicker"in window}function Zlr(t){if(O$(t)){var e=Object.entries(t).filter(function(r){var n=mY(r,2),o=n[0],i=n[1],a=!0;return ecr(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(tcr))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=mY(n,2),i=o[0],a=o[1];return zlr(zlr({},r),{},Hlr({},i,a))},{});return[{description:"Files",accept:e}]}return t}function Ylr(t){if(O$(t))return Object.entries(t).reduce(function(e,r){var n=mY(r,2),o=n[0],i=n[1];return[].concat($lr(e),[o],$lr(i))},[]).filter(function(e){return ecr(e)||tcr(e)}).join(",")}function Xlr(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function Qlr(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function ecr(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function tcr(t){return/^.*\.[\w]+$/.test(t)}var SVn=["children"],CVn=["open"],OVn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],EVn=["refKey","onChange","onClick"];function PVn(t){return IVn(t)||AVn(t)||ocr(t)||TVn()}function TVn(){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 AVn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function IVn(t){if(Array.isArray(t))return Q5e(t)}function X5e(t,e){return NVn(t)||RVn(t,e)||ocr(t,e)||MVn()}function MVn(){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 ocr(t,e){if(t){if(typeof t=="string")return Q5e(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 Q5e(t,e)}}function Q5e(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 RVn(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 NVn(t){if(Array.isArray(t))return t}function rcr(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 Es(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rcr(Object(r),!0).forEach(function(n){eWe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rcr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function eWe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function b_e(t,e){if(t==null)return{};var r=jVn(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 jVn(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 rWe=(0,zn.forwardRef)(function(t,e){var r=t.children,n=b_e(t,SVn),o=nWe(n),i=o.open,a=b_e(o,CVn);return(0,zn.useImperativeHandle)(e,function(){return{open:i}},[i]),zn.default.createElement(zn.Fragment,null,r(Es(Es({},a),{},{open:i})))});rWe.displayName="Dropzone";var icr={disabled:!1,getFilesFromEvent:W5e,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};rWe.defaultProps=icr;rWe.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 tWe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function nWe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Es(Es({},icr),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,h=e.onDropRejected,m=e.onFileDialogCancel,g=e.onFileDialogOpen,y=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,zn.useMemo)(function(){return Ylr(r)},[r]),M=(0,zn.useMemo)(function(){return Zlr(r)},[r]),D=(0,zn.useMemo)(function(){return typeof g=="function"?g:ncr},[g]),k=(0,zn.useMemo)(function(){return typeof m=="function"?m:ncr},[m]),F=(0,zn.useRef)(null),K=(0,zn.useRef)(null),U=(0,zn.useReducer)(DVn,tWe),X=X5e(U,2),ee=X[0],L=X[1],Q=ee.isFocused,z=ee.isFileDialogActive,W=(0,zn.useRef)(typeof window<"u"&&window.isSecureContext&&y&&Jlr()),V=function(){!W.current&&z&&setTimeout(function(){if(K.current){var fe=K.current.files;fe.length||(L({type:"closeDialog"}),k())}},300)};(0,zn.useEffect)(function(){return window.addEventListener("focus",V,!1),function(){window.removeEventListener("focus",V,!1)}},[K,z,k,W]);var q=(0,zn.useRef)([]),H=function(fe){F.current&&F.current.contains(fe.target)||(fe.preventDefault(),q.current=[])};(0,zn.useEffect)(function(){return w&&(document.addEventListener("dragover",Y5e,!1),document.addEventListener("drop",H,!1)),function(){w&&(document.removeEventListener("dragover",Y5e),document.removeEventListener("drop",H))}},[F,w]),(0,zn.useEffect)(function(){return!n&&_&&F.current&&F.current.focus(),function(){}},[F,_,n]);var G=(0,zn.useCallback)(function(ne){T?T(ne):console.error(ne)},[T]),Z=(0,zn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne),q.current=[].concat(PVn(q.current),[ne.target]),gY(ne)&&Promise.resolve(o(ne)).then(function(fe){if(!(hY(ne)&&!P)){var be=fe.length,ye=be>0&&Klr({files:fe,accept:N,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),ze=be>0&&!ye;L({isDragAccept:ye,isDragReject:ze,isDragActive:!0,type:"setDraggedFiles"}),l&&l(ne)}}).catch(function(fe){return G(fe)})},[o,l,G,P,N,a,i,s,u,I]),de=(0,zn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne);var fe=gY(ne);if(fe&&ne.dataTransfer)try{ne.dataTransfer.dropEffect="copy"}catch{}return fe&&d&&d(ne),!1},[d,P]),pe=(0,zn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne);var fe=q.current.filter(function(ye){return F.current&&F.current.contains(ye)}),be=fe.indexOf(ne.target);be!==-1&&fe.splice(be,1),q.current=fe,!(fe.length>0)&&(L({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),gY(ne)&&c&&c(ne))},[F,c,P]),ae=(0,zn.useCallback)(function(ne,fe){var be=[],ye=[];ne.forEach(function(ze){var hr=J5e(ze,N),Ii=X5e(hr,2),_i=Ii[0],bf=Ii[1],mp=Z5e(ze,a,i),Hi=X5e(mp,2),gd=Hi[0],yd=Hi[1],_f=I?I(ze):null;if(_i&&gd&&!_f)be.push(ze);else{var Wn=[bf,yd];_f&&(Wn=Wn.concat(_f)),ye.push({file:ze,errors:Wn.filter(function(EA){return EA})})}}),(!s&&be.length>1||s&&u>=1&&be.length>u)&&(be.forEach(function(ze){ye.push({file:ze,errors:[Wlr]})}),be.splice(0)),L({acceptedFiles:be,fileRejections:ye,isDragReject:ye.length>0,type:"setFiles"}),f&&f(be,ye,fe),ye.length>0&&h&&h(ye,fe),be.length>0&&p&&p(be,fe)},[L,s,N,a,i,u,f,p,h,I]),Te=(0,zn.useCallback)(function(ne){ne.preventDefault(),ne.persist(),Me(ne),q.current=[],gY(ne)&&Promise.resolve(o(ne)).then(function(fe){hY(ne)&&!P||ae(fe,ne)}).catch(function(fe){return G(fe)}),L({type:"reset"})},[o,ae,G,P]),Ae=(0,zn.useCallback)(function(){if(W.current){L({type:"openDialog"}),D();var ne={multiple:s,types:M};window.showOpenFilePicker(ne).then(function(fe){return o(fe)}).then(function(fe){ae(fe,null),L({type:"closeDialog"})}).catch(function(fe){Xlr(fe)?(k(fe),L({type:"closeDialog"})):Qlr(fe)?(W.current=!1,K.current?(K.current.value=null,K.current.click()):G(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."))):G(fe)});return}K.current&&(L({type:"openDialog"}),D(),K.current.value=null,K.current.click())},[L,D,k,y,ae,G,M,s]),ke=(0,zn.useCallback)(function(ne){!F.current||!F.current.isEqualNode(ne.target)||(ne.key===" "||ne.key==="Enter"||ne.keyCode===32||ne.keyCode===13)&&(ne.preventDefault(),Ae())},[F,Ae]),Ot=(0,zn.useCallback)(function(){L({type:"focus"})},[]),jr=(0,zn.useCallback)(function(){L({type:"blur"})},[]),Mr=(0,zn.useCallback)(function(){S||(Glr()?setTimeout(Ae,0):Ae())},[S,Ae]),Vn=function(fe){return n?null:fe},Xr=function(fe){return C?null:Vn(fe)},Cr=function(fe){return E?null:Vn(fe)},Me=function(fe){P&&fe.stopPropagation()},Ze=(0,zn.useMemo)(function(){return function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=ne.refKey,be=fe===void 0?"ref":fe,ye=ne.role,ze=ne.onKeyDown,hr=ne.onFocus,Ii=ne.onBlur,_i=ne.onClick,bf=ne.onDragEnter,mp=ne.onDragOver,Hi=ne.onDragLeave,gd=ne.onDrop,yd=b_e(ne,OVn);return Es(Es(eWe({onKeyDown:Xr(ov(ze,ke)),onFocus:Xr(ov(hr,Ot)),onBlur:Xr(ov(Ii,jr)),onClick:Vn(ov(_i,Mr)),onDragEnter:Cr(ov(bf,Z)),onDragOver:Cr(ov(mp,de)),onDragLeave:Cr(ov(Hi,pe)),onDrop:Cr(ov(gd,Te)),role:typeof ye=="string"&&ye!==""?ye:"presentation"},be,F),!n&&!C?{tabIndex:0}:{}),yd)}},[F,ke,Ot,jr,Mr,Z,de,pe,Te,C,E,n]),je=(0,zn.useCallback)(function(ne){ne.stopPropagation()},[]),le=(0,zn.useMemo)(function(){return function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=ne.refKey,be=fe===void 0?"ref":fe,ye=ne.onChange,ze=ne.onClick,hr=b_e(ne,EVn),Ii=eWe({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:Vn(ov(ye,Te)),onClick:Vn(ov(ze,je)),tabIndex:-1},be,K);return Es(Es({},Ii),hr)}},[K,r,s,Te,n]);return Es(Es({},ee),{},{isFocused:Q&&!n,getRootProps:Ze,getInputProps:le,rootRef:F,inputRef:K,open:Vn(Ae)})}function DVn(t,e){switch(e.type){case"focus":return Es(Es({},t),{},{isFocused:!0});case"blur":return Es(Es({},t),{},{isFocused:!1});case"openDialog":return Es(Es({},tWe),{},{isFileDialogActive:!0});case"closeDialog":return Es(Es({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Es(Es({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Es(Es({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Es({},tWe);default:return t}}function ncr(){}var hcr=j(Y());ua();un();var Pn=j(Y());po();var __e=j(Y());ire();xn();var LVn=zz("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"}}),cp=__e.forwardRef(({className:t,variant:e,...r},n)=>__e.createElement("div",{ref:n,className:me(LVn({variant:e}),t),...r}));cp.displayName="Badge";vu();var v_e=j(Y());var ccr=j(Y(),1);var acr=j(Y(),1),FVn=j(za(),1);Bv();var scr=j(st(),1),kVn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ucr=kVn.reduce((t,e)=>{let r=kf(`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,scr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var dcr=j(st(),1),$Vn="Separator",lcr="horizontal",BVn=["horizontal","vertical"],fcr=ccr.forwardRef((t,e)=>{let{decorative:r,orientation:n=lcr,...o}=t,i=zVn(n)?n:lcr,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,dcr.jsx)(ucr.div,{"data-orientation":i,...s,...o,ref:e})});fcr.displayName=$Vn;function zVn(t){return BVn.includes(t)}var oWe=fcr;xn();var E$=v_e.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>v_e.createElement(oWe,{ref:o,decorative:r,orientation:e,className:me("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}));E$.displayName=oWe.displayName;ua();function pcr({note:t,isActive:e=!1,onRemoveContext:r}){return Pn.default.createElement(cp,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Pn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&Pn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&Pn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),Pn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context",className:"tw-text-muted"},Pn.default.createElement(vi,{className:"tw-size-4"})))}function qVn({url:t,onRemoveUrl:e}){return Pn.default.createElement(cp,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Pn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),Pn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),Pn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context",className:"tw-text-muted"},Pn.default.createElement(vi,{className:"tw-size-4"})))}function HVn({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return Pn.default.createElement(cp,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Pn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),Pn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),Pn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context",className:"tw-text-muted"},Pn.default.createElement(vi,{className:"tw-size-4"})))}var mcr=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s,showProgressCard:u})=>{let[l]=Rp(),c=Obe(),d=Pn.default.useMemo(()=>{let m=new Map(e.map(g=>[g.path,g]));return Array.from(m.values()).filter(g=>g.wasAddedManually?!0:!(t&&g.path===t.path))},[e,t]),f=Pn.default.useMemo(()=>Array.from(new Set(r)),[r]),p=d.length>0||f.length>0||n.length>0||!!t,h=()=>{switch(c){case"success":return Pn.default.createElement(TI,{className:"tw-size-4 tw-text-success"});case"loading":return Pn.default.createElement(nu,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return Pn.default.createElement(zv,{className:"tw-size-4 tw-text-error"});case"initial":return Pn.default.createElement(m5,{className:"tw-size-4 tw-text-faint"})}};return Pn.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},Pn.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Pn.default.createElement(he,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},Pn.default.createElement(Hh,{className:"tw-size-4"}),!p&&Pn.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),Pn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&Pn.default.createElement(pcr,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),d.map(m=>Pn.default.createElement(pcr,{key:m.path,note:m,isActive:!1,onRemoveContext:i})),f.map(m=>Pn.default.createElement(qVn,{key:m,url:m,onRemoveUrl:a})),n.map(m=>Pn.default.createElement(HVn,{key:m.id,selectedText:m,onRemoveSelectedText:s||(()=>{})}))),l==="project"&&Pn.default.createElement(Pn.default.Fragment,null,Pn.default.createElement(E$,{orientation:"vertical"}),Pn.default.createElement("div",{className:""},Pn.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>u()},h()))))};var VVn=({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]=Rp();return hcr.default.createElement(mcr,{activeNote:o?a:null,contextNotes:r,onAddContext:()=>{new fN({app:t,onNoteSelect:m=>{a&&m.path===a.path?(i(!0),n(g=>g.filter(y=>y.path!==m.path))):n(g=>[...g,Object.assign(m,{wasAddedManually:!0})])},excludeNotePaths:e,chainType:f}).open()},onRemoveContext:m=>{let g=r.find(_=>_.path===m);g&&g.wasAddedManually?n(_=>_.filter(w=>w.path!==m)):(i(!1),n(_=>_.filter(w=>w.path!==m)))},contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c,showProgressCard:d})},gcr=VVn;var ycr=(0,Lt.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:h,selectedTextContexts:m,onRemoveSelectedText:g,showProgressCard:y},_)=>{let[w,S]=(0,Lt.useState)([]),C=(0,Lt.useRef)(null),E=(0,Lt.useRef)(null),[P,T]=oI(),[I]=Rp(),[N]=Lee(),M=vn(),[D,k]=(0,Lt.useState)(()=>{let Ze=i.workspace.getActiveFile();return JSe(Ze)?Ze:null}),[F,K]=(0,Lt.useState)(null),U=jh(I),[X,ee]=(0,Lt.useState)(!1),[L,Q]=(0,Lt.useState)(!1),[z,W]=(0,Lt.useState)(!1),[V,q]=(0,Lt.useState)(M.enableAutonomousAgent),[H,G]=(0,Lt.useState)(0),Z=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,Lt.useImperativeHandle)(_,()=>({focus:()=>{C.current?.focus()}})),(0,Lt.useEffect)(()=>{I==="project"?q(!1):q(M.enableAutonomousAgent)},[M.enableAutonomousAgent,I]),(0,Lt.useEffect)(()=>{if(I==="project"){K(wu());let Ze=cz(je=>{K(je)});return()=>{Ze()}}else K(null)},[I]),(0,Lt.useEffect)(()=>{if(!N)return;let Ze=setInterval(()=>{G(je=>(je+1)%Z.length)},3e3);return()=>clearInterval(Ze)},[N,Z.length]);let de=()=>F&&I==="project"&&F.projectModelKey?F.projectModelKey:P,pe=()=>{if(!U){r();return}let Ze=[];V||(X&&Ze.push("@vault"),L&&Ze.push("@websearch"),z&&Ze.push("@composer")),r({toolCalls:Ze,contextNotes:a,urls:w})},ae=async Ze=>{let je=Ze.target.value,le=Ze.target.selectionStart,ne=le>0&&je[le-1]==="/"&&(le===1||je[le-2]===" ");e(je),Te();let be=c.extractAllUrls(je).filter(ye=>!w.includes(ye));be.length>0&&jh(I)&&S(ye=>Array.from(new Set([...ye,...be]))),le>=2&&je.slice(le-2,le)==="[["?Ae(le):ne?ke(le,je):je.slice(-1)==="@"&&U&&Ot()},Te=()=>{C.current&&(C.current.style.height="auto",C.current.style.height=`${C.current.scrollHeight}px`)};(0,Lt.useEffect)(()=>{Te()},[t]);let Ae=Ze=>{(async()=>{let le=fV.getInstance();new fN({app:i,onNoteSelect:async ne=>{let fe=t.slice(0,Ze-2),be=t.slice(Ze-1),ze=ZSe(ne.basename,i.vault)?ne.basename:ne.path,hr=`${fe}[[${ze}]]${be}`;e(hr);let Ii=i.workspace.getActiveFile();ne&&await le.addNoteToContext(ne,i.vault,a,Ii,s,l),setTimeout(()=>{if(C.current){let _i=Ze+ze.length+2;C.current.setSelectionRange(_i,_i)}},0)},excludeNotePaths:Me}).open()})()},ke=(Ze,je)=>{let le=Pc.getInstance(),ne=up(),fe=vbe(ne.filter(hr=>hr.showInSlashMenu)),be=fe.map(hr=>hr.title),ye=Ze-1;new pY(i,be,hr=>{let Ii=fe.find(_i=>_i.title===hr);if(Ii){le.recordUsage(Ii);let _i="",bf="";ye>=0&&je[ye]==="/"&&(_i=je.slice(0,ye),bf=je.slice(ye+1));let mp=_i+Ii.content+bf;e(mp),setTimeout(()=>{if(C.current){let Hi=_i.length+Ii.content.length;C.current.setSelectionRange(Hi,Hi),C.current.focus()}},0)}}).open()},Ot=()=>{let Ze=OZ.map(je=>({title:je,description:qer(je)}));new pY(i,Ze.map(je=>je.title),je=>{e(t+je+" ")},Ze.map(je=>je.description)).open()},jr=Ze=>{if(!Ze.nativeEvent.isComposing&&Ze.key==="Enter"){if(!(!Ze.shiftKey&&!iWe.Platform.isMobile||Ze.shiftKey&&iWe.Platform.isMobile))return;Ze.preventDefault(),pe()}},Mr=(0,Lt.useCallback)(async Ze=>{let je=Ze.clipboardData?.items;if(!je)return;let le=Array.from(je).filter(ne=>ne.type.indexOf("image")!==-1);if(le.length>0){Ze.preventDefault();let fe=(await Promise.all(le.map(be=>{let ye=be.getAsFile();return ye||null}))).filter(be=>be!==null);fe.length>0&&f(fe)}},[f]);(0,Lt.useEffect)(()=>{let Ze=new Set(Jg(t,i.vault)),je=c.extractAllUrls(t);s(le=>le.filter(ne=>{if(ne.wasAddedManually===!0)return!0;let be=ne.wasAddedViaReference===!0;return ne.path===D?.path?be?Ze.has(ne):u:be?Ze.has(ne):!0})),jh(I)?S(le=>le.filter(ne=>je.includes(ne))):S([])},[t,u,D,c,s,i.vault,I]),(0,Lt.useEffect)(()=>{let Ze,je=()=>{clearTimeout(Ze),Ze=setTimeout(()=>{let ne=i.workspace.getActiveFile();k(JSe(ne)?ne:null)},100)},le=i.workspace.on("active-leaf-change",je);return()=>{clearTimeout(Ze),i.workspace.offref(le)}},[i.workspace]);let{getRootProps:Vn,getInputProps:Xr,isDragActive:Cr}=nWe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Ze=>{f(Ze)},noClick:!0,noDragEventsBubbling:!0}),Me=(0,Lt.useMemo)(()=>[...a.map(Ze=>Ze.path),...u&&D?[D.path]:[]].filter(Ze=>Ze!=null),[a,u,D]);return Lt.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},Lt.default.createElement(gcr,{app:i,excludeNotePaths:Me,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:D,contextUrls:w,onRemoveUrl:Ze=>S(je=>je.filter(le=>le!==Ze)),selectedTextContexts:m,onRemoveSelectedText:g,showProgressCard:y}),d.length>0&&Lt.default.createElement("div",{className:"selected-images"},d.map((Ze,je)=>Lt.default.createElement("div",{key:je,className:"image-preview-container"},Lt.default.createElement("img",{src:URL.createObjectURL(Ze),alt:Ze.name,className:"selected-image-preview"}),Lt.default.createElement("button",{className:"remove-image-button",onClick:()=>p(le=>le.filter((ne,fe)=>fe!==je)),title:"Remove image"},Lt.default.createElement(vi,{className:"tw-size-4"}))))),Lt.default.createElement("div",{className:"tw-relative",...Vn()},N&&Lt.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"},Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement(nu,{className:"tw-size-4 tw-animate-spin"}),Lt.default.createElement("span",{className:"tw-text-sm"},Z[H]))),Lt.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. "+(U?"@ for tools.":""),value:t,onChange:ae,onKeyDown:jr,onPaste:Mr,disabled:N}),Lt.default.createElement("input",{...Xr()}),Cr&&Lt.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"},Lt.default.createElement("span",null,"Drop images here..."))),Lt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-muted"},Lt.default.createElement(nu,{className:"tw-size-3 tw-animate-spin"}),Lt.default.createElement("span",null,"Generating...")):Lt.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Lt.default.createElement(m_e,{variant:"ghost2",size:"fit",disabled:h,value:de(),onChange:Ze=>{I!=="project"&&T(Ze)},className:"tw-max-w-full tw-truncate"})),Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?Lt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},Lt.default.createElement(AI,{className:"tw-size-4"}),"Stop"):Lt.default.createElement(Lt.default.Fragment,null,Lt.default.createElement(Clr,{vaultToggle:X,setVaultToggle:ee,webToggle:L,setWebToggle:Q,composerToggle:z,setComposerToggle:W,autonomousAgentToggle:V,setAutonomousAgentToggle:q,currentChain:I}),Lt.default.createElement(so,{delayDuration:0},Lt.default.createElement(St,null,Lt.default.createElement(Ct,{asChild:!0},Lt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new p_e(i,f).open()}},Lt.default.createElement(P5,{className:"tw-size-4"}))),Lt.default.createElement(_t,{className:"tw-px-1 tw-py-0.5"},"Add image(s)"))),Lt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>pe()},Lt.default.createElement(Vb,{className:"!tw-size-3"}),Lt.default.createElement("span",null,"chat"))))))});ycr.displayName="ChatInput";var bcr=ycr;po();or();xn();un();var _cr=require("obsidian"),zr=j(Y()),vcr=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>zr.default.createElement("div",{className:me("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!_cr.Platform.isMobile})},t.sender===Fo?zr.default.createElement(zr.default.Fragment,null,zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?zr.default.createElement(ls,{className:"tw-size-4"}):zr.default.createElement(Uh,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Copy")),zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},zr.default.createElement(km,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Edit")),zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},zr.default.createElement(Vh,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Delete"))):zr.default.createElement(zr.default.Fragment,null,u&&zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},zr.default.createElement(rD,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Show Sources")),zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},zr.default.createElement(N5,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Insert / Replace at cursor")),zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?zr.default.createElement(ls,{className:"tw-size-4"}):zr.default.createElement(Uh,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Copy")),zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},zr.default.createElement(R5,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Regenerate")),zr.default.createElement(St,null,zr.default.createElement(Ct,{asChild:!0},zr.default.createElement(he,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},zr.default.createElement(Vh,{className:"tw-size-4"}))),zr.default.createElement(_t,null,"Delete"))));var es=j(Y());un();var df=j(Y(),1);function wcr(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Scr=j(Y(),1);function xcr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function aWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=xcr(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():xcr(t[o],null)}}}}function Ccr(...t){return Scr.useCallback(aWe(...t),t)}var Ocr=j(Y(),1),ZVn=j(za(),1);var cf=j(Y(),1);var pV=j(st(),1),uWe=cf.forwardRef((t,e)=>{let{children:r,...n}=t,o=cf.Children.toArray(r),i=o.find(KVn);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,pV.jsx)(sWe,{...n,ref:e,children:cf.isValidElement(a)?cf.cloneElement(a,void 0,s):null})}return(0,pV.jsx)(sWe,{...n,ref:e,children:r})});uWe.displayName="Slot";var sWe=cf.forwardRef((t,e)=>{let{children:r,...n}=t;if(cf.isValidElement(r)){let o=JVn(r);return cf.cloneElement(r,{...GVn(n,r.props),ref:e?aWe(e,o):o})}return cf.Children.count(r)>1?cf.Children.only(null):null});sWe.displayName="SlotClone";var WVn=({children:t})=>(0,pV.jsx)(pV.Fragment,{children:t});function KVn(t){return cf.isValidElement(t)&&t.type===WVn}function GVn(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 JVn(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 Ecr=j(st(),1),YVn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],w_e=YVn.reduce((t,e)=>{let r=Ocr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?uWe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Ecr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var P$=j(st(),1),lWe="Collapsible",[XVn,V8i]=Qa(lWe),[QVn,cWe]=XVn(lWe),Pcr=df.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=tm({prop:n,defaultProp:o,onChange:a});return(0,P$.jsx)(QVn,{scope:r,disabled:i,contentId:Jl(),open:u,onOpenToggle:df.useCallback(()=>l(c=>!c),[l]),children:(0,P$.jsx)(w_e.div,{"data-state":mWe(u),"data-disabled":i?"":void 0,...s,ref:e})})});Pcr.displayName=lWe;var Tcr="CollapsibleTrigger",dWe=df.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=cWe(Tcr,r);return(0,P$.jsx)(w_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:wcr(t.onClick,o.onOpenToggle)})});dWe.displayName=Tcr;var fWe="CollapsibleContent",pWe=df.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=cWe(fWe,t.__scopeCollapsible);return(0,P$.jsx)(nf,{present:r||o.open,children:({present:i})=>(0,P$.jsx)(e6n,{...n,ref:e,present:i})})});pWe.displayName=fWe;var e6n=df.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=cWe(fWe,r),[s,u]=df.useState(n),l=df.useRef(null),c=Ccr(e,l),d=df.useRef(0),f=d.current,p=df.useRef(0),h=p.current,m=a.open||s,g=df.useRef(m),y=df.useRef(void 0);return df.useEffect(()=>{let _=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(_)},[]),wo(()=>{let _=l.current;if(_){y.current=y.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let w=_.getBoundingClientRect();d.current=w.height,p.current=w.width,g.current||(_.style.transitionDuration=y.current.transitionDuration,_.style.animationName=y.current.animationName),u(n)}},[a.open,n]),(0,P$.jsx)(w_e.div,{"data-state":mWe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:m&&o})});function mWe(t){return t?"open":"closed"}var Acr=Pcr;var iv=Acr,fA=dWe,av=pWe;xn();P6e();var r6n="shimmer 2s ease-in-out infinite",hWe=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,es.useState)(!1),c=!n&&o!==null;return es.default.createElement(iv,{open:u,onOpenChange:l,disabled:!c,"aria-disabled":!c,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},es.default.createElement("div",{className:me("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",n&&"tw-relative tw-overflow-hidden")},n&&es.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},es.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:r6n}})),es.default.createElement(fA,{className:me("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")},es.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},es.default.createElement("span",{className:"tw-text-base"},r),es.default.createElement("span",{className:"tw-font-medium"},n?"Calling":"Called"," ",e,n&&"..."),n&&i&&es.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),es.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!n&&a&&s&&es.default.createElement(es.default.Fragment,null,es.default.createElement("button",{onClick:d=>{d.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},es.default.createElement(ls,{className:"tw-size-4 tw-text-success"})),es.default.createElement("button",{onClick:d=>{d.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},es.default.createElement(vi,{className:"tw-size-4 tw-text-error"}))),c&&es.default.createElement(Lm,{className:me("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),es.default.createElement(av,null,es.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"},es.default.createElement("div",{className:"tw-text-sm tw-text-muted"},es.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},o?jH.format(t,o):"No result available"))))))};var Icr=require("obsidian"),x_e=class extends Icr.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()}};or();xn();h4();ir();un();var T$=require("obsidian"),vr=j(Y()),Mcr=j($c());function n6n({context:t}){return!t||!t.notes?.length&&!t.urls?.length?null:vr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>vr.default.createElement(St,{key:`${r}-${e.path}`},vr.default.createElement(Ct,{asChild:!0},vr.default.createElement(cp,{variant:"secondary"},vr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),vr.default.createElement(_t,null,e.path))),t.urls.map((e,r)=>vr.default.createElement(St,{key:`${r}-${e}`},vr.default.createElement(Ct,{asChild:!0},vr.default.createElement(cp,{variant:"secondary"},vr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),vr.default.createElement(_t,null,e))))}var o6n=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,vr.useState)(!1),[l,c]=(0,vr.useState)(!1),[d,f]=(0,vr.useState)(t.message),p=(0,vr.useRef)(null),h=(0,vr.useRef)(null),m=(0,vr.useRef)(null),g=(0,vr.useRef)(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`),y=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),w=(0,vr.useRef)((()=>{let U=y();return U.has(g.current)||U.set(g.current,new Map),U.get(g.current)})()),S=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let U=wee(t.message);navigator.clipboard.writeText(U).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},C=(0,vr.useCallback)(U=>{let X=e.workspace.getActiveFile(),ee=X?X.path:"",L=(pe,ae,Te,Ae)=>{let ke="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",Ot="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",jr="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",Mr=`<${ae}>`;if(r&&pe.includes(Mr)){let Xr=new RegExp(`<${ae}>([\\s\\S]*?)<\\/${ae}>`,"g");pe=pe.replace(Xr,(Me,Ze)=>`<details style="${ke}">
<summary style="${Ot}">${Te}</summary>
<div class="tw-text-muted" style="${jr}">${Ze.trim()}</div>
</details>
`);let Cr=new RegExp(`<${ae}>([\\s\\S]*)$`);return pe=pe.replace(Cr,(Me,Ze)=>`<div style="${ke}">
<div style="${Ot}">${Ae}</div>
<div class="tw-text-muted" style="${jr}">${Ze.trim()}</div>
</div>`),pe}let Vn=new RegExp(`<${ae}>([\\s\\S]*?)<\\/${ae}>`,"g");return pe.replace(Vn,(Xr,Cr)=>`<details style="${ke}">
<summary style="${Ot}">${Te}</summary>
<div class="tw-text-muted" style="${jr}">${Cr.trim()}</div>
</details>
`)},Q=pe=>L(pe,"think","Thought for a while","Thinking..."),z=pe=>{let ae=ke=>{let Ot=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?)\s*```/g;return ke.replace(Ot,(jr,Mr)=>Mr.trim())},Te=ke=>{if(!r)return ke;let Ot=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?)$/g;return ke.replace(Ot,(jr,Mr)=>Mr.trim())},Ae=ae(pe);return Ae=Te(Ae),L(Ae,"writeToFile","Generated new content","Generating changes...")},W=(pe,ae,Te)=>pe.split(/(```[\s\S]*?```|`[^`]*`)/g).map((ke,Ot)=>Ot%2===0?ke.replace(ae,(jr,Mr)=>{let Vn=e.metadataCache.getFirstLinkpathDest(Mr,ee);return Vn?Te(Vn):jr}):ke).join(""),V=U.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),q=W(V,/!\[\[(.*?)]]/g,pe=>`![](${e.vault.getResourcePath(pe)})`),H=Q(q),G=z(H),Z=E(G);return W(Z,/(?<!!)\[\[([^\]]+)]]/g,pe=>`<a href="obsidian://open?file=${encodeURIComponent(pe.path)}">${pe.basename}</a>`)},[e,r]),E=U=>{let X=U.split(`
#### Sources:
`);if(X.length!==2)return U;let[ee,L]=X,Q=L.split(`
`).map(z=>{let W=z.match(/- \[\[(.*?)\]\]/);return W?`<li>[[${W[1]}]]</li>`:z}).join(`
`);return ee+`
<br/>
<details><summary>Sources</summary>
<ul>
`+Q+`
</ul>
</details>`};(0,vr.useEffect)(()=>{let U=!1;if(p.current&&t.sender!==Fo){h.current||(h.current=new T$.Component);let X=C(t.message),ee=_ze(X);if(!U){let L=new Set;p.current.querySelectorAll('[id^="tool-call-"]').forEach(q=>{let H=q.id.replace("tool-call-","");L.add(H)}),p.current.querySelectorAll(".message-segment").forEach(q=>q.remove());let W=0;ee.segments.forEach((q,H)=>{if(q.type==="text"&&q.content.trim()){let G=p.current.children[W],Z=document.createElement("div");Z.className="message-segment",G?p.current.insertBefore(Z,G):p.current.appendChild(Z),T$.MarkdownRenderer.renderMarkdown(q.content,Z,"",h.current),W++}else if(q.type==="toolCall"&&q.toolCall){let G=q.toolCall.id;if(document.getElementById(`tool-call-${G}`)){let de=w.current.get(G);de&&de.render(vr.default.createElement(hWe,{toolName:q.toolCall.toolName,displayName:q.toolCall.displayName,emoji:q.toolCall.emoji,isExecuting:q.toolCall.isExecuting,result:q.toolCall.result||null,confirmationMessage:q.toolCall.confirmationMessage})),W++}else{let de=p.current.children[W],pe=document.createElement("div");pe.className="tool-call-container",pe.id=`tool-call-${G}`,de?p.current.insertBefore(pe,de):p.current.appendChild(pe);let ae=Mcr.default.createRoot(pe);w.current.set(G,ae),ae.render(vr.default.createElement(hWe,{toolName:q.toolCall.toolName,displayName:q.toolCall.displayName,emoji:q.toolCall.emoji,isExecuting:q.toolCall.isExecuting,result:q.toolCall.result||null,confirmationMessage:q.toolCall.confirmationMessage})),W++}}});let V=new Set(ee.segments.filter(q=>q.type==="toolCall"&&q.toolCall).map(q=>q.toolCall.id));L.forEach(q=>{if(!V.has(q)){let H=document.getElementById(`tool-call-${q}`);if(H){let G=w.current.get(q);G&&setTimeout(()=>{try{G.unmount()}catch(Z){console.debug("Error unmounting tool call root:",Z)}w.current.delete(q)},0),H.remove()}}})}}return()=>{U=!0}},[t,e,h,r,C]),(0,vr.useEffect)(()=>{let U=h,X=g.current;return(()=>{let L=y(),Q=Date.now()-60*60*1e3;L.forEach((z,W)=>{let V=parseInt(W);!isNaN(V)&&V<Q&&setTimeout(()=>{z.forEach(q=>{try{q.unmount()}catch{}}),L.delete(W)},0)})})(),()=>{setTimeout(()=>{if(U.current&&(U.current.unload(),U.current=null),X.startsWith("temp-")){let L=y(),Q=L.get(X);Q&&(Q.forEach(z=>{try{z.unmount()}catch(W){console.debug("Error unmounting React root during cleanup:",W)}}),L.delete(X))}},0)}},[]),(0,vr.useEffect)(()=>{l&&m.current&&P(m.current)},[l]),(0,vr.useEffect)(()=>{f(t.message)},[t.message]);let P=U=>{U.style.height="auto",U.style.height=`${U.scrollHeight}px`},T=U=>{f(U.target.value),P(U.target)},I=U=>{U.nativeEvent.isComposing||(U.key==="Enter"&&!U.shiftKey?(U.preventDefault(),D()):U.key==="Escape"&&(U.preventDefault(),N()))},N=()=>{c(!1),f(t.message)},M=()=>{c(!0)},D=()=>{c(!1),o&&o(d)},k=()=>{t.sources&&t.sources.length>0&&new x_e(e,t.sources).open()},F=()=>{let U=e.workspace.getMostRecentLeaf();if((!U||!(U.view instanceof T$.MarkdownView))&&(U=e.workspace.getLeaf(!1),!U||!(U.view instanceof T$.MarkdownView)))return;let ee=U.view.editor.getSelection().length>0,L=wee(t.message);u8(L,ee)},K=()=>t.content?vr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((U,X)=>U.type==="text"?vr.default.createElement("div",{key:X},t.sender===Fo&&l?vr.default.createElement("textarea",{ref:m,value:d,onChange:T,onKeyDown:I,autoFocus:!0,className:"edit-textarea"}):t.sender===Fo?vr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):vr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):U.type==="image_url"?vr.default.createElement("div",{key:X,className:"message-image-content"},vr.default.createElement("img",{src:U.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Fo&&l?vr.default.createElement("textarea",{ref:m,value:d,onChange:T,onKeyDown:I,autoFocus:!0,className:"edit-textarea"}):t.sender===Fo?vr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):vr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return vr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},vr.default.createElement("div",{className:me("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===Fo&&"tw-border tw-border-solid tw-border-border")},vr.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===Fo?vr.default.createElement(j5,null):vr.default.createElement(eD,null)),vr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&vr.default.createElement(n6n,{context:t.context}),vr.default.createElement("div",{className:"message-content"},K()),!r&&vr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},vr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),vr.default.createElement(vcr,{message:t,onCopy:S,isCopied:s,onInsertIntoEditor:F,onRegenerate:n,onEdit:M,onDelete:i,onShowSources:k,hasSources:!!(t.sources&&t.sources.length>0)})))))},gWe=o6n;po();var wY=j(Y());var ts=j(Y(),1);function VO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Ncr=j(Y(),1);function Rcr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function yWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=Rcr(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():Rcr(t[o],null)}}}}function sv(...t){return Ncr.useCallback(yWe(...t),t)}var Ps=j(Y(),1);var jcr=j(Y(),1),Dcr=j(za(),1);var ff=j(Y(),1);var mV=j(st(),1),yY=ff.forwardRef((t,e)=>{let{children:r,...n}=t,o=ff.Children.toArray(r),i=o.find(a6n);if(i){let a=i.props.children,s=o.map(u=>u===i?ff.Children.count(a)>1?ff.Children.only(null):ff.isValidElement(a)?a.props.children:null:u);return(0,mV.jsx)(bWe,{...n,ref:e,children:ff.isValidElement(a)?ff.cloneElement(a,void 0,s):null})}return(0,mV.jsx)(bWe,{...n,ref:e,children:r})});yY.displayName="Slot";var bWe=ff.forwardRef((t,e)=>{let{children:r,...n}=t;if(ff.isValidElement(r)){let o=u6n(r);return ff.cloneElement(r,{...s6n(n,r.props),ref:e?yWe(e,o):o})}return ff.Children.count(r)>1?ff.Children.only(null):null});bWe.displayName="SlotClone";var i6n=({children:t})=>(0,mV.jsx)(mV.Fragment,{children:t});function a6n(t){return ff.isValidElement(t)&&t.type===i6n}function s6n(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 u6n(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 Lcr=j(st(),1),l6n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],im=l6n.reduce((t,e)=>{let r=jcr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?yY:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Lcr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Fcr(t,e){t&&Dcr.flushSync(()=>t.dispatchEvent(e))}var vWe=j(st(),1),c6n="DismissableLayer",_We="dismissableLayer.update",d6n="dismissableLayer.pointerDownOutside",f6n="dismissableLayer.focusOutside",kcr,Bcr=Ps.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wWe=Ps.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ps.useContext(Bcr),[c,d]=Ps.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ps.useState({}),h=sv(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=h6n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=g6n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return G1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ps.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(kcr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),$cr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=kcr)}},[c,f,r,l]),Ps.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),$cr())},[c,l]),Ps.useEffect(()=>{let P=()=>p({});return document.addEventListener(_We,P),()=>document.removeEventListener(_We,P)},[]),(0,vWe.jsx)(im.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:VO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:VO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:VO(t.onPointerDownCapture,C.onPointerDownCapture)})});wWe.displayName=c6n;var p6n="DismissableLayerBranch",m6n=Ps.forwardRef((t,e)=>{let r=Ps.useContext(Bcr),n=Ps.useRef(null),o=sv(e,n);return Ps.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,vWe.jsx)(im.div,{...t,ref:o})});m6n.displayName=p6n;function h6n(t,e=globalThis?.document){let r=cn(t),n=Ps.useRef(!1),o=Ps.useRef(()=>{});return Ps.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){zcr(d6n,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 g6n(t,e=globalThis?.document){let r=cn(t),n=Ps.useRef(!1);return Ps.useEffect(()=>{let o=i=>{i.target&&!n.current&&zcr(f6n,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 $cr(){let t=new CustomEvent(_We);document.dispatchEvent(t)}function zcr(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?Fcr(o,i):o.dispatchEvent(i)}var gb=j(Y(),1);var Wcr=j(st(),1),xWe="focusScope.autoFocusOnMount",SWe="focusScope.autoFocusOnUnmount",Ucr={bubbles:!1,cancelable:!0},y6n="FocusScope",CWe=gb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=gb.useState(null),l=cn(o),c=cn(i),d=gb.useRef(null),f=sv(e,m=>u(m)),p=gb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;gb.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:mN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||mN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&mN(s)};var m=_,g=w,y=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]),gb.useEffect(()=>{if(s){Hcr.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(xWe,Ucr);s.addEventListener(xWe,l),s.dispatchEvent(y),y.defaultPrevented||(b6n(S6n(Kcr(s)),{select:!0}),document.activeElement===m&&mN(s))}return()=>{s.removeEventListener(xWe,l),setTimeout(()=>{let y=new CustomEvent(SWe,Ucr);s.addEventListener(SWe,c),s.dispatchEvent(y),y.defaultPrevented||mN(m??document.body,{select:!0}),s.removeEventListener(SWe,c),Hcr.remove(p)},0)}}},[s,l,c,p]);let h=gb.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=_6n(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&mN(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&mN(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,Wcr.jsx)(im.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});CWe.displayName=y6n;function b6n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(mN(n,{select:e}),document.activeElement!==r)return}function _6n(t){let e=Kcr(t),r=qcr(e,t),n=qcr(e.reverse(),t);return[r,n]}function Kcr(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 qcr(t,e){for(let r of t)if(!v6n(r,{upTo:e}))return r}function v6n(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 w6n(t){return t instanceof HTMLInputElement&&"select"in t}function mN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&w6n(t)&&e&&t.select()}}var Hcr=x6n();function x6n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Vcr(t,e),t.unshift(e)},remove(e){t=Vcr(t,e),t[0]?.resume()}}}function Vcr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function S6n(t){return t.filter(e=>e.tagName!=="A")}var Ag=j(Y(),1);var Gcr=j(Y(),1);var OWe=j(st(),1),C6n="Arrow",Jcr=Gcr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,OWe.jsx)(im.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,OWe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Jcr.displayName=C6n;var Zcr=Jcr;var hN=j(st(),1);var EWe="Popper",[Ycr,PWe]=Qa(EWe),[E6n,Xcr]=Ycr(EWe),Qcr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Ag.useState(null);return(0,hN.jsx)(E6n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Qcr.displayName=EWe;var edr="PopperAnchor",tdr=Ag.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Xcr(edr,r),a=Ag.useRef(null),s=sv(e,a);return Ag.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,hN.jsx)(im.div,{...o,ref:s})});tdr.displayName=edr;var TWe="PopperContent",[P6n,T6n]=Ycr(TWe),rdr=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:h,...m}=t,g=Xcr(TWe,r),[y,_]=Ag.useState(null),w=sv(e,Z=>_(Z)),[S,C]=Ag.useState(null),E=z1(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(I6n),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:X,middlewareData:ee}=Y1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>sA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[X1({mainAxis:o+T,alignmentAxis:a}),u&&Q1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?eN():void 0,...k}),u&&tN({...k}),rN({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&oN({element:S,padding:s}),M6n({arrowWidth:P,arrowHeight:T}),f&&nN({strategy:"referenceHidden",...k})]}),[L,Q]=idr(U),z=cn(h);wo(()=>{X&&z?.()},[X,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Ag.useState();return wo(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,hN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:X?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,hN.jsx)(P6n,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,hN.jsx)(im.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:X?void 0:"none"}})})})});rdr.displayName=TWe;var ndr="PopperArrow",A6n={top:"bottom",right:"left",bottom:"top",left:"right"},odr=Ag.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=T6n(ndr,n),a=A6n[i.placedSide];return(0,hN.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,hN.jsx)(Zcr,{...o,ref:r,style:{...o.style,display:"block"}})})});odr.displayName=ndr;function I6n(t){return t!==null}var M6n=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]=idr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function idr(t){let[e,r="center"]=t.split("-");return[e,r]}var adr=Qcr,AWe=tdr,sdr=rdr,udr=odr;var S_e=j(Y(),1),ldr=j(za(),1);var cdr=j(st(),1),N6n="Portal",IWe=S_e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=S_e.useState(!1);wo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?ldr.default.createPortal((0,cdr.jsx)(im.div,{...n,ref:e}),a):null});IWe.displayName=N6n;var E_e=j(Y());var dp=j(Y());var C_e=b$();var MWe=function(){},bY=dp.forwardRef(function(t,e){var r=dp.useRef(null),n=dp.useState({onScrollCapture:MWe,onWheelCapture:MWe,onTouchMoveCapture:MWe}),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,h=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,_=t.gapMode,w=lN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=y$([r,e]),E=Di(Di({},w),o);return dp.createElement(dp.Fragment,null,c&&dp.createElement(S,{sideCar:C_e,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?dp.cloneElement(dp.Children.only(s),Di(Di({},E),{ref:C})):dp.createElement(y,Di({},E,{className:u,ref:C}),s))});bY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bY.classNames={fullWidth:tv,zeroRight:ev};var Da=j(Y());var RWe=!1;if(typeof window<"u")try{_Y=Object.defineProperty({},"passive",{get:function(){return RWe=!0,!0}}),window.addEventListener("test",_Y,_Y),window.removeEventListener("test",_Y,_Y)}catch{RWe=!1}var _Y,A$=RWe?{passive:!1}:!1;var j6n=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&&!j6n(t)&&r[e]==="visible")},D6n=function(t){return ddr(t,"overflowY")},L6n=function(t){return ddr(t,"overflowX")},NWe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=fdr(t,n);if(o){var i=pdr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},F6n=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},k6n=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},fdr=function(t,e){return t==="v"?D6n(e):L6n(e)},pdr=function(t,e){return t==="v"?F6n(e):k6n(e)},$6n=function(t,e){return t==="h"&&e==="rtl"?-1:1},mdr=function(t,e,r,n,o){var i=$6n(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=pdr(t,s),h=p[0],m=p[1],g=p[2],y=m-g-i*h;(h||y)&&fdr(t,s)&&(d+=y,f+=h),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 O_e=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},hdr=function(t){return[t.deltaX,t.deltaY]},gdr=function(t){return t&&"current"in t?t.current:t},B6n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},z6n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},U6n=0,hV=[];function ydr(t){var e=Da.useRef([]),r=Da.useRef([0,0]),n=Da.useRef(),o=Da.useState(U6n++)[0],i=Da.useState(uA)[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 m=oV([t.lockRef.current],(t.shards||[]).map(gdr),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Da.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var y=O_e(m),_=r.current,w="deltaX"in m?m.deltaX:_[0]-y[0],S="deltaY"in m?m.deltaY:_[1]-y[1],C,E=m.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&E.type==="range")return!1;var T=NWe(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=NWe(P,E)),!T)return!1;if(!n.current&&"changedTouches"in m&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return mdr(I,g,m,I==="h"?w:S,!0)},[]),u=Da.useCallback(function(m){var g=m;if(!(!hV.length||hV[hV.length-1]!==i)){var y="deltaY"in g?hdr(g):O_e(g),_=e.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&B6n(C.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(gdr).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=w.length>0?s(g,w[0]):!a.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=Da.useCallback(function(m,g,y,_){var w={name:m,delta:g,target:y,should:_,shadowParent:q6n(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=Da.useCallback(function(m){r.current=O_e(m),n.current=void 0},[]),d=Da.useCallback(function(m){l(m.type,hdr(m),m.target,s(m,t.lockRef.current))},[]),f=Da.useCallback(function(m){l(m.type,O_e(m),m.target,s(m,t.lockRef.current))},[]);Da.useEffect(function(){return hV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,A$),document.addEventListener("touchmove",u,A$),document.addEventListener("touchstart",c,A$),function(){hV=hV.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,A$),document.removeEventListener("touchmove",u,A$),document.removeEventListener("touchstart",c,A$)}},[]);var p=t.removeScrollBar,h=t.inert;return Da.createElement(Da.Fragment,null,h?Da.createElement(i,{styles:z6n(o)}):null,p?Da.createElement(v$,{gapMode:t.gapMode}):null)}function q6n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var bdr=_$(C_e,ydr);var _dr=E_e.forwardRef(function(t,e){return E_e.createElement(bY,Di({},t,{ref:e,sideCar:bdr}))});_dr.classNames=bY.classNames;var jWe=_dr;var Xl=j(st(),1),DWe="Popover",[vdr,PWi]=Qa(DWe,[PWe]),vY=PWe(),[H6n,gN]=vdr(DWe),wdr=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=vY(e),u=ts.useRef(null),[l,c]=ts.useState(!1),[d=!1,f]=tm({prop:n,defaultProp:o,onChange:i});return(0,Xl.jsx)(adr,{...s,children:(0,Xl.jsx)(H6n,{scope:e,contentId:Jl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:ts.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:ts.useCallback(()=>c(!0),[]),onCustomAnchorRemove:ts.useCallback(()=>c(!1),[]),modal:a,children:r})})};wdr.displayName=DWe;var xdr="PopoverAnchor",V6n=ts.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=gN(xdr,r),i=vY(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return ts.useEffect(()=>(a(),()=>s()),[a,s]),(0,Xl.jsx)(AWe,{...i,...n,ref:e})});V6n.displayName=xdr;var Sdr="PopoverTrigger",Cdr=ts.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=gN(Sdr,r),i=vY(r),a=sv(e,o.triggerRef),s=(0,Xl.jsx)(im.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Adr(o.open),...n,ref:a,onClick:VO(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,Xl.jsx)(AWe,{asChild:!0,...i,children:s})});Cdr.displayName=Sdr;var LWe="PopoverPortal",[W6n,K6n]=vdr(LWe,{forceMount:void 0}),Odr=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=gN(LWe,e);return(0,Xl.jsx)(W6n,{scope:e,forceMount:r,children:(0,Xl.jsx)(nf,{present:r||i.open,children:(0,Xl.jsx)(IWe,{asChild:!0,container:o,children:n})})})};Odr.displayName=LWe;var gV="PopoverContent",Edr=ts.forwardRef((t,e)=>{let r=K6n(gV,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=gN(gV,t.__scopePopover);return(0,Xl.jsx)(nf,{present:n||i.open,children:i.modal?(0,Xl.jsx)(G6n,{...o,ref:e}):(0,Xl.jsx)(J6n,{...o,ref:e})})});Edr.displayName=gV;var G6n=ts.forwardRef((t,e)=>{let r=gN(gV,t.__scopePopover),n=ts.useRef(null),o=sv(e,n),i=ts.useRef(!1);return ts.useEffect(()=>{let a=n.current;if(a)return uN(a)},[]),(0,Xl.jsx)(jWe,{as:yY,allowPinchZoom:!0,children:(0,Xl.jsx)(Pdr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:VO(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:VO(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:VO(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),J6n=ts.forwardRef((t,e)=>{let r=gN(gV,t.__scopePopover),n=ts.useRef(!1),o=ts.useRef(!1);return(0,Xl.jsx)(Pdr,{...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()}})}),Pdr=ts.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=gN(gV,r),p=vY(r);return J1(),(0,Xl.jsx)(CWe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Xl.jsx)(wWe,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Xl.jsx)(sdr,{"data-state":Adr(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)"}})})})}),Tdr="PopoverClose",Z6n=ts.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=gN(Tdr,r);return(0,Xl.jsx)(im.button,{type:"button",...n,ref:e,onClick:VO(t.onClick,()=>o.onOpenChange(!1))})});Z6n.displayName=Tdr;var Y6n="PopoverArrow",X6n=ts.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=vY(r);return(0,Xl.jsx)(udr,{...o,...n,ref:e})});X6n.displayName=Y6n;function Adr(t){return t?"open":"closed"}var Idr=wdr;var Mdr=Cdr,Rdr=Odr,FWe=Edr;xn();var Ndr=Idr,jdr=Mdr;var kWe=wY.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>wY.createElement(Rdr,{container:n??activeDocument.body},wY.createElement(FWe,{ref:i,align:e,sideOffset:r,className:me("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})));kWe.displayName=FWe.displayName;or();var $We=j(Y()),P_e=$We.createContext(void 0),yV=$We.createContext(void 0);var bV=j(Y());function BWe(){let[t,e]=(0,bV.useState)(null),r=(0,bV.useContext)(yV);return(0,bV.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Xg.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Xg.ACTIVE_LEAF_CHANGE,n)}},[r]),t}xn();un();var xY=require("obsidian"),Xe=j(Y());function e8n(t){let[e,r]=(0,Xe.useState)([]),n=BWe();return(0,Xe.useEffect)(()=>{async function o(){if(n?.path)try{let a=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().getDb();if(!a){r([]);return}let s=await sbe({db:a,filePath:n.path});r(s)}catch(i){console.warn("Failed to fetch relevant notes:",i),r([])}}o()},[n?.path,t]),e}function t8n(t,e){let[r,n]=(0,Xe.useState)(!0);return(0,Xe.useEffect)(()=>{if(!t)return;async function o(){try{let a=await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().hasIndex(t);n(a)}catch{n(!1)}}o()},[t,e]),r}function r8n({score:t}){let e=abe(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),Xe.default.createElement("span",{className:"tw-text-sm"},r)}function n8n({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,Xe.useState)(!1),[i,a]=(0,Xe.useState)(null),s=(0,Xe.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof xY.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,Xe.useEffect)(()=>{n&&s()},[n,s]),Xe.default.createElement(iv,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Xe.default.createElement("div",{className:me("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Xe.default.createElement(he,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Xe.default.createElement(fA,null,Xe.default.createElement(Lm,{className:me("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),Xe.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},Xe.default.createElement(r8n,{score:t.metadata.similarityScore??0})),Xe.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},Xe.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)),Xe.default.createElement(St,null,Xe.default.createElement(Ct,{asChild:!0},Xe.default.createElement(he,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Xe.default.createElement(zh,{className:"tw-size-4"}))),Xe.default.createElement(_t,null,"Add to Chat"))),Xe.default.createElement(av,null,Xe.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},Xe.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&&Xe.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)),Xe.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&&Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement(S5,{className:"tw-size-4"}),Xe.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement(x5,{className:"tw-size-4"}),Xe.default.createElement("span",null,"Backlinks")))))}function o8n({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Xe.default.createElement(Ndr,{key:t.document.path},Xe.default.createElement(jdr,{asChild:!0},n),Xe.default.createElement(kWe,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},Xe.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),Xe.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),Xe.default.createElement("div",{className:"tw-flex tw-gap-2"},Xe.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 ",Xe.default.createElement(zh,{className:"tw-size-4"})),Xe.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 ",Xe.default.createElement(p5,{className:"tw-size-4"})))))}var T_e=(0,Xe.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,Xe.useState)(0),[i,a]=(0,Xe.useState)(r),s=e8n(n),u=BWe(),l=t8n(u?.path??"",n),c=(p,h=!1)=>{let m=app.vault.getAbstractFileByPath(p);m instanceof xY.TFile&&app.workspace.getLeaf(h).openFile(m)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().reindexFile(u),new xY.Notice(`Refreshed index for ${u.basename}`),o(n+1))};return Xe.default.createElement("div",{className:me("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Xe.default.createElement(iv,{open:i,onOpenChange:a},Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},Xe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Xe.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),Xe.default.createElement(St,null,Xe.default.createElement(Ct,{asChild:!0},Xe.default.createElement(qv,{className:"tw-size-4 tw-text-muted"})),Xe.default.createElement(_t,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&Xe.default.createElement(St,null,Xe.default.createElement(Ct,{asChild:!0},Xe.default.createElement(Lp,{className:"tw-size-4 tw-text-warning"})),Xe.default.createElement(_t,{side:"bottom"},"Note has not been indexed"))),Xe.default.createElement("div",{className:"tw-flex tw-items-center"},Xe.default.createElement(St,null,Xe.default.createElement(Ct,{asChild:!0},Xe.default.createElement(he,{variant:"ghost2",size:"icon",onClick:f},Xe.default.createElement(I5,{className:"tw-size-4"}))),Xe.default.createElement(_t,{side:"bottom"},"Reindex Current Note")),s.length>0&&Xe.default.createElement(fA,{asChild:!0},Xe.default.createElement(he,{variant:"ghost2",size:"icon"},i?Xe.default.createElement(Hb,{className:"tw-size-5"}):Xe.default.createElement(ki,{className:"tw-size-5"}))))),s.length===0&&Xe.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"},Xe.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&&Xe.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=>Xe.default.createElement(o8n,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:h=>c(p.document.path,h)},Xe.default.createElement(cp,{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"},Xe.default.createElement("span",{className:"tw-truncate"},p.document.title))))),Xe.default.createElement(av,null,Xe.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=>Xe.default.createElement(n8n,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:h=>c(p.document.path,h)}))))))});T_e.displayName="RelevantNotes";ua();vu();po();var wh=j(Y());xn();var I$=wh.forwardRef(({className:t,...e},r)=>wh.createElement("div",{ref:r,className:me("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));I$.displayName="Card";var M$=wh.forwardRef(({className:t,...e},r)=>wh.createElement("div",{ref:r,className:me("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));M$.displayName="CardHeader";var SY=wh.forwardRef(({className:t,...e},r)=>wh.createElement("div",{ref:r,className:me("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));SY.displayName="CardTitle";var i8n=wh.forwardRef(({className:t,...e},r)=>wh.createElement("div",{ref:r,className:me("tw-text-sm tw-text-muted",t),...e}));i8n.displayName="CardDescription";var R$=wh.forwardRef(({className:t,...e},r)=>wh.createElement("div",{ref:r,className:me("tw-p-6 tw-pt-0",t),...e}));R$.displayName="CardContent";var a8n=wh.forwardRef(({className:t,...e},r)=>wh.createElement("div",{ref:r,className:me("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));a8n.displayName="CardFooter";or();bt();un();var ga=j(Y()),zWe={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>]]"]}},Ddr={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function s8n(t="llm_chain"){let e=Ddr[t]||Ddr.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...zWe[n].prompts].sort(()=>Math.random()-.5)),{title:zWe[n].title,text:r[n].pop()||zWe[n].prompts[0]}))}var Ldr=({onClick:t})=>{let[e]=Rp(),r=(0,ga.useMemo)(()=>s8n(e),[e]),o=vn().indexVaultToVectorStore;return ga.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},ga.default.createElement(I$,{className:"tw-w-full tw-bg-transparent"},ga.default.createElement(M$,{className:"tw-px-2"},ga.default.createElement(SY,null,"Suggested Prompts")),ga.default.createElement(R$,{className:"tw-p-2 tw-pt-0"},ga.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>ga.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"},ga.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},ga.default.createElement("div",{className:"tw-text-muted"},i.title),ga.default.createElement("div",null,i.text)),ga.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},ga.default.createElement(St,null,ga.default.createElement(Ct,{asChild:!0},ga.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},ga.default.createElement(zh,{className:"tw-size-4"}))),ga.default.createElement(_t,null,"Add to Chat")))))))),e==="vault_qa"&&ga.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"&&ga.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},ga.default.createElement("div",null,ga.default.createElement(Lp,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",ga.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",ga.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",ga.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};or();or();var am=j(Y()),Fdr=({chatHistory:t})=>{let[e,r]=(0,am.useState)(0),n=(0,am.useRef)(null),o=(0,am.useRef)(null),i=(0,am.useCallback)((l,c)=>`message-${l.timestamp?.epoch||c}`,[]),a=(0,am.useCallback)(()=>{if(!n.current)return 0;let l=n.current,c=l.clientHeight,d=t.map((h,m)=>({msg:h,idx:m})).filter(({msg:h})=>h.isVisible&&h.sender===Fo).pop()?.idx,f=0;if(d!==void 0){let h=i(t[d],d),m=l.querySelector(`[data-message-key="${h}"]`);if(m)f=m.getBoundingClientRect().height;else{let g=t[d].message.length,y=Math.ceil(g/80);f=Math.max(60,y*24)}}return Math.max(100,c-f)},[t,i]),s=(0,am.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,am.useEffect)(()=>{if(n.current&&t.length>0){let l=a();r(l)}},[t,a]),(0,am.useEffect)(()=>()=>{o.current&&o.current.disconnect()},[]);let u=(0,am.useCallback)((l="smooth")=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},[]);return(0,am.useEffect)(()=>{u("instant")},[u]),(0,am.useEffect)(()=>{u()},[t.length,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};bt();var pf=j(Y()),kdr=(0,pf.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,pf.useState)(""),p=vn(),{containerMinHeight:h,scrollContainerCallbackRef:m,getMessageKey:g}=Fdr({chatHistory:t});if((0,pf.useEffect)(()=>{let _;return r?_=setInterval(()=>{f(w=>w.length<6?w+".":"")},200):f(""),()=>clearInterval(_)},[r]),!t.filter(_=>_.isVisible).length&&!e)return pf.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&pf.default.createElement(T_e,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&pf.default.createElement(Ldr,{onClick:l}));let y=()=>n?`${n} ${d}`:d;return pf.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&pf.default.createElement(T_e,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),pf.default.createElement("div",{ref:m,"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!==Fo;return _.isVisible&&pf.default.createElement("div",{key:g(_,w),"data-message-key":g(_,w),className:"tw-w-full",style:{minHeight:E?`${h}px`:"auto"}},pf.default.createElement(gWe,{message:_,app:o,isStreaming:!1,onRegenerate:()=>i(w),onEdit:P=>a(w,P),onDelete:()=>s(w),chatHistory:t}))}),(e||r)&&pf.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${h}px`}},pf.default.createElement(gWe,{key:"ai_message_streaming",message:{sender:"AI",message:e||y(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t}))))});kdr.displayName="ChatMessages";var $dr=kdr;po();ir();var A_e=j(Y());function I_e(t){let[e,r]=(0,A_e.useState)(null);(0,A_e.useEffect)(()=>{(async()=>{let i=await Det();i.version&&r(i.version)})()},[]);let n=e!==null&&See(e,t);return{latestVersion:e,hasUpdate:n}}xn();bt();ir();un();var yb=j(Y());function Bdr({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=I_e(t),n=vn().lastDismissedVersion,[o,i]=(0,yb.useState)(!0),a=r&&e&&See(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{nt("lastDismissedVersion",e)},300))};return a?yb.default.createElement("div",{className:me("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")},yb.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"},yb.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yb.default.createElement("span",{className:"tw-font-medium"},"Update available:"),yb.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),yb.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yb.default.createElement(he,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),yb.default.createElement(he,{variant:"ghost2",size:"icon",onClick:s},yb.default.createElement(vi,{className:"tw-size-4"}))))):null}ua();var zdr=require("obsidian");rh();var _V=class extends zdr.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=XK(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 UWe=require("obsidian");var CY=class extends dV{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 UWe.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 UWe.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}};ir();var Udr=require("obsidian"),vV=class extends Udr.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)Tj(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var wV=j(Y());xn();var M_e=j(Y()),u8n=2;function l8n(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+u8n<t.current?.scrollWidth)??!1}function c8n(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var xh=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,M_e.useRef)(null),[a,s]=(0,M_e.useState)(!1);return wV.default.createElement(so,{delayDuration:0},wV.default.createElement(St,{open:a,onOpenChange:l=>{s(l&&l8n(i,r))}},wV.default.createElement(Ct,{asChild:!0},wV.default.createElement("div",{...o,ref:i,className:me("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&c8n(r),e),"data-testid":"truncatedText"},t)),wV.default.createElement(_t,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};po();var AY=j(Y());un();var Ydr=j(Y(),1),At=j(Y(),1),L_e=(0,At.createContext)(null);L_e.displayName="PanelGroupContext";var Ws={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"},JWe=10,j$=At.useLayoutEffect,qdr=Ydr.useId,d8n=typeof qdr=="function"?qdr:()=>null,f8n=0;function ZWe(t=null){let e=d8n(),r=(0,At.useRef)(t||e||null);return r.current===null&&(r.current=""+f8n++),t??r.current}function Xdr({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:h="div",...m}){let g=(0,At.useContext)(L_e);if(g===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:y,expandPanel:_,getPanelSize:w,getPanelStyle:S,groupId:C,isPanelCollapsed:E,reevaluatePanelConstraints:P,registerPanel:T,resizePanel:I,unregisterPanel:N}=g,M=ZWe(a),D=(0,At.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,At.useRef)({didLogMissingDefaultSizeWarning:!1}),j$(()=>{let{callbacks:F,constraints:K}=D.current,U={...K};D.current.id=M,D.current.idIsFromProps=a!==void 0,D.current.order=f,F.onCollapse=l,F.onExpand=c,F.onResize=d,K.collapsedSize=r,K.collapsible=n,K.defaultSize=o,K.maxSize=s,K.minSize=u,(U.collapsedSize!==K.collapsedSize||U.collapsible!==K.collapsible||U.maxSize!==K.maxSize||U.minSize!==K.minSize)&&P(D.current,U)}),j$(()=>{let F=D.current;return T(F),()=>{N(F)}},[f,M,T,N]),(0,At.useImperativeHandle)(i,()=>({collapse:()=>{y(D.current)},expand:F=>{_(D.current,F)},getId(){return M},getSize(){return w(D.current)},isCollapsed(){return E(D.current)},isExpanded(){return!E(D.current)},resize:F=>{I(D.current,F)}}),[y,_,w,E,M,I]);let k=S(D.current,o);return(0,At.createElement)(h,{...m,children:t,className:e,id:M,style:{...k,...p},[Ws.groupId]:C,[Ws.panel]:"",[Ws.panelCollapsible]:n||void 0,[Ws.panelId]:M,[Ws.panelSize]:parseFloat(""+k.flexGrow).toFixed(1)})}var YWe=(0,At.forwardRef)((t,e)=>(0,At.createElement)(Xdr,{...t,forwardedRef:e}));Xdr.displayName="Panel";YWe.displayName="forwardRef(Panel)";var p8n;function m8n(){return p8n}var GWe=null,h8n=!0,N_e=-1,pA=null;function g8n(t,e){if(e){let r=(e&nfr)!==0,n=(e&ofr)!==0,o=(e&ifr)!==0,i=(e&afr)!==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 y8n(){pA!==null&&(document.head.removeChild(pA),GWe=null,pA=null,N_e=-1)}function qWe(t,e){var r,n;if(!h8n)return;let o=g8n(t,e);if(GWe!==o){if(GWe=o,pA===null){pA=document.createElement("style");let a=m8n();a&&pA.setAttribute("nonce",a),document.head.appendChild(pA)}if(N_e>=0){var i;(i=pA.sheet)===null||i===void 0||i.removeRule(N_e)}N_e=(r=(n=pA.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Qdr(t){return t.type==="keydown"}function efr(t){return t.type.startsWith("pointer")}function tfr(t){return t.type.startsWith("mouse")}function F_e(t){if(efr(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(tfr(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function b8n(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function _8n(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 v8n(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:Wdr(t),b:Wdr(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;Ln(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:Vdr(Hdr(r.a)),b:Vdr(Hdr(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 w8n=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function x8n(t){var e;let r=getComputedStyle((e=rfr(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function S8n(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||x8n(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"||w8n.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Hdr(t){let e=t.length;for(;e--;){let r=t[e];if(Ln(r,"Missing node"),S8n(r))return r}return null}function Vdr(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Wdr(t){let e=[];for(;t;)e.push(t),t=rfr(t);return e}function rfr(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var nfr=1,ofr=2,ifr=4,afr=8,C8n=b8n()==="coarse",uv=[],OV=!1,yN=new Map,k_e=new Map,PY=new Set;function O8n(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=yN.get(a))!==null&&i!==void 0?i:0;return yN.set(a,u+1),PY.add(s),j_e(),function(){var c;k_e.delete(t),PY.delete(s);let d=(c=yN.get(a))!==null&&c!==void 0?c:1;if(yN.set(a,d-1),j_e(),d===1&&yN.delete(a),uv.includes(s)){let f=uv.indexOf(s);f>=0&&uv.splice(f,1),QWe(),o("up",!0,null)}}}function E8n(t){let{target:e}=t,{x:r,y:n}=F_e(t);OV=!0,XWe({target:e,x:r,y:n}),j_e(),uv.length>0&&(D_e("down",t),t.preventDefault(),sfr(e)||t.stopImmediatePropagation())}function HWe(t){let{x:e,y:r}=F_e(t);if(OV&&t.buttons===0&&(OV=!1,D_e("up",t)),!OV){let{target:n}=t;XWe({target:n,x:e,y:r})}D_e("move",t),QWe(),uv.length>0&&t.preventDefault()}function VWe(t){let{target:e}=t,{x:r,y:n}=F_e(t);k_e.clear(),OV=!1,uv.length>0&&(t.preventDefault(),sfr(e)||t.stopImmediatePropagation()),D_e("up",t),XWe({target:e,x:r,y:n}),QWe(),j_e()}function sfr(t){let e=t;for(;e;){if(e.hasAttribute(Ws.resizeHandle))return!0;e=e.parentElement}return!1}function XWe({target:t,x:e,y:r}){uv.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),PY.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=C8n?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)&&v8n(n,i)>0){let h=n,m=!1;for(;h&&!h.contains(i);){if(_8n(h.getBoundingClientRect(),s,!0)){m=!0;break}h=h.parentElement}if(m)return}uv.push(o)}})}function WWe(t,e){k_e.set(t,e)}function QWe(){let t=!1,e=!1;uv.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;k_e.forEach(n=>{r|=n}),t&&e?qWe("intersection",r):t?qWe("horizontal",r):e?qWe("vertical",r):y8n()}var KWe=new AbortController;function j_e(){KWe.abort(),KWe=new AbortController;let t={capture:!0,signal:KWe.signal};PY.size&&(OV?(uv.length>0&&yN.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",VWe,t),n.addEventListener("pointerleave",HWe,t),n.addEventListener("pointermove",HWe,t))}),yN.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",VWe,t),n.addEventListener("pointercancel",VWe,t)})):yN.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",E8n,t),n.addEventListener("pointermove",HWe,t))}))}function D_e(t,e){PY.forEach(r=>{let{setResizeHandlerState:n}=r,o=uv.includes(r);n(t,o,e)})}function P8n(){let[t,e]=(0,At.useState)(0);return(0,At.useCallback)(()=>e(r=>r+1),[])}function Ln(t,e){if(!t)throw console.error(e),Error(e)}function D$(t,e,r=JWe){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function mA(t,e,r=JWe){return D$(t,e,r)===0}function Ig(t,e,r){return D$(t,e,r)===0}function T8n(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 CV({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];Ln(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(D$(r,s)<0)if(i){let u=(o+s)/2;D$(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(JWe)),r}function OY({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(Ig(t,0))return e;let a=[...e],[s,u]=n;Ln(s!=null,"Invalid first pivot index"),Ln(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];Ln(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:h,minSize:m=0}=f;if(h){let g=e[d];if(Ln(g!=null,`Previous layout not found for panel index ${d}`),Ig(g,p)){let y=m-g;D$(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{let d=t<0?s:u,f=r[d];Ln(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:h,minSize:m=0}=f;if(h){let g=e[d];if(Ln(g!=null,`Previous layout not found for panel index ${d}`),Ig(g,m)){let y=g-p;D$(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let m=e[f];Ln(m!=null,`Previous layout not found for panel index ${f}`);let y=CV({panelConstraints:r,panelIndex:f,size:100})-m;if(p+=y,f+=d,f<0||f>=r.length)break}let h=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-h:h}{let f=t<0?s:u;for(;f>=0&&f<r.length;){let p=Math.abs(t)-Math.abs(l),h=e[f];Ln(h!=null,`Previous layout not found for panel index ${f}`);let m=h-p,g=CV({panelConstraints:r,panelIndex:f,size:m});if(!Ig(h,g)&&(l+=h-g,a[f]=g,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(T8n(o,a))return o;{let d=t<0?u:s,f=e[d];Ln(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,h=CV({panelConstraints:r,panelIndex:d,size:p});if(a[d]=h,!Ig(h,p)){let m=p-h,y=t<0?u:s;for(;y>=0&&y<r.length;){let _=a[y];Ln(_!=null,`Previous layout not found for panel index ${y}`);let w=_+m,S=CV({panelConstraints:r,panelIndex:y,size:w});if(Ig(_,S)||(m-=S-_,a[y]=S),Ig(m,0))break;t>0?y--:y++}}}let c=a.reduce((d,f)=>f+d,0);return Ig(c,100)?a:o}function A8n({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];Ln(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:h=100,minSize:m=0}=p;f===s?(n=m,o=h):(i+=m,a+=h)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function TY(t,e=document){return Array.from(e.querySelectorAll(`[${Ws.resizeHandleId}][data-panel-group-id="${t}"]`))}function ufr(t,e,r=document){let o=TY(t,r).findIndex(i=>i.getAttribute(Ws.resizeHandleId)===e);return o??null}function lfr(t,e,r){let n=ufr(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function I8n(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function cfr(t,e=document){if(I8n(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function $_e(t,e=document){let r=e.querySelector(`[${Ws.resizeHandleId}="${t}"]`);return r||null}function M8n(t,e,r,n=document){var o,i,a,s;let u=$_e(e,n),l=TY(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 R8n({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,At.useRef)({didWarnAboutMissingResizeHandle:!1}),j$(()=>{if(!i)return;let s=TY(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=A8n({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];Ln(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,At.useEffect)(()=>{if(!i)return;let s=e.current;Ln(s,"Eager values not found");let{panelDataArray:u}=s,l=cfr(r,i);Ln(l!=null,`No group found for id "${r}"`);let c=TY(r,i);Ln(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(Ws.resizeHandleId);Ln(p,"Resize handle element has no handle id attribute");let[h,m]=M8n(r,p,u,i);if(h==null||m==null)return()=>{};let g=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();let _=u.findIndex(w=>w.id===h);if(_>=0){let w=u[_];Ln(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=OY({delta:Ig(S,C)?P-C:C-S,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:lfr(r,p,i),prevLayout:n,trigger:"keyboard"});n!==T&&a(T)}}break}}};return f.addEventListener("keydown",g),()=>{f.removeEventListener("keydown",g)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function Kdr(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}=F_e(e);return r?n:o}function N8n(t,e,r,n,o){let i=r==="horizontal",a=$_e(e,o);Ln(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(Ws.groupId);Ln(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=dfr(r,t),c=cfr(s,o);Ln(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function j8n(t,e,r,n,o,i){if(Qdr(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:N8n(t,e,r,n,i)}function D8n({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];Ln(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];Ln(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 xV(t,e,r){e.forEach((n,o)=>{let i=t[o];Ln(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:h}=a;h&&h(n,d),c&&(f||p)&&(p&&(d==null||mA(d,l))&&!mA(n,l)&&p(),f&&(d==null||!mA(d,l))&&mA(n,l)&&f())}})}function R_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 L8n({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 F8n(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function Gdr(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 ffr(t){return`react-resizable-panels:${t}`}function pfr(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 mfr(t,e){try{let r=ffr(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function k8n(t,e,r){var n,o;let i=(n=mfr(t,r))!==null&&n!==void 0?n:{},a=pfr(e);return(o=i[a])!==null&&o!==void 0?o:null}function $8n(t,e,r,n,o){var i;let a=ffr(t),s=pfr(e),u=(i=mfr(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 Jdr({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];Ln(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];Ln(a!=null,`No layout data found for index ${i}`);let s=CV({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];Ln(a!=null,`No layout data found for index ${i}`);let s=a+o,u=CV({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,Ig(o,0)))break}return r}var B8n=100,EY={getItem:t=>(Gdr(EY),EY.getItem(t)),setItem:(t,e)=>{Gdr(EY),EY.setItem(t,e)}},Zdr={};function hfr({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=EY,style:l,tagName:c="div",...d}){let f=ZWe(i),p=(0,At.useRef)(null),[h,m]=(0,At.useState)(null),[g,y]=(0,At.useState)([]),_=P8n(),w=(0,At.useRef)({}),S=(0,At.useRef)(new Map),C=(0,At.useRef)(0),E=(0,At.useRef)({autoSaveId:t,direction:n,dragState:h,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),P=(0,At.useRef)({layout:g,panelDataArray:[],panelDataArrayChanged:!1});(0,At.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,At.useImperativeHandle)(o,()=>({getId:()=>E.current.id,getLayout:()=>{let{layout:V}=P.current;return V},setLayout:V=>{let{onLayout:q}=E.current,{layout:H,panelDataArray:G}=P.current,Z=Jdr({layout:V,panelConstraints:G.map(de=>de.constraints)});Kdr(H,Z)||(y(Z),P.current.layout=Z,q&&q(Z),xV(G,Z,w.current))}}),[]),j$(()=>{E.current.autoSaveId=t,E.current.direction=n,E.current.dragState=h,E.current.id=f,E.current.onLayout=a,E.current.storage=u}),R8n({committedValuesRef:E,eagerValuesRef:P,groupId:f,layout:g,panelDataArray:P.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),(0,At.useEffect)(()=>{let{panelDataArray:V}=P.current;if(t){if(g.length===0||g.length!==V.length)return;let q=Zdr[t];q==null&&(q=F8n($8n,B8n),Zdr[t]=q);let H=[...V],G=new Map(S.current);q(t,H,G,g,u)}},[t,g,u]),(0,At.useEffect)(()=>{});let T=(0,At.useCallback)(V=>{let{onLayout:q}=E.current,{layout:H,panelDataArray:G}=P.current;if(V.constraints.collapsible){let Z=G.map(Te=>Te.constraints),{collapsedSize:de=0,panelSize:pe,pivotIndices:ae}=N$(G,V,H);if(Ln(pe!=null,`Panel size not found for panel "${V.id}"`),!mA(pe,de)){S.current.set(V.id,pe);let Ae=SV(G,V)===G.length-1?pe-de:de-pe,ke=OY({delta:Ae,initialLayout:H,panelConstraints:Z,pivotIndices:ae,prevLayout:H,trigger:"imperative-api"});R_e(H,ke)||(y(ke),P.current.layout=ke,q&&q(ke),xV(G,ke,w.current))}}},[]),I=(0,At.useCallback)((V,q)=>{let{onLayout:H}=E.current,{layout:G,panelDataArray:Z}=P.current;if(V.constraints.collapsible){let de=Z.map(Ot=>Ot.constraints),{collapsedSize:pe=0,panelSize:ae=0,minSize:Te=0,pivotIndices:Ae}=N$(Z,V,G),ke=q??Te;if(mA(ae,pe)){let Ot=S.current.get(V.id),jr=Ot!=null&&Ot>=ke?Ot:ke,Vn=SV(Z,V)===Z.length-1?ae-jr:jr-ae,Xr=OY({delta:Vn,initialLayout:G,panelConstraints:de,pivotIndices:Ae,prevLayout:G,trigger:"imperative-api"});R_e(G,Xr)||(y(Xr),P.current.layout=Xr,H&&H(Xr),xV(Z,Xr,w.current))}}},[]),N=(0,At.useCallback)(V=>{let{layout:q,panelDataArray:H}=P.current,{panelSize:G}=N$(H,V,q);return Ln(G!=null,`Panel size not found for panel "${V.id}"`),G},[]),M=(0,At.useCallback)((V,q)=>{let{panelDataArray:H}=P.current,G=SV(H,V);return L8n({defaultSize:q,dragState:h,layout:g,panelData:H,panelIndex:G})},[h,g]),D=(0,At.useCallback)(V=>{let{layout:q,panelDataArray:H}=P.current,{collapsedSize:G=0,collapsible:Z,panelSize:de}=N$(H,V,q);return Ln(de!=null,`Panel size not found for panel "${V.id}"`),Z===!0&&mA(de,G)},[]),k=(0,At.useCallback)(V=>{let{layout:q,panelDataArray:H}=P.current,{collapsedSize:G=0,collapsible:Z,panelSize:de}=N$(H,V,q);return Ln(de!=null,`Panel size not found for panel "${V.id}"`),!Z||D$(de,G)>0},[]),F=(0,At.useCallback)(V=>{let{panelDataArray:q}=P.current;q.push(V),q.sort((H,G)=>{let Z=H.order,de=G.order;return Z==null&&de==null?0:Z==null?-1:de==null?1:Z-de}),P.current.panelDataArrayChanged=!0,_()},[_]);j$(()=>{if(P.current.panelDataArrayChanged){P.current.panelDataArrayChanged=!1;let{autoSaveId:V,onLayout:q,storage:H}=E.current,{layout:G,panelDataArray:Z}=P.current,de=null;if(V){let ae=k8n(V,Z,H);ae&&(S.current=new Map(Object.entries(ae.expandToSizes)),de=ae.layout)}de==null&&(de=D8n({panelDataArray:Z}));let pe=Jdr({layout:de,panelConstraints:Z.map(ae=>ae.constraints)});Kdr(G,pe)||(y(pe),P.current.layout=pe,q&&q(pe),xV(Z,pe,w.current))}}),j$(()=>{let V=P.current;return()=>{V.layout=[]}},[]);let K=(0,At.useCallback)(V=>{let q=!1,H=p.current;return H&&window.getComputedStyle(H,null).getPropertyValue("direction")==="rtl"&&(q=!0),function(Z){Z.preventDefault();let de=p.current;if(!de)return()=>null;let{direction:pe,dragState:ae,id:Te,keyboardResizeBy:Ae,onLayout:ke}=E.current,{layout:Ot,panelDataArray:jr}=P.current,{initialLayout:Mr}=ae??{},Vn=lfr(Te,V,de),Xr=j8n(Z,V,pe,ae,Ae,de),Cr=pe==="horizontal";Cr&&q&&(Xr=-Xr);let Me=jr.map(le=>le.constraints),Ze=OY({delta:Xr,initialLayout:Mr??Ot,panelConstraints:Me,pivotIndices:Vn,prevLayout:Ot,trigger:Qdr(Z)?"keyboard":"mouse-or-touch"}),je=!R_e(Ot,Ze);(efr(Z)||tfr(Z))&&C.current!=Xr&&(C.current=Xr,!je&&Xr!==0?Cr?WWe(V,Xr<0?nfr:ofr):WWe(V,Xr<0?ifr:afr):WWe(V,0)),je&&(y(Ze),P.current.layout=Ze,ke&&ke(Ze),xV(jr,Ze,w.current))}},[]),U=(0,At.useCallback)((V,q)=>{let{onLayout:H}=E.current,{layout:G,panelDataArray:Z}=P.current,de=Z.map(Ot=>Ot.constraints),{panelSize:pe,pivotIndices:ae}=N$(Z,V,G);Ln(pe!=null,`Panel size not found for panel "${V.id}"`);let Ae=SV(Z,V)===Z.length-1?pe-q:q-pe,ke=OY({delta:Ae,initialLayout:G,panelConstraints:de,pivotIndices:ae,prevLayout:G,trigger:"imperative-api"});R_e(G,ke)||(y(ke),P.current.layout=ke,H&&H(ke),xV(Z,ke,w.current))},[]),X=(0,At.useCallback)((V,q)=>{let{layout:H,panelDataArray:G}=P.current,{collapsedSize:Z=0,collapsible:de}=q,{collapsedSize:pe=0,collapsible:ae,maxSize:Te=100,minSize:Ae=0}=V.constraints,{panelSize:ke}=N$(G,V,H);ke!=null&&(de&&ae&&mA(ke,Z)?mA(Z,pe)||U(V,pe):ke<Ae?U(V,Ae):ke>Te&&U(V,Te))},[U]),ee=(0,At.useCallback)((V,q)=>{let{direction:H}=E.current,{layout:G}=P.current;if(!p.current)return;let Z=$_e(V,p.current);Ln(Z,`Drag handle element not found for id "${V}"`);let de=dfr(H,q);m({dragHandleId:V,dragHandleRect:Z.getBoundingClientRect(),initialCursorPosition:de,initialLayout:G})},[]),L=(0,At.useCallback)(()=>{m(null)},[]),Q=(0,At.useCallback)(V=>{let{panelDataArray:q}=P.current,H=SV(q,V);H>=0&&(q.splice(H,1),delete w.current[V.id],P.current.panelDataArrayChanged=!0,_())},[_]),z=(0,At.useMemo)(()=>({collapsePanel:T,direction:n,dragState:h,expandPanel:I,getPanelSize:N,getPanelStyle:M,groupId:f,isPanelCollapsed:D,isPanelExpanded:k,reevaluatePanelConstraints:X,registerPanel:F,registerResizeHandle:K,resizePanel:U,startDragging:ee,stopDragging:L,unregisterPanel:Q,panelGroupElement:p.current}),[T,h,n,I,N,M,f,D,k,X,F,K,U,ee,L,Q]),W={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,At.createElement)(L_e.Provider,{value:z},(0,At.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...W,...l},[Ws.group]:"",[Ws.groupDirection]:n,[Ws.groupId]:f}))}var e9e=(0,At.forwardRef)((t,e)=>(0,At.createElement)(hfr,{...t,forwardedRef:e}));hfr.displayName="PanelGroup";e9e.displayName="forwardRef(PanelGroup)";function SV(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function N$(t,e,r){let n=SV(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function z8n({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,At.useEffect)(()=>{if(t||r==null||n==null)return;let o=$_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(Ws.groupId);Ln(s,`No group element found for id "${s}"`);let u=TY(s,n),l=ufr(s,e,n);Ln(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 t9e({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",...h}){var m,g;let y=(0,At.useRef)(null),_=(0,At.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,At.useEffect)(()=>{_.current.onClick=a,_.current.onDragging=s,_.current.onPointerDown=l,_.current.onPointerUp=c});let w=(0,At.useContext)(L_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=ZWe(o),[M,D]=(0,At.useState)("inactive"),[k,F]=(0,At.useState)(!1),[K,U]=(0,At.useState)(null),X=(0,At.useRef)({state:M});j$(()=>{X.current.state=M}),(0,At.useEffect)(()=>{if(r)U(null);else{let z=E(N);U(()=>z)}},[r,N,E]);let ee=(m=n?.coarse)!==null&&m!==void 0?m:15,L=(g=n?.fine)!==null&&g!==void 0?g:5;return(0,At.useEffect)(()=>{if(r||K==null)return;let z=y.current;Ln(z,"Element ref not attached");let W=!1;return O8n(N,z,S,{coarse:ee,fine:L},(q,H,G)=>{if(!H){D("inactive");return}switch(q){case"down":{D("drag"),W=!1,Ln(G,'Expected event to be defined for "down" action'),P(N,G);let{onDragging:Z,onPointerDown:de}=_.current;Z?.(!0),de?.();break}case"move":{let{state:Z}=X.current;W=!0,Z!=="drag"&&D("hover"),Ln(G,'Expected event to be defined for "move" action'),K(G);break}case"up":{D("hover"),T();let{onClick:Z,onDragging:de,onPointerUp:pe}=_.current;de?.(!1),pe?.(),W||Z?.();break}}})},[ee,S,r,L,E,N,K,P,T]),z8n({disabled:r,handleId:N,resizeHandler:K,panelGroupElement:I}),(0,At.createElement)(p,{...h,children:t,className:e,id:o,onBlur:()=>{F(!1),i?.()},onFocus:()=>{F(!0),u?.()},ref:y,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[Ws.groupDirection]:S,[Ws.groupId]:C,[Ws.resizeHandle]:"",[Ws.resizeHandleActive]:M==="drag"?"pointer":k?"keyboard":void 0,[Ws.resizeHandleEnabled]:!r,[Ws.resizeHandleId]:N,[Ws.resizeHandleState]:M})}t9e.displayName="PanelResizeHandle";xn();var gfr=({className:t,...e})=>AY.createElement(e9e,{className:me("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),r9e=YWe,yfr=({withHandle:t,className:e,...r})=>AY.createElement(t9e,{className:me("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&&AY.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"},AY.createElement(Uv,{className:"tw-size-2.5"})));var KO=j(Y());var fr=j(Y(),1);var bfr=j(Y(),1),q8n=j(za(),1);Bv();var _fr=j(st(),1),H8n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],EV=H8n.reduce((t,e)=>{let r=kf(`Primitive.${e}`),n=bfr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,_fr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Sh=j(Y(),1);var wfr=j(Y(),1);function vfr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function V8n(...t){return e=>{let r=!1,n=t.map(o=>{let i=vfr(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():vfr(t[o],null)}}}}function hA(...t){return wfr.useCallback(V8n(...t),t)}var xfr=j(Y(),1),IY=globalThis?.document?xfr.useLayoutEffect:()=>{};var Sfr=j(Y(),1);function W8n(t,e){return Sfr.useReducer((r,n)=>e[r][n]??r,t)}var PV=t=>{let{present:e,children:r}=t,n=K8n(e),o=typeof r=="function"?r({present:n.isPresent}):Sh.Children.only(r),i=hA(n.ref,G8n(o));return typeof r=="function"||n.isPresent?Sh.cloneElement(o,{ref:i}):null};PV.displayName="Presence";function K8n(t){let[e,r]=Sh.useState(),n=Sh.useRef(null),o=Sh.useRef(t),i=Sh.useRef("none"),a=t?"mounted":"unmounted",[s,u]=W8n(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Sh.useEffect(()=>{let l=B_e(n.current);i.current=s==="mounted"?l:"none"},[s]),IY(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=B_e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),IY(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let m=B_e(n.current).includes(p.animationName);if(p.target===e&&m&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=B_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 B_e(t){return t?.animationName||"none"}function G8n(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 gA=j(Y(),1),Cfr=j(st(),1);function Ofr(t,e=[]){let r=[];function n(i,a){let s=gA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=gA.useMemo(()=>h,Object.values(h));return(0,Cfr.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=gA.useContext(p);if(h)return h;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=>gA.createContext(a));return function(s){let u=s?.[t]||i;return gA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,J8n(o,...e)]}function J8n(...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 gA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var TV=j(Y(),1);function bN(t){let e=TV.useRef(t);return TV.useEffect(()=>{e.current=t}),TV.useMemo(()=>(...r)=>e.current?.(...r),[])}var z_e=j(Y(),1),Z8n=j(st(),1),Y8n=z_e.createContext(void 0);function Efr(t){let e=z_e.useContext(Y8n);return t||e||"ltr"}function Pfr(t,[e,r]){return Math.min(r,Math.max(e,t))}function _N(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Afr=j(Y(),1),Ai=j(st(),1);function X8n(t,e){return Afr.useReducer((r,n)=>e[r][n]??r,t)}var n9e="ScrollArea",[Ifr,aKi]=Ofr(n9e),[Q8n,bb]=Ifr(n9e),Mfr=fr.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=fr.useState(null),[l,c]=fr.useState(null),[d,f]=fr.useState(null),[p,h]=fr.useState(null),[m,g]=fr.useState(null),[y,_]=fr.useState(0),[w,S]=fr.useState(0),[C,E]=fr.useState(!1),[P,T]=fr.useState(!1),I=hA(e,M=>u(M)),N=Efr(o);return(0,Ai.jsx)(Q8n,{scope:r,type:n,dir:N,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:h,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:_,onCornerHeightChange:S,children:(0,Ai.jsx)(EV.div,{dir:N,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});Mfr.displayName=n9e;var Rfr="ScrollAreaViewport",Nfr=fr.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=bb(Rfr,r),s=fr.useRef(null),u=hA(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)(EV.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})})]})});Nfr.displayName=Rfr;var WO="ScrollAreaScrollbar",H_e=fr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=bb(WO,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return fr.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Ai.jsx)(e5n,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Ai.jsx)(t5n,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Ai.jsx)(jfr,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Ai.jsx)(o9e,{...n,ref:e}):null});H_e.displayName=WO;var e5n=fr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=bb(WO,t.__scopeScrollArea),[i,a]=fr.useState(!1);return fr.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)(PV,{present:r||i,children:(0,Ai.jsx)(jfr,{"data-state":i?"visible":"hidden",...n,ref:e})})}),t5n=fr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=bb(WO,t.__scopeScrollArea),i=t.orientation==="horizontal",a=W_e(()=>u("SCROLL_END"),100),[s,u]=X8n("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 fr.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),fr.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)(PV,{present:r||s!=="hidden",children:(0,Ai.jsx)(o9e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:_N(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:_N(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),jfr=fr.forwardRef((t,e)=>{let r=bb(WO,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=fr.useState(!1),s=t.orientation==="horizontal",u=W_e(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return AV(r.viewport,u),AV(r.content,u),(0,Ai.jsx)(PV,{present:n||i,children:(0,Ai.jsx)(o9e,{"data-state":i?"visible":"hidden",...o,ref:e})})}),o9e=fr.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=bb(WO,t.__scopeScrollArea),i=fr.useRef(null),a=fr.useRef(0),[s,u]=fr.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=kfr(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 s5n(f,a.current,s,p)}return r==="horizontal"?(0,Ai.jsx)(r5n,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=Tfr(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)(n5n,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=Tfr(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}),r5n=fr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=bb(WO,t.__scopeScrollArea),[a,s]=fr.useState(),u=fr.useRef(null),l=hA(e,u,i.onScrollbarXChange);return fr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ai.jsx)(Lfr,{"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":V_e(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),Bfr(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:q_e(a.paddingLeft),paddingEnd:q_e(a.paddingRight)}})}})}),n5n=fr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=bb(WO,t.__scopeScrollArea),[a,s]=fr.useState(),u=fr.useRef(null),l=hA(e,u,i.onScrollbarYChange);return fr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ai.jsx)(Lfr,{"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":V_e(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),Bfr(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:q_e(a.paddingTop),paddingEnd:q_e(a.paddingBottom)}})}})}),[o5n,Dfr]=Ifr(WO),Lfr=fr.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=bb(WO,r),[h,m]=fr.useState(null),g=hA(e,I=>m(I)),y=fr.useRef(null),_=fr.useRef(""),w=p.viewport,S=n.content-n.viewport,C=bN(c),E=bN(u),P=W_e(d,10);function T(I){if(y.current){let N=I.clientX-y.current.left,M=I.clientY-y.current.top;l({x:N,y:M})}}return fr.useEffect(()=>{let I=N=>{let M=N.target;h?.contains(M)&&C(N,S)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[w,h,S,C]),fr.useEffect(E,[n,E]),AV(h,P),AV(p.content,P),(0,Ai.jsx)(o5n,{scope:r,scrollbar:h,hasThumb:o,onThumbChange:bN(i),onThumbPointerUp:bN(a),onThumbPositionChange:E,onThumbPointerDown:bN(s),children:(0,Ai.jsx)(EV.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:_N(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),y.current=h.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(I))}),onPointerMove:_N(t.onPointerMove,T),onPointerUp:_N(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=""),y.current=null})})})}),U_e="ScrollAreaThumb",i9e=fr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Dfr(U_e,t.__scopeScrollArea);return(0,Ai.jsx)(PV,{present:r||o.hasThumb,children:(0,Ai.jsx)(i5n,{ref:e,...n})})}),i5n=fr.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=bb(U_e,r),a=Dfr(U_e,r),{onThumbPositionChange:s}=a,u=hA(e,d=>a.onThumbChange(d)),l=fr.useRef(void 0),c=W_e(()=>{l.current&&(l.current(),l.current=void 0)},100);return fr.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=u5n(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Ai.jsx)(EV.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:_N(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),h=d.clientX-p.left,m=d.clientY-p.top;a.onThumbPointerDown({x:h,y:m})}),onPointerUp:_N(t.onPointerUp,a.onThumbPointerUp)})});i9e.displayName=U_e;var a9e="ScrollAreaCorner",Ffr=fr.forwardRef((t,e)=>{let r=bb(a9e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Ai.jsx)(a5n,{...t,ref:e}):null});Ffr.displayName=a9e;var a5n=fr.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=bb(a9e,r),[i,a]=fr.useState(0),[s,u]=fr.useState(0),l=!!(i&&s);return AV(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),AV(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Ai.jsx)(EV.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 q_e(t){return t?parseInt(t,10):0}function kfr(t,e){let r=t/e;return isNaN(r)?0:r}function V_e(t){let e=kfr(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function s5n(t,e,r,n="ltr"){let o=V_e(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 $fr([u,l],d)(t)}function Tfr(t,e,r="ltr"){let n=V_e(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=Pfr(t,u);return $fr([0,a],[0,s])(l)}function $fr(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 Bfr(t,e){return t>0&&t<e}var u5n=(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 W_e(t,e){let r=bN(t),n=fr.useRef(0);return fr.useEffect(()=>()=>window.clearTimeout(n.current),[]),fr.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function AV(t,e){let r=bN(e);IY(()=>{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 s9e=Mfr,zfr=Nfr;var Ufr=Ffr;xn();var K_e=KO.forwardRef(({className:t,children:e,...r},n)=>KO.createElement(s9e,{ref:n,className:me("tw-relative tw-overflow-hidden",t),...r},KO.createElement(zfr,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),KO.createElement(qfr,null),KO.createElement(Ufr,null)));K_e.displayName=s9e.displayName;var qfr=KO.forwardRef(({className:t,orientation:e="vertical",...r},n)=>KO.createElement(H_e,{ref:n,orientation:e,className:me("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},KO.createElement(i9e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));qfr.displayName=H_e.displayName;var IV=j(Y());po();un();var G_e=({value:t,onChange:e,placeholder:r="Search..."})=>IV.default.createElement("div",{className:"tw-relative"},IV.default.createElement(gi,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&IV.default.createElement(he,{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"},IV.default.createElement(II,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),IV.default.createElement(nD,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));xn();rh();ir();un();var Z_e=require("obsidian"),Ne=j(Y()),Wfr=j($c());function c5n({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ne.default.createElement(w5,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ne.default.createElement(v5,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ne.default.createElement(C5,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ne.default.createElement(Fm,{className:`${e}`}):Ne.default.createElement(Fm,{className:`tw-text-faint ${e}`})}var u9e=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>Ne.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},Ne.default.createElement("div",{className:"tw-flex tw-items-center"},Ne.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),Ne.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&Ne.default.createElement(so,{delayDuration:0},Ne.default.createElement(St,null,Ne.default.createElement(Ct,{asChild:!0},Ne.default.createElement($i,{className:"tw-ml-2 tw-size-4 tw-text-muted"})),Ne.default.createElement(_t,null,Ne.default.createElement("div",{className:"tw-max-w-80"},o))))),Ne.default.createElement(he,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ne.default.createElement(zh,{className:`tw-size-4 ${r}`}))),Hfr=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>Ne.default.createElement("div",null,Ne.default.createElement(u9e,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),Ne.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>Ne.default.createElement("div",{key:f.id,className:me("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)},Ne.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):Ne.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),Ne.default.createElement(xh,{className:"tw-flex-1 tw-text-sm"},f.name)),Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),Ne.default.createElement(vi,{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 d5n({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?Hh:vi;return Ne.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"},Ne.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ne.default.createElement(c5n,{extension:n,size:"tw-size-8"})),Ne.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ne.default.createElement(xh,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&Ne.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&Ne.default.createElement(xh,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),Ne.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},Ne.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 f5n({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=NI,n="tw-text-context-manager-orange";break;case"folder":r=uy,n="tw-text-context-manager-yellow";break;case"files":r=Fm,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=vi,n="tw-text-context-manager-red";break}return Ne.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)},Ne.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ne.default.createElement(r,{className:`tw-size-6 ${n}`})),Ne.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ne.default.createElement(xh,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.type==="tag"&&Ne.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),t.name),Ne.default.createElement(xh,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function Vfr(t){return"type"in t}function p5n({initialProject:t,onSave:e,onCancel:r,app:n}){let{inclusions:o,exclusions:i}=(0,Ne.useMemo)(()=>vc({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),a=(0,Ne.useMemo)(()=>n.vault.getFiles(),[n.vault]),s=(0,Ne.useCallback)((z,W,V)=>{let q=z.filter(ae=>_s(ae,W,V,!0)),H=(ae,Te,Ae,ke)=>{Te&&Te.forEach(Ot=>{let jr={[Ae]:[Ot]};_s(ae,jr,null,!0)&&!ke[Ot].some(Mr=>Mr.id===ae.path)&&ke[Ot].push({id:ae.path,name:ae.basename})})},G={},Z={},de={},pe=[];return(W?.tagPatterns??[]).forEach(ae=>{G[ae]=[]}),(W?.folderPatterns??[]).forEach(ae=>{Z[ae]=[]}),(W?.extensionPatterns??[]).forEach(ae=>{de[ae]=[]}),q.forEach(ae=>{H(ae,W?.tagPatterns,"tagPatterns",G),H(ae,W?.folderPatterns,"folderPatterns",Z),H(ae,W?.extensionPatterns,"extensionPatterns",de),W?.notePatterns&&_s(ae,{notePatterns:W.notePatterns},null,!0)&&!pe.some(Te=>Te.id===ae.path)&&pe.push({id:ae.path,name:ae.basename})}),{tags:G,folders:Z,extensions:de,notes:pe}},[]),[u,l]=(0,Ne.useState)(()=>s(a,o,i)),[c,d]=(0,Ne.useState)(()=>{let z=a.filter(W=>i&&_s(W,i,null,!0));return{files:new Set(z)}}),f=(0,Ne.useRef)(u),p=(0,Ne.useRef)(c),[h,m]=(0,Ne.useState)(""),[g,y]=(0,Ne.useState)(null),[_,w]=(0,Ne.useState)(null),S=(0,Ne.useCallback)((z,W)=>{let V=Object.keys(z.tags),q=Object.keys(z.folders),H=Object.keys(z.extensions),G=z.notes.map(Z=>{let de=W.find(pe=>pe.path===Z.id);if(de)return l4(de)}).filter(Boolean);return u4({tagPatterns:V,folderPatterns:q,extensionPatterns:H,notePatterns:G})},[]),C=(0,Ne.useCallback)(z=>{let W=new Array(...z.files).map(V=>l4(V));return u4({notePatterns:W})||""},[]);(0,Ne.useEffect)(()=>{f.current=u,p.current=c},[u,c]);let E=(0,Ne.useMemo)(()=>{let z=[],W=(q,H)=>{H.forEach(G=>{q.some(Z=>Z.id===G.id)||q.push({id:G.id,name:G.name})})};return[u.tags,u.folders,u.extensions,{notes:u.notes}].forEach(q=>{Object.values(q).forEach(H=>{W(z,H)})}),z},[u]),P=(0,Ne.useCallback)(z=>{let W=[],V=[],q=[];return z.split(",").map(G=>G.trim()).filter(G=>G).forEach(G=>{G.startsWith("#")?W.push(G.substring(1)):G.startsWith(".")||G.startsWith("*.")?q.push(G.replace("*","")):V.push(G)}),{tags:W,titles:V,extensions:q}},[]),T=(0,Ne.useCallback)(z=>[...z].sort((W,V)=>W.name.toLowerCase().localeCompare(V.name.toLowerCase())),[]),I=(0,Ne.useMemo)(()=>{if(h){let z=P(h);return E.filter(W=>{let V=a.find(pe=>pe.path===W.id);if(!V)return!1;let q=V.extension==="md",H=z.tags.length>0&&q&&z.tags.some(pe=>Tj(V).some(Te=>(Te.startsWith("#")?Te.substring(1):Te).toLowerCase().includes(pe.toLowerCase()))),G=z.titles.length>0&&z.titles.some(pe=>V.basename.toLowerCase().includes(pe.toLowerCase())),Z=z.extensions.length>0&&z.extensions.some(pe=>`.${V.extension}`.toLowerCase()===pe.toLowerCase());return z.tags.length>0||z.titles.length>0||z.extensions.length>0?H||G||Z:!1}).map(W=>({id:W.id,name:W.name}))}if(g==="tags"&&_){let z=u.tags[_];return z||[]}if(g==="folders"&&_){let z=u.folders[_];return z||[]}if(g==="files")return u.notes;if(g==="extensions"&&_){let z=u.extensions[_];return z||[]}if(g==="ignoreFiles")return Array.from(c.files).map(z=>({id:z.path,name:z.basename}));if(!g){let z=T(Object.entries(u.tags).map(([H,G])=>({id:`tag:${H}`,name:H.slice(1),type:"tag",originalId:H,count:G.length}))),W=T(Object.entries(u.folders).map(([H,G])=>({id:`folder:${H}`,name:H,type:"folder",originalId:H,count:G.length}))),V=u.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:u.notes.length}]:[],q=c.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:c.files.size}]:[];return[...z,...W,...V,...q]}return[]},[h,g,_,P,E,a,u.tags,u.folders,u.notes,u.extensions,c.files,T]),N=(0,Ne.useCallback)((z,W)=>Object.entries(z).sort(([V],[q])=>V.localeCompare(q)).map(([V,q])=>({id:V,name:W?W(V):V,count:q.length})),[]),M=(0,Ne.useCallback)((z,W,V)=>{let q=Z=>a.filter(de=>_s(de,Z,null,!0)).map(de=>({id:de.path,name:de.basename})),H=[...p.current.files],G=q(V).map(Z=>({...Z,isIgnored:H.some(de=>de.path===Z.id)}));l(Z=>({...Z,[z]:{...Z[z],[W]:G}}))},[a]),D=(0,Ne.useCallback)((z,W)=>{let V={tags:{...z.tags},folders:{...z.folders},extensions:{...z.extensions},notes:[...z.notes]},q=H=>{Object.keys(H).forEach(G=>{H[G]=H[G].filter(Z=>Z.id!==W)})};return q(V.tags),q(V.folders),q(V.extensions),V.notes=V.notes.filter(H=>H.id!==W),V},[]),k=(0,Ne.useCallback)((z,W=null,V=!0)=>{y(z),w(W),V&&m("")},[]),F=(0,Ne.useMemo)(()=>{let z=W=>(V,q)=>{V.stopPropagation(),l(H=>{let G={...H[W]};return delete G[q.id],{...H,[W]:G}})};return{delete:{tag:z("tags"),folder:z("folders"),extension:z("extensions")},add:{tag:()=>{new vV(n,W=>{let V=QK(W);M("tags",V,{tagPatterns:[V]})}).open()},folder:()=>{new _V(n,W=>{M("folders",W,{folderPatterns:[W]})}).open()},file:()=>{new CY({app:n,onFileSelect:W=>{u.notes.find(q=>q.id===W.path)||(d(q=>{let H=new Set(q.files);return H.delete(W),{...q,files:H}}),l(q=>({...q,notes:[...q.notes,{id:W.path,name:W.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new Z_e.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new CY({app:n,onFileSelect:W=>{c.files.has(W)||(d(q=>{let H=new Set(q.files);return H.add(W),{...q,files:H}}),l(q=>D(q,W.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:W=>{k("tags",W)},folder:W=>{k("folders",W)},extension:W=>{k("extensions",W)},files:()=>{k("files")},ignoreFiles:()=>{k("ignoreFiles")}}}},[n,u.notes,c.files,M,D,k]),K=(0,Ne.useCallback)(z=>{z.type==="tag"&&z.originalId?F.click.tag(z.originalId):z.type==="folder"&&z.originalId?F.click.folder(z.originalId):z.type==="files"?F.click.files():z.type==="ignoreFiles"&&F.click.ignoreFiles()},[F]),U=()=>h?`Search Results for: "${h}"`:g==="tags"&&_?`Tag: ${_}`:g==="folders"&&_?`Folder: ${_}`:g==="files"?"Files":g==="extensions"&&_?`Extension: ${_}`:g==="ignoreFiles"?"Ignore Files":"All Categories",X=(z,W)=>{z.stopPropagation();let V=a.find(q=>q.path===W.id);V&&(d(q=>{let H=new Set(q.files);return H.add(V),{...q,files:H}}),l(q=>D(q,W.id)))},ee=(0,Ne.useCallback)(()=>{let z=S(f.current,a),W=C(p.current),{inclusions:V,exclusions:q}=vc({inclusions:z,exclusions:W,isProject:!0}),H=s(a,V,q);l(H)},[a,C,S,s]),L=(z,W)=>{z.stopPropagation();let V=a.find(q=>q.path===W.id);V&&(d(q=>{let H=new Set(q.files);return H.delete(V),{...q,files:H}}),ee())},Q=()=>{let z=S(u,a),W=C(c);e({...t,contextSource:{...t.contextSource,inclusions:z,exclusions:W}})};return Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement(gfr,{direction:"horizontal",className:"tw-flex-1"},Ne.default.createElement(r9e,{defaultSize:30,minSize:20,maxSize:40},Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement("div",{className:"tw-border-b tw-p-4"},Ne.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),Ne.default.createElement(K_e,{className:"tw-max-h-[500px] tw-flex-1"},Ne.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ne.default.createElement(Hfr,{title:"Tags",IconComponent:NI,iconColorClassName:"tw-text-context-manager-orange",items:N(u.tags,z=>z.slice(1)),activeItem:_,activeSection:g,sectionType:"tags",renderIcon:z=>Ne.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:F.click.tag,onAddClick:F.add.tag,onDeleteItem:(z,W)=>F.delete.tag(z,W),tooltip:"must be in note property"}),Ne.default.createElement(E$,null),Ne.default.createElement(Hfr,{title:"Folders",IconComponent:uy,iconColorClassName:"tw-text-context-manager-yellow",items:N(u.folders),activeItem:_,activeSection:g,sectionType:"folders",onItemClick:F.click.folder,onAddClick:F.add.folder,onDeleteItem:(z,W)=>F.delete.folder(z,W)}),Ne.default.createElement(E$,null),Ne.default.createElement("div",null,Ne.default.createElement(u9e,{IconComponent:Fm,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:F.add.file}),Ne.default.createElement("div",{className:me("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:F.click.files},"Files (",u.notes.length,")")),Ne.default.createElement(E$,null),Ne.default.createElement("div",null,Ne.default.createElement(u9e,{IconComponent:vi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:F.add.ignoreFile}),Ne.default.createElement("div",{className:me("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:F.click.ignoreFiles},"Ignore Files (",c.files.size,")")))))),Ne.default.createElement(yfr,{withHandle:!0}),Ne.default.createElement(r9e,{defaultSize:70},Ne.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ne.default.createElement("div",{className:"tw-border-b tw-p-4"},Ne.default.createElement(G_e,{placeholder:"Custom search: title, #tag1, .jpg",value:h,onChange:z=>{m(z),z&&k("search",null,!1)}})),Ne.default.createElement("div",{className:"tw-p-4"},Ne.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},U())),Ne.default.createElement(K_e,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},I.length===0?Ne.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."):Ne.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},g||h?T(I).map(z=>Vfr(z)?null:Ne.default.createElement(d5n,{key:z.id,item:z,viewMode:"list",onDelete:g==="ignoreFiles"||z.isIgnored?L:X})).filter(Boolean):I.map(z=>Vfr(z)?Ne.default.createElement(f5n,{key:z.id,item:z,onClick:K}):null).filter(Boolean)))))),Ne.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Ne.default.createElement(he,{variant:"ghost",onClick:r},"Cancel"),Ne.default.createElement(he,{onClick:Q},"Save")))}var J_e=class extends Z_e.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,Wfr.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ne.default.createElement(p5n,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};po();var MV=j(Y());var Yn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>MV.default.createElement("div",{className:"tw-space-y-2"},t&&MV.default.createElement(em,{className:r?"tw-text-error":""},t," ",e&&MV.default.createElement("span",{className:"tw-text-error"},"*")),n&&MV.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&MV.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var L$=j(Y());xn();un();function Y_e({options:t,placeholder:e,containerClassName:r,className:n,...o}){return L$.default.createElement("div",{className:me("tw-group tw-relative tw-w-full",r)},L$.default.createElement("select",{className:me("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&&L$.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>L$.default.createElement("option",{key:i.value,value:i.value},i.label))),L$.default.createElement("div",{className:me("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")},L$.default.createElement(ki,{className:"tw-size-4"})))}var wN=j(Y());xn();var k$=j(Y());var ta=j(Y(),1);function l9e(t,[e,r]){return Math.min(r,Math.max(e,t))}function F$(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Gfr=j(Y(),1);function Kfr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function m5n(...t){return e=>{let r=!1,n=t.map(o=>{let i=Kfr(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():Kfr(t[o],null)}}}}function GO(...t){return Gfr.useCallback(m5n(...t),t)}var yA=j(Y(),1),Jfr=j(st(),1);function X_e(t,e=[]){let r=[];function n(i,a){let s=yA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=yA.useMemo(()=>h,Object.values(h));return(0,Jfr.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=yA.useContext(p);if(h)return h;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=>yA.createContext(a));return function(s){let u=s?.[t]||i;return yA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,h5n(o,...e)]}function h5n(...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 yA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var _b=j(Y(),1);var Zfr=j(Y(),1),Q_e=globalThis?.document?Zfr.useLayoutEffect:()=>{};var eve=j(Y(),1);var g5n=_b[" useInsertionEffect ".trim().toString()]||Q_e;function Yfr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=y5n({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=_b.useRef(t!==void 0);_b.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=_b.useCallback(c=>{if(s){let d=b5n(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function y5n({defaultProp:t,onChange:e}){let[r,n]=_b.useState(t),o=_b.useRef(r),i=_b.useRef(e);return g5n(()=>{i.current=e},[e]),_b.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function b5n(t){return typeof t=="function"}var qKi=Symbol("RADIX:SYNC_STATE");var tve=j(Y(),1),_5n=j(st(),1),v5n=tve.createContext(void 0);function Xfr(t){let e=tve.useContext(v5n);return t||e||"ltr"}var rve=j(Y(),1);function Qfr(t){let e=rve.useRef({value:t,previous:t});return rve.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var epr=j(Y(),1);function tpr(t){let[e,r]=epr.useState(void 0);return Q_e(()=>{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 rpr=j(Y(),1),w5n=j(za(),1);Bv();var npr=j(st(),1),x5n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],RV=x5n.reduce((t,e)=>{let r=kf(`Primitive.${e}`),n=rpr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,npr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var vN=j(Y(),1);Bv();var nve=j(st(),1),S5n=j(Y(),1);var C5n=j(st(),1);function opr(t){let e=t+"CollectionProvider",[r,n]=X_e(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=m=>{let{scope:g,children:y}=m,_=vN.default.useRef(null),w=vN.default.useRef(new Map).current;return(0,nve.jsx)(o,{scope:g,itemMap:w,collectionRef:_,children:y})};a.displayName=e;let s=t+"CollectionSlot",u=kf(s),l=vN.default.forwardRef((m,g)=>{let{scope:y,children:_}=m,w=i(s,y),S=GO(g,w.collectionRef);return(0,nve.jsx)(u,{ref:S,children:_})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=kf(c),p=vN.default.forwardRef((m,g)=>{let{scope:y,children:_,...w}=m,S=vN.default.useRef(null),C=GO(g,S),E=i(c,y);return vN.default.useEffect(()=>(E.itemMap.set(S,{ref:S,...w}),()=>void E.itemMap.delete(S))),(0,nve.jsx)(f,{[d]:"",ref:C,children:_})});p.displayName=c;function h(m){let g=i(t+"CollectionConsumer",m);return vN.default.useCallback(()=>{let _=g.collectionRef.current;if(!_)return[];let w=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((E,P)=>w.indexOf(E.ref.current)-w.indexOf(P.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},h,n]}var Ic=j(st(),1),ipr=["PageUp","PageDown"],apr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],spr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},NV="Slider",[c9e,O5n,E5n]=opr(NV),[upr,mGi]=X_e(NV,[E5n]),[P5n,ove]=upr(NV),lpr=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:h,...m}=t,g=ta.useRef(new Set),y=ta.useRef(0),w=a==="horizontal"?T5n:A5n,[S=[],C]=Yfr({prop:c,defaultProp:l,onChange:M=>{[...g.current][y.current]?.focus(),d(M)}}),E=ta.useRef(S);function P(M){let D=j5n(S,M);N(M,D)}function T(M){N(M,y.current)}function I(){let M=E.current[y.current];S[y.current]!==M&&f(S)}function N(M,D,{commit:k}={commit:!1}){let F=k5n(i),K=$5n(Math.round((M-n)/i)*i+n,F),U=l9e(K,[n,o]);C((X=[])=>{let ee=R5n(X,U,D);if(F5n(ee,u*i)){y.current=ee.indexOf(U);let L=String(ee)!==String(X);return L&&k&&f(ee),L?ee:X}else return X})}return(0,Ic.jsx)(P5n,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:y,thumbs:g.current,values:S,orientation:a,form:h,children:(0,Ic.jsx)(c9e.Provider,{scope:t.__scopeSlider,children:(0,Ic.jsx)(c9e.Slot,{scope:t.__scopeSlider,children:(0,Ic.jsx)(w,{"aria-disabled":s,"data-disabled":s?"":void 0,...m,ref:e,onPointerDown:F$(m.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 K=ipr.includes(M.key)||M.shiftKey&&apr.includes(M.key)?10:1,U=y.current,X=S[U],ee=i*K*D;N(X+ee,U,{commit:!0})}}})})})})});lpr.displayName=NV;var[cpr,dpr]=upr(NV,{startEdge:"left",endEdge:"right",size:"width",direction:1}),T5n=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=GO(e,w=>f(w)),h=ta.useRef(void 0),m=Xfr(o),g=m==="ltr",y=g&&!i||!g&&i;function _(w){let S=h.current||d.getBoundingClientRect(),C=[0,S.width],P=p9e(C,y?[r,n]:[n,r]);return h.current=S,P(w-S.left)}return(0,Ic.jsx)(cpr,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:(0,Ic.jsx)(fpr,{dir:m,"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:()=>{h.current=void 0,u?.()},onStepKeyDown:w=>{let C=spr[y?"from-left":"from-right"].includes(w.key);l?.({event:w,direction:C?-1:1})}})})}),A5n=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=GO(e,c),f=ta.useRef(void 0),p=!o;function h(m){let g=f.current||c.current.getBoundingClientRect(),y=[0,g.height],w=p9e(y,p?[n,r]:[r,n]);return f.current=g,w(m-g.top)}return(0,Ic.jsx)(cpr,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Ic.jsx)(fpr,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{let g=h(m.clientY);i?.(g)},onSlideMove:m=>{let g=h(m.clientY);a?.(g)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:m=>{let y=spr[p?"from-bottom":"from-top"].includes(m.key);u?.({event:m,direction:y?-1:1})}})})}),fpr=ta.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=ove(NV,r);return(0,Ic.jsx)(RV.span,{...l,ref:e,onKeyDown:F$(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):ipr.concat(apr).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:F$(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:F$(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:F$(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),ppr="SliderTrack",mpr=ta.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=ove(ppr,r);return(0,Ic.jsx)(RV.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});mpr.displayName=ppr;var d9e="SliderRange",hpr=ta.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=ove(d9e,r),i=dpr(d9e,r),a=ta.useRef(null),s=GO(e,a),u=o.values.length,l=o.values.map(f=>bpr(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Ic.jsx)(RV.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});hpr.displayName=d9e;var f9e="SliderThumb",gpr=ta.forwardRef((t,e)=>{let r=O5n(t.__scopeSlider),[n,o]=ta.useState(null),i=GO(e,s=>o(s)),a=ta.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Ic.jsx)(I5n,{...t,ref:i,index:a})}),I5n=ta.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=ove(f9e,r),s=dpr(f9e,r),[u,l]=ta.useState(null),c=GO(e,_=>l(_)),d=u?a.form||!!u.closest("form"):!0,f=tpr(u),p=a.values[n],h=p===void 0?0:bpr(p,a.min,a.max),m=N5n(n,a.values.length),g=f?.[s.size],y=g?D5n(g,h,s.direction):0;return ta.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Ic.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${h}% + ${y}px)`},children:[(0,Ic.jsx)(c9e.ItemSlot,{scope:t.__scopeSlider,children:(0,Ic.jsx)(RV.span,{role:"slider","aria-label":t["aria-label"]||m,"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:F$(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Ic.jsx)(ypr,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});gpr.displayName=f9e;var M5n="RadioBubbleInput",ypr=ta.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=ta.useRef(null),i=GO(o,n),a=Qfr(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,Ic.jsx)(RV.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});ypr.displayName=M5n;function R5n(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function bpr(t,e,r){let i=100/(r-e)*(t-e);return l9e(i,[0,100])}function N5n(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function j5n(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 D5n(t,e,r){let n=t/2,i=p9e([0,50],[0,n]);return(n-i(e)*r)*r}function L5n(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function F5n(t,e){if(e>0){let r=L5n(t);return Math.min(...r)>=e}return!0}function p9e(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 k5n(t){return(String(t).split(".")[1]||"").length}function $5n(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var m9e=lpr,_pr=mpr,vpr=hpr,wpr=gpr;xn();var MY=k$.forwardRef(({className:t,...e},r)=>k$.createElement(m9e,{ref:r,className:me("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},k$.createElement(_pr,{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"},k$.createElement(vpr,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),k$.createElement(wpr,{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"})));MY.displayName=m9e.displayName;function RY({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,wN.useState)(t);return(0,wN.useEffect)(()=>{l(t)},[t]),wN.default.createElement("div",{className:me("tw-flex tw-items-center tw-gap-4",a)},wN.default.createElement(MY,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),wN.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},u,s))}or();rh();bt();ir();un();var jV=require("obsidian"),rr=j(Y()),xpr=j($c());function z5n({initialProject:t,onSave:e,onCancel:r}){let n=vn(),[o,i]=(0,rr.useState)(!1),[a,s]=(0,rr.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,rr.useState)(t||{id:Let(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:Rf.TEMPERATURE,maxTokens:Rf.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=th(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=m=>{new J_e(app,async y=>{l(y)},m).open()},f=()=>u.name&&u.projectModelKey,p=(m,g)=>{l(y=>{if(typeof g=="string"&&m==="projectModelKey"&&(g=g.trim()),Array.isArray(g)&&g.every(_=>typeof _=="string")&&(g=g.map(_=>_.trim()).filter(Boolean)),m.includes(".")){let[_,w]=m.split("."),C=y[_];if(typeof C=="object"&&C!==null)return{...y,[_]:{...C,[w]:g}}}return{...y,[m]:g}})},h=async()=>{u.name&&(u.name=u.name.trim());let g=["name","projectModelKey"].filter(y=>!u[y]);if(g.length>0){s(y=>({...y,...Object.fromEntries(g.map(_=>[_,!0]))})),new jV.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(y){new jV.Notice(eo(y)),s(_=>({..._,name:!0}))}finally{i(!1)}};return rr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},rr.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),rr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},rr.default.createElement(Yn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},rr.default.createElement(gi,{type:"text",value:u.name,onChange:m=>p("name",m.target.value),onBlur:()=>s(m=>({...m,name:!0})),className:"tw-w-full"})),rr.default.createElement(Yn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},rr.default.createElement(gi,{type:"text",value:u.description,onChange:m=>p("description",m.target.value),className:"tw-w-full"})),rr.default.createElement(Yn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},rr.default.createElement(J_,{value:u.systemPrompt,onChange:m=>p("systemPrompt",m.target.value),onBlur:()=>s(m=>({...m,systemPrompt:!0})),className:"tw-min-h-32"})),rr.default.createElement(Yn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},rr.default.createElement(Y_e,{value:u.projectModelKey,onChange:m=>{let g=m.target.value,y=n.activeModels.find(S=>S.enabled&&tn(S)===g);if(!y)return;let{hasApiKey:_,errorNotice:w}=tz(y,n);if(!_&&w){new jV.Notice(w);return}p("projectModelKey",g)},onBlur:()=>s(m=>({...m,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(m=>m.enabled&&m.projectEnabled).map(m=>({label:qH(m),value:tn(m)}))})),rr.default.createElement("div",{className:"tw-space-y-4"},rr.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),rr.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},rr.default.createElement(Yn,{label:"Temperature"},rr.default.createElement(RY,{value:u.modelConfigs?.temperature??Rf.TEMPERATURE,onChange:m=>p("modelConfigs.temperature",m),min:0,max:2,step:.01,className:"tw-w-full"})),rr.default.createElement(Yn,{label:"Token Limit"},rr.default.createElement(RY,{value:u.modelConfigs?.maxTokens??Rf.MAX_TOKENS,onChange:m=>p("modelConfigs.maxTokens",m),min:1,max:65e3,step:1,className:"tw-w-full"})))),rr.default.createElement("div",{className:"tw-space-y-4"},rr.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),rr.default.createElement(Yn,{label:rr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rr.default.createElement("span",null,"File Context"),rr.default.createElement(so,{delayDuration:0},rr.default.createElement(St,null,rr.default.createElement(Ct,{asChild:!0},rr.default.createElement($i,{className:"tw-size-4 tw-text-muted"})),rr.default.createElement(_t,null,rr.default.createElement("div",{className:"tw-max-w-80"},rr.default.createElement("strong",null,"Supported File Types:"),rr.default.createElement("br",null),rr.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",rr.default.createElement("br",null),rr.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",rr.default.createElement("br",null),rr.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",rr.default.createElement("br",null),rr.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",rr.default.createElement("br",null),rr.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."},rr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rr.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},rr.default.createElement(xh,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),rr.default.createElement(he,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),rr.default.createElement(Yn,{label:"Web URLs"},rr.default.createElement(J_,{value:u.contextSource?.webUrls,onChange:m=>{let y=m.target.value.split(`
`).map(_=>{if(!_.trim())return _;try{return new URL(_.trim()),_}catch{return _}});p("contextSource.webUrls",y.join(`
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),rr.default.createElement(Yn,{label:"YouTube URLs"},rr.default.createElement(J_,{value:u.contextSource?.youtubeUrls,onChange:m=>{let y=m.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",y.join(`
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),rr.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},rr.default.createElement(he,{variant:"ghost",onClick:r,disabled:o},"Cancel"),rr.default.createElement(he,{onClick:h,disabled:o||!f()},o?"Saving...":"Save")))}var NY=class extends jV.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,xpr.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(rr.default.createElement(z5n,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};po();var ra=j(Y());var pt=j(Y(),1),$9e=j(za(),1);function h9e(t,[e,r]){return Math.min(r,Math.max(e,t))}function Ks(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var xN=j(Y(),1);var bA=j(Y(),1),Spr=j(st(),1);function Cpr(t,e=[]){let r=[];function n(i,a){let s=bA.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[t][u]||s,g=bA.useMemo(()=>h,Object.values(h));return(0,Spr.jsx)(m.Provider,{value:g,children:p})}function c(d,f){let p=f?.[t][u]||s,h=bA.useContext(p);if(h)return h;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=>bA.createContext(a));return function(s){let u=s?.[t]||i;return bA.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,U5n(o,...e)]}function U5n(...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 bA.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var mf=j(Y(),1);var DV=j(st(),1),ive=mf.forwardRef((t,e)=>{let{children:r,...n}=t,o=mf.Children.toArray(r),i=o.find(H5n);if(i){let a=i.props.children,s=o.map(u=>u===i?mf.Children.count(a)>1?mf.Children.only(null):mf.isValidElement(a)?a.props.children:null:u);return(0,DV.jsx)(g9e,{...n,ref:e,children:mf.isValidElement(a)?mf.cloneElement(a,void 0,s):null})}return(0,DV.jsx)(g9e,{...n,ref:e,children:r})});ive.displayName="Slot";var g9e=mf.forwardRef((t,e)=>{let{children:r,...n}=t;if(mf.isValidElement(r)){let o=W5n(r);return mf.cloneElement(r,{...V5n(n,r.props),ref:e?r$(e,o):o})}return mf.Children.count(r)>1?mf.Children.only(null):null});g9e.displayName="SlotClone";var q5n=({children:t})=>(0,DV.jsx)(DV.Fragment,{children:t});function H5n(t){return mf.isValidElement(t)&&t.type===q5n}function V5n(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 W5n(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 ave=j(st(),1);function Opr(t){let e=t+"CollectionProvider",[r,n]=Cpr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:h,children:m}=p,g=xN.default.useRef(null),y=xN.default.useRef(new Map).current;return(0,ave.jsx)(o,{scope:h,itemMap:y,collectionRef:g,children:m})};a.displayName=e;let s=t+"CollectionSlot",u=xN.default.forwardRef((p,h)=>{let{scope:m,children:g}=p,y=i(s,m),_=Vs(h,y.collectionRef);return(0,ave.jsx)(ive,{ref:_,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=xN.default.forwardRef((p,h)=>{let{scope:m,children:g,...y}=p,_=xN.default.useRef(null),w=Vs(h,_),S=i(l,m);return xN.default.useEffect(()=>(S.itemMap.set(_,{ref:_,...y}),()=>void S.itemMap.delete(_))),(0,ave.jsx)(ive,{[c]:"",ref:w,children:g})});d.displayName=l;function f(p){let h=i(t+"CollectionConsumer",p);return xN.default.useCallback(()=>{let g=h.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((S,C)=>y.indexOf(S.ref.current)-y.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Ts=j(Y(),1);var b9e=j(st(),1),K5n="DismissableLayer",y9e="dismissableLayer.update",G5n="dismissableLayer.pointerDownOutside",J5n="dismissableLayer.focusOutside",Epr,Tpr=Ts.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_9e=Ts.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ts.useContext(Tpr),[c,d]=Ts.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ts.useState({}),h=Vs(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=X5n(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=Q5n(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return G1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ts.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Epr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Ppr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Epr)}},[c,f,r,l]),Ts.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Ppr())},[c,l]),Ts.useEffect(()=>{let P=()=>p({});return document.addEventListener(y9e,P),()=>document.removeEventListener(y9e,P)},[]),(0,b9e.jsx)(qi.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Ks(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Ks(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ks(t.onPointerDownCapture,C.onPointerDownCapture)})});_9e.displayName=K5n;var Z5n="DismissableLayerBranch",Y5n=Ts.forwardRef((t,e)=>{let r=Ts.useContext(Tpr),n=Ts.useRef(null),o=Vs(e,n);return Ts.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,b9e.jsx)(qi.div,{...t,ref:o})});Y5n.displayName=Z5n;function X5n(t,e=globalThis?.document){let r=cn(t),n=Ts.useRef(!1),o=Ts.useRef(()=>{});return Ts.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Apr(G5n,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 Q5n(t,e=globalThis?.document){let r=cn(t),n=Ts.useRef(!1);return Ts.useEffect(()=>{let o=i=>{i.target&&!n.current&&Apr(J5n,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 Ppr(){let t=new CustomEvent(y9e);document.dispatchEvent(t)}function Apr(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?Bor(o,i):o.dispatchEvent(i)}var vb=j(Y(),1);var jpr=j(st(),1),v9e="focusScope.autoFocusOnMount",w9e="focusScope.autoFocusOnUnmount",Ipr={bubbles:!1,cancelable:!0},eWn="FocusScope",x9e=vb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=vb.useState(null),l=cn(o),c=cn(i),d=vb.useRef(null),f=Vs(e,m=>u(m)),p=vb.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;vb.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 m=_,g=w,y=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]),vb.useEffect(()=>{if(s){Rpr.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(v9e,Ipr);s.addEventListener(v9e,l),s.dispatchEvent(y),y.defaultPrevented||(tWn(aWn(Dpr(s)),{select:!0}),document.activeElement===m&&SN(s))}return()=>{s.removeEventListener(v9e,l),setTimeout(()=>{let y=new CustomEvent(w9e,Ipr);s.addEventListener(w9e,c),s.dispatchEvent(y),y.defaultPrevented||SN(m??document.body,{select:!0}),s.removeEventListener(w9e,c),Rpr.remove(p)},0)}}},[s,l,c,p]);let h=vb.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=rWn(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&SN(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&SN(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,jpr.jsx)(qi.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});x9e.displayName=eWn;function tWn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(SN(n,{select:e}),document.activeElement!==r)return}function rWn(t){let e=Dpr(t),r=Mpr(e,t),n=Mpr(e.reverse(),t);return[r,n]}function Dpr(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 Mpr(t,e){for(let r of t)if(!nWn(r,{upTo:e}))return r}function nWn(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 oWn(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&&oWn(t)&&e&&t.select()}}var Rpr=iWn();function iWn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Npr(t,e),t.unshift(e)},remove(e){t=Npr(t,e),t[0]?.resume()}}}function Npr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function aWn(t){return t.filter(e=>e.tagName!=="A")}var Mg=j(Y(),1);var Lpr=j(Y(),1);var S9e=j(st(),1),sWn="Arrow",Fpr=Lpr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,S9e.jsx)(qi.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,S9e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Fpr.displayName=sWn;var kpr=Fpr;var _A=j(Y(),1),$pr=j(st(),1);function Bpr(t,e=[]){let r=[];function n(i,a){let s=_A.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...h}=d,m=f?.[t][u]||s,g=_A.useMemo(()=>h,Object.values(h));return(0,$pr.jsx)(m.Provider,{value:g,children:p})}function c(d,f){let p=f?.[t][u]||s,h=_A.useContext(p);if(h)return h;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=>_A.createContext(a));return function(s){let u=s?.[t]||i;return _A.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,lWn(o,...e)]}function lWn(...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 _A.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var CN=j(st(),1);var C9e="Popper",[zpr,O9e]=Bpr(C9e),[cWn,Upr]=zpr(C9e),qpr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Mg.useState(null);return(0,CN.jsx)(cWn,{scope:e,anchor:n,onAnchorChange:o,children:r})};qpr.displayName=C9e;var Hpr="PopperAnchor",Vpr=Mg.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Upr(Hpr,r),a=Mg.useRef(null),s=Vs(e,a);return Mg.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,CN.jsx)(qi.div,{...o,ref:s})});Vpr.displayName=Hpr;var E9e="PopperContent",[dWn,fWn]=zpr(E9e),Wpr=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:h,...m}=t,g=Upr(E9e,r),[y,_]=Mg.useState(null),w=Vs(e,Z=>_(Z)),[S,C]=Mg.useState(null),E=z1(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(mWn),altBoundary:D},{refs:F,floatingStyles:K,placement:U,isPositioned:X,middlewareData:ee}=Y1({strategy:"fixed",placement:I,whileElementsMounted:(...Z)=>sA(...Z,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[X1({mainAxis:o+T,alignmentAxis:a}),u&&Q1({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?eN():void 0,...k}),u&&tN({...k}),rN({...k,apply:({elements:Z,rects:de,availableWidth:pe,availableHeight:ae})=>{let{width:Te,height:Ae}=de.reference,ke=Z.floating.style;ke.setProperty("--radix-popper-available-width",`${pe}px`),ke.setProperty("--radix-popper-available-height",`${ae}px`),ke.setProperty("--radix-popper-anchor-width",`${Te}px`),ke.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),S&&oN({element:S,padding:s}),hWn({arrowWidth:P,arrowHeight:T}),f&&nN({strategy:"referenceHidden",...k})]}),[L,Q]=Jpr(U),z=cn(h);wo(()=>{X&&z?.()},[X,z]);let W=ee.arrow?.x,V=ee.arrow?.y,q=ee.arrow?.centerOffset!==0,[H,G]=Mg.useState();return wo(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),(0,CN.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:X?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(" "),...ee.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,CN.jsx)(dWn,{scope:r,placedSide:L,onArrowChange:C,arrowX:W,arrowY:V,shouldHideArrow:q,children:(0,CN.jsx)(qi.div,{"data-side":L,"data-align":Q,...m,ref:w,style:{...m.style,animation:X?void 0:"none"}})})})});Wpr.displayName=E9e;var Kpr="PopperArrow",pWn={top:"bottom",right:"left",bottom:"top",left:"right"},Gpr=Mg.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=fWn(Kpr,n),a=pWn[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)(kpr,{...o,ref:r,style:{...o.style,display:"block"}})})});Gpr.displayName=Kpr;function mWn(t){return t!==null}var hWn=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]=Jpr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,h="",m="";return l==="bottom"?(h=a?d:`${f}px`,m=`${-u}px`):l==="top"?(h=a?d:`${f}px`,m=`${n.floating.height+u}px`):l==="right"?(h=`${-u}px`,m=a?d:`${p}px`):l==="left"&&(h=`${n.floating.width+u}px`,m=a?d:`${p}px`),{data:{x:h,y:m}}}});function Jpr(t){let[e,r="center"]=t.split("-");return[e,r]}var Zpr=qpr,Ypr=Vpr,Xpr=Wpr,Qpr=Gpr;var sve=j(Y(),1),emr=j(za(),1);var tmr=j(st(),1),yWn="Portal",P9e=sve.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=sve.useState(!1);wo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?emr.default.createPortal((0,tmr.jsx)(qi.div,{...n,ref:e}),a):null});P9e.displayName=yWn;var hf=j(Y(),1);var LV=j(st(),1),A9e=hf.forwardRef((t,e)=>{let{children:r,...n}=t,o=hf.Children.toArray(r),i=o.find(_Wn);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,LV.jsx)(T9e,{...n,ref:e,children:hf.isValidElement(a)?hf.cloneElement(a,void 0,s):null})}return(0,LV.jsx)(T9e,{...n,ref:e,children:r})});A9e.displayName="Slot";var T9e=hf.forwardRef((t,e)=>{let{children:r,...n}=t;if(hf.isValidElement(r)){let o=wWn(r);return hf.cloneElement(r,{...vWn(n,r.props),ref:e?r$(e,o):o})}return hf.Children.count(r)>1?hf.Children.only(null):null});T9e.displayName="SlotClone";var bWn=({children:t})=>(0,LV.jsx)(LV.Fragment,{children:t});function _Wn(t){return hf.isValidElement(t)&&t.type===bWn}function vWn(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 wWn(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 rmr=j(Y(),1);var nmr=j(st(),1),xWn="VisuallyHidden",I9e=rmr.forwardRef((t,e)=>(0,nmr.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}}));I9e.displayName=xWn;var cve=j(Y());var fp=j(Y());var uve=b$();var M9e=function(){},jY=fp.forwardRef(function(t,e){var r=fp.useRef(null),n=fp.useState({onScrollCapture:M9e,onWheelCapture:M9e,onTouchMoveCapture:M9e}),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,h=t.inert,m=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,_=t.gapMode,w=lN(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=y$([r,e]),E=Di(Di({},w),o);return fp.createElement(fp.Fragment,null,c&&fp.createElement(S,{sideCar:uve,removeScrollBar:l,shards:d,noIsolation:p,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:r,gapMode:_}),a?fp.cloneElement(fp.Children.only(s),Di(Di({},E),{ref:C})):fp.createElement(y,Di({},E,{className:u,ref:C}),s))});jY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jY.classNames={fullWidth:tv,zeroRight:ev};var La=j(Y());var R9e=!1;if(typeof window<"u")try{DY=Object.defineProperty({},"passive",{get:function(){return R9e=!0,!0}}),window.addEventListener("test",DY,DY),window.removeEventListener("test",DY,DY)}catch{R9e=!1}var DY,$$=R9e?{passive:!1}:!1;var SWn=function(t){return t.tagName==="TEXTAREA"},omr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!SWn(t)&&r[e]==="visible")},CWn=function(t){return omr(t,"overflowY")},OWn=function(t){return omr(t,"overflowX")},N9e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=imr(t,n);if(o){var i=amr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},EWn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},PWn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},imr=function(t,e){return t==="v"?CWn(e):OWn(e)},amr=function(t,e){return t==="v"?EWn(e):PWn(e)},TWn=function(t,e){return t==="h"&&e==="rtl"?-1:1},smr=function(t,e,r,n,o){var i=TWn(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=amr(t,s),h=p[0],m=p[1],g=p[2],y=m-g-i*h;(h||y)&&imr(t,s)&&(d+=y,f+=h),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 lve=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},umr=function(t){return[t.deltaX,t.deltaY]},lmr=function(t){return t&&"current"in t?t.current:t},AWn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},IWn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},MWn=0,FV=[];function cmr(t){var e=La.useRef([]),r=La.useRef([0,0]),n=La.useRef(),o=La.useState(MWn++)[0],i=La.useState(uA)[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 m=oV([t.lockRef.current],(t.shards||[]).map(lmr),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=La.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var y=lve(m),_=r.current,w="deltaX"in m?m.deltaX:_[0]-y[0],S="deltaY"in m?m.deltaY:_[1]-y[1],C,E=m.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&E.type==="range")return!1;var T=N9e(P,E);if(!T)return!0;if(T?C=P:(C=P==="v"?"h":"v",T=N9e(P,E)),!T)return!1;if(!n.current&&"changedTouches"in m&&(w||S)&&(n.current=C),!C)return!0;var I=n.current||C;return smr(I,g,m,I==="h"?w:S,!0)},[]),u=La.useCallback(function(m){var g=m;if(!(!FV.length||FV[FV.length-1]!==i)){var y="deltaY"in g?umr(g):lve(g),_=e.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&AWn(C.delta,y)})[0];if(_&&_.should){g.cancelable&&g.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(lmr).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=w.length>0?s(g,w[0]):!a.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=La.useCallback(function(m,g,y,_){var w={name:m,delta:g,target:y,should:_,shadowParent:RWn(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),c=La.useCallback(function(m){r.current=lve(m),n.current=void 0},[]),d=La.useCallback(function(m){l(m.type,umr(m),m.target,s(m,t.lockRef.current))},[]),f=La.useCallback(function(m){l(m.type,lve(m),m.target,s(m,t.lockRef.current))},[]);La.useEffect(function(){return FV.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,$$),document.addEventListener("touchmove",u,$$),document.addEventListener("touchstart",c,$$),function(){FV=FV.filter(function(m){return m!==i}),document.removeEventListener("wheel",u,$$),document.removeEventListener("touchmove",u,$$),document.removeEventListener("touchstart",c,$$)}},[]);var p=t.removeScrollBar,h=t.inert;return La.createElement(La.Fragment,null,h?La.createElement(i,{styles:IWn(o)}):null,p?La.createElement(v$,{gapMode:t.gapMode}):null)}function RWn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var dmr=_$(uve,cmr);var fmr=cve.forwardRef(function(t,e){return cve.createElement(jY,Di({},t,{ref:e,sideCar:dmr}))});fmr.classNames=jY.classNames;var LY=fmr;var wr=j(st(),1),NWn=[" ","Enter","ArrowUp","ArrowDown"],jWn=[" ","Enter"],kY="Select",[fve,pve,DWn]=Opr(kY),[kV,d7i]=Qa(kY,[DWn,O9e]),mve=O9e(),[LWn,ON]=kV(kY),[FWn,kWn]=kV(kY),pmr=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:h}=t,m=mve(e),[g,y]=pt.useState(null),[_,w]=pt.useState(null),[S,C]=pt.useState(!1),E=YH(l),[P=!1,T]=tm({prop:n,defaultProp:o,onChange:i}),[I,N]=tm({prop:a,defaultProp:s,onChange:u}),M=pt.useRef(null),D=g?h||!!g.closest("form"):!0,[k,F]=pt.useState(new Set),K=Array.from(k).map(U=>U.props.value).join(";");return(0,wr.jsx)(Zpr,{...m,children:(0,wr.jsxs)(LWn,{required:p,scope:e,trigger:g,onTriggerChange:y,valueNode:_,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Jl(),value:I,onValueChange:N,open:P,onOpenChange:T,dir:E,triggerPointerDownPosRef:M,disabled:f,children:[(0,wr.jsx)(fve.Provider,{scope:e,children:(0,wr.jsx)(FWn,{scope:t.__scopeSelect,onNativeOptionAdd:pt.useCallback(U=>{F(X=>new Set(X).add(U))},[]),onNativeOptionRemove:pt.useCallback(U=>{F(X=>{let ee=new Set(X);return ee.delete(U),ee})},[]),children:r})}),D?(0,wr.jsxs)(kmr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:U=>N(U.target.value),disabled:f,form:h,children:[I===void 0?(0,wr.jsx)("option",{value:""}):null,Array.from(k)]},K):null]})})};pmr.displayName=kY;var mmr="SelectTrigger",hmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=mve(r),a=ON(mmr,r),s=a.disabled||n,u=Vs(e,a.onTriggerChange),l=pve(r),c=pt.useRef("touch"),[d,f,p]=$mr(m=>{let g=l().filter(w=>!w.disabled),y=g.find(w=>w.value===a.value),_=Bmr(g,m,y);_!==void 0&&a.onValueChange(_.value)}),h=m=>{s||(a.onOpenChange(!0),p()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return(0,wr.jsx)(Ypr,{asChild:!0,...i,children:(0,wr.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":Fmr(a.value)?"":void 0,...o,ref:u,onClick:Ks(o.onClick,m=>{m.currentTarget.focus(),c.current!=="mouse"&&h(m)}),onPointerDown:Ks(o.onPointerDown,m=>{c.current=m.pointerType;let g=m.target;g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(h(m),m.preventDefault())}),onKeyDown:Ks(o.onKeyDown,m=>{let g=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(g&&m.key===" ")&&NWn.includes(m.key)&&(h(),m.preventDefault())})})})});hmr.displayName=mmr;var gmr="SelectValue",ymr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=ON(gmr,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Vs(e,u.onValueNodeChange);return wo(()=>{l(c)},[l,c]),(0,wr.jsx)(qi.span,{...s,ref:d,style:{pointerEvents:"none"},children:Fmr(u.value)?(0,wr.jsx)(wr.Fragment,{children:a}):i})});ymr.displayName=gmr;var $Wn="SelectIcon",bmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,wr.jsx)(qi.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});bmr.displayName=$Wn;var BWn="SelectPortal",_mr=t=>(0,wr.jsx)(P9e,{asChild:!0,...t});_mr.displayName=BWn;var B$="SelectContent",vmr=pt.forwardRef((t,e)=>{let r=ON(B$,t.__scopeSelect),[n,o]=pt.useState();if(wo(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?$9e.createPortal((0,wr.jsx)(wmr,{scope:t.__scopeSelect,children:(0,wr.jsx)(fve.Slot,{scope:t.__scopeSelect,children:(0,wr.jsx)("div",{children:t.children})})}),i):null}return(0,wr.jsx)(xmr,{...t,ref:e})});vmr.displayName=B$;var lv=10,[wmr,EN]=kV(B$),zWn="SelectContentImpl",xmr=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:h,hideWhenDetached:m,avoidCollisions:g,...y}=t,_=ON(B$,r),[w,S]=pt.useState(null),[C,E]=pt.useState(null),P=Vs(e,Z=>S(Z)),[T,I]=pt.useState(null),[N,M]=pt.useState(null),D=pve(r),[k,F]=pt.useState(!1),K=pt.useRef(!1);pt.useEffect(()=>{if(w)return uN(w)},[w]),J1();let U=pt.useCallback(Z=>{let[de,...pe]=D().map(Ae=>Ae.ref.current),[ae]=pe.slice(-1),Te=document.activeElement;for(let Ae of Z)if(Ae===Te||(Ae?.scrollIntoView({block:"nearest"}),Ae===de&&C&&(C.scrollTop=0),Ae===ae&&C&&(C.scrollTop=C.scrollHeight),Ae?.focus(),document.activeElement!==Te))return},[D,C]),X=pt.useCallback(()=>U([T,w]),[U,T,w]);pt.useEffect(()=>{k&&X()},[k,X]);let{onOpenChange:ee,triggerPointerDownPosRef:L}=_;pt.useEffect(()=>{if(w){let Z={x:0,y:0},de=ae=>{Z={x:Math.abs(Math.round(ae.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(ae.pageY)-(L.current?.y??0))}},pe=ae=>{Z.x<=10&&Z.y<=10?ae.preventDefault():w.contains(ae.target)||ee(!1),document.removeEventListener("pointermove",de),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",pe,{capture:!0})}}},[w,ee,L]),pt.useEffect(()=>{let Z=()=>ee(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[ee]);let[Q,z]=$mr(Z=>{let de=D().filter(Te=>!Te.disabled),pe=de.find(Te=>Te.ref.current===document.activeElement),ae=Bmr(de,Z,pe);ae&&setTimeout(()=>ae.ref.current.focus())}),W=pt.useCallback((Z,de,pe)=>{let ae=!K.current&&!pe;(_.value!==void 0&&_.value===de||ae)&&(I(Z),ae&&(K.current=!0))},[_.value]),V=pt.useCallback(()=>w?.focus(),[w]),q=pt.useCallback((Z,de,pe)=>{let ae=!K.current&&!pe;(_.value!==void 0&&_.value===de||ae)&&M(Z)},[_.value]),H=n==="popper"?j9e:Smr,G=H===j9e?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:m,avoidCollisions:g}:{};return(0,wr.jsx)(wmr,{scope:r,content:w,viewport:C,onViewportChange:E,itemRefCallback:W,selectedItem:T,onItemLeave:V,itemTextRefCallback:q,focusSelectedItem:X,selectedItemText:N,position:n,isPositioned:k,searchRef:Q,children:(0,wr.jsx)(LY,{as:A9e,allowPinchZoom:!0,children:(0,wr.jsx)(x9e,{asChild:!0,trapped:_.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Ks(o,Z=>{_.trigger?.focus({preventScroll:!0}),Z.preventDefault()}),children:(0,wr.jsx)(_9e,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:(0,wr.jsx)(H,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:Z=>Z.preventDefault(),...y,...G,onPlaced:()=>F(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Ks(y.onKeyDown,Z=>{let de=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!de&&Z.key.length===1&&z(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ae=D().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){let Te=Z.target,Ae=ae.indexOf(Te);ae=ae.slice(Ae+1)}setTimeout(()=>U(ae)),Z.preventDefault()}})})})})})})});xmr.displayName=zWn;var UWn="SelectItemAlignedPosition",Smr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=ON(B$,r),a=EN(B$,r),[s,u]=pt.useState(null),[l,c]=pt.useState(null),d=Vs(e,P=>c(P)),f=pve(r),p=pt.useRef(!1),h=pt.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:y,focusSelectedItem:_}=a,w=pt.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&m&&g&&y){let P=i.trigger.getBoundingClientRect(),T=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),N=y.getBoundingClientRect();if(i.dir!=="rtl"){let Te=N.left-T.left,Ae=I.left-Te,ke=P.left-Ae,Ot=P.width+ke,jr=Math.max(Ot,T.width),Mr=window.innerWidth-lv,Vn=h9e(Ae,[lv,Math.max(lv,Mr-jr)]);s.style.minWidth=Ot+"px",s.style.left=Vn+"px"}else{let Te=T.right-N.right,Ae=window.innerWidth-I.right-Te,ke=window.innerWidth-P.right-Ae,Ot=P.width+ke,jr=Math.max(Ot,T.width),Mr=window.innerWidth-lv,Vn=h9e(Ae,[lv,Math.max(lv,Mr-jr)]);s.style.minWidth=Ot+"px",s.style.right=Vn+"px"}let M=f(),D=window.innerHeight-lv*2,k=m.scrollHeight,F=window.getComputedStyle(l),K=parseInt(F.borderTopWidth,10),U=parseInt(F.paddingTop,10),X=parseInt(F.borderBottomWidth,10),ee=parseInt(F.paddingBottom,10),L=K+U+k+ee+X,Q=Math.min(g.offsetHeight*5,L),z=window.getComputedStyle(m),W=parseInt(z.paddingTop,10),V=parseInt(z.paddingBottom,10),q=P.top+P.height/2-lv,H=D-q,G=g.offsetHeight/2,Z=g.offsetTop+G,de=K+U+Z,pe=L-de;if(de<=q){let Te=M.length>0&&g===M[M.length-1].ref.current;s.style.bottom="0px";let Ae=l.clientHeight-m.offsetTop-m.offsetHeight,ke=Math.max(H,G+(Te?V:0)+Ae+X),Ot=de+ke;s.style.height=Ot+"px"}else{let Te=M.length>0&&g===M[0].ref.current;s.style.top="0px";let ke=Math.max(q,K+m.offsetTop+(Te?W:0)+G)+pe;s.style.height=ke+"px",m.scrollTop=de-q+m.offsetTop}s.style.margin=`${lv}px 0`,s.style.minHeight=Q+"px",s.style.maxHeight=D+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,m,g,y,i.dir,n]);wo(()=>w(),[w]);let[S,C]=pt.useState();wo(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let E=pt.useCallback(P=>{P&&h.current===!0&&(w(),_?.(),h.current=!1)},[w,_]);return(0,wr.jsx)(HWn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:E,children:(0,wr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,wr.jsx)(qi.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Smr.displayName=UWn;var qWn="SelectPopperPosition",j9e=pt.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=lv,...i}=t,a=mve(r);return(0,wr.jsx)(Xpr,{...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)"}})});j9e.displayName=qWn;var[HWn,B9e]=kV(B$,{}),D9e="SelectViewport",Cmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=EN(D9e,r),a=B9e(D9e,r),s=Vs(e,i.onViewportChange),u=pt.useRef(0);return(0,wr.jsxs)(wr.Fragment,{children:[(0,wr.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,wr.jsx)(fve.Slot,{scope:r,children:(0,wr.jsx)(qi.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ks(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 h=window.innerHeight-lv*2,m=parseFloat(d.style.minHeight),g=parseFloat(d.style.height),y=Math.max(m,g);if(y<h){let _=y+p,w=Math.min(h,_),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})})})]})});Cmr.displayName=D9e;var Omr="SelectGroup",[VWn,WWn]=kV(Omr),KWn=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Jl();return(0,wr.jsx)(VWn,{scope:r,id:o,children:(0,wr.jsx)(qi.div,{role:"group","aria-labelledby":o,...n,ref:e})})});KWn.displayName=Omr;var Emr="SelectLabel",Pmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=WWn(Emr,r);return(0,wr.jsx)(qi.div,{id:o.id,...n,ref:e})});Pmr.displayName=Emr;var dve="SelectItem",[GWn,Tmr]=kV(dve),Amr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=ON(dve,r),u=EN(dve,r),l=s.value===n,[c,d]=pt.useState(i??""),[f,p]=pt.useState(!1),h=Vs(e,_=>u.itemRefCallback?.(_,n,o)),m=Jl(),g=pt.useRef("touch"),y=()=>{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,wr.jsx)(GWn,{scope:r,value:n,disabled:o,textId:m,isSelected:l,onItemTextChange:pt.useCallback(_=>{d(w=>w||(_?.textContent??"").trim())},[]),children:(0,wr.jsx)(fve.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,wr.jsx)(qi.div,{role:"option","aria-labelledby":m,"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:h,onFocus:Ks(a.onFocus,()=>p(!0)),onBlur:Ks(a.onBlur,()=>p(!1)),onClick:Ks(a.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:Ks(a.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:Ks(a.onPointerDown,_=>{g.current=_.pointerType}),onPointerMove:Ks(a.onPointerMove,_=>{g.current=_.pointerType,o?u.onItemLeave?.():g.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ks(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Ks(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(jWn.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});Amr.displayName=dve;var FY="SelectItemText",Imr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=ON(FY,r),s=EN(FY,r),u=Tmr(FY,r),l=kWn(FY,r),[c,d]=pt.useState(null),f=Vs(e,y=>d(y),u.onItemTextChange,y=>s.itemTextRefCallback?.(y,u.value,u.disabled)),p=c?.textContent,h=pt.useMemo(()=>(0,wr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=l;return wo(()=>(m(h),()=>g(h)),[m,g,h]),(0,wr.jsxs)(wr.Fragment,{children:[(0,wr.jsx)(qi.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?$9e.createPortal(i.children,a.valueNode):null]})});Imr.displayName=FY;var Mmr="SelectItemIndicator",Rmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return Tmr(Mmr,r).isSelected?(0,wr.jsx)(qi.span,{"aria-hidden":!0,...n,ref:e}):null});Rmr.displayName=Mmr;var L9e="SelectScrollUpButton",Nmr=pt.forwardRef((t,e)=>{let r=EN(L9e,t.__scopeSelect),n=B9e(L9e,t.__scopeSelect),[o,i]=pt.useState(!1),a=Vs(e,n.onScrollButtonChange);return wo(()=>{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,wr.jsx)(Dmr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});Nmr.displayName=L9e;var F9e="SelectScrollDownButton",jmr=pt.forwardRef((t,e)=>{let r=EN(F9e,t.__scopeSelect),n=B9e(F9e,t.__scopeSelect),[o,i]=pt.useState(!1),a=Vs(e,n.onScrollButtonChange);return wo(()=>{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,wr.jsx)(Dmr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});jmr.displayName=F9e;var Dmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=EN("SelectScrollButton",r),a=pt.useRef(null),s=pve(r),u=pt.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return pt.useEffect(()=>()=>u(),[u]),wo(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,wr.jsx)(qi.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Ks(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Ks(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Ks(o.onPointerLeave,()=>{u()})})}),JWn="SelectSeparator",Lmr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,wr.jsx)(qi.div,{"aria-hidden":!0,...n,ref:e})});Lmr.displayName=JWn;var k9e="SelectArrow",ZWn=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=mve(r),i=ON(k9e,r),a=EN(k9e,r);return i.open&&a.position==="popper"?(0,wr.jsx)(Qpr,{...o,...n,ref:e}):null});ZWn.displayName=k9e;function Fmr(t){return t===""||t===void 0}var kmr=pt.forwardRef((t,e)=>{let{value:r,...n}=t,o=pt.useRef(null),i=Vs(e,o),a=mbe(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,wr.jsx)(I9e,{asChild:!0,children:(0,wr.jsx)("select",{...n,ref:i,defaultValue:r})})});kmr.displayName="BubbleSelect";function $mr(t){let e=cn(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 Bmr(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=YWn(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 YWn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var zmr=pmr,z9e=hmr,Umr=ymr,qmr=bmr,Hmr=_mr,U9e=vmr,Vmr=Cmr;var q9e=Pmr,H9e=Amr,Wmr=Imr,Kmr=Rmr,V9e=Nmr,W9e=jmr,K9e=Lmr;un();xn();var PN=zmr;var TN=Umr,vA=ra.forwardRef(({className:t,children:e,...r},n)=>ra.createElement(z9e,{ref:n,className:me("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(qmr,{asChild:!0},ra.createElement(ki,{className:"tw-size-4"}))));vA.displayName=z9e.displayName;var Gmr=ra.forwardRef(({className:t,...e},r)=>ra.createElement(V9e,{ref:r,className:me("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ra.createElement(Hb,{className:"tw-size-4"})));Gmr.displayName=V9e.displayName;var Jmr=ra.forwardRef(({className:t,...e},r)=>ra.createElement(W9e,{ref:r,className:me("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ra.createElement(ki,{className:"tw-size-4"})));Jmr.displayName=W9e.displayName;var wA=ra.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>ra.createElement(Hmr,{container:n},ra.createElement(U9e,{ref:i,className:me("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(Gmr,null),ra.createElement(Vmr,{className:me("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(Jmr,null))));wA.displayName=U9e.displayName;var QWn=ra.forwardRef(({className:t,...e},r)=>ra.createElement(q9e,{ref:r,className:me("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));QWn.displayName=q9e.displayName;var xA=ra.forwardRef(({className:t,children:e,...r},n)=>ra.createElement(H9e,{ref:n,className:me("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(Kmr,null,ra.createElement(ls,{className:"tw-size-4"}))),ra.createElement(Wmr,null,e)));xA.displayName=H9e.displayName;var e9n=ra.forwardRef(({className:t,...e},r)=>ra.createElement(K9e,{ref:r,className:me("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));e9n.displayName=K9e.displayName;xn();Gt();bt();un();var Ymr=require("obsidian"),$e=j(Y());function t9n(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 Zmr(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>t9n(n,e,r)):t}function r9n({project:t,loadContext:e,onEdit:r,onDelete:n}){return $e.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)},$e.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},$e.default.createElement("div",{className:"tw-text-accent"},$e.default.createElement(uy,{className:"tw-size-4"})),$e.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},$e.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&$e.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),$e.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},$e.default.createElement(St,null,$e.default.createElement(Ct,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},$e.default.createElement(qh,{className:"tw-size-4"}))),$e.default.createElement(_t,{side:"bottom"},"Edit Project")),$e.default.createElement(St,null,$e.default.createElement(Ct,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},$e.default.createElement(Wz,{className:"tw-size-4"}))),$e.default.createElement(_t,{side:"bottom"},"Start Chat")),$e.default.createElement(St,null,$e.default.createElement(Ct,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new Tc(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},$e.default.createElement(Vh,{className:"tw-size-4"}))),$e.default.createElement(_t,{side:"bottom"},"Delete Project"))))}var G9e=(0,$e.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,$e.useState)(r),[p,h]=(0,$e.useState)(!1),[m,g]=(0,$e.useState)(null),[y,_]=(0,$e.useState)("");(0,$e.useEffect)(()=>{a&&f(!1)},[a]);let w=(0,$e.useMemo)(()=>Zmr(e,y),[e,y]),S=()=>{new NY(n,async N=>{o(N)}).open()},C=I=>{new NY(n,async M=>{i(I,M),m&&m.name===I.name&&g(M)},I).open()},E=I=>{let M=(e||[]).filter(D=>D.name!==I.name);m?.name===I.name&&P(!1),nt("projectList",M),new Ymr.Notice(`Project "${I.name}" deleted successfully`)},P=(I,N)=>{if(I){if(!N){ie("Must be exist one project.");return}g(N),h(!0),f(!1)}else{g(null),h(!1),f(!0),s(!1),Lj(null);return}},T=I=>{g(I),h(!0),f(!1),s(!0),Lj(I),setTimeout(()=>{l.current&&l.current.focus()},0)};return $e.default.createElement("div",{className:me("tw-flex tw-flex-col",t)},$e.default.createElement("div",{className:"tw-overflow-y-auto"},$e.default.createElement("div",{className:"tw-flex tw-flex-col"},p&&m?$e.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),$e.default.createElement(PN,{value:m.name,onValueChange:I=>{let N=e.find(M=>M.name===I);N&&T(N)}},$e.default.createElement(vA,{className:"tw-w-[200px]"},$e.default.createElement(TN,null,$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(uy,{className:"tw-size-4 tw-text-accent/70"}),$e.default.createElement("span",null,m.name)))),$e.default.createElement(wA,null,e.map(I=>$e.default.createElement(xA,{key:I.name,value:I.name,className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(uy,{className:"tw-size-4"}),I.name)))))),$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(he,{variant:"secondary",onClick:()=>C(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},$e.default.createElement(qh,{className:"tw-mr-1 tw-size-4"}),"Edit"),$e.default.createElement(St,null,$e.default.createElement(Ct,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:()=>{P(!1),c()},"aria-label":"Close Current Project"},$e.default.createElement(vi,{className:"tw-size-4"}))),$e.default.createElement(_t,{side:"bottom"},"Close Current Project")))):$e.default.createElement(iv,{open:d,onOpenChange:f,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},$e.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},$e.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),$e.default.createElement(St,null,$e.default.createElement(Ct,{asChild:!0},$e.default.createElement(qv,{className:"tw-size-4 tw-text-muted"})),$e.default.createElement(_t,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(he,{className:"tw-px-2",variant:"secondary",onClick:S},"Create",$e.default.createElement(Hh,{className:"tw-size-3"})),e.length>0&&$e.default.createElement(fA,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon"},d?$e.default.createElement(Hb,{className:"tw-size-5"}):$e.default.createElement(ki,{className:"tw-size-5"}))),$e.default.createElement(St,null,$e.default.createElement(Ct,{asChild:!0},$e.default.createElement(he,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},$e.default.createElement(vi,{className:"tw-size-4"}))),$e.default.createElement(_t,{side:"bottom"},"Close Project Mode")))),e.length===0&&$e.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),$e.default.createElement(av,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},$e.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&$e.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},$e.default.createElement("div",{className:"tw-relative"},$e.default.createElement(G_e,{value:y,onChange:_,placeholder:"Search projects..."}))),$e.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},$e.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=>$e.default.createElement(r9n,{key:I.name,project:I,loadContext:T,onEdit:C,onDelete:E}))),y.trim()&&w.length===0&&$e.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},$e.default.createElement(nD,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),$e.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),$e.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&$e.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&&$e.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"},$e.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},$e.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),$e.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},$e.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$e.default.createElement(Wz,{className:"tw-size-4"}),$e.default.createElement("span",null,"Click a project card to start chatting")))))))});G9e.displayName="ProjectList";var Ur=j(Y()),tKe=j(Y());var $Y=j(Y());var Z9e=j(Y(),1);var SA=j(Y(),1),Xmr=j(st(),1);function Qmr(t,e=[]){let r=[];function n(i,a){let s=SA.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...h}=d,m=f?.[t]?.[u]||s,g=SA.useMemo(()=>h,Object.values(h));return(0,Xmr.jsx)(m.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,h=SA.useContext(p);if(h)return h;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=>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,n9n(o,...e)]}function n9n(...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 ehr=j(Y(),1),o9n=j(za(),1);Bv();var thr=j(st(),1),i9n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J9e=i9n.reduce((t,e)=>{let r=kf(`Primitive.${e}`),n=ehr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,thr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var hve=j(st(),1),Y9e="Progress",X9e=100,[a9n,k7i]=Qmr(Y9e),[s9n,u9n]=a9n(Y9e),ohr=Z9e.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=l9n,...a}=t;(o||o===0)&&!rhr(o)&&console.error(c9n(`${o}`,"Progress"));let s=rhr(o)?o:X9e;n!==null&&!nhr(n,s)&&console.error(d9n(`${n}`,"Progress"));let u=nhr(n,s)?n:null,l=gve(u)?i(u,s):void 0;return(0,hve.jsx)(s9n,{scope:r,value:u,max:s,children:(0,hve.jsx)(J9e.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":gve(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":shr(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});ohr.displayName=Y9e;var ihr="ProgressIndicator",ahr=Z9e.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=u9n(ihr,r);return(0,hve.jsx)(J9e.div,{"data-state":shr(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});ahr.displayName=ihr;function l9n(t,e){return`${Math.round(t/e*100)}%`}function shr(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function gve(t){return typeof t=="number"}function rhr(t){return gve(t)&&!isNaN(t)&&t>0}function nhr(t,e){return gve(t)&&!isNaN(t)&&t<=e&&t>=0}function c9n(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${X9e}\`.`}function d9n(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 ${X9e} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var Q9e=ohr,uhr=ahr;xn();var eKe=$Y.forwardRef(({className:t,value:e,...r},n)=>$Y.createElement(Q9e,{ref:n,className:me("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},$Y.createElement(uhr,{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)}%)`}})));eKe.displayName=Q9e.displayName;un();ua();po();Gt();function rKe({plugin:t,setHiddenCard:e}){let[r]=Fee(),n=r.total,o=r.success,i=r.failed,a=r.processingFiles,[s,u]=(0,tKe.useState)(!1),[l,c]=(0,tKe.useState)(!1),d=o.length+i.length,f=n.length>0?Math.round(d/n.length*100):0,p=m=>m.path,h=async m=>{if(!t?.projectManager){ie("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(m)}catch(g){ie(`Error retrying failed item: ${g}`)}};return Ur.createElement(I$,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},Ur.createElement(M$,null,Ur.createElement(SY,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Ur.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ur.createElement(Fm,{className:"tw-size-5"}),"Context Loading"),Ur.createElement(he,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},Ur.createElement(vi,{className:"tw-size-4"})))),Ur.createElement(R$,{className:"tw-space-y-6"},Ur.createElement("div",{className:"tw-space-y-2"},Ur.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},Ur.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ur.createElement("span",{className:"tw-text-muted"},"Total progress"),Ur.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",Ur.createElement("span",{className:"tw-font-medium tw-text-success"},o.length),", Failed: ",Ur.createElement("span",{className:"tw-font-medium tw-text-error"},i.length),")")),Ur.createElement("span",{className:"tw-font-medium"},d,"/",n.length," (",f,"%)")),Ur.createElement(eKe,{value:f,className:"tw-h-2"})),a.length>0&&Ur.createElement("div",{className:"tw-space-y-3"},Ur.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)},Ur.createElement(nu,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),Ur.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),s?Ur.createElement(ki,{className:"tw-ml-auto tw-size-4"}):Ur.createElement(Lm,{className:"tw-ml-auto tw-size-4"})),s&&Ur.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((m,g)=>Ur.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},Ur.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),Ur.createElement(xh,{className:"tw-flex-1",title:m},m))))),i.length>0&&Ur.createElement("div",{className:"tw-space-y-3"},Ur.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ur.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)},Ur.createElement(zv,{className:"tw-size-4 tw-text-error"}),Ur.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),Ur.createElement(cp,{variant:"destructive",className:"tw-text-xs"},i.length," files"),l?Ur.createElement(ki,{className:"tw-ml-auto tw-size-4"}):Ur.createElement(Lm,{className:"tw-ml-auto tw-size-4"}))),l&&Ur.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},i.map((m,g)=>Ur.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},Ur.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},Ur.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ur.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),Ur.createElement(xh,{className:"tw-flex-1 tw-font-bold",title:m.path},p(m))),Ur.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ur.createElement("div",{className:"tw-size-2 tw-rounded-full"}),m.error&&Ur.createElement(xh,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:m.error},Ur.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),m.error))),Ur.createElement(he,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${m.type} item`,onClick:async y=>{y.stopPropagation(),await h(m)}},Ur.createElement(M5,{className:"tw-size-3"}))))))))}or();var md=j(Y());function lhr(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(g,y,_,w=!1)=>await t.sendMessage(g,y,_,w),[t]),o=(0,md.useCallback)(async(g,y,_,w=!1)=>await t.editMessage(g,y,_,w),[t]),i=(0,md.useCallback)(async(g,y,_)=>await t.regenerateMessage(g,y,_),[t]),a=(0,md.useCallback)(async g=>await t.deleteMessage(g),[t]),s=(0,md.useCallback)((g,y,_)=>t.addDisplayMessage(g,y,_),[t]),u=(0,md.useCallback)(g=>t.addFullMessage(g),[t]),l=(0,md.useCallback)(()=>{t.clearMessages()},[t]),c=(0,md.useCallback)(async g=>{await t.truncateAfterMessageId(g)},[t]),d=(0,md.useCallback)(g=>{t.addMessage(g)},[t]),f=(0,md.useCallback)(g=>{t.loadMessages(g)},[t]),p=(0,md.useCallback)(g=>t.getMessage(g),[t]),h=(0,md.useCallback)(()=>t.getLLMMessages(),[t]),m=(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:h,getDebugInfo:m}}or();ir();Gt();zN();var nKe=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: "+eo(s);r({id:dm(),sender:Zg,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:tu(new Date)})}};Mde();ly();bt();ir();var chr=j(Im()),Ql=require("obsidian"),nr=j(Y()),p9n=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i})=>{let a=vn(),s=(0,nr.useContext)(yV),{messages:u,addMessage:l}=lhr(i),[c]=oI(),[d]=Rp(),[f,p]=(0,nr.useState)(""),[h,m]=(0,nr.useState)(""),g=(0,nr.useRef)(null),y=(0,nr.useCallback)(le=>{g.current=le},[]),[_,w]=(0,nr.useState)(!1),[S,C]=(0,nr.useState)(Iv.DEFAULT),[E,P]=(0,nr.useState)([]),[T,I]=(0,nr.useState)(!1),[N,M]=(0,nr.useState)([]),[D,k]=(0,nr.useState)(!1),[F,K]=(0,nr.useState)(null),U=(0,nr.useRef)(!1),X=(0,nr.useMemo)(()=>({setCurrentAiMessage:le=>U.current&&p(le),setLoadingMessage:le=>U.current&&C(le),setLoading:le=>U.current&&w(le)}),[]),[ee]=vtt(),L=Obe(),Q=()=>V!=="project"?!1:F!==null?F:L==="loading"||L==="error";(0,nr.useEffect)(()=>{K(null)},[L]);let[z,W]=(0,nr.useState)(null),[V,q]=Rp(),H=f4(),G=fR.getInstance(),Z=(0,nr.useRef)(null);(0,nr.useEffect)(()=>{let le=()=>{Z.current&&Z.current.focus()};return s?.addEventListener(Xg.CHAT_IS_VISIBLE,le),()=>{s?.removeEventListener(Xg.CHAT_IS_VISIBLE,le)}},[s]);let de=(0,nr.useContext)(P_e),pe=o.app||de,ae=async({toolCalls:le,urls:ne,contextNotes:fe}={})=>{if(!h&&N.length===0)return;let be=ne&&ne.length>0,ye=h&&G.extractAllUrls(h).length>0;(be||ye)&&!jh(d)&&new Ql.Notice(iz.URL_PROCESSING_RESTRICTED);try{let ze=[];h&&ze.push({type:"text",text:h});for(let gd of N){let yd=await gd.arrayBuffer(),_f=chr.Buffer.from(yd).toString("base64");ze.push({type:"image_url",image_url:{url:`data:${gd.type};base64,${_f}`}})}let Ii=[...fe||[],...E].filter((gd,yd,_f)=>_f.findIndex(Wn=>Wn.path===gd.path)===yd),_i=h;le&&(_i+=" "+le.join(`
`));let bf={notes:Ii,urls:jh(d)?ne||[]:[],selectedTextContexts:ee};m(""),M([]),X.setLoading(!0),X.setLoadingMessage(Iv.DEFAULT);let mp=await i.sendMessage(_i,bf,d,T,ze.length>0?ze:void 0);h&&r(h),a.autosaveChat&&Te();let Hi=i.getLLMMessage(mp);Hi&&await nKe(Hi,t,l,X.setCurrentAiMessage,y,{debug:a.debug,updateLoadingMessage:X.setLoadingMessage}),a.autosaveChat&&Te()}catch(ze){console.error("Error sending message:",ze),new Ql.Notice("Failed to send message. Please try again.")}finally{X.setLoading(!1),X.setLoadingMessage(Iv.DEFAULT)}},Te=(0,nr.useCallback)(async()=>{if(!pe){console.error("App instance is not available.");return}try{await i.saveChat(c)}catch(le){console.error("Error saving chat as note:",eo(le)),new Ql.Notice("Failed to save chat as note. Check console for details.")}},[pe,i,c]),Ae=(0,nr.useCallback)(le=>{g.current&&(B(`stopping generation..., reason: ${le}`),g.current.abort(le),X.setLoading(!1),X.setLoadingMessage(Iv.DEFAULT))},[X]);(0,nr.useEffect)(()=>(U.current=!0,()=>{U.current=!1,g.current&&g.current.abort("component-unmount")}),[]);let ke=(0,nr.useCallback)(async le=>{if(le<=0){new Ql.Notice("Cannot regenerate the first message.");return}let ne=u[le];if(!ne){new Ql.Notice("Message not found.");return}X.setCurrentAiMessage(""),X.setLoading(!0);try{await i.regenerateMessage(ne.id,X.setCurrentAiMessage,l)?a.debug&&console.log("Message regenerated successfully"):new Ql.Notice("Failed to regenerate message. Please try again."),a.autosaveChat&&Te()}catch(fe){console.error("Error regenerating message:",fe),new Ql.Notice("Failed to regenerate message. Please try again.")}finally{X.setLoading(!1)}},[u,i,a.debug,a.autosaveChat,Te,l,X]),Ot=(0,nr.useCallback)(async(le,ne)=>{let fe=u[le];if(!(!fe||fe.message===ne))try{if(!await i.editMessage(fe.id,ne,d,T)){new Ql.Notice("Failed to edit message. Please try again.");return}if(fe.sender===Fo){let ye=le<u.length-1;if(await i.truncateAfterMessageId(fe.id),ye){X.setLoading(!0);try{let ze=i.getLLMMessage(fe.id);ze&&await nKe(ze,t,l,X.setCurrentAiMessage,y,{debug:a.debug,updateLoadingMessage:X.setLoadingMessage})}catch(ze){console.error("Error regenerating AI response:",ze),new Ql.Notice("Failed to regenerate AI response. Please try again.")}finally{X.setLoading(!1)}}}a.autosaveChat&&Te()}catch(be){console.error("Error editing message:",be),new Ql.Notice("Failed to edit message. Please try again.")}},[u,i,d,T,l,t,a.debug,a.autosaveChat,Te,X,y]);(0,nr.useEffect)(()=>{e&&e(Te)},[e,Te]);let jr=(0,nr.useCallback)(le=>{let ne=a.projectList||[];if(ne.findIndex(ze=>ze.name===le.name)>=0)throw new Error(`Project "${le.name}" already exists, please use a different name`);let be=[...ne,le];return nt("projectList",be),wu()?.id===le.id?c_e().then(()=>{new Ql.Notice(`${le.name} added and context loaded`)}).catch(ze=>{console.error("Error loading project context:",ze),new Ql.Notice(`${le.name} added but context loading failed`)}):new Ql.Notice(`${le.name} added successfully`),!0},[a.projectList]),Mr=(0,nr.useCallback)((le,ne)=>{let fe=a.projectList||[];if(!fe.find(hr=>hr.name===le.name))throw new Error(`Project "${le.name}" does not exist`);let ye=fe.map(hr=>hr.name===le.name?ne:hr);return nt("projectList",ye),wu()?.id===le.id?(Lj(ne),c_e().then(()=>{new Ql.Notice(`${le.name} updated and context reloaded`)}).catch(hr=>{console.error("Error reloading project context:",hr),new Ql.Notice(`${le.name} updated but context reload failed`)})):new Ql.Notice(`${le.name} updated successfully`),!0},[a.projectList]),Vn=(0,nr.useCallback)(le=>{m(ne=>`${ne} ${le} `)},[]),Xr=(0,nr.useCallback)(le=>{btt(le)},[]),Cr=(0,nr.useCallback)(async le=>{let ne=u[le];if(!ne){new Ql.Notice("Message not found.");return}try{await i.deleteMessage(ne.id)||new Ql.Notice("Failed to delete message. Please try again.")}catch(fe){console.error("Error deleting message:",fe),new Ql.Notice("Failed to delete message. Please try again.")}},[u,i]),Me=(0,nr.useCallback)(async()=>{Ae("new-chat"),a.autosaveChat&&await Te(),i.clearMessages(),X.setCurrentAiMessage(""),P([]),_tt(),V!=="copilot_plus"?I(!1):I(a.includeActiveNoteAsContext)},[Ae,i,a.autosaveChat,a.includeActiveNoteAsContext,V,Te,X]),Ze=(0,nr.useCallback)(()=>{o.loadCopilotChatHistory()},[o]);(0,nr.useEffect)(()=>{let le=ne=>{let fe=ne.detail?.reason||"new-chat";Ae(fe)};return s?.addEventListener(Xg.ABORT_STREAM,le),()=>{s?.removeEventListener(Xg.ABORT_STREAM,le)}},[s,Ae]),(0,nr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(V==="copilot_plus"?I(a.includeActiveNoteAsContext):I(!1))},[a.includeActiveNoteAsContext,V]);let je=()=>nr.default.createElement(nr.default.Fragment,null,nr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},nr.default.createElement(Bdr,{currentVersion:o.manifest.version}),nr.default.createElement($dr,{chatHistory:u,currentAiMessage:f,loading:_,loadingMessage:S,app:pe,onRegenerate:ke,onEdit:Ot,onDelete:Cr,onInsertToChat:Vn,onReplaceChat:m,showHelperComponents:V!=="project"}),Q()?nr.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},nr.default.createElement(rKe,{plugin:o,setHiddenCard:()=>{K(!1)}})):nr.default.createElement(nr.default.Fragment,null,nr.default.createElement(xlr,{onNewChat:Me,onSaveAsNote:()=>Te(),onLoadHistory:Ze,onModeChange:le=>{W(V),le==="project"&&k(!1)}}),nr.default.createElement(bcr,{ref:Z,inputMessage:h,setInputMessage:m,handleSendMessage:ae,isGenerating:_,onStopGenerating:()=>Ae("user-stopped"),app:pe,contextNotes:E,setContextNotes:P,includeActiveNote:T,setIncludeActiveNote:I,mention:G,selectedImages:N,onAddImage:le=>M(ne=>[...ne,...le]),setSelectedImages:M,disableModelSwitch:V==="project",selectedTextContexts:ee,onRemoveSelectedText:Xr,showProgressCard:()=>{K(!0)}}))));return nr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},nr.default.createElement("div",{className:"tw-h-full"},nr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},V==="project"&&nr.default.createElement("div",{className:`${V==="project"?"tw-z-modal":""}`},nr.default.createElement(G9e,{projects:a.projectList||[],defaultOpen:!0,app:pe,hasMessages:!1,onProjectAdded:jr,onEditProject:Mr,inputRef:Z,onClose:()=>{z?(q(z),W(null)):q(H?"copilot_plus":"llm_chain")},showChatUI:le=>k(le),onProjectClose:()=>{K(null)}})),(V!=="project"||V==="project"&&D)&&je())))},dhr=p9n;or();var fhr=require("obsidian"),AN=j(Y()),phr=j($c()),IN=class extends fhr.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 Ns}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,phr.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(AN.createElement(P_e.Provider,{value:this.app},AN.createElement(yV.Provider,{value:this.eventTarget},AN.createElement(AN.StrictMode,null,AN.createElement(l_e,{delayDuration:0},AN.createElement(dhr,{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)}};aVe();ir();var mhr=require("obsidian"),yve=class extends mhr.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=tu(new Date(n.epoch)):i=tu(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};or();function hhr(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:${pn.ADD_SELECTION_TO_CHAT_CONTEXT}`)})}),r.addItem(i=>{i.setTitle("Trigger quick command").onClick(()=>{app.commands.executeCommandById(`copilot:${pn.TRIGGER_QUICK_COMMAND}`)})});let o=up().filter(i=>i.showInContextMenu);o.length>0&&r.addSeparator(),qZ(o).forEach(i=>{r.addItem(a=>{a.setTitle(i.title).onClick(()=>{app.commands.executeCommandById(`copilot:${WH(i.title)}`)})})})})}var ghr=j(pze());Gt();var bve=class{constructor(e,r){this.handleFileModify=(0,ghr.default)(async e=>{if(!GH(e)||BZ(e.path))return;let r=await UZ(e);this.registerCommand(r),s$(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!GH(e)||BZ(e.path)))try{let r=await UZ(e);if(!cir(e)){let n=wbe();r={...r,order:n}}await x8e(e,r),s$(r,r.title),this.registerCommand(r)}catch(r){ie(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!GH(e)||BZ(e.path))return;let r=WH(e.basename);this.plugin.removeCommand(r),zZ(e.basename)};this.handleFileRename=async(e,r)=>{if(BZ(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=WH(n);this.plugin.removeCommand(o),zZ(n)}if(GH(e)){let o=await UZ(e);this.registerCommand(o),s$(o,o.title),await x8e(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await _be(),this.registerCommands()}async registerCommands(){up().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=WH(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new V1(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),Pc.getInstance().recordUsage(e)}})}};bt();function m9n(t){let r=`${H1()}/unsupported`;return app.vault.getAbstractFileByPath(r)||app.vault.createFolder(r),Promise.all(t.map(async o=>{let i=`${r}/${o.title}.md`,a=await app.vault.create(i,o.content);await app.fileManager.processFrontMatter(a,s=>{s[tA]=o.showInContextMenu,s[rA]=o.showInSlashMenu,s[zO]=o.order,s[nA]=o.modelKey,s[oA]=0})}))}async function yhr(){let t=oe().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=up(),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=bbe(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
Original name: ${a.title}
${a.content}`}):e.push(a)}await Pc.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 ${H1()}.`;r.length>0&&(await m9n(r),i+=`
We found ${r.length} unsupported commands. They are saved in ${H1()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),nt("inlineEditCommands",[]),new Tc(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function oKe(){let t=up(),e=uir.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];Pc.getInstance().updateCommands(r)}async function bhr(){if(oe().suggestedDefaultCommands)return;up().length===0&&(new Tc(app,()=>{oKe()},"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(),nt("suggestedDefaultCommands",!0))}var rs=j(Y()),BY=require("obsidian"),_hr=j($c());po();ua();function h9n({plugin:t,onRemove:e}){let[r,n]=(0,rs.useState)(""),[o,i]=(0,rs.useState)(!0),[a,s]=(0,rs.useState)(""),[u]=oI(),[l,c]=(0,rs.useState)(u),d=(0,rs.useRef)(null);(0,rs.useEffect)(()=>{let m=t.app.workspace.getActiveViewOfType(BY.MarkdownView);if(m&&m.editor){let g=m.editor.getSelection();s(g)}},[t.app]),(0,rs.useEffect)(()=>{d.current&&d.current.focus()},[]);let f=async()=>{if(!r.trim()){new BY.Notice("Please enter a prompt");return}let m=`
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).
`,g=r;if(o){let w=g.includes("{}"),S=/\{activenote\}/i.test(g),C=[];w||C.push("{}"),S||C.push("{activeNote}"),C.length>0&&(g+=`
${C.join(`
`)}`)}let y={title:"Quick Command",content:g,showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:l,lastUsedMs:Date.now()};new V1(t.app,{selectedText:a,command:y,systemPrompt:m}).open(),e()},p=()=>{e()};return rs.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4",onKeyDown:m=>{m.key==="Escape"?(m.preventDefault(),p()):m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),f())}},rs.default.createElement("div",{className:"tw-space-y-4"},rs.default.createElement(J_,{ref:d,value:r,onChange:m=>n(m.target.value),placeholder:"Ask me anything...",className:"tw-min-h-24 tw-resize-none",rows:3}),rs.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},rs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},rs.default.createElement(m_e,{size:"sm",variant:"ghost",value:l,onChange:c}),rs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rs.default.createElement(Ec,{id:"includeActiveNote",checked:o,onCheckedChange:m=>i(!!m)}),rs.default.createElement("label",{htmlFor:"includeActiveNote",className:"tw-cursor-pointer tw-text-sm tw-text-muted"},"Include note context"))),rs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rs.default.createElement(he,{variant:"secondary",onClick:p,size:"sm"},"Cancel"),rs.default.createElement(he,{onClick:f,size:"sm"},"Submit")))))}function vhr({plugin:t,element:e}){let r=document.createElement("div");e.appendChild(r);let n=(0,_hr.createRoot)(r),o=()=>{let i=t.app.workspace.getActiveViewOfType(BY.MarkdownView);i&&i.editor&&xbe(i.editor),n.unmount(),r.remove()};return n.render(rs.default.createElement(h9n,{plugin:t,onRemove:o})),{root:n,container:r}}or();bt();Gt();ua();vu();Gt();Mde();ir();var _ve=class t{constructor(){this.contextProcessor=fV.getInstance(),this.mention=fR.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 w8e(s,"",n,a),c=o==="copilot_plus"?await this.mention.processUrls(s):{urlContext:"",imageUrls:[]},d=new Set(l.map(y=>y.path)),p=[...e.context?.notes||[]];i&&o!=="project"&&a&&!p.some(y=>y.path===a.path)&&p.push(a);let h=await this.contextProcessor.processContextNotes(d,r,n,p,i,a,o),m=this.contextProcessor.processSelectedTextContexts(),g=u+c.urlContext+h+m;return B(`[ContextManager] Successfully processed context for message ${e.id}`),g}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 Jg(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return kj()}};ir();Gt();var $V=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=tu(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=tu(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||tu(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||tu(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 z$=require("obsidian");Gt();ir();or();bt();ua();var zY=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 z$.Notice("No messages to save.");return}let n=oe(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();this.app.vault.getAbstractFileByPath(n.defaultSaveFolder)||await this.app.vault.createFolder(n.defaultSaveFolder);let s=await this.findFileByEpoch(i),u;s?u=this.app.metadataCache.getFileCache(s)?.frontmatter?.topic:u=await this.generateAITopic(r);let l=this.generateFileName(r,i,u),c=this.generateNoteContent(o,i,e,u);s?(await this.app.vault.modify(s,c),B(`[ChatPersistenceManager] Updated existing chat file: ${s.path}`)):(await this.app.vault.create(l,c),new z$.Notice(`Chat saved as note: ${l}`),B(`[ChatPersistenceManager] Created new chat file: ${l}`))}catch(r){ie("[ChatPersistenceManager] Error saving chat:",r),new z$.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 z$.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=oe(),r=this.app.vault.getAbstractFileByPath(e.defaultSaveFolder);if(!(r instanceof z$.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(a=>a.path.startsWith(r.path)),i=wu();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"?Fo:Zg,u=a[2].trim(),l=u.split(`
`),c=u,d="Unknown time",f=l.length-1;if(f>0&&l[f].startsWith("[Timestamp: ")){let h=l[f].match(/\[Timestamp: (.*?)\]/);h&&(d=h[1],c=l.slice(0,f).join(`
`).trim())}let p;if(d!=="Unknown time"){let h=new Date(d);isNaN(h.getTime())||(p=h.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=oe(),a=tu(new Date(r)).fileName,s;if(n)s=n;else{let f=e.find(p=>p.sender===Fo);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=wu(),d=c?`${c.id}__`:"";return`${o.defaultSaveFolder}/${d}${l}.md`}generateNoteContent(e,r,n,o){let i=oe(),a=wu();return`---
epoch: ${r}
modelKey: ${n}
${o?`topic: "${o}"`:""}
${a?`projectId: ${a.id}`:""}
${a?`projectName: ${a.name}`:""}
tags:
- ${i.defaultConversationTag}
---
${e}`}};or();var vve=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=_ve.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new zY(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 $V;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new zY(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(h=>h.path===a.path);s.notes=p?f:[...f,a]}let u=this.getCurrentMessageRepo(),l=u.addMessage(e,e,Fo,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!==Fo)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:oe().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 Dor(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}`)}};jj();Gt();ly();Jc();or();bt();var fX=require("obsidian"),FKe=j(Y()),Cyr=j($c());var wve=class extends Tc{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")}};po();var UY=j(Y());xn();var whr=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>UY.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:me("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-md","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-px-3","!tw-max-w-full","tw-transition-all tw-duration-300 tw-ease-in-out","tw-delay-200"],"lg:tw-max-w-32","md:tw-max-w-32")},UY.default.createElement("div",{className:me("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),UY.default.createElement("span",{className:me("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)),xhr=({id:t,children:e,isSelected:r})=>r?UY.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:me("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(Y()),Shr=(0,Rg.createContext)(void 0),Chr=({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(Shr.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},BV=()=>{let t=(0,Rg.useContext)(Shr);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};bt();var Ft=j(Y());po();un();var Mc=j(Y());xn();var qY=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},Mc.createElement("table",{ref:r,className:me("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));qY.displayName="Table";var HY=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("thead",{ref:r,className:me("[&_tr]:tw-border-b",t),...e}));HY.displayName="TableHeader";var VY=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("tbody",{ref:r,className:t,...e}));VY.displayName="TableBody";var g9n=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("tfoot",{ref:r,className:me("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));g9n.displayName="TableFooter";var MN=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("tr",{ref:r,className:me("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));MN.displayName="TableRow";var sm=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("th",{ref:r,className:me("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}));sm.displayName="TableHead";var pp=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("td",{ref:r,className:me("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));pp.displayName="TableCell";var y9n=Mc.forwardRef(({className:t,...e},r)=>Mc.createElement("caption",{ref:r,className:me("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));y9n.displayName="TableCaption";var Re=j(Y()),G$=j(za());var fu=j(Y());function Ehr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,fu.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var WY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function U$(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function xve(t){return"nodeType"in t}function um(t){var e,r;return t?U$(t)?t:xve(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Sve(t){let{Document:e}=um(t);return t instanceof e}function zV(t){return U$(t)?!1:t instanceof um(t).HTMLElement}function aKe(t){return t instanceof um(t).SVGElement}function q$(t){return t?U$(t)?t.document:xve(t)?Sve(t)?t:zV(t)||aKe(t)?t.ownerDocument:document:document:document}var wb=WY?fu.useLayoutEffect:fu.useEffect;function Cve(t){let e=(0,fu.useRef)(t);return wb(()=>{e.current=t}),(0,fu.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 Phr(){let t=(0,fu.useRef)(null),e=(0,fu.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,fu.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function UV(t,e){e===void 0&&(e=[t]);let r=(0,fu.useRef)(t);return wb(()=>{r.current!==t&&(r.current=t)},e),r}function qV(t,e){let r=(0,fu.useRef)();return(0,fu.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function KY(t){let e=Cve(t),r=(0,fu.useRef)(null),n=(0,fu.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function Ove(t){let e=(0,fu.useRef)();return(0,fu.useEffect)(()=>{e.current=t},[t]),e.current}var iKe={};function H$(t,e){return(0,fu.useMemo)(()=>{if(e)return e;let r=iKe[t]==null?0:iKe[t]+1;return iKe[t]=r,t+"-"+r},[t,e])}function Thr(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 V$=Thr(1),W$=Thr(-1);function b9n(t){return"clientX"in t&&"clientY"in t}function GY(t){if(!t)return!1;let{KeyboardEvent:e}=um(t.target);return e&&t instanceof e}function _9n(t){if(!t)return!1;let{TouchEvent:e}=um(t.target);return e&&t instanceof e}function Eve(t){if(_9n(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 b9n(t)?{x:t.clientX,y:t.clientY}:null}var cv=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[cv.Translate.toString(t),cv.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),Ohr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ahr(t){return t.matches(Ohr)?t:t.querySelector(Ohr)}var K$=j(Y()),v9n={display:"none"};function Ihr(t){let{id:e,value:r}=t;return K$.default.createElement("div",{id:e,style:v9n},r)}function Mhr(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 K$.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Rhr(){let[t,e]=(0,K$.useState)("");return{announce:(0,K$.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var Vhr=(0,Re.createContext)(null);function w9n(t){let e=(0,Re.useContext)(Vhr);(0,Re.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function x9n(){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 S9n={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.
`},C9n={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 O9n(t){let{announcements:e=C9n,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=S9n}=t,{announce:i,announcement:a}=Rhr(),s=H$("DndLiveRegion"),[u,l]=(0,Re.useState)(!1);if((0,Re.useEffect)(()=>{l(!0)},[]),w9n((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(Ihr,{id:n,value:o.draggable}),Re.default.createElement(Mhr,{id:s,announcement:a}));return r?(0,G$.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 Tve(){}function HV(t,e){return(0,Re.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function Ive(){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 dv=Object.freeze({x:0,y:0});function Whr(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Khr(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function E9n(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function Nhr(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 hKe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function jhr(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 QY=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=jhr(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Whr(jhr(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(Khr)},Ghr=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Nhr(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Nhr(u),c=o.reduce((f,p,h)=>f+Whr(l[h],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Khr)};function P9n(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 T9n=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=P9n(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(E9n)};function A9n(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function Jhr(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:dv}function I9n(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 M9n=I9n(1);function R9n(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 N9n(t,e,r){let n=R9n(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 j9n={ignoreTransform:!1};function Y$(t,e){e===void 0&&(e=j9n);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=um(t).getComputedStyle(t);l&&(r=N9n(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 Dhr(t){return Y$(t,{ignoreTransform:!0})}function D9n(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function L9n(t,e){return e===void 0&&(e=um(t).getComputedStyle(t)),e.position==="fixed"}function F9n(t,e){e===void 0&&(e=um(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 eX(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(Sve(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!zV(o)||aKe(o)||r.includes(o))return r;let i=um(t).getComputedStyle(o);return o!==t&&F9n(o,i)&&r.push(o),L9n(o,i)?r:n(o.parentNode)}return t?n(t):r}function Zhr(t){let[e]=eX(t,1);return e??null}function sKe(t){return!WY||!t?null:U$(t)?t:xve(t)?Sve(t)||t===q$(t).scrollingElement?window:zV(t)?t:null:null}function Yhr(t){return U$(t)?t.scrollX:t.scrollLeft}function Xhr(t){return U$(t)?t.scrollY:t.scrollTop}function cKe(t){return{x:Yhr(t),y:Xhr(t)}}var hd;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(hd||(hd={}));function Qhr(t){return!WY||!t?!1:t===document.scrollingElement}function egr(t){let e={x:0,y:0},r=Qhr(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 k9n={x:.2,y:.2};function $9n(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=k9n);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=egr(t),p={x:0,y:0},h={x:0,y:0},m={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+m.height?(p.y=hd.Backward,h.y=n*Math.abs((e.top+m.height-i)/m.height)):!c&&u>=e.bottom-m.height&&(p.y=hd.Forward,h.y=n*Math.abs((e.bottom-m.height-u)/m.height)),!f&&s>=e.right-m.width?(p.x=hd.Forward,h.x=n*Math.abs((e.right-m.width-s)/m.width)):!d&&a<=e.left+m.width&&(p.x=hd.Backward,h.x=n*Math.abs((e.left+m.width-a)/m.width)),{direction:p,speed:h}}function B9n(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 tgr(t){return t.reduce((e,r)=>V$(e,cKe(r)),dv)}function z9n(t){return t.reduce((e,r)=>e+Yhr(r),0)}function U9n(t){return t.reduce((e,r)=>e+Xhr(r),0)}function q9n(t,e){if(e===void 0&&(e=Y$),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);Zhr(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var H9n=[["x",["left","right"],z9n],["y",["top","bottom"],U9n]],ZY=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=eX(r),o=tgr(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of H9n)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})}},J$=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 V9n(t){let{EventTarget:e}=um(t);return t instanceof e?t:q$(t)}function uKe(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 xb;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(xb||(xb={}));function Lhr(t){t.preventDefault()}function W9n(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 rgr={start:[uo.Space,uo.Enter],cancel:[uo.Esc],end:[uo.Space,uo.Enter,uo.Tab]},K9n=(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}}},NN=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 J$(q$(r)),this.windowListeners=new J$(um(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xb.Resize,this.handleCancel),this.windowListeners.add(xb.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xb.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&q9n(n),r(dv)}handleKeyDown(e){if(GY(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=rgr,coordinateGetter:a=K9n,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}:dv;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=W$(d,c),p={x:0,y:0},{scrollableAncestors:h}=n.current;for(let m of h){let g=e.code,{isTop:y,isRight:_,isLeft:w,isBottom:S,maxScroll:C,minScroll:E}=egr(m),P=B9n(m),T={x:Math.min(g===uo.Right?P.right-P.width/2:P.right,Math.max(g===uo.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(g===uo.Down?P.bottom-P.height/2:P.bottom,Math.max(g===uo.Down?P.top:P.top+P.height/2,d.y))},I=g===uo.Right&&!_||g===uo.Left&&!w,N=g===uo.Down&&!S||g===uo.Up&&!y;if(I&&T.x!==d.x){let M=m.scrollLeft+f.x,D=g===uo.Right&&M<=C.x||g===uo.Left&&M>=E.x;if(D&&!f.y){m.scrollTo({left:M,behavior:s});return}D?p.x=m.scrollLeft-M:p.x=g===uo.Right?m.scrollLeft-C.x:m.scrollLeft-E.x,p.x&&m.scrollBy({left:-p.x,behavior:s});break}else if(N&&T.y!==d.y){let M=m.scrollTop+f.y,D=g===uo.Down&&M<=C.y||g===uo.Up&&M>=E.y;if(D&&!f.x){m.scrollTo({top:M,behavior:s});return}D?p.y=m.scrollTop-M:p.y=g===uo.Down?m.scrollTop-C.y:m.scrollTop-E.y,p.y&&m.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,V$(W$(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()}};NN.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=rgr,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 Fhr(t){return!!(t&&"distance"in t)}function khr(t){return!!(t&&"delay"in t)}var YY=class{constructor(e,r,n){var o;n===void 0&&(n=V9n(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=q$(a),this.documentListeners=new J$(this.document),this.listeners=new J$(n),this.windowListeners=new J$(um(a)),this.initialCoordinates=(o=Eve(i))!=null?o:dv,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(xb.Resize,this.handleCancel),this.windowListeners.add(xb.DragStart,Lhr),this.windowListeners.add(xb.VisibilityChange,this.handleCancel),this.windowListeners.add(xb.ContextMenu,Lhr),this.documentListeners.add(xb.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(khr(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Fhr(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(xb.Click,W9n,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xb.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=Eve(e))!=null?r:dv,l=W$(o,u);if(!n&&s){if(Fhr(s)){if(s.tolerance!=null&&uKe(l,s.tolerance))return this.handleCancel();if(uKe(l,s.distance))return this.handleStart()}if(khr(s)&&uKe(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()}},G9n={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},jN=class extends YY{constructor(e){let{event:r}=e,n=q$(r.target);super(e,G9n,n)}};jN.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 J9n={move:{name:"mousemove"},end:{name:"mouseup"}},dKe;(function(t){t[t.RightClick=2]="RightClick"})(dKe||(dKe={}));var fKe=class extends YY{constructor(e){super(e,J9n,q$(e.event.target))}};fKe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===dKe.RightClick?!1:(n?.({event:r}),!0)}}];var lKe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},pKe=class extends YY{constructor(e){super(e,lKe)}static setup(){return window.addEventListener(lKe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(lKe.move.name,e)};function e(){}}};pKe.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 JY;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(JY||(JY={}));var Ave;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ave||(Ave={}));function Z9n(t){let{acceleration:e,activator:r=JY.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=Ave.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=X9n({delta:d,disabled:!i}),[h,m]=Phr(),g=(0,Re.useRef)({x:0,y:0}),y=(0,Re.useRef)({x:0,y:0}),_=(0,Re.useMemo)(()=>{switch(r){case JY.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case JY.DraggableRect:return o}},[r,o,u]),w=(0,Re.useRef)(null),S=(0,Re.useCallback)(()=>{let E=w.current;if(!E)return;let P=g.current.x*y.current.x,T=g.current.y*y.current.y;E.scrollBy(P,T)},[]),C=(0,Re.useMemo)(()=>s===Ave.TreeOrder?[...l].reverse():l,[s,l]);(0,Re.useEffect)(()=>{if(!i||!l.length||!_){m();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}=$9n(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){m(),w.current=E,h(S,a),g.current=N,y.current=I;return}}g.current={x:0,y:0},y.current={x:0,y:0},m()},[e,S,n,m,i,a,JSON.stringify(_),JSON.stringify(p),h,l,C,c,JSON.stringify(f)])}var Y9n={x:{[hd.Backward]:!1,[hd.Forward]:!1},y:{[hd.Backward]:!1,[hd.Forward]:!1}};function X9n(t){let{delta:e,disabled:r}=t,n=Ove(e);return qV(o=>{if(r||!n||!o)return Y9n;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 Q9n(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return qV(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function eKn(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 XY;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(XY||(XY={}));var mKe;(function(t){t.Optimized="optimized"})(mKe||(mKe={}));var $hr=new Map;function tKn(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=g(),f=UV(d),p=(0,Re.useCallback)(function(y){y===void 0&&(y=[]),!f.current&&a(_=>_===null?y:_.concat(y.filter(w=>!_.includes(w))))},[f]),h=(0,Re.useRef)(null),m=qV(y=>{if(d&&!r)return $hr;if(!y||y===$hr||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 ZY(u(S),S):null;w.rect.current=C,C&&_.set(w.id,C)}return _}return y},[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"||h.current!==null||(h.current=setTimeout(()=>{p(),h.current=null},s))},[s,d,p,...n]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function g(){switch(l){case XY.Always:return!1;case XY.BeforeDragging:return r;default:return!r}}}function ngr(t,e){return qV(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function rKn(t,e){return ngr(t,e)}function nKn(t){let{callback:e,disabled:r}=t,n=Cve(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 Mve(t){let{callback:e,disabled:r}=t,n=Cve(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 oKn(t){return new ZY(Y$(t),t)}function Bhr(t,e,r){e===void 0&&(e=oKn);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=nKn({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=Mve({callback:i});return wb(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function iKn(t){let e=ngr(t);return Jhr(t,e)}var zhr=[];function aKn(t){let e=(0,Re.useRef)(t),r=qV(n=>t?n&&n!==zhr&&t&&e.current&&t.parentNode===e.current.parentNode?n:eX(t):zhr,[t]);return(0,Re.useEffect)(()=>{e.current=t},[t]),r}function sKn(t){let[e,r]=(0,Re.useState)(null),n=(0,Re.useRef)(t),o=(0,Re.useCallback)(i=>{let a=sKe(i.target);a&&r(s=>s?(s.set(a,cKe(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=sKe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,cKe(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=sKe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Re.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>V$(i,a),dv):tgr(t):dv,[t,e])}function Uhr(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!==dv;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?W$(t,r.current):dv}function uKn(t){(0,Re.useEffect)(()=>{if(!WY)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 lKn(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 ogr(t){return(0,Re.useMemo)(()=>t?D9n(t):null,[t])}var qhr=[];function cKn(t,e){e===void 0&&(e=Y$);let[r]=t,n=ogr(r?um(r):null),[o,i]=(0,Re.useState)(qhr);function a(){i(()=>t.length?t.map(u=>Qhr(u)?n:new ZY(e(u),u)):qhr)}let s=Mve({callback:a});return wb(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function dKn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return zV(e)?e:t}function fKn(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=Mve({callback:o}),a=(0,Re.useCallback)(l=>{let c=dKn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=KY(a);return(0,Re.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var pKn=[{sensor:jN,options:{}},{sensor:NN,options:{}}],mKn={current:{}},Pve={draggable:{measure:Dhr},droppable:{measure:Dhr,strategy:XY.WhileDragging,frequency:mKe.Optimized},dragOverlay:{measure:Y$}},Z$=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}},hKn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Z$,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tve},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pve,measureDroppableContainers:Tve,windowRect:null,measuringScheduled:!1},gKn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tve,draggableNodes:new Map,over:null,measureDroppableContainers:Tve},Rve=(0,Re.createContext)(gKn),igr=(0,Re.createContext)(hKn);function yKn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Z$}}}function bKn(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 Z$(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 Z$(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 Z$(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function _Kn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Re.useContext)(Rve),i=Ove(n),a=Ove(r?.id);return(0,Re.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!GY(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=Ahr(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function vKn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function wKn(t){return(0,Re.useMemo)(()=>({draggable:{...Pve.draggable,...t?.draggable},droppable:{...Pve.droppable,...t?.droppable},dragOverlay:{...Pve.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function xKn(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;wb(()=>{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=Jhr(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=Zhr(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var agr=(0,Re.createContext)({...dv,scaleX:1,scaleY:1}),RN;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(RN||(RN={}));var tX=(0,Re.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=pKn,collisionDetection:d=T9n,measuring:f,modifiers:p,...h}=e,m=(0,Re.useReducer)(bKn,void 0,yKn),[g,y]=m,[_,w]=x9n(),[S,C]=(0,Re.useState)(RN.Uninitialized),E=S===RN.Initialized,{draggable:{active:P,nodes:T,translate:I},droppable:{containers:N}}=g,M=P!=null?T.get(P):null,D=(0,Re.useRef)({initial:null,translated:null}),k=(0,Re.useMemo)(()=>{var Is;return P!=null?{id:P,data:(Is=M?.data)!=null?Is:mKn,rect:D}:null},[P,M]),F=(0,Re.useRef)(null),[K,U]=(0,Re.useState)(null),[X,ee]=(0,Re.useState)(null),L=UV(h,Object.values(h)),Q=H$("DndDescribedBy",a),z=(0,Re.useMemo)(()=>N.getEnabled(),[N]),W=wKn(f),{droppableRects:V,measureDroppableContainers:q,measuringScheduled:H}=tKn(z,{dragging:E,dependencies:[I.x,I.y],config:W.droppable}),G=Q9n(T,P),Z=(0,Re.useMemo)(()=>X?Eve(X):null,[X]),de=PA(),pe=rKn(G,W.draggable.measure);xKn({activeNode:P!=null?T.get(P):null,config:de.layoutShiftCompensation,initialRect:pe,measure:W.draggable.measure});let ae=Bhr(G,W.draggable.measure,pe),Te=Bhr(G?G.parentElement:null),Ae=(0,Re.useRef)({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=N.getNodeFor((r=Ae.current.over)==null?void 0:r.id),Ot=fKn({measure:W.dragOverlay.measure}),jr=(n=Ot.nodeRef.current)!=null?n:G,Mr=E?(o=Ot.rect)!=null?o:ae:null,Vn=!!(Ot.nodeRef.current&&Ot.rect),Xr=iKn(Vn?null:ae),Cr=ogr(jr?um(jr):null),Me=aKn(E?ke??G:null),Ze=cKn(Me),je=vKn(p,{transform:{x:I.x-Xr.x,y:I.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:X,active:k,activeNodeRect:ae,containerNodeRect:Te,draggingNodeRect:Mr,over:Ae.current.over,overlayNodeRect:Ot.rect,scrollableAncestors:Me,scrollableAncestorRects:Ze,windowRect:Cr}),le=Z?V$(Z,I):null,ne=sKn(Me),fe=Uhr(ne),be=Uhr(ne,[ae]),ye=V$(je,fe),ze=Mr?M9n(Mr,je):null,hr=k&&ze?d({active:k,collisionRect:ze,droppableRects:V,droppableContainers:z,pointerCoordinates:le}):null,Ii=hKe(hr,"id"),[_i,bf]=(0,Re.useState)(null),mp=Vn?je:V$(je,be),Hi=A9n(mp,(i=_i?.rect)!=null?i:null,ae),gd=(0,Re.useRef)(null),yd=(0,Re.useCallback)((Is,hu)=>{let{sensor:ns,options:hp}=hu;if(F.current==null)return;let vf=T.get(F.current);if(!vf)return;let Gs=Is.nativeEvent,cm=new ns({active:F.current,activeNode:vf,event:Gs,options:hp,context:Ae,onAbort(Xn){if(!T.get(Xn))return;let{onDragAbort:yp}=L.current,Ch={id:Xn};yp?.(Ch),_({type:"onDragAbort",event:Ch})},onPending(Xn,Qe,yp,Ch){if(!T.get(Xn))return;let{onDragPending:YO}=L.current,Kn={id:Xn,constraint:Qe,initialCoordinates:yp,offset:Ch};YO?.(Kn),_({type:"onDragPending",event:Kn})},onStart(Xn){let Qe=F.current;if(Qe==null)return;let yp=T.get(Qe);if(!yp)return;let{onDragStart:Ch}=L.current,tc={activatorEvent:Gs,active:{id:Qe,data:yp.data,rect:D}};(0,G$.unstable_batchedUpdates)(()=>{Ch?.(tc),C(RN.Initializing),y({type:Rc.DragStart,initialCoordinates:Xn,active:Qe}),_({type:"onDragStart",event:tc}),U(gd.current),ee(Gs)})},onMove(Xn){y({type:Rc.DragMove,coordinates:Xn})},onEnd:gp(Rc.DragEnd),onCancel:gp(Rc.DragCancel)});gd.current=cm;function gp(Xn){return async function(){let{active:yp,collisions:Ch,over:tc,scrollAdjustedTranslate:YO}=Ae.current,Kn=null;if(yp&&YO){let{cancelDrop:Ob}=L.current;Kn={activatorEvent:Gs,active:yp,collisions:Ch,delta:YO,over:tc},Xn===Rc.DragEnd&&typeof Ob=="function"&&await Promise.resolve(Ob(Kn))&&(Xn=Rc.DragCancel)}F.current=null,(0,G$.unstable_batchedUpdates)(()=>{y({type:Xn}),C(RN.Uninitialized),bf(null),U(null),ee(null),gd.current=null;let Ob=Xn===Rc.DragEnd?"onDragEnd":"onDragCancel";if(Kn){let KV=L.current[Ob];KV?.(Kn),_({type:Ob,event:Kn})}})}}},[T]),_f=(0,Re.useCallback)((Is,hu)=>(ns,hp)=>{let vf=ns.nativeEvent,Gs=T.get(hp);if(F.current!==null||!Gs||vf.dndKit||vf.defaultPrevented)return;let cm={active:Gs};Is(ns,hu.options,cm)===!0&&(vf.dndKit={capturedBy:hu.sensor},F.current=hp,yd(ns,hu))},[T,yd]),Wn=eKn(c,_f);uKn(c),wb(()=>{ae&&S===RN.Initializing&&C(RN.Initialized)},[ae,S]),(0,Re.useEffect)(()=>{let{onDragMove:Is}=L.current,{active:hu,activatorEvent:ns,collisions:hp,over:vf}=Ae.current;if(!hu||!ns)return;let Gs={active:hu,activatorEvent:ns,collisions:hp,delta:{x:ye.x,y:ye.y},over:vf};(0,G$.unstable_batchedUpdates)(()=>{Is?.(Gs),_({type:"onDragMove",event:Gs})})},[ye.x,ye.y]),(0,Re.useEffect)(()=>{let{active:Is,activatorEvent:hu,collisions:ns,droppableContainers:hp,scrollAdjustedTranslate:vf}=Ae.current;if(!Is||F.current==null||!hu||!vf)return;let{onDragOver:Gs}=L.current,cm=hp.get(Ii),gp=cm&&cm.rect.current?{id:cm.id,rect:cm.rect.current,data:cm.data,disabled:cm.disabled}:null,Xn={active:Is,activatorEvent:hu,collisions:ns,delta:{x:vf.x,y:vf.y},over:gp};(0,G$.unstable_batchedUpdates)(()=>{bf(gp),Gs?.(Xn),_({type:"onDragOver",event:Xn})})},[Ii]),wb(()=>{Ae.current={activatorEvent:X,active:k,activeNode:G,collisionRect:ze,collisions:hr,droppableRects:V,draggableNodes:T,draggingNode:jr,draggingNodeRect:Mr,droppableContainers:N,over:_i,scrollableAncestors:Me,scrollAdjustedTranslate:ye},D.current={initial:Mr,translated:ze}},[k,G,hr,ze,T,jr,Mr,V,N,_i,Me,ye]),Z9n({...de,delta:I,draggingRect:ze,pointerCoordinates:le,scrollableAncestors:Me,scrollableAncestorRects:Ze});let EA=(0,Re.useMemo)(()=>({active:k,activeNode:G,activeNodeRect:ae,activatorEvent:X,collisions:hr,containerNodeRect:Te,dragOverlay:Ot,draggableNodes:T,droppableContainers:N,droppableRects:V,over:_i,measureDroppableContainers:q,scrollableAncestors:Me,scrollableAncestorRects:Ze,measuringConfiguration:W,measuringScheduled:H,windowRect:Cr}),[k,G,ae,X,hr,Te,Ot,T,N,V,_i,q,Me,Ze,W,H,Cr]),FN=(0,Re.useMemo)(()=>({activatorEvent:X,activators:Wn,active:k,activeNodeRect:ae,ariaDescribedById:{draggable:Q},dispatch:y,draggableNodes:T,over:_i,measureDroppableContainers:q}),[X,Wn,k,ae,y,Q,T,_i,q]);return Re.default.createElement(Vhr.Provider,{value:w},Re.default.createElement(Rve.Provider,{value:FN},Re.default.createElement(igr.Provider,{value:EA},Re.default.createElement(agr.Provider,{value:Hi},l)),Re.default.createElement(_Kn,{disabled:s?.restoreFocus===!1})),Re.default.createElement(O9n,{...s,hiddenTextDescribedById:Q}));function PA(){let Is=K?.autoScrollEnabled===!1,hu=typeof u=="object"?u.enabled===!1:u===!1,ns=E&&!Is&&!hu;return typeof u=="object"?{...u,enabled:ns}:{enabled:ns}}}),SKn=(0,Re.createContext)(null),Hhr="button",CKn="Draggable";function sgr(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=H$(CKn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Re.useContext)(Rve),{role:p=Hhr,roleDescription:h="draggable",tabIndex:m=0}=o??{},g=u?.id===e,y=(0,Re.useContext)(g?agr:SKn),[_,w]=KY(),[S,C]=KY(),E=lKn(a,e),P=UV(r);wb(()=>(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:m,"aria-disabled":n,"aria-pressed":g&&p===Hhr?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[n,p,m,g,h,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:T,isDragging:g,listeners:n?void 0:E,node:_,over:f,setNodeRef:w,setActivatorNodeRef:C,transform:y}}function ugr(){return(0,Re.useContext)(igr)}var OKn="Droppable",EKn={timeout:25};function lgr(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=H$(OKn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Re.useContext)(Rve),c=(0,Re.useRef)({disabled:r}),d=(0,Re.useRef)(!1),f=(0,Re.useRef)(null),p=(0,Re.useRef)(null),{disabled:h,updateMeasurementsFor:m,timeout:g}={...EKn,...o},y=UV(m??n),_=(0,Re.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(y.current)?y.current:[y.current]),p.current=null},g)},[g]),w=Mve({callback:_,disabled:h||!a}),S=(0,Re.useCallback)((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[C,E]=KY(S),P=UV(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}}var pu=j(Y());function Lve(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function PKn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function Nve(t){return t!==null&&t>=0}function TKn(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 AKn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var cgr=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=Lve(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 jve={scaleX:1,scaleY:1},rX=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,...jve}:null}let u=IKn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...jve}:o<r&&o>=a?{x:0,y:s.height+u,...jve}:{x:0,y:0,...jve}};function IKn(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 dgr="Sortable",fgr=pu.default.createContext({activeIndex:-1,containerId:dgr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cgr,disabled:{draggable:!1,droppable:!1}});function nX(t){let{children:e,id:r,items:n,strategy:o=cgr,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=ugr(),d=H$(dgr,r),f=s.rect!==null,p=(0,pu.useMemo)(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),h=a!=null,m=a?p.indexOf(a.id):-1,g=l?p.indexOf(l.id):-1,y=(0,pu.useRef)(p),_=!TKn(p,y.current),w=g!==-1&&m===-1||_,S=AKn(i);wb(()=>{_&&h&&c(p)},[_,p,h,c]),(0,pu.useEffect)(()=>{y.current=p},[p]);let C=(0,pu.useMemo)(()=>({activeIndex:m,containerId:d,disabled:S,disableTransforms:w,items:p,overIndex:g,useDragOverlay:f,sortedRects:PKn(p,u),strategy:o}),[m,d,S.draggable,S.droppable,w,p,g,u,f,o]);return pu.default.createElement(fgr.Provider,{value:C},e)}var MKn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return Lve(r,n,o).indexOf(e)},RKn=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},NKn={duration:200,easing:"ease"},pgr="transform",jKn=cv.Transition.toString({property:pgr,duration:0,easing:"linear"}),DKn={roleDescription:"sortable"};function LKn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,pu.useState)(null),s=(0,pu.useRef)(r);return wb(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=Y$(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,pu.useEffect)(()=>{i&&a(null)},[i]),i}function oX(t){let{animateLayoutChanges:e=RKn,attributes:r,disabled:n,data:o,getNewIndex:i=MKn,id:a,strategy:s,resizeObserverConfig:u,transition:l=NKn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:h,sortedRects:m,overIndex:g,useDragOverlay:y,strategy:_}=(0,pu.useContext)(fgr),w=FKn(n,p),S=c.indexOf(a),C=(0,pu.useMemo)(()=>({sortable:{containerId:d,index:S,items:c},...o}),[d,o,S,c]),E=(0,pu.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:P,node:T,isOver:I,setNodeRef:N}=lgr({id:a,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...u}}),{active:M,activatorEvent:D,activeNodeRect:k,attributes:F,setNodeRef:K,listeners:U,isDragging:X,over:ee,setActivatorNodeRef:L,transform:Q}=sgr({id:a,data:C,attributes:{...DKn,...r},disabled:w.draggable}),z=Ehr(N,K),W=!!M,V=W&&!h&&Nve(f)&&Nve(g),q=!y&&X,H=q&&V?Q:null,Z=V?H??(s??_)({rects:m,activeNodeRect:k,activeIndex:f,overIndex:g,index:S}):null,de=Nve(f)&&Nve(g)?i({id:a,items:c,activeIndex:f,overIndex:g}):S,pe=M?.id,ae=(0,pu.useRef)({activeId:pe,items:c,newIndex:de,containerId:d}),Te=c!==ae.current.items,Ae=e({active:M,containerId:d,isDragging:X,isSorting:W,id:a,index:S,items:c,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:l,wasDragging:ae.current.activeId!=null}),ke=LKn({disabled:!Ae,index:S,node:T,rect:P});return(0,pu.useEffect)(()=>{W&&ae.current.newIndex!==de&&(ae.current.newIndex=de),d!==ae.current.containerId&&(ae.current.containerId=d),c!==ae.current.items&&(ae.current.items=c)},[W,de,d,c]),(0,pu.useEffect)(()=>{if(pe===ae.current.activeId)return;if(pe!=null&&ae.current.activeId==null){ae.current.activeId=pe;return}let jr=setTimeout(()=>{ae.current.activeId=pe},50);return()=>clearTimeout(jr)},[pe]),{active:M,activeIndex:f,attributes:F,data:C,rect:P,index:S,newIndex:de,items:c,isOver:I,isSorting:W,isDragging:X,listeners:U,node:T,overIndex:g,over:ee,setNodeRef:z,setActivatorNodeRef:L,setDroppableNodeRef:N,setDraggableNodeRef:K,transform:ke??Z,transition:Ot()};function Ot(){if(ke||Te&&ae.current.newIndex===S)return jKn;if(!(q&&!GY(D)||!l)&&(W||Ae))return cv.Transition.toString({...l,property:pgr})}}function FKn(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 Dve(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 kKn=[uo.Down,uo.Right,uo.Up,uo.Left],Fve=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(kKn.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=Ghr({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=hKe(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,h=f?.node.current;if(h&&p&&d&&f){let g=eX(h).some((E,P)=>s[P]!==E),y=mgr(d,f),_=$Kn(d,f),w=g||!y?{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:W$(S,w)}}}};function mgr(t,e){return!Dve(t)||!Dve(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function $Kn(t,e){return!Dve(t)||!Dve(e)||!mgr(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}xn();bt();bt();d8();var zve=require("obsidian");var Fa=j(Y());xn();var Ng=j(Y());xn();un();jj();Gt();ir();function JO({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 So(t)}catch(c){ie("Failed to decrypt value:"+eo(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Ng.default.createElement("div",{className:me("tw-relative",o)},Ng.default.createElement(gi,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:me("tw-w-full !tw-pr-7")}),Ng.default.createElement("div",{onClick:()=>!n&&a(!i),className:me("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(_5,{className:me("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):Ng.default.createElement(UE,{className:me("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}un();var yf=j(Y());var ya=j(Y(),1);function ZO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var ggr=j(Y(),1);function hgr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function gKe(...t){return e=>{let r=!1,n=t.map(o=>{let i=hgr(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():hgr(t[o],null)}}}}function CA(...t){return ggr.useCallback(gKe(...t),t)}var As=j(Y(),1);var ygr=j(Y(),1),bgr=j(za(),1);var gf=j(Y(),1);var VV=j(st(),1),iX=gf.forwardRef((t,e)=>{let{children:r,...n}=t,o=gf.Children.toArray(r),i=o.find(zKn);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)(yKe,{...n,ref:e,children:gf.isValidElement(a)?gf.cloneElement(a,void 0,s):null})}return(0,VV.jsx)(yKe,{...n,ref:e,children:r})});iX.displayName="Slot";var yKe=gf.forwardRef((t,e)=>{let{children:r,...n}=t;if(gf.isValidElement(r)){let o=qKn(r);return gf.cloneElement(r,{...UKn(n,r.props),ref:e?gKe(e,o):o})}return gf.Children.count(r)>1?gf.Children.only(null):null});yKe.displayName="SlotClone";var BKn=({children:t})=>(0,VV.jsx)(VV.Fragment,{children:t});function zKn(t){return gf.isValidElement(t)&&t.type===BKn}function UKn(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 qKn(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 _gr=j(st(),1),HKn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jg=HKn.reduce((t,e)=>{let r=ygr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?iX:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,_gr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vgr(t,e){t&&bgr.flushSync(()=>t.dispatchEvent(e))}var _Ke=j(st(),1),VKn="DismissableLayer",bKe="dismissableLayer.update",WKn="dismissableLayer.pointerDownOutside",KKn="dismissableLayer.focusOutside",wgr,Sgr=As.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vKe=As.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=As.useContext(Sgr),[c,d]=As.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=As.useState({}),h=CA(e,P=>d(P)),m=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),_=c?m.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=ZKn(P=>{let T=P.target,I=[...l.branches].some(N=>N.contains(T));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=YKn(P=>{let T=P.target;[...l.branches].some(N=>N.contains(T))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return G1(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),As.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(wgr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),xgr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=wgr)}},[c,f,r,l]),As.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),xgr())},[c,l]),As.useEffect(()=>{let P=()=>p({});return document.addEventListener(bKe,P),()=>document.removeEventListener(bKe,P)},[]),(0,_Ke.jsx)(jg.div,{...u,ref:h,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:ZO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ZO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ZO(t.onPointerDownCapture,C.onPointerDownCapture)})});vKe.displayName=VKn;var GKn="DismissableLayerBranch",JKn=As.forwardRef((t,e)=>{let r=As.useContext(Sgr),n=As.useRef(null),o=CA(e,n);return As.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,_Ke.jsx)(jg.div,{...t,ref:o})});JKn.displayName=GKn;function ZKn(t,e=globalThis?.document){let r=cn(t),n=As.useRef(!1),o=As.useRef(()=>{});return As.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Cgr(WKn,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 YKn(t,e=globalThis?.document){let r=cn(t),n=As.useRef(!1);return As.useEffect(()=>{let o=i=>{i.target&&!n.current&&Cgr(KKn,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 xgr(){let t=new CustomEvent(bKe);document.dispatchEvent(t)}function Cgr(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?vgr(o,i):o.dispatchEvent(i)}var Sb=j(Y(),1);var Agr=j(st(),1),wKe="focusScope.autoFocusOnMount",xKe="focusScope.autoFocusOnUnmount",Ogr={bubbles:!1,cancelable:!0},XKn="FocusScope",SKe=Sb.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Sb.useState(null),l=cn(o),c=cn(i),d=Sb.useRef(null),f=CA(e,m=>u(m)),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:DN(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||DN(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let T of E)T.removedNodes.length>0&&DN(s)};var m=_,g=w,y=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){Pgr.add(p);let m=document.activeElement;if(!s.contains(m)){let y=new CustomEvent(wKe,Ogr);s.addEventListener(wKe,l),s.dispatchEvent(y),y.defaultPrevented||(QKn(oGn(Igr(s)),{select:!0}),document.activeElement===m&&DN(s))}return()=>{s.removeEventListener(wKe,l),setTimeout(()=>{let y=new CustomEvent(xKe,Ogr);s.addEventListener(xKe,c),s.dispatchEvent(y),y.defaultPrevented||DN(m??document.body,{select:!0}),s.removeEventListener(xKe,c),Pgr.remove(p)},0)}}},[s,l,c,p]);let h=Sb.useCallback(m=>{if(!r&&!n||p.paused)return;let g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){let _=m.currentTarget,[w,S]=eGn(_);w&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&DN(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),r&&DN(S,{select:!0})):y===_&&m.preventDefault()}},[r,n,p.paused]);return(0,Agr.jsx)(jg.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});SKe.displayName=XKn;function QKn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(DN(n,{select:e}),document.activeElement!==r)return}function eGn(t){let e=Igr(t),r=Egr(e,t),n=Egr(e.reverse(),t);return[r,n]}function Igr(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 Egr(t,e){for(let r of t)if(!tGn(r,{upTo:e}))return r}function tGn(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 rGn(t){return t instanceof HTMLInputElement&&"select"in t}function DN(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&rGn(t)&&e&&t.select()}}var Pgr=nGn();function nGn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Tgr(t,e),t.unshift(e)},remove(e){t=Tgr(t,e),t[0]?.resume()}}}function Tgr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function oGn(t){return t.filter(e=>e.tagName!=="A")}var kve=j(Y(),1),Mgr=j(za(),1);var Rgr=j(st(),1),iGn="Portal",CKe=kve.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=kve.useState(!1);wo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Mgr.default.createPortal((0,Rgr.jsx)(jg.div,{...n,ref:e}),a):null});CKe.displayName=iGn;var na=j(st(),1),OKe="Dialog",[Ngr,DXi]=Qa(OKe),[aGn,fv]=Ngr(OKe),jgr=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=ya.useRef(null),u=ya.useRef(null),[l=!1,c]=tm({prop:n,defaultProp:o,onChange:i});return(0,na.jsx)(aGn,{scope:e,triggerRef:s,contentRef:u,contentId:Jl(),titleId:Jl(),descriptionId:Jl(),open:l,onOpenChange:c,onOpenToggle:ya.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};jgr.displayName=OKe;var Dgr="DialogTrigger",Lgr=ya.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fv(Dgr,r),i=CA(e,o.triggerRef);return(0,na.jsx)(jg.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":TKe(o.open),...n,ref:i,onClick:ZO(t.onClick,o.onOpenToggle)})});Lgr.displayName=Dgr;var EKe="DialogPortal",[sGn,Fgr]=Ngr(EKe,{forceMount:void 0}),kgr=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=fv(EKe,e);return(0,na.jsx)(sGn,{scope:e,forceMount:r,children:ya.Children.map(n,a=>(0,na.jsx)(nf,{present:r||i.open,children:(0,na.jsx)(CKe,{asChild:!0,container:o,children:a})}))})};kgr.displayName=EKe;var $ve="DialogOverlay",$gr=ya.forwardRef((t,e)=>{let r=Fgr($ve,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=fv($ve,t.__scopeDialog);return i.modal?(0,na.jsx)(nf,{present:n||i.open,children:(0,na.jsx)(uGn,{...o,ref:e})}):null});$gr.displayName=$ve;var uGn=ya.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fv($ve,r);return(0,na.jsx)(LY,{as:iX,allowPinchZoom:!0,shards:[o.contentRef],children:(0,na.jsx)(jg.div,{"data-state":TKe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),X$="DialogContent",Bgr=ya.forwardRef((t,e)=>{let r=Fgr(X$,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=fv(X$,t.__scopeDialog);return(0,na.jsx)(nf,{present:n||i.open,children:i.modal?(0,na.jsx)(lGn,{...o,ref:e}):(0,na.jsx)(cGn,{...o,ref:e})})});Bgr.displayName=X$;var lGn=ya.forwardRef((t,e)=>{let r=fv(X$,t.__scopeDialog),n=ya.useRef(null),o=CA(e,r.contentRef,n);return ya.useEffect(()=>{let i=n.current;if(i)return uN(i)},[]),(0,na.jsx)(zgr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ZO(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ZO(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:ZO(t.onFocusOutside,i=>i.preventDefault())})}),cGn=ya.forwardRef((t,e)=>{let r=fv(X$,t.__scopeDialog),n=ya.useRef(!1),o=ya.useRef(!1);return(0,na.jsx)(zgr,{...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()}})}),zgr=ya.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=fv(X$,r),u=ya.useRef(null),l=CA(e,u);return J1(),(0,na.jsxs)(na.Fragment,{children:[(0,na.jsx)(SKe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,na.jsx)(vKe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":TKe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,na.jsxs)(na.Fragment,{children:[(0,na.jsx)(dGn,{titleId:s.titleId}),(0,na.jsx)(pGn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),PKe="DialogTitle",Ugr=ya.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fv(PKe,r);return(0,na.jsx)(jg.h2,{id:o.titleId,...n,ref:e})});Ugr.displayName=PKe;var qgr="DialogDescription",Hgr=ya.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fv(qgr,r);return(0,na.jsx)(jg.p,{id:o.descriptionId,...n,ref:e})});Hgr.displayName=qgr;var Vgr="DialogClose",Wgr=ya.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=fv(Vgr,r);return(0,na.jsx)(jg.button,{type:"button",...n,ref:e,onClick:ZO(t.onClick,()=>o.onOpenChange(!1))})});Wgr.displayName=Vgr;function TKe(t){return t?"open":"closed"}var Kgr="DialogTitleWarning",[LXi,Ggr]=Kor(Kgr,{contentName:X$,titleName:PKe,docsSlug:"dialog"}),dGn=({titleId:t})=>{let e=Ggr(Kgr),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 ya.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},fGn="DialogDescriptionWarning",pGn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ggr(fGn).contentName}}.`;return ya.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Jgr=jgr,Zgr=Lgr,Ygr=kgr,AKe=$gr,IKe=Bgr,MKe=Ugr,RKe=Hgr,Xgr=Wgr;un();xn();var Bve=Jgr,Qgr=Zgr,hGn=Ygr;var eyr=yf.forwardRef(({className:t,...e},r)=>yf.createElement(AKe,{ref:r,className:me("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}));eyr.displayName=AKe.displayName;var aX=yf.forwardRef(({className:t,children:e,container:r,...n},o)=>yf.createElement(hGn,{container:r},yf.createElement(eyr,null),yf.createElement(IKe,{ref:o,className:me("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,yf.createElement(Xgr,{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"},yf.createElement(vi,{className:"tw-size-4"}),yf.createElement("span",{className:"tw-sr-only"},"Close")))));aX.displayName=IKe.displayName;var sX=({className:t,...e})=>yf.createElement("div",{className:me("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});sX.displayName="DialogHeader";var gGn=({className:t,...e})=>yf.createElement("div",{className:me("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});gGn.displayName="DialogFooter";var uX=yf.forwardRef(({className:t,...e},r)=>yf.createElement(MKe,{ref:r,className:me("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));uX.displayName=MKe.displayName;var lX=yf.forwardRef(({className:t,...e},r)=>yf.createElement(RKe,{ref:r,className:me("tw-text-sm tw-text-muted",t),...e}));lX.displayName=RKe.displayName;ir();function qr(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=BV(),a="onChange"in t?t.onChange:void 0,s=(0,Fa.useMemo)(()=>{if(a)return xee(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return Fa.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 Fa.default.createElement(JO,{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 Fa.default.createElement(J_,{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 Fa.default.createElement(uV,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return Fa.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},Fa.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:me("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&&Fa.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>Fa.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),Fa.default.createElement("div",{className:me("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")},Fa.default.createElement(ki,{className:"tw-size-4"})));case"slider":return Fa.default.createElement(RY,{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 Fa.default.createElement(Bve,null,Fa.default.createElement(Qgr,{asChild:!0},t.trigger),Fa.default.createElement(aX,{container:i},(t.dialogTitle||t.dialogDescription)&&Fa.default.createElement(sX,null,t.dialogTitle&&Fa.default.createElement(uX,null,t.dialogTitle),t.dialogDescription&&Fa.default.createElement(lX,null,t.dialogDescription)),t.children));case"custom":return t.children}};return Fa.default.createElement("div",{className:me("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)},Fa.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},Fa.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&Fa.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),Fa.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var yGn=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=oX({id:t.title}),d={transform:cv.Transform.toString(u),transition:l},f=()=>{n(t)};return Ft.default.createElement(MN,{ref:s,style:d,className:me("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Ft.default.createElement(pp,{className:"tw-w-10"},Ft.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Ft.default.createElement(Uv,{className:"tw-size-4"}))),Ft.default.createElement(pp,null,t.title),Ft.default.createElement(pp,{className:"tw-text-center"},Ft.default.createElement(Ec,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Ft.default.createElement(pp,{className:"tw-text-center"},Ft.default.createElement(Ec,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Ft.default.createElement(pp,{className:"tw-text-center"},Ft.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Ft.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>{new u$(app,e,t,async h=>{await r(h,t.title)}).open()}},Ft.default.createElement(Hv,{className:"tw-size-4"})),Ft.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},Ft.default.createElement(Uh,{className:"tw-size-4"})),Ft.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>{new Tc(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()}},Ft.default.createElement(Vh,{className:"tw-size-4"})))))},tyr=()=>{let t=lir(),e=(0,Ft.useMemo)(()=>qZ([...t]),[t]),r=vn(),n=Ive(HV(jN,{activationConstraint:{distance:8}}),HV(NN,{coordinateGetter:Fve})),o=async(l,c)=>{await Pc.getInstance().updateCommand(l,c)},i=async l=>{await Pc.getInstance().createCommand(l)},a=async l=>{try{await Pc.getInstance().deleteCommand(l),new zve.Notice(`Command "${l.title}" deleted successfully!`)}catch(c){throw console.error("Failed to delete command:",c),new zve.Notice("Failed to delete command. Please try again."),c}},s=async l=>{try{let c=dir(l.title,e),d={...l,title:c};await Pc.getInstance().createCommand(d,{autoOrder:!1})}catch(c){console.error("Failed to copy command:",c),new zve.Notice("Failed to copy command. Please try again.")}},u=async l=>{let{active:c,over:d}=l;if(!d||c.id===d.id)return;let f=e.findIndex(g=>g.title===c.id),p=e.findIndex(g=>g.title===d.id);if(f===-1||p===-1)return;let h=[...e],[m]=h.splice(f,1);h.splice(p,0,m),await Pc.getInstance().reorderCommands(h)};return Ft.default.createElement("div",{className:"tw-space-y-4"},Ft.default.createElement("section",null,Ft.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Ft.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Ft.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 ",Ft.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),Ft.default.createElement(qr,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:l=>{nt("customPromptsFolder",l),_be()},placeholder:"copilot-custom-prompts"}),Ft.default.createElement(qr,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:r.enableCustomPromptTemplating,onCheckedChange:l=>{nt("enableCustomPromptTemplating",l)}}),Ft.default.createElement(qr,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:l=>nt("promptSortStrategy",l),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),Ft.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"},Ft.default.createElement(qE,{className:"tw-size-5"})," ",Ft.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",Ft.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),Ft.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Ft.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between"},Ft.default.createElement("div",null,Ft.default.createElement(he,{variant:"secondary",onClick:()=>new Tc(app,oKe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default Commands")),Ft.default.createElement(he,{variant:"default",className:"tw-gap-2",onClick:()=>{let l={...BO};new u$(app,e,l,async d=>{await i(d)}).open()}},Ft.default.createElement(Hh,{className:"tw-size-4"}),"Add Command")),Ft.default.createElement(tX,{sensors:n,collisionDetection:QY,onDragEnd:u},Ft.default.createElement(qY,null,Ft.default.createElement(HY,null,Ft.default.createElement(MN,null,Ft.default.createElement(sm,{className:"tw-w-10"}),Ft.default.createElement(sm,null,"Name"),Ft.default.createElement(sm,{className:"tw-w-24 tw-text-center"},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",Ft.default.createElement(so,null,Ft.default.createElement(St,null,Ft.default.createElement(Ct,{asChild:!0},Ft.default.createElement(qv,{className:"tw-size-4"})),Ft.default.createElement(_t,{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."))))),Ft.default.createElement(sm,{className:"tw-w-28 tw-text-center"},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",Ft.default.createElement(so,null,Ft.default.createElement(St,null,Ft.default.createElement(Ct,{asChild:!0},Ft.default.createElement(qv,{className:"tw-size-4"})),Ft.default.createElement(_t,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat."))))),Ft.default.createElement(sm,{className:"tw-w-32 tw-text-center"},"Actions"))),Ft.default.createElement(nX,{items:e.map(l=>l.title),strategy:rX},Ft.default.createElement(VY,null,e.length===0?Ft.default.createElement(MN,null,Ft.default.createElement(pp,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(l=>Ft.default.createElement(yGn,{key:l.title,command:l,commands:e,onUpdate:o,onRemove:a,onCopy:s})))))))))};un();var lo=j(Y());bt();var Q$=j(Y()),ryr=()=>{let t=vn();return Q$.default.createElement("div",{className:"tw-space-y-4"},Q$.default.createElement("section",null,Q$.default.createElement(qr,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>nt("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),Q$.default.createElement("div",{className:"tw-space-y-4"},Q$.default.createElement(qr,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{nt("enableEncryption",e)}}),Q$.default.createElement(qr,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{nt("debug",e)}}))))};vu();po();or();xn();ly();bt();var ec=j(Y()),nyr=require("obsidian"),oyr=j($c());po();ly();bt();un();function bGn({onConfirm:t,onCancel:e}){let r=oe();return ec.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},ec.default.createElement("div",null,ec.default.createElement("p",null,"Thanks for purchasing ",ec.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!"),ec.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),ec.default.createElement("ul",{className:"tw-pl-4"},ec.default.createElement("li",null,"Default mode: ",ec.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),ec.default.createElement("li",null,"Chat model: ",ec.default.createElement("b",{className:"tw-text-accent"},ize)),ec.default.createElement("li",null,ec.default.createElement("div",null,"Embedding model:"," ",ec.default.createElement("b",{className:"tw-text-accent"},aze)),r.embeddingModelKey!==sze&&ec.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},ec.default.createElement(Lp,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),ec.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},ec.default.createElement(he,{variant:"ghost",onClick:e},"Apply Later"),ec.default.createElement(he,{variant:"default",onClick:t},"Apply Now")))}var Uve=class extends nyr.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,oyr.createRoot)(e);let r=()=>{U3t(),this.close()},n=()=>{this.close()};this.root.render(ec.default.createElement(bGn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};po();or();ly();bt();un();var mu=j(Y());function iyr(){let t=vn(),[e,r]=(0,mu.useState)(null),[n,o]=(0,mu.useState)(!1),i=f4(),[a,s]=(0,mu.useState)(t.plusLicenseKey);return(0,mu.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),mu.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},mu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},mu.default.createElement("span",null,"Copilot Plus"),i&&mu.default.createElement(cp,{variant:"outline",className:"tw-text-success"},"Active")),mu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},mu.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, including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more."),mu.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!")),mu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mu.default.createElement(JO,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),mu.default.createElement(he,{disabled:n,onClick:async()=>{nt("plusLicenseKey",a),o(!0);let u=await lO();o(!1),u?(r(null),new Uve(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?mu.default.createElement(nu,{className:"tw-size-4 tw-animate-spin"}):"Apply"),mu.default.createElement(he,{variant:"secondary",onClick:()=>oD(EE.SETTINGS)},"Join Now ",mu.default.createElement(tD,{className:"tw-size-4"}))),mu.default.createElement("div",{className:"tw-text-error"},e))}ir();un();var WV=require("obsidian"),at=j(Y());po();or();jj();mR();Gt();bt();or();var _Gn={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"}))||[]},vGn=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})):[],wGn=t=>_Gn[t]||vGn(t),ayr=(t,e)=>{let r=wGn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};ir();un();var LN=require("obsidian"),Nr=j(Y()),syr=j($c());function xGn({onClose:t}){let e=vn(),[r,n]=(0,Nr.useState)(null),[o,i]=(0,Nr.useState)({}),[a,s]=(0,Nr.useState)(null),[u,l]=(0,Nr.useState)(null),[c,d]=(0,Nr.useState)(null),[f,p]=(0,Nr.useState)(!1);(0,Nr.useEffect)(()=>{n(null),d(null)},[]);let h=w=>{let S=OE[w];return e[S]??""},m=QSe().map(w=>{let S=w,C=h(S);return{provider:S,apiKey:C}}),g=(w,S)=>{h(w)!==S&&(nt(OE[w],S),i(E=>({...E,[w]:void 0})),l(E=>E===w?null:E))},y=async(w,S)=>{s(w),l(null);try{S=await So(S);let C=SE(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 F=await(M?_u:fetch)(C,{headers:E,signal:D.signal,method:"GET"});if(!F.ok){let K=eo(await F.json());throw ie(K),new Error(`Failed to fetch models: ${F.statusText}
detail: `+K)}return F}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: `+eo(M)+`
with CORS Error: `+eo(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 LN.Notice(`Failed to load models for ${Mp(w)}: ${eo(C)}`,5e3)}},_=async()=>{if(!c){new LN.Notice("Please select a model first");return}p(!0);try{let w=h(c.provider),S={name:c.name,provider:c.provider,apiKey:w,enabled:!0};if(await Vd.instance.getCurrentChainManager().chatModelManager.ping(S),e.activeModels.find(E=>E.name===c.name&&E.provider===c.provider))new LN.Notice(`Model ${c.name} verified successfully! It already exists in your models list.`);else{let E=[...e.activeModels,S];nt("activeModels",E),new LN.Notice(`Model ${c.name} verified successfully and added to your models list!`)}}catch(w){console.error("Model verification failed:",w),new LN.Notice("Model verification failed: "+eo(w),1e4)}finally{p(!1)}};return Nr.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Nr.default.createElement("div",{className:"tw-mb-4"},Nr.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Nr.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Nr.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Nr.default.createElement("div",{className:"tw-space-y-4"},m.map(w=>Nr.default.createElement(Nr.default.Fragment,{key:w.provider},Nr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nr.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Nr.default.createElement("div",{className:"tw-truncate"},Mp(w.provider))),Nr.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Nr.default.createElement("div",{className:"tw-flex-1"},Nr.default.createElement(JO,{className:"tw-max-w-full",value:w.apiKey,onChange:S=>g(w.provider,S)})),Nr.default.createElement("div",{className:""},Nr.default.createElement(he,{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&&y(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?Nr.default.createElement(Hb,{className:"tw-ml-1 tw-size-4"}):Nr.default.createElement(ki,{className:"tw-ml-1 tw-size-4"})))),Nr.default.createElement("div",null,SE(w.provider).keyManagementURL&&Nr.default.createElement("a",{href:SE(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 ",Mp(w.provider)," Key"))),Nr.default.createElement(iv,{open:r===w.provider,className:"tw-mt-2"},Nr.default.createElement(av,{className:"tw-rounded-md tw-p-3"},Nr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nr.default.createElement(Yn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Nr.default.createElement("div",null,Nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Nr.default.createElement("div",{className:"tw-flex-1"},Nr.default.createElement(Y_e,{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&&y(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})),Nr.default.createElement("div",{className:"tw-w-[72px]"},Nr.default.createElement(he,{onClick:_,disabled:!c||c.provider!==w.provider||f,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},f?Nr.default.createElement(nu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Nr.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},a===w.provider&&Nr.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),u===w.provider&&Nr.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&&Nr.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&&Nr.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Nr.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Nr.default.createElement(he,{onClick:t},"Close")))}var qve=class extends LN.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,syr.createRoot)(e),this.root.render(Nr.default.createElement(xGn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};var CGn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},uyr=()=>{let t=vn(),[e,r]=(0,at.useState)(!1),[n,o]=(0,at.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=()=>{r(!0);try{let u=n||"{$date}_{$time}__{$topic}",c=["{$date}","{$time}","{$topic}"].filter(g=>!u.includes(g));if(c.length>0){new WV.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 WV.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:p}=tu(new Date),m=u.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",p.split("_")[0]).replace("{$time}",p.split("_")[1]);nt("defaultConversationNoteName",u),o(u),new WV.Notice(`Format applied successfully! Example: ${m}`,4e3)}catch(u){new WV.Notice(`Error applying format: ${u.message}`,4e3)}finally{r(!1)}},a=!!t.activeModels.find(u=>u.enabled&&tn(u)===t.defaultModelKey),s=t.activeModels.filter(u=>u.enabled).map(u=>({label:qH(u),value:tn(u)}));return at.default.createElement("div",{className:"tw-space-y-4"},at.default.createElement(iyr,null),at.default.createElement("section",null,at.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),at.default.createElement("div",{className:"tw-space-y-4"},at.default.createElement("div",{className:"tw-space-y-4"},at.default.createElement(qr,{type:"custom",title:"API Keys",description:at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},at.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),at.default.createElement(so,{delayDuration:0},at.default.createElement(St,null,at.default.createElement(Ct,{asChild:!0},at.default.createElement($i,{className:"tw-size-4"})),at.default.createElement(_t,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},at.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),at.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.")))))},at.default.createElement(he,{onClick:()=>{new qve(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",at.default.createElement(T5,{className:"tw-size-4"})))),at.default.createElement(qr,{type:"select",title:"Default Chat Model",description:at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},at.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),at.default.createElement(so,{delayDuration:0},at.default.createElement(St,null,at.default.createElement(Ct,{asChild:!0},at.default.createElement($i,{className:"tw-size-4"})),at.default.createElement(_t,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},at.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),at.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&&tn(f)===u);if(!l)return;let{hasApiKey:c,errorNotice:d}=tz(l,t);if(!c&&d){new WV.Notice(d);return}nt("defaultModelKey",u)},options:a?s:[{label:"Select Model",value:"Select Model"},...s],placeholder:"Model"}),at.default.createElement(qr,{type:"select",title:"Default Mode",description:at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},at.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),at.default.createElement(so,{delayDuration:0},at.default.createElement(St,null,at.default.createElement(Ct,{asChild:!0},at.default.createElement($i,{className:"tw-size-4"})),at.default.createElement(_t,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},at.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},at.default.createElement("li",null,at.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",at.default.createElement("i",null,"Free to use with your own API key.")),at.default.createElement("li",null,at.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",at.default.createElement("i",null,"Free to use with your own API key.")),at.default.createElement("li",null,at.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"," ",at.default.createElement("a",{href:uze(EE.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=>nt("defaultChainType",u),options:Object.entries(CGn).map(([u,l])=>({label:l,value:u}))}),at.default.createElement(qr,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:u=>nt("defaultOpenArea",u),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),at.default.createElement(qr,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot-conversations'",value:t.defaultSaveFolder,onChange:u=>nt("defaultSaveFolder",u),placeholder:"copilot-conversations"}),at.default.createElement(qr,{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=>nt("defaultConversationTag",u),placeholder:"ai-conversations"}),at.default.createElement(qr,{type:"custom",title:"Conversation Filename Template",description:at.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},at.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),at.default.createElement(so,{delayDuration:0},at.default.createElement(St,null,at.default.createElement(Ct,{asChild:!0},at.default.createElement($i,{className:"tw-size-4"})),at.default.createElement(_t,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},at.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),at.default.createElement("div",null,at.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),at.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},at.default.createElement("li",null,at.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),at.default.createElement("li",null,at.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),at.default.createElement("li",null,at.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),at.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},at.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},at.default.createElement(gi,{type:"text",className:me("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}),at.default.createElement(he,{onClick:()=>i(),disabled:e,variant:"secondary"},e?at.default.createElement(at.default.Fragment,null,at.default.createElement(nu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),at.default.createElement(qr,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:u=>nt("autosaveChat",u)}),at.default.createElement(qr,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:u=>nt("showSuggestedPrompts",u)}),at.default.createElement(qr,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:u=>nt("showRelevantNotes",u)}))))};po();var pv=j(Y());Jye();bt();var lyr=()=>{let t=vn(),e=FO.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),nt("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:pv.default.createElement(pv.default.Fragment,{key:u},c.map(({metadata:d})=>pv.default.createElement(qr,{key:d.id,type:"switch",title:d.displayName,description:d.description,checked:r.has(d.id),onCheckedChange:f=>i(d.id,f)})))});return pv.default.createElement(pv.default.Fragment,null,pv.default.createElement(qr,{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=>{nt("autonomousAgentMaxIterations",s)},min:4,max:8,step:1}),pv.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},pv.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),pv.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),pv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},a())))};or();xn();bt();un();var eB=require("obsidian"),Fn=j(Y()),cyr=()=>{let t=vn(),e=t.autocompleteAcceptKey||Yg.KEYBIND,[r,n]=(0,Fn.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{nt("autocompleteAcceptKey",u),new eB.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{nt("autocompleteAcceptKey",Yg.KEYBIND),new eB.Notice(`Autocomplete accept key reset to: ${Yg.KEYBIND}`)},s=async()=>{if(!r){n(!0),new eB.Notice("Rebuilding word index...");try{let l=await t$.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new eB.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new eB.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new eB.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return Fn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Fn.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Fn.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Fn.default.createElement(cp,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Fn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Fn.default.createElement(qr,{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=>{nt("includeActiveNoteAsContext",u)}}),Fn.default.createElement(qr,{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=>{nt("passMarkdownImages",u)}}),Fn.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),Fn.default.createElement(qr,{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=>{nt("enableAutonomousAgent",u)}}),t.enableAutonomousAgent&&Fn.default.createElement(Fn.default.Fragment,null,Fn.default.createElement(lyr,null)),Fn.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),Fn.default.createElement(qr,{type:"switch",title:"Sentence Autocomplete",description:Fn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Fn.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>nt("enableAutocomplete",u)}),Fn.default.createElement(qr,{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=>{nt("enableWordCompletion",u)}}),Fn.default.createElement(qr,{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."},Fn.default.createElement(he,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},Fn.default.createElement(Vv,{className:me("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),Fn.default.createElement(qr,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:Fn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Fn.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),Fn.default.createElement(so,{delayDuration:0},Fn.default.createElement(St,null,Fn.default.createElement(Ct,{asChild:!0},Fn.default.createElement($i,{className:"tw-size-4"})),Fn.default.createElement(_t,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Fn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},Fn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fn.default.createElement(PN,{value:e,onValueChange:i},Fn.default.createElement(vA,{className:"tw-w-[180px]"},Fn.default.createElement(TN,{placeholder:"Select key"})),Fn.default.createElement(wA,null,o.map(u=>Fn.default.createElement(xA,{key:u.value,value:u.value},u.label)))),e&&e!==Yg.KEYBIND&&Fn.default.createElement(he,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),Fn.default.createElement(qr,{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=>{nt("allowAdditionalContext",u)}}))))};or();oF();mR();Gt();bt();var Be=j(Y());bt();or();ir();var cX=require("obsidian");po();un();var NKe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=BV(),a=oe(),s=o?"openai":"openai",[u,l]=(0,Be.useState)(null),[c,d]=(0,Be.useState)(!1),[f,p]=(0,Be.useState)(!1),[h,m]=(0,Be.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),g=(L,Q)=>{m(z=>({...z,[L]:Q}))},y=()=>{m({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},_=()=>{let L=!0,Q={...h};return Q.name=!C.name,C.name||(L=!1),C.provider==="azure openai"&&(Q.instanceName=!C.azureOpenAIApiInstanceName,Q.apiVersion=!C.azureOpenAIApiVersion,o?(Q.embeddingDeploymentName=!C.azureOpenAIApiEmbeddingDeploymentName,C.azureOpenAIApiEmbeddingDeploymentName||(L=!1)):(Q.deploymentName=!C.azureOpenAIApiDeploymentName,C.azureOpenAIApiDeploymentName||(L=!1)),(!C.azureOpenAIApiInstanceName||!C.azureOpenAIApiVersion)&&(L=!1)),m(Q),L},w=L=>a[OE[L]]||"",S=(L=s)=>{let Q={name:"",provider:L,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:w(L),isEmbeddingModel:o,capabilities:[]};return o?Q:{...Q,stream:!0}},[C,E]=(0,Be.useState)(S()),P=L=>({...L,name:L.name?.trim(),baseUrl:L.baseUrl?.trim(),apiKey:L.apiKey?.trim(),openAIOrgId:L.openAIOrgId?.trim(),azureOpenAIApiInstanceName:L.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:L.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:L.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:L.azureOpenAIApiVersion?.trim()}),[T,I]=(0,Be.useState)(SE(s)),N=()=>!!(C.name&&C.provider),M=()=>f||!N(),D=()=>{if(!_()){new cX.Notice("Please fill in all required fields");return}let L=P(C);r(L),e(!1),E(S()),y()},k=L=>{I(SE(L)),E({...C,provider:L,apiKey:w(L),...L==="openai"?{openAIOrgId:a.openAIOrgId}:{},...L==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},F=L=>{L||(E(S()),y(),d(!1)),e(L)},K=async()=>{if(!_()){new cX.Notice("Please fill in all required fields");return}p(!0);try{let L=P(C);await n(L),new cX.Notice("Model verification successful!")}catch(L){console.error(L);let Q=eo(L);new cX.Notice("Model verification failed: "+Q)}finally{p(!1)}},U=()=>{let Q=(()=>{switch(C.provider){case"openai":return Be.default.createElement(Yn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Be.default.createElement(gi,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:C.openAIOrgId||"",onChange:z=>E({...C,openAIOrgId:z.target.value})}));case"azure openai":return Be.default.createElement(Be.default.Fragment,null,Be.default.createElement(Yn,{label:"Instance Name",required:!0,error:h.instanceName,errorMessage:"Instance name is required"},Be.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:C.azureOpenAIApiInstanceName||"",onChange:z=>{E({...C,azureOpenAIApiInstanceName:z.target.value}),g("instanceName",!1)}})),o?Be.default.createElement(Yn,{label:"Embedding Deployment Name",required:!0,error:h.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Be.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:C.azureOpenAIApiEmbeddingDeploymentName||"",onChange:z=>{E({...C,azureOpenAIApiEmbeddingDeploymentName:z.target.value}),g("embeddingDeploymentName",!1)}})):Be.default.createElement(Yn,{label:"Deployment Name",required:!0,error:h.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Be.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:C.azureOpenAIApiDeploymentName||"",onChange:z=>{E({...C,azureOpenAIApiDeploymentName:z.target.value}),g("deploymentName",!1)}})),Be.default.createElement(Yn,{label:"API Version",required:!0,error:h.apiVersion,errorMessage:"API version is required"},Be.default.createElement(gi,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:C.azureOpenAIApiVersion||"",onChange:z=>{E({...C,azureOpenAIApiVersion:z.target.value}),g("apiVersion",!1)}})));default:return null}})();return Q?Be.default.createElement(iv,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Be.default.createElement(em,null,"Additional ",Mp(C.provider)," Settings"),Be.default.createElement(fA,{asChild:!0},Be.default.createElement(he,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},Be.default.createElement(ki,{className:"tw-size-4"}),Be.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),Be.default.createElement(av,{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},X=()=>{if(C.provider!=="azure openai")return T.host;let L=C.azureOpenAIApiInstanceName||"[instance]",Q=o?C.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":C.azureOpenAIApiDeploymentName||"[deployment]",z=C.azureOpenAIApiVersion||"[api-version]";return`https://${L}.openai.azure.com/openai/deployments/${Q}/${o?"embeddings":"chat/completions"}?api-version=${z}`},ee=Object.entries(rI).map(([L,Q])=>({id:L,label:L.charAt(0).toUpperCase()+L.slice(1),description:Q}));return Be.default.createElement(Bve,{open:t,onOpenChange:F},Be.default.createElement(aX,{className:"sm:tw-max-w-[425px]",container:i,ref:L=>l(L)},Be.default.createElement(sX,null,Be.default.createElement(uX,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Be.default.createElement(lX,null,"Add a new model to your collection.")),Be.default.createElement("div",{className:"tw-space-y-3"},Be.default.createElement(Yn,{label:"Model Name",required:!0,error:h.name,errorMessage:"Model name is required"},Be.default.createElement(gi,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:C.name,onChange:L=>{E({...C,name:L.target.value}),g("name",!1)}})),Be.default.createElement(Yn,{label:Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Be.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Be.default.createElement(so,{delayDuration:0},Be.default.createElement(St,null,Be.default.createElement(Ct,{asChild:!0},Be.default.createElement($i,{className:"tw-size-4"})),Be.default.createElement(_t,{align:"start",className:"tw-max-w-96",side:"bottom"},Be.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Be.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Be.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Be.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Be.default.createElement("li",null,"Direct-Paid:Ds-r1"),Be.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Be.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Be.default.createElement(gi,{type:"text",placeholder:"Custom display name (optional)",value:C.displayName||"",onChange:L=>{E({...C,displayName:L.target.value})}})),Be.default.createElement(Yn,{label:"Provider"},Be.default.createElement(PN,{value:C.provider,onValueChange:k},Be.default.createElement(vA,null,Be.default.createElement(TN,{placeholder:"Select provider"})),Be.default.createElement(wA,{container:u},Object.values(o?s8(QA,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):s8(CE,["COPILOT_PLUS"])).map(L=>Be.default.createElement(xA,{key:L,value:L},Mp(L)))))),Be.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Be.default.createElement(gi,{type:"text",placeholder:X()||"https://api.example.com/v1",value:C.baseUrl||"",onChange:L=>E({...C,baseUrl:L.target.value})})),Be.default.createElement(Yn,{label:"API Key"},Be.default.createElement(JO,{placeholder:`Enter ${T.label} API Key`,value:C.apiKey||"",onChange:L=>E({...C,apiKey:L})}),T.keyManagementURL&&Be.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Be.default.createElement("a",{href:T.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",T.label," API Key"))),Be.default.createElement(Yn,{label:Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Be.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Be.default.createElement(so,{delayDuration:0},Be.default.createElement(St,null,Be.default.createElement(Ct,{asChild:!0},Be.default.createElement($i,{className:"tw-size-4"})),Be.default.createElement(_t,{align:"start",className:"tw-max-w-96",side:"bottom"},Be.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},ee.map(({id:L,label:Q,description:z})=>Be.default.createElement("div",{key:L,className:"tw-flex tw-items-center tw-gap-2"},Be.default.createElement(Ec,{id:L,checked:C.capabilities?.includes(L),onCheckedChange:W=>{let V=C.capabilities||[];E({...C,capabilities:W?[...V,L]:V.filter(q=>q!==L)})}}),Be.default.createElement(em,{htmlFor:L,className:"tw-text-sm"},Be.default.createElement(so,{delayDuration:0},Be.default.createElement(St,null,Be.default.createElement(Ct,{asChild:!0},Be.default.createElement("span",null,Q)),Be.default.createElement(_t,{side:"bottom"},z)))))))),U()),Be.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Be.default.createElement(Ec,{id:"enable-cors",checked:C.enableCors||!1,onCheckedChange:L=>E({...C,enableCors:L})}),Be.default.createElement(em,{htmlFor:"enable-cors",className:"tw-text-sm"},Be.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Be.default.createElement("span",null,"Enable CORS"),Be.default.createElement(so,{delayDuration:0},Be.default.createElement(St,null,Be.default.createElement(Ct,{asChild:!0},Be.default.createElement($i,{className:"tw-size-4"})),Be.default.createElement(_t,{align:"start",className:"tw-max-w-96",side:"bottom"},Be.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),Be.default.createElement("div",{className:"tw-flex tw-gap-2"},Be.default.createElement(he,{variant:"secondary",onClick:D,disabled:M()},"Add Model"),Be.default.createElement(he,{variant:"secondary",onClick:K,disabled:M()},f?Be.default.createElement(Be.default.Fragment,null,Be.default.createElement(nu,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};or();bt();ir();un();var dyr=require("obsidian"),Fe=j(Y()),fyr=j($c());var bi=j(Y());po();un();function tB(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,bi.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 bi.default.createElement("div",{className:"tw-space-y-3"},bi.default.createElement(so,{delayDuration:0},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&bi.default.createElement(St,null,bi.default.createElement(Ct,{asChild:!0},bi.default.createElement($i,{className:"tw-size-4 tw-text-muted"})),bi.default.createElement(_t,{side:"bottom"},bi.default.createElement("div",{className:"tw-max-w-[300px]"},r)))),bi.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},bi.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&&bi.default.createElement(St,null,bi.default.createElement(Ct,{asChild:!0},bi.default.createElement(he,{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?bi.default.createElement(L5,{className:"tw-size-4"}):bi.default.createElement(D5,{className:"tw-size-4"}))),bi.default.createElement(_t,{side:"bottom"},bi.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),bi.default.createElement("div",{className:"tw-relative"},i==="slider"?bi.default.createElement(bi.default.Fragment,null,bi.default.createElement(MY,{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&&bi.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):bi.default.createElement(PN,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},bi.default.createElement(vA,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},bi.default.createElement(TN,{placeholder:"Select an option"})),bi.default.createElement(wA,null,t.options.map(f=>bi.default.createElement(xA,{key:f.value,value:f.value},f.label))))))}var OGn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,Fe.useState)(t),[a,s]=(0,Fe.useState)(t),[u,l]=(0,Fe.useState)({}),c=oe(),d=w=>c[OE[w]]||"";(0,Fe.useEffect)(()=>{i(t),s(t),t.provider&&l(SE(t.provider))},[t]);let f=(0,Fe.useMemo)(()=>xee((w,S)=>{e(n,w,S)},500),[n,e]),p=(0,Fe.useCallback)((w,S)=>{i(C=>{let E={...C,[w]:S};return f(a,E),E})},[a,f]),h=(0,Fe.useCallback)(w=>{i(S=>{let C={...S};return delete C[w],f(a,C),C})},[f,a]);if(!o)return null;let m=()=>{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}`},g=Object.entries(rI).map(([w,S])=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),description:S})),y=o.apiKey||d(o.provider),_=!n&&o.provider!=="copilot-plus-jina";return Fe.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Fe.default.createElement("div",{className:"tw-mb-4"},Fe.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),Fe.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),Fe.default.createElement("div",{className:"tw-space-y-3"},Fe.default.createElement(Yn,{label:"Model Name",required:!0},Fe.default.createElement(gi,{type:"text",disabled:o.core,value:o.name,onChange:w=>p("name",w.target.value),placeholder:"Enter model name"})),Fe.default.createElement(Yn,{label:Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Fe.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Fe.default.createElement(so,{delayDuration:0},Fe.default.createElement(St,null,Fe.default.createElement(Ct,{asChild:!0},Fe.default.createElement($i,{className:"tw-size-4"})),Fe.default.createElement(_t,{align:"start",className:"tw-max-w-96",side:"bottom"},Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Fe.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Fe.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Fe.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Fe.default.createElement("li",null,"Direct-Paid:Ds-r1"),Fe.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Fe.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Fe.default.createElement(gi,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:w=>p("displayName",w.target.value)})),Fe.default.createElement(Yn,{label:"Provider"},Fe.default.createElement(gi,{type:"text",value:Mp(o.provider),disabled:!0})),Fe.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Fe.default.createElement(gi,{type:"text",placeholder:m(),value:o.baseUrl||"",onChange:w=>p("baseUrl",w.target.value)})),Fe.default.createElement(Yn,{label:"API Key"},Fe.default.createElement(JO,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:y,onChange:w=>p("apiKey",w)}),u.keyManagementURL&&Fe.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Fe.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),_&&Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement(Yn,{label:Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Fe.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Fe.default.createElement(so,{delayDuration:0},Fe.default.createElement(St,null,Fe.default.createElement(Ct,{asChild:!0},Fe.default.createElement($i,{className:"tw-size-4"})),Fe.default.createElement(_t,{align:"start",className:"tw-max-w-96",side:"bottom"},Fe.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},g.map(({id:w,label:S,description:C})=>Fe.default.createElement("div",{key:w,className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(Ec,{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)}}),Fe.default.createElement(em,{htmlFor:w,className:"tw-text-sm"},Fe.default.createElement(so,{delayDuration:0},Fe.default.createElement(St,null,Fe.default.createElement(Ct,{asChild:!0},Fe.default.createElement("span",null,S)),Fe.default.createElement(_t,{side:"bottom"},C)))))))),Fe.default.createElement(Yn,null,Fe.default.createElement(tB,{type:"slider",optional:!1,label:"Token limit",value:o.maxTokens??c.maxTokens,onChange:w=>p("maxTokens",w),max:65e3,min:0,step:100,defaultValue:Rf.MAX_TOKENS,helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement("p",null,"The maximum number of ",Fe.default.createElement("em",null,"output tokens")," to generate. Default is"," ",Rf.MAX_TOKENS,"."),Fe.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),Fe.default.createElement(Yn,null,Fe.default.createElement(tB,{type:"slider",optional:!1,label:"Temperature",value:o.temperature??c.temperature,onChange:w=>p("temperature",w),max:2,min:0,step:.05,defaultValue:Rf.TEMPERATURE,helpText:`Default is ${Rf.TEMPERATURE}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),Fe.default.createElement(Yn,null,Fe.default.createElement(tB,{type:"slider",label:"Top-P",value:o.topP,onChange:w=>p("topP",w),disableFn:()=>h("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"})),Fe.default.createElement(Yn,null,Fe.default.createElement(tB,{type:"slider",label:"Frequency Penalty",value:o.frequencyPenalty,onChange:w=>p("frequencyPenalty",w),disableFn:()=>h("frequencyPenalty"),max:2,min:0,step:.05,defaultValue:0,helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.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."),Fe.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"))&&Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement(Yn,null,Fe.default.createElement(tB,{type:"select",label:"Reasoning Effort",value:o.reasoningEffort,onChange:w=>p("reasoningEffort",w),disableFn:()=>h("reasoningEffort"),defaultValue:c.reasoningEffort??Rf.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:Fe.default.createElement(Fe.default.Fragment,null,Fe.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!"),Fe.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Fe.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),Fe.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Fe.default.createElement("li",null,"Medium: Balanced performance"),Fe.default.createElement("li",null,"High: Thorough reasoning, slower responses")))})),o.name.startsWith("gpt-5")&&Fe.default.createElement(Yn,null,Fe.default.createElement(tB,{type:"select",label:"Verbosity",value:o.verbosity,onChange:w=>p("verbosity",w),disableFn:()=>h("verbosity"),defaultValue:c.verbosity??Rf.VERBOSITY,options:[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement("p",null,"Controls the length and detail of the model responses."),Fe.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Fe.default.createElement("li",null,"Low: Concise, brief responses"),Fe.default.createElement("li",null,"Medium: Balanced detail"),Fe.default.createElement("li",null,"High: Detailed, comprehensive responses")))}))))))},Hve=class extends dyr.Modal{constructor(r,n,o,i){super(r);this.model=n;this.isEmbeddingModel=o;this.onUpdate=i}onOpen(){let{contentEl:r}=this;this.root=(0,fyr.createRoot)(r);let n=(i,a,s)=>{this.onUpdate(i,a,s)},o=()=>{this.close()};this.root.render(Fe.default.createElement(OGn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:n,onCancel:o}))}onClose(){this.root.unmount()}};po();or();xn();bt();ir();un();var De=j(Y());var Vve=j(Y()),jKe=(0,Vve.createContext)(null),DKe=()=>(0,Vve.useContext)(jKe);var EGn={reasoning:{icon:qE,color:"tw-text-model-capabilities-blue",tooltip:rI.reasoning},vision:{icon:UE,color:"tw-text-model-capabilities-green",tooltip:rI.vision},websearch:{icon:Wb,color:"tw-text-model-capabilities-blue",tooltip:rI.websearch}},PGn=["reasoning","vision","websearch"],TGn=t=>De.default.createElement(so,{delayDuration:0},De.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},PGn.map(e=>{let r=EGn[e];if(!r)return De.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?De.default.createElement(St,{key:e},De.default.createElement(Ct,{asChild:!0},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},De.default.createElement(n,{className:me("tw-size-4",r.color)}))),De.default.createElement(_t,{side:"bottom"},r.tooltip)):De.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},De.default.createElement("div",{className:"tw-size-4"}))}))),AGn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i})=>{let[a,s]=De.default.useState(!1),u=DKe(),{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:p,isDragging:h}=oX({id:i,disabled:t.core}),m={transform:cv.Transform.toString(f),transition:p};return De.default.createElement(I$,{ref:d,style:m,className:me("tw-mb-2",h&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],!t.core&&"tw-touch-none")},De.default.createElement(M$,{className:"tw-p-3"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&De.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...l,...c},De.default.createElement(Uv,{className:"tw-size-4"})),De.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>s(!a)},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},a?De.default.createElement(ki,{className:"tw-size-3 tw-stroke-[7]"}):De.default.createElement(Lm,{className:"tw-size-3 tw-stroke-[7]"})),De.default.createElement("div",null,De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},De.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&De.default.createElement(g8e,{capabilities:t.capabilities,iconSize:14})),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},Mp(t.provider,t)))))),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&De.default.createElement(he,{variant:"ghost",size:"icon",onClick:g=>{g.stopPropagation(),e(t)}},De.default.createElement(Gz,{className:"tw-size-4"})),De.default.createElement(lA,null,De.default.createElement(cA,{asChild:!0},De.default.createElement(he,{variant:"ghost",size:"icon"},De.default.createElement(zE,{className:"tw-size-4"}))),De.default.createElement(Pg,{align:"end",container:u},e&&De.default.createElement(Zn,{onClick:g=>{g.stopPropagation(),e(t)}},De.default.createElement(Kz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&De.default.createElement(Zn,{onClick:g=>{g.stopPropagation(),r(t)}},De.default.createElement(Uh,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&De.default.createElement(Zn,{onClick:g=>{g.stopPropagation(),n(tn(t))},className:"tw-text-error"},De.default.createElement(Vh,{className:"tw-mr-2 tw-size-4"}),"Delete")))))),De.default.createElement("div",{className:me("tw-transition-all tw-duration-300 tw-ease-in-out",a?"tw-max-h-20 tw-opacity-100":"tw-max-h-0 tw-overflow-hidden tw-opacity-0")},De.default.createElement(R$,{className:"tw-p-3 tw-pt-0"},De.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-text-sm"},"Enabled"),De.default.createElement(Ec,{checked:t.enabled,onCheckedChange:g=>o({...t,enabled:g})})),De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement("span",{className:"tw-text-sm"},"CORS"),De.default.createElement(Ec,{checked:t.enableCors,onCheckedChange:g=>o({...t,enableCors:g})}))))))},IGn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,isEmbeddingModel:i})=>{let{attributes:a,listeners:s,setNodeRef:u,transform:l,transition:c,isDragging:d}=oX({id:tn(t),disabled:t.core}),f=DKe(),p={transform:cv.Transform.toString(l),transition:c},h=e||!t.core||r&&!t.core;return De.default.createElement(MN,{ref:u,style:p,className:me("tw-transition-colors tw-duration-200 hover:tw-bg-interactive-accent/10",d&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50 tw-bg-primary/90")},De.default.createElement(pp,{className:"tw-w-6 tw-px-2"},!t.core&&De.default.createElement(he,{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",...a,...s},De.default.createElement(Uv,{className:"tw-size-4 tw-transition-colors"}))),De.default.createElement(pp,{className:"tw-pl-0"},t.displayName||t.name),De.default.createElement(pp,null,Mp(t.provider,t)),De.default.createElement(pp,null,TGn(t)),!i&&De.default.createElement(pp,{className:"tw-text-center"},De.default.createElement(Ec,{id:`${tn(t)}-enabled`,checked:t.enabled,onCheckedChange:m=>o({...t,enabled:m}),className:"tw-mx-auto"})),De.default.createElement(pp,{className:"tw-text-center"},De.default.createElement(Ec,{id:`${tn(t)}-enableCors`,checked:t.enableCors,onCheckedChange:m=>o({...t,enableCors:m}),className:"tw-mx-auto"})),De.default.createElement(pp,{className:"tw-text-center"},De.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&De.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},De.default.createElement(Gz,{className:"tw-size-4"})),h&&De.default.createElement(lA,null,De.default.createElement(cA,{asChild:!0},De.default.createElement(he,{variant:"ghost",size:"icon"},De.default.createElement(zE,{className:"tw-size-4"}))),De.default.createElement(Pg,{align:"end",container:f},e&&De.default.createElement(Zn,{onClick:()=>e(t)},De.default.createElement(Kz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&De.default.createElement(Zn,{onClick:()=>r(t)},De.default.createElement(Uh,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&De.default.createElement(Zn,{onClick:()=>n(tn(t)),className:"tw-text-error"},De.default.createElement(Vh,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},LKe=({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=Ive(HV(jN),HV(NN,{coordinateGetter:Fve})),d=t.findIndex(m=>!m.core),f=m=>g=>{let{transform:y,active:_,activeNodeRect:w,over:S}=g;if(!_||!w)return y;let C=t.findIndex(N=>tn(N)===_.id),E=t.filter(N=>!N.core).length,P=w.height,T=(d-C)*P,I=(d+E-1-C)*P;if(m&&S){let N=t.findIndex(D=>tn(D)===S.id);if(t[N].core||N<d)return{...y,x:0,y:C*P}}return{...y,x:0,y:Math.min(Math.max(T,y.y),I)}},p=m=>{let{active:g,over:y}=m;if(y&&g.id!==y.id){let _=t.findIndex(E=>tn(E)===g.id),w=t.findIndex(E=>tn(E)===y.id),S=t[w];if(w<d||S.core)return;let C=Lve(t,_,w);a?.(C)}},h=()=>De.default.createElement("div",{className:"tw-relative md:tw-hidden"},De.default.createElement(tX,{sensors:c,collisionDetection:QY,onDragEnd:p,modifiers:[f(!0)]},De.default.createElement(nX,{items:t.map(m=>tn(m)),strategy:rX},De.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(m=>De.default.createElement(AGn,{key:tn(m),id:tn(m),model:m,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return De.default.createElement("div",{className:"tw-mb-4"},De.default.createElement("div",{className:"tw-hidden md:tw-block"},De.default.createElement(tX,{sensors:c,collisionDetection:QY,onDragEnd:p,modifiers:[f(!1)]},De.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},De.default.createElement(qY,null,De.default.createElement(HY,null,De.default.createElement(MN,null,De.default.createElement(sm,{className:"tw-w-6 tw-px-2"}),De.default.createElement(sm,{className:"tw-pl-0"},"Model"),De.default.createElement(sm,null,"Provider"),De.default.createElement(sm,{className:"tw-text-center"},"Capabilities"),!l&&De.default.createElement(sm,{className:"tw-text-center"},"Enable"),De.default.createElement(sm,{className:"tw-text-center"},"CORS"),De.default.createElement(sm,{className:"tw-w-[100px] tw-text-center"},"Actions"))),De.default.createElement(VY,{className:"tw-relative"},De.default.createElement(nX,{items:t.map(m=>tn(m)),strategy:rX},t.map(m=>De.default.createElement(IGn,{key:tn(m),model:m,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h(),De.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},s&&De.default.createElement(he,{onClick:s,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(Vv,{className:"tw-size-4"}),"Refresh Built-in Models"),De.default.createElement(he,{onClick:o,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(Hh,{className:"tw-size-4"}),"Add Custom Model")))};ir();var Wve=require("obsidian"),lm=j(Y()),pyr=()=>{let t=vn(),[e,r]=(0,lm.useState)(!1),[n,o]=(0,lm.useState)(!1),i=(m,g=!1)=>{let y={...s8(m,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${m.name} (copy)`},_=g?"activeEmbeddingModels":"activeModels";nt(_,[...t[_],y])},a=(m,g=!1)=>{nt(g?"activeEmbeddingModels":"activeModels",m)},s=m=>{let[g,y]=m.split("|"),_=t.activeModels.filter(S=>!(S.name===g&&S.provider===y)),w=t.defaultModelKey;if(m===t.defaultModelKey){let S=_.find(C=>C.enabled);w=S?`${S.name}|${S.provider}`:""}wE({activeModels:_,defaultModelKey:w})},u=(m,g,y)=>{let _=m?"activeEmbeddingModels":"activeModels",w=t[_].findIndex(S=>S.name===g.name&&S.provider===g.provider);if(w!==-1){let S=[...t[_]];S[w]=y,nt(_,S)}else new Wve.Notice("Could not find model to update"),ie("Could not find model to update:",g)},l=m=>{let g=t.activeModels.map(y=>y.name===m.name&&y.provider===m.provider?m:y);nt("activeModels",g)},c=m=>{let[g,y]=m.split("|"),_=t.activeEmbeddingModels.filter(w=>!(w.name===g&&w.provider===y));nt("activeEmbeddingModels",_)},d=m=>{let g=t.activeEmbeddingModels.map(y=>y.name===m.name&&y.provider===m.provider?m:y);nt("activeEmbeddingModels",g)},f=()=>{let m=t.activeModels.filter(y=>!y.isBuiltIn),g=[...Av,...m];nt("activeModels",g),new Wve.Notice("Chat models refreshed successfully")},p=()=>{let m=t.activeEmbeddingModels.filter(y=>!y.isBuiltIn),g=[...Pj,...m];nt("activeEmbeddingModels",g),new Wve.Notice("Embedding models refreshed successfully")},h=(m,g=!1)=>{new Hve(app,m,g,u).open()};return lm.default.createElement("div",{className:"tw-space-y-4"},lm.default.createElement("section",null,lm.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),lm.default.createElement(LKe,{models:t.activeModels,onEdit:m=>h(m),onCopy:m=>i(m),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:m=>a(m),onRefresh:f,title:"Chat Model"}),lm.default.createElement(NKe,{open:e,onOpenChange:r,onAdd:m=>{let g=[...t.activeModels,m];nt("activeModels",g)},ping:m=>Vd.instance.getCurrentChainManager().chatModelManager.ping(m)}),lm.default.createElement("div",{className:"tw-space-y-4"},lm.default.createElement(qr,{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:m=>nt("contextTurns",m),min:1,max:50,step:1}))),lm.default.createElement("section",null,lm.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),lm.default.createElement(LKe,{models:t.activeEmbeddingModels,onEdit:m=>h(m,!0),onDelete:c,onCopy:m=>i(m,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:m=>a(m,!0),onRefresh:p,title:"Embedding Model"}),lm.default.createElement(NKe,{open:n,onOpenChange:o,onAdd:m=>{let g=[...t.activeEmbeddingModels,m];nt("activeEmbeddingModels",g)},isEmbeddingModel:!0,ping:m=>Iu.getInstance().ping(m)})))};var byr=require("obsidian");po();var Hn=j(Y()),_yr=j($c());rh();un();var myr=require("obsidian"),Cb=j(Y()),hyr=j($c());po();function MGn({onConfirm:t,onCancel:e}){let[r,n]=(0,Cb.useState)(""),[o,i]=(0,Cb.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return Cb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Cb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Cb.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&&Cb.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),Cb.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Cb.default.createElement(he,{variant:"secondary",onClick:e},"Cancel"),Cb.default.createElement(he,{variant:"default",onClick:()=>a(r)},"Confirm")))}var Kve=class extends myr.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,hyr.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Cb.default.createElement(MGn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var gyr=require("obsidian"),mv=j(Y()),yyr=j($c());po();function RGn({onConfirm:t,onCancel:e}){let[r,n]=(0,mv.useState)("");return mv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},mv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},mv.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"),mv.default.createElement(gi,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),mv.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},mv.default.createElement(he,{variant:"secondary",onClick:e},"Cancel"),mv.default.createElement(he,{variant:"default",onClick:()=>t(r)},"Confirm")))}var Gve=class extends gyr.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,yyr.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(mv.default.createElement(RGn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Jve({title:t,patterns:e,onRemove:r}){return Hn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Hn.default.createElement("div",{className:"tw-font-bold"},t),Hn.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=>Hn.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"},Hn.default.createElement(xh,{className:"tw-flex-1"},n),Hn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Hn.default.createElement(vi,{className:"tw-size-4"}))))))}function NGn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Hn.useState)(t),i=th(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=s4(i),c=f=>{let p=u4({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 Hn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Hn.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&&Hn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Hn.default.createElement(Jve,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(h=>h!==f);c({tagPatterns:p})}}),s.length>0&&Hn.default.createElement(Jve,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(h=>h!==f);c({extensionPatterns:p})}}),u.length>0&&Hn.default.createElement(Jve,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(h=>h!==f);c({folderPatterns:p})}}),l.length>0&&Hn.default.createElement(Jve,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(h=>h!==f);c({notePatterns:p})}})),Hn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Hn.default.createElement(lA,null,Hn.default.createElement(cA,{asChild:!0},Hn.default.createElement(he,{variant:"secondary"},"Add...")),Hn.default.createElement(Pg,{align:"start",container:r},Hn.default.createElement(Zn,{onSelect:()=>{new vV(app,f=>{let p=QK(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hn.default.createElement(NI,{className:"tw-size-4"}),"Tag")),Hn.default.createElement(Zn,{onSelect:()=>{new _V(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hn.default.createElement(uy,{className:"tw-size-4"}),"Folder")),Hn.default.createElement(Zn,{onSelect:()=>{new fN({app,onNoteSelect:f=>{let p=l4(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hn.default.createElement(Fm,{className:"tw-size-4"}),"Note")),Hn.default.createElement(Zn,{onSelect:()=>{new Kve(app,f=>{let p=rze(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hn.default.createElement(O5,{className:"tw-size-4"}),"Extension")),Hn.default.createElement(Zn,{onSelect:()=>{new Gve(app,f=>{let p=th(f),{tagPatterns:h,extensionPatterns:m,folderPatterns:g,notePatterns:y}=s4(p);c({tagPatterns:[...a,...h],extensionPatterns:[...s,...m],folderPatterns:[...u,...g],notePatterns:[...l,...y]})}).open()}},Hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hn.default.createElement(VE,{className:"tw-size-4"}),"Custom"))))))}var dX=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,_yr.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Hn.default.createElement(NGn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var Zve=class extends Tc{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 Yve=class extends Tc{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")}};po();or();bt();un();var Wt=j(Y()),vyr=()=>{let t=vn(),e=async r=>{r!==t.embeddingModelKey&&new Zve(app,async()=>{nt("embeddingModelKey",r),await(await Promise.resolve().then(()=>(Jc(),Qf))).default.getInstance().indexVaultToVectorStore()}).open()};return Wt.default.createElement("div",{className:"tw-space-y-4"},Wt.default.createElement("section",null,Wt.default.createElement("div",{className:"tw-space-y-4"},Wt.default.createElement(qr,{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 Yve(app,()=>nt("enableSemanticSearchV3",r),r).open()}}),t.enableSemanticSearchV3&&Wt.default.createElement(qr,{type:"select",title:"Embedding Model",description:Wt.default.createElement("div",{className:"tw-space-y-2"},Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Wt.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Powers Semantic Local Vault Search"),Wt.default.createElement(so,{delayDuration:0},Wt.default.createElement(St,null,Wt.default.createElement(Ct,{asChild:!0},Wt.default.createElement($i,{className:"tw-size-4"})),Wt.default.createElement(_t,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Wt.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:"),Wt.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Wt.default.createElement("li",null,"Require rebuilding your vault's vector index"),Wt.default.createElement("li",null,"Affect semantic search quality"),Wt.default.createElement("li",null,"Impact Question Answering feature performance"))))))),value:t.embeddingModelKey,onChange:e,options:t.activeEmbeddingModels.map(r=>({label:qH(r),value:tn(r)})),placeholder:"Model"}),Wt.default.createElement(qr,{type:"select",title:"Auto-Index Strategy",description:Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Wt.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),Wt.default.createElement(so,{delayDuration:0},Wt.default.createElement(St,null,Wt.default.createElement(Ct,{asChild:!0},Wt.default.createElement($i,{className:"tw-size-4"})),Wt.default.createElement(_t,null,Wt.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},Wt.default.createElement("div",{className:"tw-space-y-1"},Wt.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),Wt.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},Wt.default.createElement("li",null,Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Wt.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),Wt.default.createElement("span",null,"Manual indexing via command or refresh only"))),Wt.default.createElement("li",null,Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Wt.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),Wt.default.createElement("span",null,"Index updates when plugin loads or reloads"))),Wt.default.createElement("li",null,Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Wt.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),Wt.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),Wt.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=>{nt("indexVaultToVectorStore",r)},options:zet.map(r=>({label:r,value:r})),placeholder:"Strategy"}),Wt.default.createElement(qr,{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=>nt("maxSourceChunks",r)}),t.enableSemanticSearchV3&&Wt.default.createElement(Wt.default.Fragment,null,Wt.default.createElement(qr,{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=>nt("embeddingRequestsPerMin",r)}),Wt.default.createElement(qr,{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=>nt("embeddingBatchSize",r)}),Wt.default.createElement(qr,{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=>nt("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"})),Wt.default.createElement(qr,{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=>nt("lexicalSearchRamLimit",r),suffix:" MB"}),Wt.default.createElement(qr,{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=>nt("enableLexicalBoosts",r)}),Wt.default.createElement(qr,{type:"custom",title:"Exclusions",description:Wt.default.createElement(Wt.default.Fragment,null,Wt.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."))},Wt.default.createElement(he,{variant:"secondary",onClick:()=>new dX(app,r=>nt("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),Wt.default.createElement(qr,{type:"custom",title:"Inclusions",description:Wt.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.")},Wt.default.createElement(he,{variant:"secondary",onClick:()=>new dX(app,r=>nt("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),Wt.default.createElement(qr,{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=>nt("enableIndexSync",r)}),Wt.default.createElement(qr,{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=>nt("disableIndexOnMobile",r)}))))};var xyr=["basic","model","QA","command","plus","advanced"],jGn={basic:lo.default.createElement(g5,{className:"tw-size-5"}),model:lo.default.createElement(y5,{className:"tw-size-5"}),QA:lo.default.createElement(BE,{className:"tw-size-5"}),command:lo.default.createElement(MI,{className:"tw-size-5"}),plus:lo.default.createElement($f,{className:"tw-size-5"}),advanced:lo.default.createElement(VE,{className:"tw-size-5"})},DGn={basic:()=>lo.default.createElement(uyr,null),model:()=>lo.default.createElement(pyr,null),QA:()=>lo.default.createElement(vyr,null),command:()=>lo.default.createElement(tyr,null),plus:()=>lo.default.createElement(cyr,null),advanced:()=>lo.default.createElement(ryr,null)},wyr=xyr.map(t=>({id:t,icon:jGn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),LGn=()=>{let{selectedTab:t,setSelectedTab:e}=BV();return lo.default.createElement("div",{className:"tw-flex tw-flex-col"},lo.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},wyr.map((r,n)=>lo.default.createElement(whr,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===wyr.length-1}))),lo.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),lo.default.createElement("div",null,xyr.map(r=>{let n=DGn[r];return lo.default.createElement(xhr,{key:r,id:r,isSelected:t===r},lo.default.createElement(n,null))})))},FGn=({plugin:t})=>{let[e,r]=lo.default.useState(0),{latestVersion:n,hasUpdate:o}=I_e(t.manifest.version),i=async()=>{new wve(app,async()=>{zSe(),r(s=>s+1)}).open()};return lo.default.createElement(Chr,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(he,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),lo.default.createElement(LGn,{key:e})))},Syr=FGn;var Xve=class extends fX.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(Ns)[0]?.view&&oe().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 fX.Notice("Plugin reloaded successfully.")}catch(e){new fX.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,Cyr.createRoot)(r).render(FKe.default.createElement(jKe.Provider,{value:e},FKe.default.createElement(Syr,{plugin:this.plugin})))}};bt();Gt();var Qve=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)}};Lde();j6e();var OA=require("obsidian");Hye();var ewe=class extends OA.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=wa(async(i,a)=>{a.enableEncryption?await this.saveData(await ltt(a)):await this.saveData(a),S8e(this,i,a)}),this.addSettingTab(new Xve(this.app,this)),Zye(this.app.vault),this.brevilabsClient=Ji.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),lO(),this.projectManager=Vd.getInstance(this.app,this),this.vectorStoreManager=zP.getInstance(),this.fileParserManager=new pR(this.brevilabsClient,this.app.vault);let r=new $V,n=this.projectManager.getCurrentChainManager(),o=new vve(r,n,this.fileParserManager,this);this.chatUIState=new Qve(o),this.registerView(Ns,i=>new IN(i,this)),this.registerView(s7,i=>new aye(i)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",i=>{this.activateView()}),S8e(this,void 0,oe()),this.registerMarkdownCodeBlockProcessor(HH,(i,a)=>{vhr({plugin:this,element:a}),a.parentElement&&(a.parentElement.className="")}),Zk.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",i=>hhr(i))),this.registerEvent(this.app.workspace.on("active-leaf-change",i=>{if(i&&i.view instanceof OA.MarkdownView&&i.view.file){let s=this.app.workspace.getLeavesOfType(Ns).find(u=>u.view instanceof IN)?.view;if(s){let u=new CustomEvent(Xg.ACTIVE_LEAF_CHANGE);s.eventTarget.dispatchEvent(u)}}})),this.autocompleteService=cbe.getInstance(this),this.customCommandRegister=new bve(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(yhr).then(bhr)})}async onunload(){this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),B("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(oe().autosaveChat){let r=this.app.workspace.getLeavesOfType(Ns)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Ns).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Ns).find(l=>l.view instanceof IN)?.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(Ns).find(n=>n.view instanceof IN)?.view;if(r){let n=new CustomEvent(Xg.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Ns&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(OA.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(Ns).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Ns);r.length===0?oe().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Ns,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Ns,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(Ns)}async loadSettings(){let r=await this.loadData(),n=USe(r);wE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=tn(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 OA.Notice("No chat history found.");return}new yve(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(oe().defaultSaveFolder);if(!(r instanceof OA.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=wu()?.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=jor(n),i=this.app.workspace.getLeavesOfType(Ns)[0];i||this.activateView(),await this.chatUIState.loadMessages(o);let a=(i||this.app.workspace.getLeavesOfType(Ns)[0])?.view;a&&a.updateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Ns)[0];if(r){let n=r.view,o=new CustomEvent(Xg.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(oe().enableSemanticSearchV3?new(await Promise.resolve().then(()=>(cG(),$de))).HybridRetriever({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}):new(await Promise.resolve().then(()=>(r7(),tye))).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/info.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/user.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 */