1787 lines
3.7 MiB
Plaintext
1787 lines
3.7 MiB
Plaintext
/*
|
||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
if you want to view the source, please visit the github repository of this plugin
|
||
*/
|
||
|
||
var Mlr=Object.create;var tH=Object.defineProperty;var Rlr=Object.getOwnPropertyDescriptor;var Nlr=Object.getOwnPropertyNames;var jlr=Object.getPrototypeOf,Dlr=Object.prototype.hasOwnProperty;var h6e=t=>{throw TypeError(t)};var Llr=(t,e,r)=>e in t?tH(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var w=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Qd=(t,e)=>{for(var r in e)tH(t,r,{get:e[r],enumerable:!0})},g6e=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Nlr(e))!Dlr.call(t,o)&&o!==r&&tH(t,o,{get:()=>e[o],enumerable:!(n=Rlr(e,o))||n.enumerable});return t};var F=(t,e,r)=>(r=t!=null?Mlr(jlr(t)):{},g6e(e||!t||!t.__esModule?tH(r,"default",{value:t,enumerable:!0}):r,t)),dc=t=>g6e(tH({},"__esModule",{value:!0}),t);var Kc=(t,e,r)=>Llr(t,typeof e!="symbol"?e+"":e,r),Flr=(t,e,r)=>e.has(t)||h6e("Cannot "+r);var y6e=(t,e,r)=>e.has(t)?h6e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var b6e=(t,e,r)=>(Flr(t,e,"access private method"),r);function Cye(){if(!B7&&(B7=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!B7))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return B7(klr)}var B7,klr,_6e=w(()=>{klr=new Uint8Array(16)});function v6e(t,e=0){return Gc[t[e+0]]+Gc[t[e+1]]+Gc[t[e+2]]+Gc[t[e+3]]+"-"+Gc[t[e+4]]+Gc[t[e+5]]+"-"+Gc[t[e+6]]+Gc[t[e+7]]+"-"+Gc[t[e+8]]+Gc[t[e+9]]+"-"+Gc[t[e+10]]+Gc[t[e+11]]+Gc[t[e+12]]+Gc[t[e+13]]+Gc[t[e+14]]+Gc[t[e+15]]}var Gc,w6e=w(()=>{Gc=[];for(let t=0;t<256;++t)Gc.push((t+256).toString(16).slice(1))});var $lr,Oye,x6e=w(()=>{$lr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Oye={randomUUID:$lr}});function zlr(t,e,r){if(Oye.randomUUID&&!e&&!t)return Oye.randomUUID();t=t||{};let n=t.random||(t.rng||Cye)();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 v6e(n)}var Rp,S6e=w(()=>{x6e();_6e();w6e();Rp=zlr});var I1=w(()=>{S6e()});var kn,Pye,yt,I_,rH=w(()=>{(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})(kn||(kn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Pye||(Pye={}));yt=kn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),I_=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 ze,Blr,Np,U7=w(()=>{rH();ze=kn.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"]),Blr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Np=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,kn.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()}};Np.create=t=>new Np(t)});var Ulr,SO,Eye=w(()=>{U7();rH();Ulr=(t,e)=>{let r;switch(t.code){case ze.invalid_type:t.received===yt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ze.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,kn.jsonStringifyReplacer)}`;break;case ze.unrecognized_keys:r=`Unrecognized key(s) in object: ${kn.joinValues(t.keys,", ")}`;break;case ze.invalid_union:r="Invalid input";break;case ze.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${kn.joinValues(t.options)}`;break;case ze.invalid_enum_value:r=`Invalid enum value. Expected ${kn.joinValues(t.options)}, received '${t.received}'`;break;case ze.invalid_arguments:r="Invalid function arguments";break;case ze.invalid_return_type:r="Invalid function return type";break;case ze.invalid_date:r="Invalid date";break;case ze.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}"`:kn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ze.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 ze.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 ze.custom:r="Invalid input";break;case ze.invalid_intersection_types:r="Intersection results could not be merged";break;case ze.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ze.not_finite:r="Number must be finite";break;default:r=e.defaultError,kn.assertNever(t)}return{message:r}},SO=Ulr});function qlr(t){C6e=t}function kk(){return C6e}var C6e,q7=w(()=>{Eye();C6e=SO});function lt(t,e){let r=kk(),n=nH({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===SO?void 0:SO].filter(o=>!!o)});t.common.issues.push(n)}var nH,Hlr,Jc,gr,M1,ef,H7,V7,UT,$k,Tye=w(()=>{q7();Eye();nH=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}},Hlr=[];Jc=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 gr;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 gr;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}}},gr=Object.freeze({status:"aborted"}),M1=t=>({status:"dirty",value:t}),ef=t=>({status:"valid",value:t}),H7=t=>t.status==="aborted",V7=t=>t.status==="dirty",UT=t=>t.status==="valid",$k=t=>typeof Promise<"u"&&t instanceof Promise});var O6e=w(()=>{});var Ht,P6e=w(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ht||(Ht={}))});function tn(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 I6e(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 scr(t){return new RegExp(`^${I6e(t)}$`)}function M6e(t){let e=`${A6e}T${I6e(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 ucr(t,e){return!!((e==="v4"||!e)&&ecr.test(t)||(e==="v6"||!e)&&rcr.test(t))}function lcr(t,e){if(!Zlr.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 ccr(t,e){return!!((e==="v4"||!e)&&tcr.test(t)||(e==="v6"||!e)&&ncr.test(t))}function dcr(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 zk(t){if(t instanceof Dp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=jp.create(zk(n))}return new Dp({...t._def,shape:()=>e})}else return t instanceof PO?new PO({...t._def,type:zk(t.element)}):t instanceof jp?jp.create(zk(t.unwrap())):t instanceof R_?R_.create(zk(t.unwrap())):t instanceof M_?M_.create(t.items.map(e=>zk(e))):t}function Iye(t,e){let r=I_(t),n=I_(e);if(t===e)return{valid:!0,data:t};if(r===yt.object&&n===yt.object){let o=kn.objectKeys(e),i=kn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Iye(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=Iye(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 R6e(t,e){return new U1({values:t,typeName:re.ZodEnum,...tn(e)})}function T6e(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function N6e(t,e={},r){return t?HT.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=T6e(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=T6e(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):HT.create()}var Yh,E6e,bn,Vlr,Wlr,Klr,Glr,Jlr,Zlr,Ylr,Xlr,Qlr,Aye,ecr,tcr,rcr,ncr,ocr,icr,A6e,acr,qT,R1,N1,j1,D1,Bk,L1,F1,HT,OO,Ky,Uk,PO,Dp,k1,CO,W7,$1,M_,K7,qk,Hk,G7,z1,B1,U1,q1,VT,Xh,jp,R_,H1,V1,Vk,fcr,oH,iH,W1,pcr,re,mcr,j6e,D6e,hcr,gcr,L6e,ycr,bcr,_cr,vcr,wcr,xcr,Scr,Ccr,Ocr,Pcr,Ecr,Tcr,Acr,Icr,Mcr,Rcr,Ncr,jcr,Dcr,Lcr,Fcr,kcr,$cr,zcr,Bcr,Ucr,qcr,Hcr,Vcr,Wcr,Kcr,Gcr,Jcr,Zcr,F6e=w(()=>{U7();q7();P6e();Tye();rH();Yh=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}},E6e=(t,e)=>{if(UT(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 Np(t.common.issues);return this._error=r,this._error}}};bn=class{get description(){return this._def.description}_getType(e){return I_(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:I_(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jc,ctx:{common:e.parent.common,data:e.data,parsedType:I_(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if($k(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:I_(e)},o=this._parseSync({data:e,path:n.path,parent:n});return E6e(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:I_(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return UT(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=>UT(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:I_(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await($k(o)?o:Promise.resolve(o));return E6e(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:ze.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 Xh({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 jp.create(this,this._def)}nullable(){return R_.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return PO.create(this)}promise(){return VT.create(this,this._def)}or(e){return k1.create([this,e],this._def)}and(e){return $1.create(this,e,this._def)}transform(e){return new Xh({...tn(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new H1({...tn(this._def),innerType:this,defaultValue:r,typeName:re.ZodDefault})}brand(){return new oH({typeName:re.ZodBranded,type:this,...tn(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new V1({...tn(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 iH.create(this,e)}readonly(){return W1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vlr=/^c[^\s-]{8,}$/i,Wlr=/^[0-9a-z]+$/,Klr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Glr=/^[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,Jlr=/^[a-z0-9_-]{21}$/i,Zlr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ylr=/^[-+]?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)?)??$/,Xlr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qlr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ecr=/^(?:(?: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])$/,tcr=/^(?:(?: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])$/,rcr=/^(([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]))$/,ncr=/^(([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])$/,ocr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,icr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,A6e="((\\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])))",acr=new RegExp(`^${A6e}$`);qT=class t extends bn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==yt.string){let i=this._getOrReturnCtx(e);return lt(i,{code:ze.invalid_type,expected:yt.string,received:i.parsedType}),gr}let n=new Jc,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),lt(o,{code:ze.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),lt(o,{code:ze.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?lt(o,{code:ze.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&<(o,{code:ze.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Xlr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"email",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Aye||(Aye=new RegExp(Qlr,"u")),Aye.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"emoji",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Glr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"uuid",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Jlr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"nanoid",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Vlr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"cuid",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Wlr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"cuid2",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Klr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"ulid",code:ze.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),lt(o,{validation:"url",code:ze.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),lt(o,{validation:"regex",code:ze.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),lt(o,{code:ze.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),lt(o,{code:ze.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),lt(o,{code:ze.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?M6e(i).test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{code:ze.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?acr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{code:ze.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?scr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{code:ze.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Ylr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"duration",code:ze.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ucr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"ip",code:ze.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?lcr(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"jwt",code:ze.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ccr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"cidr",code:ze.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ocr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"base64",code:ze.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?icr.test(e.data)||(o=this._getOrReturnCtx(e,o),lt(o,{validation:"base64url",code:ze.invalid_string,message:i.message}),n.dirty()):kn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:ze.invalid_string,...Ht.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ht.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ht.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ht.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ht.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ht.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ht.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ht.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ht.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ht.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ht.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ht.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ht.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ht.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,...Ht.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,...Ht.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ht.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ht.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Ht.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Ht.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Ht.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ht.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ht.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Ht.errToObj(r)})}nonempty(e){return this.min(1,Ht.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}};qT.create=t=>new qT({checks:[],typeName:re.ZodString,coerce:t?.coerce??!1,...tn(t)});R1=class t extends bn{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 lt(i,{code:ze.invalid_type,expected:yt.number,received:i.parsedType}),gr}let n,o=new Jc;for(let i of this._def.checks)i.kind==="int"?kn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),lt(n,{code:ze.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),lt(n,{code:ze.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),lt(n,{code:ze.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?dcr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),lt(n,{code:ze.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),lt(n,{code:ze.not_finite,message:i.message}),o.dirty()):kn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ht.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ht.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ht.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ht.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ht.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ht.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ht.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ht.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ht.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ht.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ht.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Ht.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ht.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ht.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"&&kn.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)}};R1.create=t=>new R1({checks:[],typeName:re.ZodNumber,coerce:t?.coerce||!1,...tn(t)});N1=class t extends bn{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 Jc;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),lt(n,{code:ze.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),lt(n,{code:ze.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),lt(n,{code:ze.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):kn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return lt(r,{code:ze.invalid_type,expected:yt.bigint,received:r.parsedType}),gr}gte(e,r){return this.setLimit("min",e,!0,Ht.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ht.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ht.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ht.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ht.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:Ht.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ht.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ht.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ht.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ht.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}};N1.create=t=>new N1({checks:[],typeName:re.ZodBigInt,coerce:t?.coerce??!1,...tn(t)});j1=class extends bn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==yt.boolean){let n=this._getOrReturnCtx(e);return lt(n,{code:ze.invalid_type,expected:yt.boolean,received:n.parsedType}),gr}return ef(e.data)}};j1.create=t=>new j1({typeName:re.ZodBoolean,coerce:t?.coerce||!1,...tn(t)});D1=class t extends bn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==yt.date){let i=this._getOrReturnCtx(e);return lt(i,{code:ze.invalid_type,expected:yt.date,received:i.parsedType}),gr}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return lt(i,{code:ze.invalid_date}),gr}let n=new Jc,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),lt(o,{code:ze.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),lt(o,{code:ze.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):kn.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:Ht.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Ht.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}};D1.create=t=>new D1({checks:[],coerce:t?.coerce||!1,typeName:re.ZodDate,...tn(t)});Bk=class extends bn{_parse(e){if(this._getType(e)!==yt.symbol){let n=this._getOrReturnCtx(e);return lt(n,{code:ze.invalid_type,expected:yt.symbol,received:n.parsedType}),gr}return ef(e.data)}};Bk.create=t=>new Bk({typeName:re.ZodSymbol,...tn(t)});L1=class extends bn{_parse(e){if(this._getType(e)!==yt.undefined){let n=this._getOrReturnCtx(e);return lt(n,{code:ze.invalid_type,expected:yt.undefined,received:n.parsedType}),gr}return ef(e.data)}};L1.create=t=>new L1({typeName:re.ZodUndefined,...tn(t)});F1=class extends bn{_parse(e){if(this._getType(e)!==yt.null){let n=this._getOrReturnCtx(e);return lt(n,{code:ze.invalid_type,expected:yt.null,received:n.parsedType}),gr}return ef(e.data)}};F1.create=t=>new F1({typeName:re.ZodNull,...tn(t)});HT=class extends bn{constructor(){super(...arguments),this._any=!0}_parse(e){return ef(e.data)}};HT.create=t=>new HT({typeName:re.ZodAny,...tn(t)});OO=class extends bn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ef(e.data)}};OO.create=t=>new OO({typeName:re.ZodUnknown,...tn(t)});Ky=class extends bn{_parse(e){let r=this._getOrReturnCtx(e);return lt(r,{code:ze.invalid_type,expected:yt.never,received:r.parsedType}),gr}};Ky.create=t=>new Ky({typeName:re.ZodNever,...tn(t)});Uk=class extends bn{_parse(e){if(this._getType(e)!==yt.undefined){let n=this._getOrReturnCtx(e);return lt(n,{code:ze.invalid_type,expected:yt.void,received:n.parsedType}),gr}return ef(e.data)}};Uk.create=t=>new Uk({typeName:re.ZodVoid,...tn(t)});PO=class t extends bn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==yt.array)return lt(r,{code:ze.invalid_type,expected:yt.array,received:r.parsedType}),gr;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(lt(r,{code:a?ze.too_big:ze.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&&(lt(r,{code:ze.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&&(lt(r,{code:ze.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 Yh(r,a,r.path,s)))).then(a=>Jc.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Yh(r,a,r.path,s)));return Jc.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Ht.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Ht.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Ht.toString(r)}})}nonempty(e){return this.min(1,e)}};PO.create=(t,e)=>new PO({type:t,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...tn(e)});Dp=class t extends bn{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=kn.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 lt(l,{code:ze.invalid_type,expected:yt.object,received:l.parsedType}),gr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ky&&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 Yh(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Ky){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&&(lt(o,{code:ze.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 Yh(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=>Jc.mergeObjectSync(n,l)):Jc.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Ht.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:Ht.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 kn.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 kn.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return zk(this)}partial(e){let r={};for(let n of kn.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 kn.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof jp;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return R6e(kn.objectKeys(this.shape))}};Dp.create=(t,e)=>new Dp({shape:()=>t,unknownKeys:"strip",catchall:Ky.create(),typeName:re.ZodObject,...tn(e)});Dp.strictCreate=(t,e)=>new Dp({shape:()=>t,unknownKeys:"strict",catchall:Ky.create(),typeName:re.ZodObject,...tn(e)});Dp.lazycreate=(t,e)=>new Dp({shape:t,unknownKeys:"strip",catchall:Ky.create(),typeName:re.ZodObject,...tn(e)});k1=class extends bn{_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 Np(s.ctx.common.issues));return lt(r,{code:ze.invalid_union,unionErrors:a}),gr}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 Np(u));return lt(r,{code:ze.invalid_union,unionErrors:s}),gr}}get options(){return this._def.options}};k1.create=(t,e)=>new k1({options:t,typeName:re.ZodUnion,...tn(e)});CO=t=>t instanceof z1?CO(t.schema):t instanceof Xh?CO(t.innerType()):t instanceof B1?[t.value]:t instanceof U1?t.options:t instanceof q1?kn.objectValues(t.enum):t instanceof H1?CO(t._def.innerType):t instanceof L1?[void 0]:t instanceof F1?[null]:t instanceof jp?[void 0,...CO(t.unwrap())]:t instanceof R_?[null,...CO(t.unwrap())]:t instanceof oH||t instanceof W1?CO(t.unwrap()):t instanceof V1?CO(t._def.innerType):[],W7=class t extends bn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.object)return lt(r,{code:ze.invalid_type,expected:yt.object,received:r.parsedType}),gr;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}):(lt(r,{code:ze.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),gr)}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=CO(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,...tn(n)})}};$1=class extends bn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(H7(i)||H7(a))return gr;let s=Iye(i.value,a.value);return s.valid?((V7(i)||V7(a))&&r.dirty(),{status:r.value,value:s.data}):(lt(n,{code:ze.invalid_intersection_types}),gr)};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}))}};$1.create=(t,e,r)=>new $1({left:t,right:e,typeName:re.ZodIntersection,...tn(r)});M_=class t extends bn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yt.array)return lt(n,{code:ze.invalid_type,expected:yt.array,received:n.parsedType}),gr;if(n.data.length<this._def.items.length)return lt(n,{code:ze.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),gr;!this._def.rest&&n.data.length>this._def.items.length&&(lt(n,{code:ze.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 Yh(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Jc.mergeArray(r,a)):Jc.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};M_.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new M_({items:t,typeName:re.ZodTuple,rest:null,...tn(e)})};K7=class t extends bn{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 lt(n,{code:ze.invalid_type,expected:yt.object,received:n.parsedType}),gr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Yh(n,s,n.path,s)),value:a._parse(new Yh(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Jc.mergeObjectAsync(r,o):Jc.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof bn?new t({keyType:e,valueType:r,typeName:re.ZodRecord,...tn(n)}):new t({keyType:qT.create(),valueType:e,typeName:re.ZodRecord,...tn(r)})}},qk=class extends bn{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 lt(n,{code:ze.invalid_type,expected:yt.map,received:n.parsedType}),gr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Yh(n,s,n.path,[l,"key"])),value:i._parse(new Yh(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 gr;(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 gr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};qk.create=(t,e,r)=>new qk({valueType:e,keyType:t,typeName:re.ZodMap,...tn(r)});Hk=class t extends bn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yt.set)return lt(n,{code:ze.invalid_type,expected:yt.set,received:n.parsedType}),gr;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(lt(n,{code:ze.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&&(lt(n,{code:ze.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 gr;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 Yh(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:Ht.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Ht.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Hk.create=(t,e)=>new Hk({valueType:t,minSize:null,maxSize:null,typeName:re.ZodSet,...tn(e)});G7=class t extends bn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.function)return lt(r,{code:ze.invalid_type,expected:yt.function,received:r.parsedType}),gr;function n(s,u){return nH({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kk(),SO].filter(l=>!!l),issueData:{code:ze.invalid_arguments,argumentsError:u}})}function o(s,u){return nH({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kk(),SO].filter(l=>!!l),issueData:{code:ze.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof VT){let s=this;return ef(async function(...u){let l=new Np([]),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 ef(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Np([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new Np([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:M_.create(e).rest(OO.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||M_.create([]).rest(OO.create()),returns:r||OO.create(),typeName:re.ZodFunction,...tn(n)})}},z1=class extends bn{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})}};z1.create=(t,e)=>new z1({getter:t,typeName:re.ZodLazy,...tn(e)});B1=class extends bn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return lt(r,{received:r.data,code:ze.invalid_literal,expected:this._def.value}),gr}return{status:"valid",value:e.data}}get value(){return this._def.value}};B1.create=(t,e)=>new B1({value:t,typeName:re.ZodLiteral,...tn(e)});U1=class t extends bn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return lt(r,{expected:kn.joinValues(n),received:r.parsedType,code:ze.invalid_type}),gr}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 lt(r,{received:r.data,code:ze.invalid_enum_value,options:n}),gr}return ef(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})}};U1.create=R6e;q1=class extends bn{_parse(e){let r=kn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==yt.string&&n.parsedType!==yt.number){let o=kn.objectValues(r);return lt(n,{expected:kn.joinValues(o),received:n.parsedType,code:ze.invalid_type}),gr}if(this._cache||(this._cache=new Set(kn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=kn.objectValues(r);return lt(n,{received:n.data,code:ze.invalid_enum_value,options:o}),gr}return ef(e.data)}get enum(){return this._def.values}};q1.create=(t,e)=>new q1({values:t,typeName:re.ZodNativeEnum,...tn(e)});VT=class extends bn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yt.promise&&r.common.async===!1)return lt(r,{code:ze.invalid_type,expected:yt.promise,received:r.parsedType}),gr;let n=r.parsedType===yt.promise?r.data:Promise.resolve(r.data);return ef(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};VT.create=(t,e)=>new VT({type:t,typeName:re.ZodPromise,...tn(e)});Xh=class extends bn{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=>{lt(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 gr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?gr:u.status==="dirty"?M1(u.value):r.value==="dirty"?M1(u.value):u});{if(r.value==="aborted")return gr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?gr:s.status==="dirty"?M1(s.value):r.value==="dirty"?M1(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"?gr:(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"?gr:(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(!UT(a))return gr;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=>UT(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):gr);kn.assertNever(o)}};Xh.create=(t,e,r)=>new Xh({schema:t,typeName:re.ZodEffects,effect:e,...tn(r)});Xh.createWithPreprocess=(t,e,r)=>new Xh({schema:e,effect:{type:"preprocess",transform:t},typeName:re.ZodEffects,...tn(r)});jp=class extends bn{_parse(e){return this._getType(e)===yt.undefined?ef(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jp.create=(t,e)=>new jp({innerType:t,typeName:re.ZodOptional,...tn(e)});R_=class extends bn{_parse(e){return this._getType(e)===yt.null?ef(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};R_.create=(t,e)=>new R_({innerType:t,typeName:re.ZodNullable,...tn(e)});H1=class extends bn{_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}};H1.create=(t,e)=>new H1({innerType:t,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...tn(e)});V1=class extends bn{_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 $k(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Np(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Np(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};V1.create=(t,e)=>new V1({innerType:t,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...tn(e)});Vk=class extends bn{_parse(e){if(this._getType(e)!==yt.nan){let n=this._getOrReturnCtx(e);return lt(n,{code:ze.invalid_type,expected:yt.nan,received:n.parsedType}),gr}return{status:"valid",value:e.data}}};Vk.create=t=>new Vk({typeName:re.ZodNaN,...tn(t)});fcr=Symbol("zod_brand"),oH=class extends bn{_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}},iH=class t extends bn{_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"?gr:i.status==="dirty"?(r.dirty(),M1(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"?gr: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})}},W1=class extends bn{_parse(e){let r=this._def.innerType._parse(e),n=o=>(UT(o)&&(o.value=Object.freeze(o.value)),o);return $k(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};W1.create=(t,e)=>new W1({innerType:t,typeName:re.ZodReadonly,...tn(e)});pcr={object:Dp.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={}));mcr=(t,e={message:`Input not instance of ${t.name}`})=>N6e(r=>r instanceof t,e),j6e=qT.create,D6e=R1.create,hcr=Vk.create,gcr=N1.create,L6e=j1.create,ycr=D1.create,bcr=Bk.create,_cr=L1.create,vcr=F1.create,wcr=HT.create,xcr=OO.create,Scr=Ky.create,Ccr=Uk.create,Ocr=PO.create,Pcr=Dp.create,Ecr=Dp.strictCreate,Tcr=k1.create,Acr=W7.create,Icr=$1.create,Mcr=M_.create,Rcr=K7.create,Ncr=qk.create,jcr=Hk.create,Dcr=G7.create,Lcr=z1.create,Fcr=B1.create,kcr=U1.create,$cr=q1.create,zcr=VT.create,Bcr=Xh.create,Ucr=jp.create,qcr=R_.create,Hcr=Xh.createWithPreprocess,Vcr=iH.create,Wcr=()=>j6e().optional(),Kcr=()=>D6e().optional(),Gcr=()=>L6e().optional(),Jcr={string:t=>qT.create({...t,coerce:!0}),number:t=>R1.create({...t,coerce:!0}),boolean:t=>j1.create({...t,coerce:!0}),bigint:t=>N1.create({...t,coerce:!0}),date:t=>D1.create({...t,coerce:!0})},Zcr=gr});var rn={};Qd(rn,{BRAND:()=>fcr,DIRTY:()=>M1,EMPTY_PATH:()=>Hlr,INVALID:()=>gr,NEVER:()=>Zcr,OK:()=>ef,ParseStatus:()=>Jc,Schema:()=>bn,ZodAny:()=>HT,ZodArray:()=>PO,ZodBigInt:()=>N1,ZodBoolean:()=>j1,ZodBranded:()=>oH,ZodCatch:()=>V1,ZodDate:()=>D1,ZodDefault:()=>H1,ZodDiscriminatedUnion:()=>W7,ZodEffects:()=>Xh,ZodEnum:()=>U1,ZodError:()=>Np,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>G7,ZodIntersection:()=>$1,ZodIssueCode:()=>ze,ZodLazy:()=>z1,ZodLiteral:()=>B1,ZodMap:()=>qk,ZodNaN:()=>Vk,ZodNativeEnum:()=>q1,ZodNever:()=>Ky,ZodNull:()=>F1,ZodNullable:()=>R_,ZodNumber:()=>R1,ZodObject:()=>Dp,ZodOptional:()=>jp,ZodParsedType:()=>yt,ZodPipeline:()=>iH,ZodPromise:()=>VT,ZodReadonly:()=>W1,ZodRecord:()=>K7,ZodSchema:()=>bn,ZodSet:()=>Hk,ZodString:()=>qT,ZodSymbol:()=>Bk,ZodTransformer:()=>Xh,ZodTuple:()=>M_,ZodType:()=>bn,ZodUndefined:()=>L1,ZodUnion:()=>k1,ZodUnknown:()=>OO,ZodVoid:()=>Uk,addIssueToContext:()=>lt,any:()=>wcr,array:()=>Ocr,bigint:()=>gcr,boolean:()=>L6e,coerce:()=>Jcr,custom:()=>N6e,date:()=>ycr,datetimeRegex:()=>M6e,defaultErrorMap:()=>SO,discriminatedUnion:()=>Acr,effect:()=>Bcr,enum:()=>kcr,function:()=>Dcr,getErrorMap:()=>kk,getParsedType:()=>I_,instanceof:()=>mcr,intersection:()=>Icr,isAborted:()=>H7,isAsync:()=>$k,isDirty:()=>V7,isValid:()=>UT,late:()=>pcr,lazy:()=>Lcr,literal:()=>Fcr,makeIssue:()=>nH,map:()=>Ncr,nan:()=>hcr,nativeEnum:()=>$cr,never:()=>Scr,null:()=>vcr,nullable:()=>qcr,number:()=>D6e,object:()=>Pcr,objectUtil:()=>Pye,oboolean:()=>Gcr,onumber:()=>Kcr,optional:()=>Ucr,ostring:()=>Wcr,pipeline:()=>Vcr,preprocess:()=>Hcr,promise:()=>zcr,quotelessJson:()=>Blr,record:()=>Rcr,set:()=>jcr,setErrorMap:()=>qlr,strictObject:()=>Ecr,string:()=>j6e,symbol:()=>bcr,transformer:()=>Bcr,tuple:()=>Mcr,undefined:()=>_cr,union:()=>Tcr,unknown:()=>xcr,util:()=>kn,void:()=>Ccr});var aH=w(()=>{q7();Tye();O6e();rH();F6e();U7()});var J7=w(()=>{aH();aH()});var $6e=v((Uqn,k6e)=>{function Qh(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))}k6e.exports=Qh;Qh.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Qh.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Qh.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};Qh.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)};Qh.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Qh.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Qh.prototype.start=Qh.prototype.try;Qh.prototype.errors=function(){return this._errors};Qh.prototype.attempts=function(){return this._attempts};Qh.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 z6e=v(K1=>{var Ycr=$6e();K1.operation=function(t){var e=K1.timeouts(t);return new Ycr(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};K1.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};K1.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};K1.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=K1.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 U6e=v((Hqn,B6e)=>{B6e.exports=z6e()});var X7=v((Vqn,Y7)=>{"use strict";var Xcr=U6e(),Qcr=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],Z7=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}},edr=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},tdr=t=>Qcr.includes(t),q6e=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=Xcr.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 Z7)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!tdr(a.message))o.stop(),n(a);else{edr(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});Y7.exports=q6e;Y7.exports.default=q6e;Y7.exports.AbortError=Z7});var H6e,V6e=w(()=>{H6e=/^(?:[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 rdr(t){return typeof t=="string"&&H6e.test(t)}var WT,Mye=w(()=>{V6e();WT=rdr});function ndr(t){if(!WT(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 W6e,K6e=w(()=>{Mye();W6e=ndr});function eZ(t,e=0){return(Zc[t[e+0]]+Zc[t[e+1]]+Zc[t[e+2]]+Zc[t[e+3]]+"-"+Zc[t[e+4]]+Zc[t[e+5]]+"-"+Zc[t[e+6]]+Zc[t[e+7]]+"-"+Zc[t[e+8]]+Zc[t[e+9]]+"-"+Zc[t[e+10]]+Zc[t[e+11]]+Zc[t[e+12]]+Zc[t[e+13]]+Zc[t[e+14]]+Zc[t[e+15]]).toLowerCase()}var Zc,Q7,Rye=w(()=>{Zc=[];for(Q7=0;Q7<256;++Q7)Zc.push((Q7+256).toString(16).slice(1))});function Nye(){if(!tZ&&(tZ=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!tZ))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tZ(odr)}var tZ,odr,G6e=w(()=>{odr=new Uint8Array(16)});function idr(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function jye(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=idr(o)),typeof i=="string"&&(i=W6e(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 eZ(l)}try{n.name=t}catch{}return n.DNS=adr,n.URL=sdr,n}var adr,sdr,J6e=w(()=>{Rye();K6e();adr="6ba7b810-9dad-11d1-80b4-00c04fd430c8",sdr="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var udr,Dye,Z6e=w(()=>{udr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Dye={randomUUID:udr}});function ldr(t,e,r){if(Dye.randomUUID&&!e&&!t)return Dye.randomUUID();t=t||{};var n=t.random||(t.rng||Nye)();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 eZ(n)}var _s,Y6e=w(()=>{Z6e();G6e();Rye();_s=ldr});function cdr(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 Lye(t,e){return t<<e|t>>>32-e}function ddr(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var o=0;o<n.length;++o)t.push(n.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var i=t.length/4+2,a=Math.ceil(i/16),s=new Array(a),u=0;u<a;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];s[u]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<a;++d){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=s[d][p];for(var m=16;m<80;++m)f[m]=Lye(f[m-3]^f[m-8]^f[m-14]^f[m-16],1);for(var h=r[0],b=r[1],g=r[2],y=r[3],x=r[4],S=0;S<80;++S){var O=Math.floor(S/20),E=Lye(h,5)+cdr(O,b,g,y)+x+e[O]+f[S]>>>0;x=y,y=g,g=Lye(b,30)>>>0,b=h,h=E}r[0]=r[0]+h>>>0,r[1]=r[1]+b>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+x>>>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 X6e,Q6e=w(()=>{X6e=ddr});var fdr,rZ,e8e=w(()=>{J6e();Q6e();fdr=jye("v5",80,X6e),rZ=fdr});var G1=w(()=>{Y6e();e8e();Mye()});function t8e(t=!1){let e=mdr.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 nZ(t){return typeof t=="function"&&"langsmith:traceable"in t}var $ye,kye,pdr,zye,mdr,m2n,r8e=w(()=>{$ye=class{getStore(){}run(e,r){return r()}},kye=Symbol.for("ls:tracing_async_local_storage"),pdr=new $ye,zye=class{getInstance(){return globalThis[kye]??pdr}initializeGlobalInstance(e){globalThis[kye]===void 0&&(globalThis[kye]=e)}},mdr=new zye;m2n=Symbol.for("langsmith:traceable:root")});var Bye=w(()=>{r8e()});function iZ(t,e){return hdr.call(t,e)}function aZ(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)iZ(t,r)&&e.push(r);return e}function tf(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function sZ(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 N_(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function sH(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function oZ(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(oZ(t[r]))return!0}else if(typeof t=="object"){let r=aZ(t),n=r.length;for(var e=0;e<n;e++)if(oZ(t[r[e]]))return!0}}return!1}function n8e(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 hdr,J1,uH=w(()=>{hdr=Object.prototype.hasOwnProperty;J1=class extends Error{constructor(e,r,n,o,i){super(n8e(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=n8e(e,{name:r,index:n,operation:o,tree:i})}}});var Uye={};Qd(Uye,{JsonPatchError:()=>vs,_areEquals:()=>lH,applyOperation:()=>Z1,applyPatch:()=>KT,applyReducer:()=>bdr,deepClone:()=>gdr,getValueByPointer:()=>uZ,validate:()=>o8e,validator:()=>lZ});function uZ(t,e){if(e=="")return t;var r={op:"_get",path:e};return Z1(t,r),r.value}function Z1(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):lZ(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=uZ(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=lH(t,e.value),a.test===!1)throw new vs("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 vs("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=tf(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=lZ;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=sH(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&&!sZ(f))throw new vs("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);sZ(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new vs("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=ydr[e.op].call(e,u,f,t);if(m.test===!1)throw new vs("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=Wk[e.op].call(e,u,f,t);if(m.test===!1)throw new vs("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new vs("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function KT(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new vs("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=tf(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=Z1(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function bdr(t,e,r){let n=Z1(t,e);if(n.test===!1)throw new vs("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function lZ(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new vs("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(Wk[t.op]){if(typeof t.path!="string")throw new vs("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new vs('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 vs("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 vs("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")&&oZ(t.value))throw new vs("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 vs("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 vs("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=o8e([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new vs("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new vs("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function o8e(t,e,r){try{if(!Array.isArray(t))throw new vs("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)KT(tf(e),tf(t),r||!0);else{r=r||lZ;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof vs)return o;throw o}}function lH(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(!lH(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],!lH(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var vs,gdr,Wk,ydr,cZ=w(()=>{uH();vs=J1,gdr=tf,Wk={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=uZ(r,this.path);n&&(n=tf(n));let o=Z1(r,{op:"remove",path:this.from}).removed;return Z1(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=uZ(r,this.from);return Z1(r,{op:"add",path:this.path,value:tf(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:lH(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},ydr={add:function(t,e,r){return sZ(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:Wk.move,copy:Wk.copy,test:Wk.test,_get:Wk._get}});function i8e(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=aZ(e),a=aZ(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(iZ(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)?i8e(d,f,r,n+"/"+N_(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+N_(c),value:tf(d)}),r.push({op:"replace",path:n+"/"+N_(c),value:tf(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+N_(c),value:tf(d)}),r.push({op:"remove",path:n+"/"+N_(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];!iZ(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+N_(c),value:tf(e[c])})}}}function dZ(t,e,r=!1){var n=[];return i8e(t,e,n,"",r),n}var a8e=w(()=>{uH();cZ();});var C2n,qye=w(()=>{cZ();a8e();uH();cZ();uH();C2n={...Uye,JsonPatchError:J1,deepClone:tf,escapePathComponent:N_,unescapePathComponent:sH}});var s8e,u8e,Hye,l8e,Vye,Wye,Kye,c8e,d8e,f8e,p8e,m8e,h8e,g8e,y8e,b8e,_8e,v8e,w8e,x8e,S8e,C8e,O8e,P8e,E8e,T8e,A8e,I8e,M8e,R8e,Gye,N8e,j8e,D8e=w(()=>{s8e="gen_ai.operation.name",u8e="gen_ai.system",Hye="gen_ai.request.model",l8e="gen_ai.response.model",Vye="gen_ai.usage.input_tokens",Wye="gen_ai.usage.output_tokens",Kye="gen_ai.usage.total_tokens",c8e="gen_ai.request.max_tokens",d8e="gen_ai.request.temperature",f8e="gen_ai.request.top_p",p8e="gen_ai.request.frequency_penalty",m8e="gen_ai.request.presence_penalty",h8e="gen_ai.response.finish_reasons",g8e="gen_ai.prompt",y8e="gen_ai.completion",b8e="gen_ai.request.extra_query",_8e="gen_ai.request.extra_body",v8e="gen_ai.serialized.name",w8e="gen_ai.serialized.signature",x8e="gen_ai.serialized.doc",S8e="gen_ai.response.id",C8e="gen_ai.response.service_tier",O8e="gen_ai.response.system_fingerprint",P8e="gen_ai.usage.input_token_details",E8e="gen_ai.usage.output_token_details",T8e="langsmith.trace.session_id",A8e="langsmith.trace.session_name",I8e="langsmith.span.kind",M8e="langsmith.trace.name",R8e="langsmith.metadata",Gye="langsmith.span.tags",N8e="langsmith.request.streaming",j8e="langsmith.request.headers"});var vdr,L8e,F8e,Vt,fZ=w(()=>{EO();vdr=(...t)=>fetch(...t),L8e=Symbol.for("ls:fetch_implementation"),F8e=()=>{let t=globalThis[L8e];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},Vt=t=>async(...e)=>{if(t||$l("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[L8e]??vdr)(...e);return(t||$l("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var cH,Jye=w(()=>{EO();cH=()=>$l("PROJECT")??Bm("LANGCHAIN_SESSION")??"default"});var pZ,mZ=w(()=>{Zye();Yye();fZ();Jye();pZ="0.3.54"});function hZ(){if(Xye===void 0){let t=Odr(),e=Edr();Xye={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:pZ,...e}}return Xye}function $8e(){let t=Pdr()||{},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 Pdr(){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 Bm(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function $l(t){return Bm(`LANGSMITH_${t}`)||Bm(`LANGCHAIN_${t}`)}function Edr(){if(Qye!==void 0)return Qye;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=Bm(r);n!==void 0&&(e[r]=n)}return Qye=e,e}function gZ(){return Bm("OTEL_ENABLED")==="true"||$l("OTEL_ENABLED")==="true"}var TO,wdr,xdr,Sdr,k8e,Cdr,Odr,Xye,Qye,EO=w(()=>{mZ();wdr=()=>typeof window<"u"&&typeof window.document<"u",xdr=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Sdr=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),k8e=()=>typeof Deno<"u",Cdr=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!k8e(),Odr=()=>TO||(wdr()?TO="browser":Cdr()?TO="node":xdr()?TO="webworker":Sdr()?TO="jsdom":k8e()?TO="deno":TO="other",TO)});function yZ(){return abe.getTraceInstance()}function B8e(){return abe.getContextInstance()}function U8e(){return abe.getDefaultOTLPTracerComponents()}var rbe,nbe,obe,ebe,tbe,z8e,Tdr,Adr,ibe,abe,sbe=w(()=>{EO();rbe=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&gZ()&&(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()}},nbe=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new rbe})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},obe=class{active(){return{}}with(e,r){return r()}},ebe=Symbol.for("ls:otel_trace"),tbe=Symbol.for("ls:otel_context"),z8e=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),Tdr=new nbe,Adr=new obe,ibe=class{getTraceInstance(){return globalThis[ebe]??Tdr}getContextInstance(){return globalThis[tbe]??Adr}initializeGlobalInstances(e){globalThis[ebe]===void 0&&(globalThis[ebe]=e.trace),globalThis[tbe]===void 0&&(globalThis[tbe]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[z8e]=e}getDefaultOTLPTracerComponents(){return globalThis[z8e]??void 0}},abe=new ibe});function Mdr(t){return Idr[t]||t}var Idr,bZ,q8e=w(()=>{D8e();sbe();Idr={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};bZ=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&&yZ().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(I8e,r.run_type);let s=Mdr(r.run_type||"chain");e.setAttribute(s8e,s)}"name"in r&&r.name&&e.setAttribute(M8e,r.name),"session_id"in r&&r.session_id&&e.setAttribute(T8e,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(A8e,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(Hye,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(Vye,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(Wye,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(Kye,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${R8e}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(Gye,a.join(", ")):a&&e.setAttribute(Gye,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(v8e,String(s.name)),s.signature&&e.setAttribute(w8e,String(s.signature)),s.doc&&e.setAttribute(x8e,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(u8e,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(c8e,n.max_tokens),n.temperature!==void 0&&e.setAttribute(d8e,n.temperature),n.top_p!==void 0&&e.setAttribute(f8e,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(p8e,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(m8e,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(Hye,n.model),n.stream!==void 0&&e.setAttribute(N8e,n.stream),n.extra_headers&&e.setAttribute(j8e,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(b8e,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(_8e,JSON.stringify(n.extra_body))),e.setAttribute(g8e,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(Vye,o[0]),e.setAttribute(Wye,o[1]),e.setAttribute(Kye,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(l8e,String(n.model)),n.id&&e.setAttribute(S8e,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(h8e,i.join(", "))}if(n.service_tier&&e.setAttribute(C8e,n.service_tier),n.system_fingerprint&&e.setAttribute(O8e,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(P8e,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(E8e,JSON.stringify(i.output_token_details))}}e.setAttribute(y8e,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 V8e=v((V2n,ube)=>{"use strict";var Rdr=Object.prototype.hasOwnProperty,Wf="~";function dH(){}Object.create&&(dH.prototype=Object.create(null),new dH().__proto__||(Wf=!1));function Ndr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function H8e(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new Ndr(r,n||t,o),a=Wf?Wf+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 _Z(t,e){--t._eventsCount===0?t._events=new dH:delete t._events[e]}function rf(){this._events=new dH,this._eventsCount=0}rf.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Rdr.call(r,n)&&e.push(Wf?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};rf.prototype.listeners=function(e){var r=Wf?Wf+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};rf.prototype.listenerCount=function(e){var r=Wf?Wf+e:e,n=this._events[r];return n?n.fn?1:n.length:0};rf.prototype.emit=function(e,r,n,o,i,a){var s=Wf?Wf+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};rf.prototype.on=function(e,r,n){return H8e(this,e,r,n,!1)};rf.prototype.once=function(e,r,n){return H8e(this,e,r,n,!0)};rf.prototype.removeListener=function(e,r,n,o){var i=Wf?Wf+e:e;if(!this._events[i])return this;if(!r)return _Z(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&_Z(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:_Z(this,i)}return this};rf.prototype.removeAllListeners=function(e){var r;return e?(r=Wf?Wf+e:e,this._events[r]&&_Z(this,r)):(this._events=new dH,this._eventsCount=0),this};rf.prototype.off=rf.prototype.removeListener;rf.prototype.addListener=rf.prototype.on;rf.prefixed=Wf;rf.EventEmitter=rf;typeof ube<"u"&&(ube.exports=rf)});var K8e=v((W2n,W8e)=>{"use strict";W8e.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 J8e=v((K2n,wZ)=>{"use strict";var jdr=K8e(),vZ=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},G8e=(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 vZ(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);jdr(t.then(n,o),()=>{clearTimeout(i)})});wZ.exports=G8e;wZ.exports.default=G8e;wZ.exports.TimeoutError=vZ});var Z8e=v(lbe=>{"use strict";Object.defineProperty(lbe,"__esModule",{value:!0});function Ddr(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}lbe.default=Ddr});var Y8e=v(dbe=>{"use strict";Object.defineProperty(dbe,"__esModule",{value:!0});var Ldr=Z8e(),cbe=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=Ldr.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}};dbe.default=cbe});var SZ=v(pbe=>{"use strict";Object.defineProperty(pbe,"__esModule",{value:!0});var Fdr=V8e(),X8e=J8e(),kdr=Y8e(),xZ=()=>{},$dr=new X8e.TimeoutError,fbe=class extends Fdr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=xZ,this._resolveIdle=xZ,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:kdr.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=xZ,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=xZ,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():X8e.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o($dr)});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}};pbe.default=fbe});var Q8e,CZ,zdr,Bdr,fH,eVe=w(()=>{Q8e=F(X7(),1),CZ=F(SZ(),1);fZ();zdr=[400,401,403,404,405,406,407,408],Bdr=[409],fH=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 CZ.default?this.queue=new CZ.default.default({concurrency:this.maxConcurrency}):this.queue=new CZ.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,Q8e.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(zdr.includes(+a))throw o;if(Bdr.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(()=>Vt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function mbe(t){return typeof t?._getType=="function"}function hbe(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 tVe=w(()=>{});function Jr(t,e){if(!Udr.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var Udr,rVe=w(()=>{Udr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});function OZ(t){nVe[t]||(console.warn(t),nVe[t]=!0)}var nVe,gbe=w(()=>{nVe={}});var pH=v((r4n,oVe)=>{var qdr="2.0.0",Hdr=Number.MAX_SAFE_INTEGER||9007199254740991,Vdr=16,Wdr=250,Kdr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];oVe.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Vdr,MAX_SAFE_BUILD_LENGTH:Wdr,MAX_SAFE_INTEGER:Hdr,RELEASE_TYPES:Kdr,SEMVER_SPEC_VERSION:qdr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var mH=v((n4n,iVe)=>{var Gdr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};iVe.exports=Gdr});var Kk=v((AO,aVe)=>{var{MAX_SAFE_COMPONENT_LENGTH:ybe,MAX_SAFE_BUILD_LENGTH:Jdr,MAX_LENGTH:Zdr}=pH(),Ydr=mH();AO=aVe.exports={};var Xdr=AO.re=[],Qdr=AO.safeRe=[],St=AO.src=[],Ct=AO.t={},efr=0,bbe="[a-zA-Z0-9-]",tfr=[["\\s",1],["\\d",Zdr],[bbe,Jdr]],rfr=t=>{for(let[e,r]of tfr)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Zr=(t,e,r)=>{let n=rfr(e),o=efr++;Ydr(t,o,e),Ct[t]=o,St[o]=e,Xdr[o]=new RegExp(e,r?"g":void 0),Qdr[o]=new RegExp(n,r?"g":void 0)};Zr("NUMERICIDENTIFIER","0|[1-9]\\d*");Zr("NUMERICIDENTIFIERLOOSE","\\d+");Zr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${bbe}*`);Zr("MAINVERSION",`(${St[Ct.NUMERICIDENTIFIER]})\\.(${St[Ct.NUMERICIDENTIFIER]})\\.(${St[Ct.NUMERICIDENTIFIER]})`);Zr("MAINVERSIONLOOSE",`(${St[Ct.NUMERICIDENTIFIERLOOSE]})\\.(${St[Ct.NUMERICIDENTIFIERLOOSE]})\\.(${St[Ct.NUMERICIDENTIFIERLOOSE]})`);Zr("PRERELEASEIDENTIFIER",`(?:${St[Ct.NUMERICIDENTIFIER]}|${St[Ct.NONNUMERICIDENTIFIER]})`);Zr("PRERELEASEIDENTIFIERLOOSE",`(?:${St[Ct.NUMERICIDENTIFIERLOOSE]}|${St[Ct.NONNUMERICIDENTIFIER]})`);Zr("PRERELEASE",`(?:-(${St[Ct.PRERELEASEIDENTIFIER]}(?:\\.${St[Ct.PRERELEASEIDENTIFIER]})*))`);Zr("PRERELEASELOOSE",`(?:-?(${St[Ct.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${St[Ct.PRERELEASEIDENTIFIERLOOSE]})*))`);Zr("BUILDIDENTIFIER",`${bbe}+`);Zr("BUILD",`(?:\\+(${St[Ct.BUILDIDENTIFIER]}(?:\\.${St[Ct.BUILDIDENTIFIER]})*))`);Zr("FULLPLAIN",`v?${St[Ct.MAINVERSION]}${St[Ct.PRERELEASE]}?${St[Ct.BUILD]}?`);Zr("FULL",`^${St[Ct.FULLPLAIN]}$`);Zr("LOOSEPLAIN",`[v=\\s]*${St[Ct.MAINVERSIONLOOSE]}${St[Ct.PRERELEASELOOSE]}?${St[Ct.BUILD]}?`);Zr("LOOSE",`^${St[Ct.LOOSEPLAIN]}$`);Zr("GTLT","((?:<|>)?=?)");Zr("XRANGEIDENTIFIERLOOSE",`${St[Ct.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Zr("XRANGEIDENTIFIER",`${St[Ct.NUMERICIDENTIFIER]}|x|X|\\*`);Zr("XRANGEPLAIN",`[v=\\s]*(${St[Ct.XRANGEIDENTIFIER]})(?:\\.(${St[Ct.XRANGEIDENTIFIER]})(?:\\.(${St[Ct.XRANGEIDENTIFIER]})(?:${St[Ct.PRERELEASE]})?${St[Ct.BUILD]}?)?)?`);Zr("XRANGEPLAINLOOSE",`[v=\\s]*(${St[Ct.XRANGEIDENTIFIERLOOSE]})(?:\\.(${St[Ct.XRANGEIDENTIFIERLOOSE]})(?:\\.(${St[Ct.XRANGEIDENTIFIERLOOSE]})(?:${St[Ct.PRERELEASELOOSE]})?${St[Ct.BUILD]}?)?)?`);Zr("XRANGE",`^${St[Ct.GTLT]}\\s*${St[Ct.XRANGEPLAIN]}$`);Zr("XRANGELOOSE",`^${St[Ct.GTLT]}\\s*${St[Ct.XRANGEPLAINLOOSE]}$`);Zr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ybe}})(?:\\.(\\d{1,${ybe}}))?(?:\\.(\\d{1,${ybe}}))?`);Zr("COERCE",`${St[Ct.COERCEPLAIN]}(?:$|[^\\d])`);Zr("COERCEFULL",St[Ct.COERCEPLAIN]+`(?:${St[Ct.PRERELEASE]})?(?:${St[Ct.BUILD]})?(?:$|[^\\d])`);Zr("COERCERTL",St[Ct.COERCE],!0);Zr("COERCERTLFULL",St[Ct.COERCEFULL],!0);Zr("LONETILDE","(?:~>?)");Zr("TILDETRIM",`(\\s*)${St[Ct.LONETILDE]}\\s+`,!0);AO.tildeTrimReplace="$1~";Zr("TILDE",`^${St[Ct.LONETILDE]}${St[Ct.XRANGEPLAIN]}$`);Zr("TILDELOOSE",`^${St[Ct.LONETILDE]}${St[Ct.XRANGEPLAINLOOSE]}$`);Zr("LONECARET","(?:\\^)");Zr("CARETTRIM",`(\\s*)${St[Ct.LONECARET]}\\s+`,!0);AO.caretTrimReplace="$1^";Zr("CARET",`^${St[Ct.LONECARET]}${St[Ct.XRANGEPLAIN]}$`);Zr("CARETLOOSE",`^${St[Ct.LONECARET]}${St[Ct.XRANGEPLAINLOOSE]}$`);Zr("COMPARATORLOOSE",`^${St[Ct.GTLT]}\\s*(${St[Ct.LOOSEPLAIN]})$|^$`);Zr("COMPARATOR",`^${St[Ct.GTLT]}\\s*(${St[Ct.FULLPLAIN]})$|^$`);Zr("COMPARATORTRIM",`(\\s*)${St[Ct.GTLT]}\\s*(${St[Ct.LOOSEPLAIN]}|${St[Ct.XRANGEPLAIN]})`,!0);AO.comparatorTrimReplace="$1$2$3";Zr("HYPHENRANGE",`^\\s*(${St[Ct.XRANGEPLAIN]})\\s+-\\s+(${St[Ct.XRANGEPLAIN]})\\s*$`);Zr("HYPHENRANGELOOSE",`^\\s*(${St[Ct.XRANGEPLAINLOOSE]})\\s+-\\s+(${St[Ct.XRANGEPLAINLOOSE]})\\s*$`);Zr("STAR","(<|>)?=?\\s*\\*");Zr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Zr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var PZ=v((o4n,sVe)=>{var nfr=Object.freeze({loose:!0}),ofr=Object.freeze({}),ifr=t=>t?typeof t!="object"?nfr:t:ofr;sVe.exports=ifr});var _be=v((i4n,cVe)=>{var uVe=/^[0-9]+$/,lVe=(t,e)=>{let r=uVe.test(t),n=uVe.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},afr=(t,e)=>lVe(e,t);cVe.exports={compareIdentifiers:lVe,rcompareIdentifiers:afr}});var nf=v((a4n,mVe)=>{var EZ=mH(),{MAX_LENGTH:dVe,MAX_SAFE_INTEGER:TZ}=pH(),{safeRe:fVe,t:pVe}=Kk(),sfr=PZ(),{compareIdentifiers:Gk}=_be(),vbe=class t{constructor(e,r){if(r=sfr(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>dVe)throw new TypeError(`version is longer than ${dVe} characters`);EZ("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?fVe[pVe.LOOSE]:fVe[pVe.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>TZ||this.major<0)throw new TypeError("Invalid major version");if(this.minor>TZ||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>TZ||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<TZ)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(EZ("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)),Gk(this.major,e.major)||Gk(this.minor,e.minor)||Gk(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(EZ("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 Gk(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(EZ("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 Gk(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]),Gk(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}};mVe.exports=vbe});var X1=v((s4n,gVe)=>{var hVe=nf(),ufr=(t,e,r=!1)=>{if(t instanceof hVe)return t;try{return new hVe(t,e)}catch(n){if(!r)return null;throw n}};gVe.exports=ufr});var bVe=v((u4n,yVe)=>{var lfr=X1(),cfr=(t,e)=>{let r=lfr(t,e);return r?r.version:null};yVe.exports=cfr});var vVe=v((l4n,_Ve)=>{var dfr=X1(),ffr=(t,e)=>{let r=dfr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};_Ve.exports=ffr});var SVe=v((c4n,xVe)=>{var wVe=nf(),pfr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new wVe(t instanceof wVe?t.version:t,r).inc(e,n,o).version}catch{return null}};xVe.exports=pfr});var PVe=v((d4n,OVe)=>{var CVe=X1(),mfr=(t,e)=>{let r=CVe(t,null,!0),n=CVe(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"};OVe.exports=mfr});var TVe=v((f4n,EVe)=>{var hfr=nf(),gfr=(t,e)=>new hfr(t,e).major;EVe.exports=gfr});var IVe=v((p4n,AVe)=>{var yfr=nf(),bfr=(t,e)=>new yfr(t,e).minor;AVe.exports=bfr});var RVe=v((m4n,MVe)=>{var _fr=nf(),vfr=(t,e)=>new _fr(t,e).patch;MVe.exports=vfr});var jVe=v((h4n,NVe)=>{var wfr=X1(),xfr=(t,e)=>{let r=wfr(t,e);return r&&r.prerelease.length?r.prerelease:null};NVe.exports=xfr});var eg=v((g4n,LVe)=>{var DVe=nf(),Sfr=(t,e,r)=>new DVe(t,r).compare(new DVe(e,r));LVe.exports=Sfr});var kVe=v((y4n,FVe)=>{var Cfr=eg(),Ofr=(t,e,r)=>Cfr(e,t,r);FVe.exports=Ofr});var zVe=v((b4n,$Ve)=>{var Pfr=eg(),Efr=(t,e)=>Pfr(t,e,!0);$Ve.exports=Efr});var AZ=v((_4n,UVe)=>{var BVe=nf(),Tfr=(t,e,r)=>{let n=new BVe(t,r),o=new BVe(e,r);return n.compare(o)||n.compareBuild(o)};UVe.exports=Tfr});var HVe=v((v4n,qVe)=>{var Afr=AZ(),Ifr=(t,e)=>t.sort((r,n)=>Afr(r,n,e));qVe.exports=Ifr});var WVe=v((w4n,VVe)=>{var Mfr=AZ(),Rfr=(t,e)=>t.sort((r,n)=>Mfr(n,r,e));VVe.exports=Rfr});var hH=v((x4n,KVe)=>{var Nfr=eg(),jfr=(t,e,r)=>Nfr(t,e,r)>0;KVe.exports=jfr});var IZ=v((S4n,GVe)=>{var Dfr=eg(),Lfr=(t,e,r)=>Dfr(t,e,r)<0;GVe.exports=Lfr});var wbe=v((C4n,JVe)=>{var Ffr=eg(),kfr=(t,e,r)=>Ffr(t,e,r)===0;JVe.exports=kfr});var xbe=v((O4n,ZVe)=>{var $fr=eg(),zfr=(t,e,r)=>$fr(t,e,r)!==0;ZVe.exports=zfr});var MZ=v((P4n,YVe)=>{var Bfr=eg(),Ufr=(t,e,r)=>Bfr(t,e,r)>=0;YVe.exports=Ufr});var RZ=v((E4n,XVe)=>{var qfr=eg(),Hfr=(t,e,r)=>qfr(t,e,r)<=0;XVe.exports=Hfr});var Sbe=v((T4n,QVe)=>{var Vfr=wbe(),Wfr=xbe(),Kfr=hH(),Gfr=MZ(),Jfr=IZ(),Zfr=RZ(),Yfr=(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 Vfr(t,r,n);case"!=":return Wfr(t,r,n);case">":return Kfr(t,r,n);case">=":return Gfr(t,r,n);case"<":return Jfr(t,r,n);case"<=":return Zfr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};QVe.exports=Yfr});var t5e=v((A4n,e5e)=>{var Xfr=nf(),Qfr=X1(),{safeRe:NZ,t:jZ}=Kk(),epr=(t,e)=>{if(t instanceof Xfr)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?NZ[jZ.COERCEFULL]:NZ[jZ.COERCE]);else{let u=e.includePrerelease?NZ[jZ.COERCERTLFULL]:NZ[jZ.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 Qfr(`${n}.${o}.${i}${a}${s}`,e)};e5e.exports=epr});var n5e=v((I4n,r5e)=>{var Cbe=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}};r5e.exports=Cbe});var tg=v((M4n,s5e)=>{var tpr=/\s+/g,Obe=class t{constructor(e,r){if(r=npr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Pbe)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(tpr," "),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=>!i5e(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&&cpr(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&&upr)|(this.options.loose&&lpr))+":"+e,o=o5e.get(n);if(o)return o;let i=this.options.loose,a=i?Lp[Kf.HYPHENRANGELOOSE]:Lp[Kf.HYPHENRANGE];e=e.replace(a,vpr(this.options.includePrerelease)),ca("hyphen replace",e),e=e.replace(Lp[Kf.COMPARATORTRIM],ipr),ca("comparator trim",e),e=e.replace(Lp[Kf.TILDETRIM],apr),ca("tilde trim",e),e=e.replace(Lp[Kf.CARETTRIM],spr),ca("caret trim",e);let s=e.split(" ").map(d=>dpr(d,this.options)).join(" ").split(/\s+/).map(d=>_pr(d,this.options));i&&(s=s.filter(d=>(ca("loose invalid filter",d,this.options),!!d.match(Lp[Kf.COMPARATORLOOSE])))),ca("range list",s);let u=new Map,l=s.map(d=>new Pbe(d,this.options));for(let d of l){if(i5e(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return o5e.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>a5e(n,r)&&e.set.some(o=>a5e(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 opr(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(wpr(this.set[r],e,this.options))return!0;return!1}};s5e.exports=Obe;var rpr=n5e(),o5e=new rpr,npr=PZ(),Pbe=gH(),ca=mH(),opr=nf(),{safeRe:Lp,t:Kf,comparatorTrimReplace:ipr,tildeTrimReplace:apr,caretTrimReplace:spr}=Kk(),{FLAG_INCLUDE_PRERELEASE:upr,FLAG_LOOSE:lpr}=pH(),i5e=t=>t.value==="<0.0.0-0",cpr=t=>t.value==="",a5e=(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},dpr=(t,e)=>(ca("comp",t,e),t=mpr(t,e),ca("caret",t),t=fpr(t,e),ca("tildes",t),t=gpr(t,e),ca("xrange",t),t=bpr(t,e),ca("stars",t),t),Gf=t=>!t||t.toLowerCase()==="x"||t==="*",fpr=(t,e)=>t.trim().split(/\s+/).map(r=>ppr(r,e)).join(" "),ppr=(t,e)=>{let r=e.loose?Lp[Kf.TILDELOOSE]:Lp[Kf.TILDE];return t.replace(r,(n,o,i,a,s)=>{ca("tilde",t,n,o,i,a,s);let u;return Gf(o)?u="":Gf(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Gf(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(ca("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,ca("tilde return",u),u})},mpr=(t,e)=>t.trim().split(/\s+/).map(r=>hpr(r,e)).join(" "),hpr=(t,e)=>{ca("caret",t,e);let r=e.loose?Lp[Kf.CARETLOOSE]:Lp[Kf.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{ca("caret",t,o,i,a,s,u);let l;return Gf(i)?l="":Gf(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Gf(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(ca("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`):(ca("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`),ca("caret return",l),l})},gpr=(t,e)=>(ca("replaceXRanges",t,e),t.split(/\s+/).map(r=>ypr(r,e)).join(" ")),ypr=(t,e)=>{t=t.trim();let r=e.loose?Lp[Kf.XRANGELOOSE]:Lp[Kf.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{ca("xRange",t,n,o,i,a,s,u);let l=Gf(i),c=l||Gf(a),d=c||Gf(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`),ca("xRange return",n),n})},bpr=(t,e)=>(ca("replaceStars",t,e),t.trim().replace(Lp[Kf.STAR],"")),_pr=(t,e)=>(ca("replaceGTE0",t,e),t.trim().replace(Lp[e.includePrerelease?Kf.GTE0PRE:Kf.GTE0],"")),vpr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Gf(n)?r="":Gf(o)?r=`>=${n}.0.0${t?"-0":""}`:Gf(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Gf(l)?u="":Gf(c)?u=`<${+l+1}.0.0-0`:Gf(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()),wpr=(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(ca(t[n].semver),t[n].semver!==Pbe.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 gH=v((R4n,p5e)=>{var yH=Symbol("SemVer ANY"),Abe=class t{static get ANY(){return yH}constructor(e,r){if(r=u5e(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Tbe("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===yH?this.value="":this.value=this.operator+this.semver.version,Tbe("comp",this)}parse(e){let r=this.options.loose?l5e[c5e.COMPARATORLOOSE]:l5e[c5e.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 d5e(n[2],this.options.loose):this.semver=yH}toString(){return this.value}test(e){if(Tbe("Comparator.test",e,this.options.loose),this.semver===yH||e===yH)return!0;if(typeof e=="string")try{e=new d5e(e,this.options)}catch{return!1}return Ebe(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 f5e(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new f5e(this.value,r).test(e.semver):(r=u5e(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("=")||Ebe(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Ebe(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};p5e.exports=Abe;var u5e=PZ(),{safeRe:l5e,t:c5e}=Kk(),Ebe=Sbe(),Tbe=mH(),d5e=nf(),f5e=tg()});var bH=v((N4n,m5e)=>{var xpr=tg(),Spr=(t,e,r)=>{try{e=new xpr(e,r)}catch{return!1}return e.test(t)};m5e.exports=Spr});var g5e=v((j4n,h5e)=>{var Cpr=tg(),Opr=(t,e)=>new Cpr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));h5e.exports=Opr});var b5e=v((D4n,y5e)=>{var Ppr=nf(),Epr=tg(),Tpr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Epr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new Ppr(n,r))}),n};y5e.exports=Tpr});var v5e=v((L4n,_5e)=>{var Apr=nf(),Ipr=tg(),Mpr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Ipr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new Apr(n,r))}),n};_5e.exports=Mpr});var S5e=v((F4n,x5e)=>{var Ibe=nf(),Rpr=tg(),w5e=hH(),Npr=(t,e)=>{t=new Rpr(t,e);let r=new Ibe("0.0.0");if(t.test(r)||(r=new Ibe("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 Ibe(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||w5e(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||w5e(r,i))&&(r=i)}return r&&t.test(r)?r:null};x5e.exports=Npr});var O5e=v((k4n,C5e)=>{var jpr=tg(),Dpr=(t,e)=>{try{return new jpr(t,e).range||"*"}catch{return null}};C5e.exports=Dpr});var DZ=v(($4n,A5e)=>{var Lpr=nf(),T5e=gH(),{ANY:Fpr}=T5e,kpr=tg(),$pr=bH(),P5e=hH(),E5e=IZ(),zpr=RZ(),Bpr=MZ(),Upr=(t,e,r,n)=>{t=new Lpr(t,n),e=new kpr(e,n);let o,i,a,s,u;switch(r){case">":o=P5e,i=zpr,a=E5e,s=">",u=">=";break;case"<":o=E5e,i=Bpr,a=P5e,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if($pr(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===Fpr&&(p=new T5e(">=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};A5e.exports=Upr});var M5e=v((z4n,I5e)=>{var qpr=DZ(),Hpr=(t,e,r)=>qpr(t,e,">",r);I5e.exports=Hpr});var N5e=v((B4n,R5e)=>{var Vpr=DZ(),Wpr=(t,e,r)=>Vpr(t,e,"<",r);R5e.exports=Wpr});var L5e=v((U4n,D5e)=>{var j5e=tg(),Kpr=(t,e,r)=>(t=new j5e(t,r),e=new j5e(e,r),t.intersects(e,r));D5e.exports=Kpr});var k5e=v((q4n,F5e)=>{var Gpr=bH(),Jpr=eg();F5e.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>Jpr(c,d,r));for(let c of a)Gpr(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 H5e=v((H4n,q5e)=>{var $5e=tg(),Rbe=gH(),{ANY:Mbe}=Rbe,_H=bH(),Nbe=eg(),Zpr=(t,e,r={})=>{if(t===e)return!0;t=new $5e(t,r),e=new $5e(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=Xpr(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},Ypr=[new Rbe(">=0.0.0-0")],z5e=[new Rbe(">=0.0.0")],Xpr=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Mbe){if(e.length===1&&e[0].semver===Mbe)return!0;r.includePrerelease?t=Ypr:t=z5e}if(e.length===1&&e[0].semver===Mbe){if(r.includePrerelease)return!0;e=z5e}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=B5e(o,p,r):p.operator==="<"||p.operator==="<="?i=U5e(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Nbe(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&&!_H(p,String(o),r)||i&&!_H(p,String(i),r))return null;for(let m of e)if(!_H(p,String(m),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=B5e(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!_H(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=U5e(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!_H(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)},B5e=(t,e,r)=>{if(!t)return e;let n=Nbe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},U5e=(t,e,r)=>{if(!t)return e;let n=Nbe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};q5e.exports=Zpr});var G5e=v((V4n,K5e)=>{var jbe=Kk(),V5e=pH(),Qpr=nf(),W5e=_be(),emr=X1(),tmr=bVe(),rmr=vVe(),nmr=SVe(),omr=PVe(),imr=TVe(),amr=IVe(),smr=RVe(),umr=jVe(),lmr=eg(),cmr=kVe(),dmr=zVe(),fmr=AZ(),pmr=HVe(),mmr=WVe(),hmr=hH(),gmr=IZ(),ymr=wbe(),bmr=xbe(),_mr=MZ(),vmr=RZ(),wmr=Sbe(),xmr=t5e(),Smr=gH(),Cmr=tg(),Omr=bH(),Pmr=g5e(),Emr=b5e(),Tmr=v5e(),Amr=S5e(),Imr=O5e(),Mmr=DZ(),Rmr=M5e(),Nmr=N5e(),jmr=L5e(),Dmr=k5e(),Lmr=H5e();K5e.exports={parse:emr,valid:tmr,clean:rmr,inc:nmr,diff:omr,major:imr,minor:amr,patch:smr,prerelease:umr,compare:lmr,rcompare:cmr,compareLoose:dmr,compareBuild:fmr,sort:pmr,rsort:mmr,gt:hmr,lt:gmr,eq:ymr,neq:bmr,gte:_mr,lte:vmr,cmp:wmr,coerce:xmr,Comparator:Smr,Range:Cmr,satisfies:Omr,toComparators:Pmr,maxSatisfying:Emr,minSatisfying:Tmr,minVersion:Amr,validRange:Imr,outside:Mmr,gtr:Rmr,ltr:Nmr,intersects:jmr,simplifyRange:Dmr,subset:Lmr,SemVer:Qpr,re:jbe.re,src:jbe.src,tokens:jbe.t,SEMVER_SPEC_VERSION:V5e.SEMVER_SPEC_VERSION,RELEASE_TYPES:V5e.RELEASE_TYPES,compareIdentifiers:W5e.compareIdentifiers,rcompareIdentifiers:W5e.rcompareIdentifiers}});function IO(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 Fmr,J5e=w(()=>{Fmr=F(G5e(),1)});async function nn(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 Dbe(o);let i=new Error(o);throw i.status=t.status,i}function Y5e(t){return typeof t=="object"&&t!==null&&t.code===Z5e}var Dbe,Z5e,LZ,Lbe=w(()=>{Dbe=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}};Z5e="ERR_CONFLICTING_ENDPOINTS",LZ=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:Z5e}),this.name="ConflictingEndpointsError"}}});function zmr(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function FZ(t){return $mr.encode(t)}function Q5e(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 Bmr(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return Q5e(r)}}function Fp(t,e,r,n,o){try{let i=JSON.stringify(t,Bmr(r),n);return FZ(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
|
||
Context: ${e}`:""}`),FZ("[Unserializable]");$l("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
|
||
Context: ${e}`:""}`),typeof o>"u"&&(o=zmr()),kbe(t,"",0,[],void 0,0,o);let a;try{Jk.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,Umr(r),n)}catch{return FZ("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;kZ.length!==0;){let s=kZ.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return FZ(a)}}function Fbe(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),kZ.push([n,r,e,o])):Jk.push([e,r,t]):(n[r]=t,kZ.push([n,r,e]))}function kbe(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){Fbe(kmr,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Fbe(X5e,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Fbe(X5e,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)kbe(t[s],s,s,n,t,i,a);else{t=Q5e(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];kbe(t[l],l,s,n,t,i,a)}}n.pop()}}function Umr(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(Jk.length>0)for(var n=0;n<Jk.length;n++){var o=Jk[n];if(o[1]===e&&o[0]===r){r=o[2],Jk.splice(n,1);break}}return t.call(this,e,r)}}var X5e,kmr,kZ,Jk,$mr,e9e=w(()=>{EO();X5e="[...]",kmr={result:"[Circular]"},kZ=[],Jk=[],$mr=new TextEncoder});function t9e(t){let e=hZ(),r=$8e(),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 Vmr(t){let e=[];for await(let r of t)e.push(r);return e}function $be(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function r9e(t){return typeof t=="number"?Number(t.toFixed(4)):t}function o9e(t){return"dataset_id"in t||"dataset_name"in t}var qmr,Hmr,Wmr,zbe,Kmr,Gmr,n9e,Y1,Zye=w(()=>{G1();q8e();sbe();eVe();tVe();EO();mZ();rVe();gbe();J5e();Lbe();fZ();e9e();qmr=t=>{let e=t?.toString()??$l("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},Hmr=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};Wmr=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};zbe=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=Fp(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())]}},Kmr=20971520,Gmr=2500,n9e="https://api.smith.langchain.com",Y1=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 zbe}),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:Bm("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:Bm("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=qmr(e.tracingSamplingRate),this.apiUrl=$be(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=$be(e.apiKey??r.apiKey),this.webUrl=$be(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new fH({...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 fH({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:Wmr,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,gZ()&&(this.langSmithToOTELTranslator=new bZ)}static getDefaultClientConfig(){let e=$l("API_KEY"),r=$l("ENDPOINT")??n9e,n=$l("HIDE_INPUTS")==="true",o=$l("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Hmr(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/${pZ}`};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(Vt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Vt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Vt(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??Kmr}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=t9e(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(Vt(this.debug),`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(Gmr),...this.fetchOptions});await nn(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=yZ(),r=B8e();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=t9e(i);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey);let s=await this.caller.call(Vt(this.debug),`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,body:Fp(a,`Creating run with id: ${a.id}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Fp(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(Vt(this.debug),`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(o,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let a=[];for(let d of r??[])a.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(a.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&a.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of a)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),a=f}if(i.length===0&&a.length===0)return;let l=[],c=[];for(let[d,f]of[["post",i],["patch",a]])for(let p of f){let{inputs:m,outputs:h,events:b,attachments:g,...y}=p,x={inputs:m,outputs:h,events:b},S=Fp(y,`Serializing for multipart ingestion of run with id: ${y.id}`);c.push({name:`${d}.${y.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[O,E]of Object.entries(x)){if(E===void 0)continue;let P=Fp(E,`Serializing ${O} for multipart ingestion of run with id: ${y.id}`);c.push({name:`${d}.${y.id}.${O}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(y.id!==void 0){let O=o[y.id];if(O){delete o[y.id];for(let[E,P]of Object.entries(O)){let A,I;if(Array.isArray(P)?[A,I]=P:(A=P.mimeType,I=P.data),E.includes(".")){console.warn(`Skipping attachment '${E}' for run ${y.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${y.id}.${E}`,payload:new Blob([I],{type:`${A}; length=${I.byteLength}`})})}}}l.push(`trace=${y.trace_id},id=${y.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=F8e(),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(Vt(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)!==n9e&&(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 nn(l,"ingest multipart runs",!0)}catch(l){console.warn(`${l.message.trim()}
|
||
|
||
Context: ${r}`)}}async updateRun(e,r,n){Jr(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(Vt(this.debug),`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,body:Fp(r,`Serializing payload to update run with id: ${e}`),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(a,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Jr(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:$l("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 Vmr(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:b,limit:g,select:y,order:x}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let A=Array.isArray(n)?n:[n],I=await Promise.all(A.map(R=>this.readProject({projectName:R}).then(N=>N.id)));S.push(...I)}let O=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],E={session:S.length?S:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:b,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:y||O,is_root:l,order:x},P=0;for await(let A of this._getCursorPaginatedList("/runs/query",E))if(g){if(P>=g)break;if(A.length+P>g){yield*A.slice(0,g-P);break}P+=A.length,yield*A}else yield*A}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:a,endTime:s,limit:u,offset:l}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:a?a.toISOString():null,end_time:s?s.toISOString():null,limit:Number(u)||100},f=Number(l)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},b=Object.fromEntries(Object.entries(h).filter(([O,E])=>E!==void 0)),g=await this.caller.call(Vt(),m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(b),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(g,`Failed to fetch ${p}`);let y=await g.json(),{groups:x,total:S}=y;if(x.length===0)break;for(let O of x)yield O;if(f+=x.length,f>=S)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:b}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(P=>P.id)))]);let x=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:b}).filter(([E,P])=>P!==void 0));return await(await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(x),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||_s()};Jr(e);let i=await(await this.caller.call(Vt(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){Jr(e);let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(r,"unshare run",!0)}async readRunSharedLink(e){Jr(e);let n=await(await this.caller.call(Vt(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 Jr(e),await(await this.caller.call(Vt(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),Jr(e);let o=await(await this.caller.call(Vt(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};Jr(e);let i=await(await this.caller.call(Vt(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){Jr(e);let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(r,"unshare dataset",!0)}async readSharedDataset(e){return Jr(e),await(await this.caller.call(Vt(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(Vt(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(Vt(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 nn(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(Vt(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 nn(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)Jr(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(Vt(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)Jr(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,Jr(n);let o=await this.caller.call(Vt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Vt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Vt(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 nn(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)Jr(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;Jr(i);let a=await this.caller.call(Vt(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 nn(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;Jr(a);let s=await this.caller.call(Vt(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 nn(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)Jr(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Vt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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),Jr(o);let i={tag:n},a=await this.caller.call(Vt(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 nn(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),Jr(r);let a=await this.caller.call(Vt(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 nn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(o9e(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;o9e(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]??_s())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let y=e,x=y[0].dataset_id,S=y[0].dataset_name;if(x===void 0&&S===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&S!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:S})).id);let O=await this._uploadExamplesMultipart(x,y);return await Promise.all(O.example_ids.map(P=>this.readExample(P)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((y,x)=>({dataset_id:p,inputs:y,outputs:n?.[x],metadata:o?.[x],split:i?.[x],id:c?.[x],attachments:l?.[x],source_run_id:a?.[x],use_source_run_io:s?.[x],use_source_run_attachments:u?.[x]})),b=await this._uploadExamplesMultipart(p,h);return await Promise.all(b.example_ids.map(y=>this.readExample(y)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>mbe(a)?hbe(a):a),i=mbe(r)?hbe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Jr(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let b=0;for await(let g of this._getPaginated("/examples",p)){for(let y of g){let{attachment_urls:x,...S}=y,O=S;x&&(O.attachments=Object.entries(x).reduce((E,[P,A])=>(E[P.slice(11)]={presigned_url:A.presigned_url,mime_type:A.mime_type||void 0},E),{})),yield O,b++}if(u!==void 0&&b>=u)break}}async deleteExample(e){Jr(e);let r=`/examples/${e}`,n=await this.caller.call(Vt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,Jr(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,Jr(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(Vt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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,Jr(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,Jr(a);let s={split_name:n,examples:o.map(l=>(Jr(l),l)),remove:i},u=await this.caller.call(Vt(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 nn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){OZ("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&Jr(m.metadata.__run.run_id);let h={id:c??_s(),run_id:e,key:r,score:r9e(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},b=`${this.apiUrl}/feedback`,g=await this.caller.call(Vt(this.debug),b,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=r9e(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Jr(e);let s=await this.caller.call(Vt(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 nn(s,"update feedback",!0)}async readFeedback(e){Jr(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Jr(e);let r=`/feedback/${e}`,n=await this.caller.call(Vt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Vt(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(Vt(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){Jr(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)=>{Jr(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||_s(),rubric_instructions:i},s=await this.caller.call(Vt(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 nn(s,"create annotation queue"),await s.json()}async readAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Jr(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(r,"read annotation queue"),await r.json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,a=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Jr(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 nn(a,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Jr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Jr(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>Jr(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Jr(e,"queueId")}/run`,o=await this.caller.call(Vt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Jr(e,"queueId")}/runs/${Jr(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Jr(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Vt(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]=IO(e),a=await this.caller.call(Vt(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 nn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=IO(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]=IO(e),i=await this.caller.call(Vt(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 nn(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]=IO(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(Vt(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 nn(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]=IO(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(Vt(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 nn(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=Fp(l,`Serializing body for example with id: ${u}`),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=Fp(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=Fp(s.outputs,`Serializing outputs whle updating example with id: ${u}`),p=new Blob([f],{type:"application/json"});n.append(`${u}.outputs`,p)}if(s.attachments)for(let[f,p]of Object.entries(s.attachments)){let m,h;Array.isArray(p)?[m,h]=p:(m=p.mimeType,h=p.data);let b=new Blob([h],{type:`${m}; length=${h.byteLength}`});n.append(`${u}.attachment.${f}`,b)}if(s.attachments_operations){let f=Fp(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(Vt(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??_s()).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=Fp(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=Fp(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=Fp(a.outputs,`Serializing outputs for uploaded example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}}let o=await this.caller.call(Vt(this.debug),`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,body:n});return await nn(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]=IO(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(Vt(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 nn(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]=IO(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Vt(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]=IO(e),a=await this.caller.call(Vt(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 nn(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 Jr(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 U8e()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var i9e,a9e=w(()=>{EO();i9e=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>$l(r)==="true")});var $Z,s9e=w(()=>{$Z=Symbol.for("lc:context_variables")});function Jmr(t){return t.replace(/[-:.]/g,"")}function Bbe(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:Jmr(o)+e,microsecondPrecisionDatestring:o}}function l9e(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function c9e(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function u9e(t){return Array.isArray(t)&&t.some(e=>c9e(e))}function Zmr(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Ymr(t){return t!==void 0&&typeof t.callbacks=="object"&&(u9e(t.callbacks?.handlers)||u9e(t.callbacks))}function Xmr(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 Qmr(){let t=Bm("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){thr(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(Y5e(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 ehr(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Qmr()}function thr(t){if(Object.keys(t).length>0&&$l("ENDPOINT"))throw new LZ}var zZ,Gy,Yye=w(()=>{G1();Zye();a9e();Lbe();s9e();EO();Jye();EO();gbe();zZ=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(",")}},Gy=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}),l9e(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=ehr(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}=Bbe(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:_s(),run_type:"chain",project_name:cH(),child_runs:[],api_url:Bm("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Bm("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new Y1),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});$Z in this&&(n[$Z]=this[$Z]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(Ymr(i)){let u={...i},l=Zmr(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(c9e)?.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=>rZ(`${d}:${e}`,rZ.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=Xmr(o.dotted_order),f=[];for(let m=0;m<d.length-1;m++){let[h,b]=d[m],g=i(b);f.push(h.toISOString().replace(/[-:]/g,"").replace(".","")+g)}let[p]=d[d.length-1];f.push(p.toISOString().replace(/[-:]/g,"").replace(".","")+a),l=f.join(".")}else l=void 0;return{...o,id:a,trace_id:s,parent_run_id:u,dotted_order:l,session_name:e}}async postRun(e=!0){try{let r=hZ();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){OZ("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=i9e();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=zZ.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 zZ(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(Gy,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var BZ=w(()=>{Yye()});var f9e=v((S3n,d9e)=>{"use strict";d9e.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 _9e=v((C3n,Ube)=>{"use strict";var rhr=/[\p{Lu}]/u,nhr=/[\p{Ll}]/u,p9e=/^[\p{Lu}](?![\p{Lu}])/gu,g9e=/([\p{Alpha}\p{N}_]|$)/u,y9e=/[_.\- ]+/,ohr=new RegExp("^"+y9e.source),m9e=new RegExp(y9e.source+g9e.source,"gu"),h9e=new RegExp("\\d+"+g9e.source,"gu"),ihr=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&rhr.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&nhr.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},ahr=(t,e)=>(p9e.lastIndex=0,t.replace(p9e,r=>e(r))),shr=(t,e)=>(m9e.lastIndex=0,h9e.lastIndex=0,t.replace(m9e,(r,n)=>e(n)).replace(h9e,r=>e(r))),b9e=(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=ihr(t,r,n)),t=t.replace(ohr,""),e.preserveConsecutiveUppercase?t=ahr(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),shr(t,n))};Ube.exports=b9e;Ube.exports.default=b9e});function w9e(t,e){return e?.[t]||(0,v9e.default)(t)}function x9e(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var v9e,uhr,S9e=w(()=>{v9e=F(f9e(),1),uhr=F(_9e(),1)});function C9e(t){return Array.isArray(t)?[...t]:{...t}}function lhr(t,e){let r=C9e(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]=C9e(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function qbe(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 kp,Q1=w(()=>{S9e();kp=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,qbe(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:x9e(Object.keys(r).length?lhr(n,r):n,w9e,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function O9e(){return Hbe===void 0&&(Hbe={library:"langchain-js",runtime:UZ()}),Hbe}function ct(t){try{return typeof process<"u"?process.env?.[t]:Vbe()?Deno?.env.get(t):void 0}catch{return}}var chr,dhr,fhr,Vbe,phr,UZ,Hbe,eN=w(()=>{chr=()=>typeof window<"u"&&typeof window.document<"u",dhr=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",fhr=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),Vbe=()=>typeof Deno<"u",phr=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Vbe(),UZ=()=>{let t;return chr()?t="browser":phr()?t="node":dhr()?t="webworker":fhr()?t="jsdom":Vbe()?t="deno":t="other",t}});function Kbe(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var Wbe,tN,P9e,vH=w(()=>{G1();Q1();eN();Wbe=class{};tN=class t extends Wbe{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,qbe(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:ct("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 kp.prototype.toJSON.call(this)}toJSONNotImplemented(){return kp.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:_s()}),Object.assign(this,e)}}return new r}},P9e=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function Jbe(t,e){if(t)return new Gy({...t,start_time:t._serialized_start_time??t.start_time,parent_run:Jbe(e),child_runs:t.child_runs.map(r=>Jbe(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:O9e()},tracingEnabled:!1})}function Gbe(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function Zk(t){return typeof t._addRunToRunMap=="function"}var mhr,rg,rN=w(()=>{BZ();vH();eN();mhr=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};rg=class extends tN{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?mhr(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}=Bbe(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=Jbe(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=Gbe(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Gbe(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=Gbe(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 I9e=v((L3n,A9e)=>{"use strict";var E9e=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,T9e=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function hhr(){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=E9e(),e.color.ansi16m=T9e(),e.bgColor.ansi256=E9e(10),e.bgColor.ansi16m=T9e(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(A9e,"exports",{enumerable:!0,get:hhr})});function Jf(t,e){return`${t.open}${e}${t.close}`}function ng(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function M9e(t){return typeof t=="string"?t.trim():t==null?t:ng(t,t.toString())}function GT(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 Zbe,$p,wH,R9e=w(()=>{Zbe=F(I9e(),1);rN();({color:$p}=Zbe.default),wH=class extends rg{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?Jf(Zbe.default.bold,s):s}).join(" > ");return Jf($p.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.green,"[chain/start]")} [${r}] Entering Chain run with input: ${ng(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.cyan,"[chain/end]")} [${r}] [${GT(e)}] Exiting Chain run with output: ${ng(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.red,"[chain/error]")} [${r}] [${GT(e)}] Chain run errored with error: ${ng(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(`${Jf($p.green,"[llm/start]")} [${r}] Entering LLM run with input: ${ng(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.cyan,"[llm/end]")} [${r}] [${GT(e)}] Exiting LLM run with output: ${ng(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.red,"[llm/error]")} [${r}] [${GT(e)}] LLM run errored with error: ${ng(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.green,"[tool/start]")} [${r}] Entering Tool run with input: "${M9e(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.cyan,"[tool/end]")} [${r}] [${GT(e)}] Exiting Tool run with output: "${M9e(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.red,"[tool/error]")} [${r}] [${GT(e)}] Tool run errored with error: ${ng(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${ng(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.cyan,"[retriever/end]")} [${r}] [${GT(e)}] Exiting Retriever run with output: ${ng(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Jf($p.red,"[retriever/error]")} [${r}] [${GT(e)}] Retriever run errored with error: ${ng(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Jf($p.blue,"[agent/action]")} [${n}] Agent selected action: ${ng(r.actions[r.actions.length-1],"[action]")}`)}}});function JT(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}var xH=w(()=>{});function ZT(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function N9e(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 nN,qZ=w(()=>{nN=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 Ybe(t,e=Yk){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 Yk(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 Xbe=w(()=>{});function Jy(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 j9e(t){return Jy(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function D9e(t){return Jy(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function L9e(t){if(Jy(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 Qbe(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 Xk({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 SH(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 e_e=w(()=>{});function og(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>Jy(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?CH(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Jy(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function F9e(t,e){return t==="error"||e==="error"?"error":"success"}function ghr(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 Fs(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]=Fs(r[n],o);else if(Array.isArray(r[n]))r[n]=CH(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 CH(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]=Fs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function k9e(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 CH(t,e);if(typeof t=="object"&&typeof e=="object")return Fs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
|
||
Left ${t}
|
||
Right ${e}`)}function $9e(t){return typeof t.role=="string"}function ig(t){return typeof t?._getType=="function"}function t_e(t){return ig(t)&&typeof t.concat=="function"}var zl,zp,ag=w(()=>{Q1();e_e();zl=class extends kp{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=ghr(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};zp=class extends zl{}});function z9e(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function B9e(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 MO,sg,Qk=w(()=>{ag();MO=class extends zl{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}}},sg=class t extends zp{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:og(this.content,e.content),additional_kwargs:Fs(this.additional_kwargs,e.additional_kwargs),response_metadata:Fs(this.response_metadata,e.response_metadata),artifact:k9e(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:F9e(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Di(t){return t._getType()==="ai"}function r_e(t){return t._getType()==="ai"}var En,yr,oN=w(()=>{Xbe();ag();Qk();En=class extends zl{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]=B9e(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}}};yr=class t extends zp{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=Yk(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:og(this.content,e.content),additional_kwargs:Fs(this.additional_kwargs,e.additional_kwargs),response_metadata:Fs(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=CH(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 ks,Zf,HZ=w(()=>{ag();ks=class t extends zl{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}}},Zf=class t extends zp{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:og(this.content,e.content),additional_kwargs:Fs(this.additional_kwargs,e.additional_kwargs),response_metadata:Fs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var Um,VZ=w(()=>{ag();Um=class t extends zp{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:og(this.content,e.content),additional_kwargs:Fs(this.additional_kwargs,e.additional_kwargs),response_metadata:Fs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var $s,Yf,OH=w(()=>{ag();$s=class extends zl{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},Yf=class t extends zp{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:og(this.content,e.content),additional_kwargs:Fs(this.additional_kwargs,e.additional_kwargs),response_metadata:Fs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var RO,of,WZ=w(()=>{ag();RO=class extends zl{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},of=class t extends zp{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:og(this.content,e.content),additional_kwargs:Fs(this.additional_kwargs,e.additional_kwargs),response_metadata:Fs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function bhr(t){return ZT(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 _hr(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function n_e(t){let e,r;if(_hr(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 $s(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new En(r);let i=n.map(bhr);return new En({...o,tool_calls:i})}else{if(e==="system")return new RO(r);if(e==="developer")return new RO({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new MO({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw JT(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 Zy(t){if(typeof t=="string")return new $s(t);if(ig(t))return t;if(Array.isArray(t)){let[e,r]=t;return n_e({type:e,content:r})}else if($9e(t)){let{role:e,...r}=t;return n_e({...r,type:e})}else return n_e(t)}function Xf(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 o_e(t){let e=t._getType();if(e==="human")return new Yf({...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 yr({...r})}else{if(e==="system")return new of({...t});if(e==="function")return new Um({...t});if(ks.isInstance(t))return new Zf({...t});throw new Error("Unknown message type.")}}var YT=w(()=>{xH();qZ();oN();ag();HZ();VZ();OH();WZ();Qk()});var KZ=w(()=>{mZ()});var i_e,a_e,s_e=w(()=>{KZ();eN();a_e=()=>{if(i_e===void 0){let t=ct("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};i_e=new Y1(t)}return i_e}});var e$,U9e=w(()=>{KZ();BZ();Bye();rN();s_e();e$=class t extends rg{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??cH(),this.replicas=i,this.exampleId=r,this.client=o??a_e();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 Gy({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return t8e(!0)}catch{return}}}});var q9e,iN,H9e,XT,PH=w(()=>{q9e=Symbol.for("ls:tracing_async_local_storage"),iN=Symbol.for("lc:context_variables"),H9e=t=>{globalThis[q9e]=t},XT=()=>globalThis[q9e]});function vhr(){let t="default"in GZ.default?GZ.default.default:GZ.default;return new t({autoStart:!0,concurrency:1})}function whr(){return typeof EH>"u"&&(EH=vhr()),EH}async function zs(t,e){if(e===!0){let r=XT();r!==void 0?await r.run(void 0,async()=>t()):await t()}else EH=whr(),EH.add(async()=>{let r=XT();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var GZ,EH,V9e=w(()=>{GZ=F(SZ(),1);PH();s_e()});var W9e=w(()=>{V9e()});var K9e,G9e=w(()=>{eN();K9e=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>ct(r)==="true")});function u_e(t){let e=XT();return e===void 0?void 0:e.getStore()?.[iN]?.[t]}var xhr,J9e,Z9e=w(()=>{BZ();PH();xhr=Symbol("lc:configure_hooks"),J9e=()=>u_e(xhr)||[]});function aN(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function TH(t){return"name"in t?t:tN.fromMethods(t)}var l_e,t$,c_e,JZ,d_e,f_e,ru,QT=w(()=>{G1();vH();R9e();YT();eN();U9e();W9e();G9e();rN();Z9e();l_e=class{setHandler(e){return this.setHandlers([e])}},t$=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=>zs(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=>zs(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)))}},c_e=class extends t${getChild(e){let r=new ru(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=>zs(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=>zs(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)))}},JZ=class extends t${async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>zs(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=>zs(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=>zs(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)))}},d_e=class extends t${getChild(e){let r=new ru(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=>zs(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=>zs(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=>zs(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=>zs(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)))}},f_e=class extends t${getChild(e){let r=new ru(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=>zs(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=>zs(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)))}},ru=class t extends l_e{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:_s();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return Zk(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),zs(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 JZ(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:_s();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return Zk(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),zs(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=Xf(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 JZ(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=_s(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return Zk(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),zs(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 d_e(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=_s(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return Zk(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),zs(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 f_e(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=_s(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return Zk(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),zs(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 c_e(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=>zs(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 tN{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:_s()}),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(TH)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(TH):r?.handlers,!1));let l=ct("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=e$.getTraceableRunTree()?.tracingEnabled||K9e(),d=c||(ct("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===wH.prototype.name)){let f=new wH;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new e$;u.addHandler(f,!0),u._parentRunId=e$.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of J9e()){let b=h&&ct(h)==="true"&&m,g,y=f!==void 0?u_e(f):void 0;y&&P9e(y)?g=y:b&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(x=>x.name===g.name)||u.addHandler(g,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var ZZ,Shr,Y9e,p_e,Yc,X9e=w(()=>{KZ();PH();QT();ZZ=class{getStore(){}run(e,r){return r()}enterWith(e){}},Shr=new ZZ,Y9e=Symbol.for("lc:child_config"),p_e=class{getInstance(){return XT()??Shr}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[Y9e]}runWithConfig(e,r,n){let o=ru._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 Gy({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[Y9e]:e}),a!==void 0&&a[iN]!==void 0&&(l===void 0&&(l={}),l[iN]=a[iN]),i.run(l,r)}initializeGlobalInstance(e){XT()===void 0&&H9e(e)}},Yc=new p_e});var sN=w(()=>{X9e();PH()});async function Bp(t){return ru._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function r$(...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(TH(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(TH(s),!0);e.callbacks=a}else e.callbacks=new ru(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 _n(t){let e=Yc.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))Chr.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 Ka(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=_n(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 Up(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 YZ,Chr,j_=w(()=>{QT();sN();YZ=25;Chr=new Set(["string","number","boolean"])});async function D_(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 m_e=w(()=>{});function h_e(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 fc(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]=fc(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function Q9e(t,e,r,n,...o){let i=new NO({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var af,NO,L_=w(()=>{j_();sN();m_e();af=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)}})}};NO=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)=>{Yc.runWithConfig(Up(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?Yc.runWithConfig(Up(this.config),this.signal?async()=>D_(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 eWe(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 tWe(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 Ohr(t){return t!==void 0&&t.message!==void 0}var Yy,AH,rWe,IH,nWe=w(()=>{qye();rN();L_();oN();Yy=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=KT({},r);return new AH({ops:r,state:n[n.length-1].newDocument})}},AH=class t extends Yy{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=KT(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=KT({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},rWe=t=>t.name==="log_stream_tracer";IH=class extends rg{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=af.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 Yy({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 Yy({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 eWe(e,this._schemaFormat)),await this.writer.write(new Yy({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 eWe(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await tWe(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 Yy({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new Yy({ops:[{op:"replace",path:"/final_output",value:await tWe(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?Ohr(n?.chunk)?a=n?.chunk:a=new yr({id:`run-${e.id}`,content:r}):a=r;let s=new Yy({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 MH,qp,eo,n$=w(()=>{MH="__run",qp=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}})}},eo=class t extends qp{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 XZ({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 oWe,QZ,iWe=w(()=>{rN();L_();oN();n$();oWe=t=>t.name==="event_stream_tracer",QZ=class extends rg{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=af.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 qp({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=XZ(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 yr({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 qp({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=XZ(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=XZ(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=XZ(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 aWe,eY,Phr,Ehr,qm,o$=w(()=>{aWe=F(X7(),1),eY=F(SZ(),1),Phr=[400,401,402,403,404,405,406,407,409],Ehr=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&&Phr.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},qm=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??Ehr;let r="default"in eY.default?eY.default.default:eY.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,aWe.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 RH,sWe=w(()=>{rN();RH=class extends rg{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 NH(t){return t?t.lc_runnable:!1}var tY,g_e=w(()=>{tY=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 y_e(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function Ahr(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
|
||
`;return e}function uWe(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
|
||
graph TD;
|
||
`:`graph TD;
|
||
`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,b]of Object.entries(t)){let g=b.name.split(":").pop()??"",x=Thr.some(O=>g.startsWith(O)&&g.endsWith(O))?`<p>${g}</p>`:g;Object.keys(b.metadata??{}).length&&(x+=`<hr/><small><em>${Object.entries(b.metadata??{}).map(([O,E])=>`${O} = ${E}`).join(`
|
||
`)}</em></small>`);let S=(m[h]??m[p]).replace("{0}",y_e(h)).replace("{1}",x);l+=` ${S}
|
||
`}}let c={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),b=m.filter((g,y)=>g===h[y]).join(":");c[b]||(c[b]=[]),c[b].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let b=m.split(":").pop();if(d.has(b))throw new Error(`Found duplicate subgraph '${b}' -- 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(b),l+=` subgraph ${b}
|
||
`}for(let b of p){let{source:g,target:y,data:x,conditional:S}=b,O="";if(x!==void 0){let E=x,P=E.split(" ");P.length>u&&(E=Array.from({length:Math.ceil(P.length/u)},(A,I)=>P.slice(I*u,(I+1)*u).join(" ")).join(" <br> ")),O=S?` -. ${E} .-> `:` -- ${E} --> `}else O=S?" -.-> ":" --> ";l+=` ${y_e(g)}${O}${y_e(y)};
|
||
`}for(let b in c)b.startsWith(`${m}:`)&&b!==m&&f(c[b],b);m&&!h&&(l+=` end
|
||
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=Ahr(i??{})),l}async function lWe(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 Thr,cWe=w(()=>{Thr=["*","_","`"]});function i$(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 a$(t){return t&&Object.assign(b_e,t),b_e}var E6n,T6n,eA,b_e,jH=w(()=>{E6n=Object.freeze({status:"aborted"});T6n=Symbol("zod_brand"),eA=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},b_e={}});function __e(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 fWe(t,e){return typeof e=="bigint"?e.toString():e}function pWe(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function s$(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function mWe(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 nY(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function rY(t){return typeof t=="string"?t:t?.message}function u$(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=rY(t.inst?._zod.def?.error?.(t))??rY(e?.error?.(t))??rY(r.customError?.(t))??rY(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}var v_e,Ihr,A6n,tA=w(()=>{v_e=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{},Ihr=pWe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});A6n={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 hWe,gWe,DH,w_e=w(()=>{jH();tA();hWe=(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,fWe,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},gWe=i$("$ZodError",hWe),DH=i$("$ZodError",hWe,{Parent:Error})});var Rhr,oY,Nhr,yWe,jhr,bWe,Dhr,_We,x_e=w(()=>{jH();w_e();tA();Rhr=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 eA;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>u$(u,i,a$())));throw v_e(s,o?.callee),s}return a.value},oY=Rhr(DH),Nhr=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=>u$(u,i,a$())));throw v_e(s,o?.callee),s}return a.value},yWe=Nhr(DH),jhr=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 eA;return i.issues.length?{success:!1,error:new(t??gWe)(i.issues.map(a=>u$(a,o,a$())))}:{success:!0,data:i.value}},bWe=jhr(DH),Dhr=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=>u$(a,o,a$())))}:{success:!0,data:i.value}},_We=Dhr(DH)});var Lhr,R6n,vWe=w(()=>{Lhr="(?:(?:\\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])))",R6n=new RegExp(`^${Lhr}$`)});var wWe=w(()=>{});var xWe=w(()=>{});var SWe,S_e=w(()=>{SWe={major:4,minor:0,patch:0}});var khr,CWe,OWe=w(()=>{jH();x_e();tA();S_e();tA();khr=i$("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=SWe;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=nY(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 eA;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=nY(i,d)))});else{if(i.issues.length===d)continue;u||(u=nY(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 eA;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=bWe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return _We(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),CWe=i$("$ZodNever",(t,e)=>{khr.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)})});var PWe=w(()=>{});function zhr(){return new LH}var Y6n,X6n,LH,F_,C_e=w(()=>{Y6n=Symbol("ZodOutput"),X6n=Symbol("ZodInput"),LH=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)}};F_=zhr()});function EWe(t,e){return new t({type:"never",...mWe(e)})}var TWe=w(()=>{tA()});var AWe=w(()=>{});function FH(t,e){if(t instanceof LH){let n=new iY(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 iY(e);return r.process(t),r.emit(t,e)}function Bl(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 Bl(o.element,r);case"object":{for(let i in o.shape)if(Bl(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(Bl(i,r))return!0;return!1}case"intersection":return Bl(o.left,r)||Bl(o.right,r);case"tuple":{for(let i of o.items)if(Bl(i,r))return!0;return!!(o.rest&&Bl(o.rest,r))}case"record":return Bl(o.keyType,r)||Bl(o.valueType,r);case"map":return Bl(o.keyType,r)||Bl(o.valueType,r);case"set":return Bl(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Bl(o.innerType,r);case"lazy":return Bl(o.getter(),r);case"default":return Bl(o.innerType,r);case"prefault":return Bl(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Bl(o.in,r)||Bl(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var iY,IWe=w(()=>{C_e();tA();iY=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??F_,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,s);let u=e._zod.toJSONSchema?.();if(u)s.schema=u;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=s.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:b,format:g,patterns:y,contentEncoding:x}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof b=="number"&&(m.maxLength=b),g&&(m.format=i[g]??g,m.format===""&&delete m.format),x&&(m.contentEncoding=x),y&&y.size>0){let S=[...y];S.length===1?m.pattern=S[0].source:S.length>1&&(s.schema.allOf=[...S.map(O=>({...this.target==="draft-7"?{type:"string"}:{},pattern:O.source}))])}break}case"number":{let m=p,{minimum:h,maximum:b,format:g,multipleOf:y,exclusiveMaximum:x,exclusiveMinimum:S}=e._zod.bag;typeof g=="string"&&g.includes("int")?m.type="integer":m.type="number",typeof S=="number"&&(m.exclusiveMinimum=S),typeof h=="number"&&(m.minimum=h,typeof S=="number"&&(S>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof x=="number"&&(m.exclusiveMaximum=x),typeof b=="number"&&(m.maximum=b,typeof x=="number"&&(x<=b?delete m.maximum:delete m.exclusiveMaximum)),typeof y=="number"&&(m.multipleOf=y);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:b}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof b=="number"&&(m.maxItems=b),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let y in h)m.properties[y]=this.process(h[y],{...d,path:[...d.path,"properties",y]});let b=new Set(Object.keys(h)),g=new Set([...b].filter(y=>{let x=o.shape[y]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));g.size>0&&(m.required=Array.from(g)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p;m.anyOf=o.options.map((h,b)=>this.process(h,{...d,path:[...d.path,"anyOf",b]}));break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),b=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),g=x=>"allOf"in x&&Object.keys(x).length===1,y=[...g(h)?h.allOf:[h],...g(b)?b.allOf:[b]];m.allOf=y;break}case"tuple":{let m=p;m.type="array";let h=o.items.map((y,x)=>this.process(y,{...d,path:[...d.path,"prefixItems",x]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){let y=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?m.items=y:m.additionalItems=y}o.rest&&(m.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:b,maximum:g}=e._zod.bag;typeof b=="number"&&(m.minItems=b),typeof g=="number"&&(m.maxItems=g);break}case"record":{let m=p;m.type="object",m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=__e(o.entries);h.every(b=>typeof b=="number")&&(m.type="number"),h.every(b=>typeof b=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let b of o.values)if(b===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof b=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(b))}else h.push(b);if(h.length!==0)if(h.length===1){let b=h[0];m.type=b===null?"null":typeof b,m.const=b}else h.every(b=>typeof b=="number")&&(m.type="number"),h.every(b=>typeof b=="string")&&(m.type="string"),h.every(b=>typeof b=="boolean")&&(m.type="string"),h.every(b=>b===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:b,maximum:g,mime:y}=e._zod.bag;b!==void 0&&(h.minLength=b),g!==void 0&&(h.maxLength=g),y?y.length===1?(h.contentMediaType=y[0],Object.assign(m,h)):m.anyOf=y.map(x=>({...h,contentMediaType:x})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),s.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),s.ref=m;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),this.io==="input"&&Bl(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(c[0])?.id,b=n.external.uri??(y=>y);if(h)return{ref:b(h)};let g=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=g,{defId:g,ref:`${b("__shared")}#/${d}/${g}`}}if(c[1]===o)return{ref:"#"};let p=`#/${d}/`,m=c[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},a=c=>{if(c[1].schema.$ref)return;let d=c[1],{ref:f,defId:p}=i(c);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
||
|
||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let d=c[1];if(e===c[0]){a(c);continue}if(n.external){let p=n.external.registry.get(c[0])?.id;if(e!==c[0]&&p){a(c);continue}}if(this.metadataRegistry.get(c[0])?.id){a(c);continue}if(d.cycle){a(c);continue}if(d.count>1&&n.reused==="ref"){a(c);continue}}let s=(c,d)=>{let f=this.seen.get(c),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){s(h,d);let b=this.seen.get(h).schema;b.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(b)):(Object.assign(p,b),Object.assign(p,m))}f.isParent||this.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(c)}Object.assign(u,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(l[d.defId]=d.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}});var MWe=w(()=>{});var aY=w(()=>{jH();x_e();w_e();OWe();wWe();S_e();tA();vWe();PWe();C_e();xWe();AWe();TWe();IWe();MWe()});var NWe,RWe,jWe,sY=w(()=>{NWe=Symbol("Let zodToJsonSchema decide on which parser to use"),RWe={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"},jWe=t=>typeof t=="string"?{...RWe,name:t}:{...RWe,...t}});var DWe,O_e=w(()=>{sY();DWe=t=>{let e=jWe(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 P_e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function to(t,e,r,n,o){t[e]=r,P_e(t,e,n,o)}var rA=w(()=>{});var Qf=w(()=>{aH();aH()});function LWe(){return{}}var E_e=w(()=>{});function FWe(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==re.ZodAny&&(r.items=br(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&to(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&to(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(to(r,"minItems",t.exactLength.value,t.exactLength.message,e),to(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var T_e=w(()=>{Qf();rA();nu()});function kWe(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?to(r,"minimum",n.value,n.message,e):to(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),to(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?to(r,"maximum",n.value,n.message,e):to(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),to(r,"maximum",n.value,n.message,e));break;case"multipleOf":to(r,"multipleOf",n.value,n.message,e);break}return r}var A_e=w(()=>{rA()});function $We(){return{type:"boolean"}}var I_e=w(()=>{});function uY(t,e){return br(t.type._def,e)}var lY=w(()=>{nu()});var zWe,M_e=w(()=>{nu();zWe=(t,e)=>br(t.innerType._def,e)});function R_e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>R_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 Bhr(t,e)}}var Bhr,N_e=w(()=>{rA();Bhr=(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":to(r,"minimum",n.value,n.message,e);break;case"max":to(r,"maximum",n.value,n.message,e);break}return r}});function BWe(t,e){return{...br(t.innerType._def,e),default:t.defaultValue()}}var j_e=w(()=>{nu()});function UWe(t,e){return e.effectStrategy==="input"?br(t.schema._def,e):{}}var D_e=w(()=>{nu()});function qWe(t){return{type:"string",enum:Array.from(t.values)}}var L_e=w(()=>{});function HWe(t,e){let r=[br(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),br(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(Uhr(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 Uhr,F_e=w(()=>{nu();Uhr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function VWe(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 k_e=w(()=>{});function cY(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":to(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":to(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":Qy(r,"email",n.message,e);break;case"format:idn-email":Qy(r,"idn-email",n.message,e);break;case"pattern:zod":ep(r,Xy.email,n.message,e);break}break;case"url":Qy(r,"uri",n.message,e);break;case"uuid":Qy(r,"uuid",n.message,e);break;case"regex":ep(r,n.regex,n.message,e);break;case"cuid":ep(r,Xy.cuid,n.message,e);break;case"cuid2":ep(r,Xy.cuid2,n.message,e);break;case"startsWith":ep(r,RegExp(`^${z_e(n.value,e)}`),n.message,e);break;case"endsWith":ep(r,RegExp(`${z_e(n.value,e)}$`),n.message,e);break;case"datetime":Qy(r,"date-time",n.message,e);break;case"date":Qy(r,"date",n.message,e);break;case"time":Qy(r,"time",n.message,e);break;case"duration":Qy(r,"duration",n.message,e);break;case"length":to(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),to(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{ep(r,RegExp(z_e(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Qy(r,"ipv4",n.message,e),n.version!=="v4"&&Qy(r,"ipv6",n.message,e);break}case"base64url":ep(r,Xy.base64url,n.message,e);break;case"jwt":ep(r,Xy.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&ep(r,Xy.ipv4Cidr,n.message,e),n.version!=="v4"&&ep(r,Xy.ipv6Cidr,n.message,e);break}case"emoji":ep(r,Xy.emoji(),n.message,e);break;case"ulid":{ep(r,Xy.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Qy(r,"binary",n.message,e);break}case"contentEncoding:base64":{to(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{ep(r,Xy.base64,n.message,e);break}}break}case"nanoid":ep(r,Xy.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function z_e(t,e){return e.patternStrategy==="escape"?Hhr(t):t}function Hhr(t){let e="";for(let r=0;r<t.length;r++)qhr.has(t[r])||(e+="\\"),e+=t[r];return e}function Qy(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}}})):to(t,"format",e,r,n)}function ep(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:WWe(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):to(t,"pattern",WWe(e,n),r,n)}function WWe(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 $_e,Xy,qhr,dY=w(()=>{rA();Xy={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:()=>($_e===void 0&&($_e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$_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])$/,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-_]*$/};qhr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function fY(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]:br(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:br(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}=cY(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}=uY(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var pY=w(()=>{Qf();nu();dY();lY()});function KWe(t,e){if(e.mapStrategy==="record")return fY(t,e);let r=br(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=br(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 B_e=w(()=>{nu();pY()});function GWe(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 U_e=w(()=>{});function JWe(){return{not:{}}}var q_e=w(()=>{});function ZWe(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var H_e=w(()=>{});function XWe(t,e){if(e.target==="openApi3")return YWe(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in kH&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=kH[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 YWe(t,e)}var kH,YWe,mY=w(()=>{nu();kH={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};YWe=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>br(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 QWe(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:kH[t.innerType._def.typeName],nullable:!0}:{type:[kH[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=br(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=br(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var V_e=w(()=>{nu();mY()});function eKe(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",P_e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?to(r,"minimum",n.value,n.message,e):to(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),to(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?to(r,"maximum",n.value,n.message,e):to(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),to(r,"maximum",n.value,n.message,e));break;case"multipleOf":to(r,"multipleOf",n.value,n.message,e);break}return r}var W_e=w(()=>{rA()});function Vhr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":br(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":br(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function tKe(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 jp&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=br(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:Vhr(t,e)};return n.required.length||delete n.required,n}var K_e=w(()=>{Qf();nu()});var rKe,G_e=w(()=>{nu();rKe=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return br(t.innerType._def,e);let r=br(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var nKe,J_e=w(()=>{nu();nKe=(t,e)=>{if(e.pipeStrategy==="input")return br(t.in._def,e);if(e.pipeStrategy==="output")return br(t.out._def,e);let r=br(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=br(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function oKe(t,e){return br(t.type._def,e)}var Z_e=w(()=>{nu()});function iKe(t,e){let n={type:"array",uniqueItems:!0,items:br(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&to(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&to(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Y_e=w(()=>{rA();nu()});function aKe(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>br(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:br(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>br(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var X_e=w(()=>{nu()});function sKe(){return{not:{}}}var Q_e=w(()=>{});function uKe(){return{}}var eve=w(()=>{});var lKe,tve=w(()=>{nu();lKe=(t,e)=>br(t.innerType._def,e)});function br(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==NWe)return a}if(n&&!r){let a=Whr(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=Ghr(t,t.typeName,e);return i&&Jhr(t,e,i),o.jsonSchema=i,i}var Whr,Khr,Ghr,Jhr,nu=w(()=>{Qf();E_e();T_e();A_e();I_e();lY();M_e();N_e();j_e();D_e();L_e();F_e();k_e();B_e();U_e();q_e();H_e();V_e();W_e();K_e();G_e();J_e();Z_e();pY();Y_e();dY();X_e();Q_e();mY();eve();tve();sY();Whr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Khr(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}},Khr=(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("/")},Ghr=(t,e,r)=>{switch(e){case re.ZodString:return cY(t,r);case re.ZodNumber:return eKe(t,r);case re.ZodObject:return tKe(t,r);case re.ZodBigInt:return kWe(t,r);case re.ZodBoolean:return $We();case re.ZodDate:return R_e(t,r);case re.ZodUndefined:return sKe();case re.ZodNull:return ZWe(r);case re.ZodArray:return FWe(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return XWe(t,r);case re.ZodIntersection:return HWe(t,r);case re.ZodTuple:return aKe(t,r);case re.ZodRecord:return fY(t,r);case re.ZodLiteral:return VWe(t,r);case re.ZodEnum:return qWe(t);case re.ZodNativeEnum:return GWe(t);case re.ZodNullable:return QWe(t,r);case re.ZodOptional:return rKe(t,r);case re.ZodMap:return KWe(t,r);case re.ZodSet:return iKe(t,r);case re.ZodLazy:return br(t.getter()._def,r);case re.ZodPromise:return oKe(t,r);case re.ZodNaN:case re.ZodNever:return JWe();case re.ZodEffects:return UWe(t,r);case re.ZodAny:return LWe();case re.ZodUnknown:return uKe();case re.ZodDefault:return BWe(t,r);case re.ZodBranded:return uY(t,r);case re.ZodReadonly:return lKe(t,r);case re.ZodCatch:return zWe(t,r);case re.ZodPipeline:return nKe(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(n=>{})(e)}},Jhr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Ga,rve=w(()=>{nu();O_e();Ga=(t,e)=>{let r=DWe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:br(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=br(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 ug=w(()=>{sY();O_e();rA();nu();E_e();T_e();A_e();I_e();lY();M_e();N_e();j_e();D_e();L_e();F_e();k_e();B_e();U_e();q_e();H_e();V_e();W_e();K_e();G_e();J_e();Z_e();tve();pY();Y_e();dY();X_e();Q_e();mY();eve();rve();rve()});function jO(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(!jO(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(!jO(t[a],e[a]))return!1;return!0}return t===e}var nve=w(()=>{});function Hm(t){return encodeURI(Zhr(t))}function Zhr(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var hY=w(()=>{});function DO(t,e=Object.create(null),r=egr,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:DO(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(Qhr[i])continue;let a=`${n}/${Hm(i)}`,s=t[i];if(Array.isArray(s)){if(Yhr[i]){let u=s.length;for(let l=0;l<u;l++)DO(s[l],e,r,`${a}/${l}`)}}else if(Xhr[i])for(let u in s)DO(s[u],e,r,`${a}/${Hm(u)}`);else DO(s,e,r,a)}return e}var Yhr,Xhr,Qhr,egr,gY=w(()=>{hY();Yhr={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Xhr={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Qhr={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},egr=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 Hp(t){return t.test.bind(t)}function wgr(t){return t%4===0&&(t%100!==0||t%400===0)}function cKe(t){let e=t.match(tgr);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&wgr(r)?29:rgr[n])}function dKe(t,e){let r=e.match(ngr);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 Sgr(t){let e=t.split(xgr);return e.length==2&&cKe(e[0])&&dKe(!0,e[1])}function Pgr(t){return Cgr.test(t)&&Ogr.test(t)}function Tgr(t){if(Egr.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var tgr,rgr,ngr,ogr,igr,agr,sgr,ugr,lgr,cgr,dgr,fgr,pgr,mgr,hgr,ggr,ygr,bgr,_gr,vgr,ove,xgr,Cgr,Ogr,Egr,ive=w(()=>{tgr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,rgr=[0,31,28,31,30,31,30,31,31,30,31,30,31],ngr=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ogr=/^(?=.{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,igr=/^(?:[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,agr=/^(?:(?:[^\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,sgr=/^(?:(?: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,ugr=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,lgr=/^(?:\/(?:[^~/]|~0|~1)*)*$/,cgr=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,dgr=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,fgr=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,pgr=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,mgr=/^\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,hgr=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,ggr=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))},ygr=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,bgr=/^((([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,_gr=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));vgr={date:cKe,time:dKe.bind(void 0,!1),"date-time":Sgr,duration:_gr,uri:Pgr,"uri-reference":Hp(igr),"uri-template":Hp(agr),url:Hp(sgr),email:ggr,hostname:Hp(ogr),ipv4:Hp(ygr),ipv6:Hp(bgr),regex:Tgr,uuid:Hp(ugr),"json-pointer":Hp(lgr),"json-pointer-uri-fragment":Hp(cgr),"relative-json-pointer":Hp(dgr)},ove={...vgr,date:Hp(fgr),time:Hp(pgr),"date-time":Hp(mgr),"uri-reference":Hp(hgr)};xgr=/t|\s/i;Cgr=/\/|:/,Ogr=/^(?:[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;Egr=/[^\\]\\Z/});var fKe,pKe=w(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(fKe||(fKe={}))});function mKe(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 ave=w(()=>{});function da(t,e,r="2019-09",n=DO(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:b,required:g,not:y,anyOf:x,allOf:S,oneOf:O,if:E,then:P,else:A,format:I,properties:R,patternProperties:N,additionalProperties:j,unevaluatedProperties:$,minProperties:k,maxProperties:H,propertyNames:V,dependentRequired:Q,dependentSchemas:Z,dependencies:D,prefixItems:z,items:B,additionalItems:K,unevaluatedItems:q,contains:te,minContains:U,maxContains:W,minItems:Y,maxItems:se,uniqueItems:Te,minimum:de,maximum:Ue,exclusiveMinimum:Ke,exclusiveMaximum:at,multipleOf:hr,minLength:Nn,maxLength:De,pattern:_t,__absolute_ref__:Oe,__absolute_recursive_ref__:$e}=e,ce=[];if(p===!0&&i===null&&(i=e),f==="#"){let Ze=i===null?n[$e]:i,Ne=`${s}/$recursiveRef`,ue=da(t,i===null?e:i,r,n,o,Ze,a,Ne,u);ue.valid||ce.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Ne,error:"A subschema had errors."},...ue.errors)}if(d!==void 0){let Ne=n[Oe||d];if(Ne===void 0){let Pe=`Unresolved $ref "${d}".`;throw Oe&&Oe!==d&&(Pe+=` Absolute URI "${Oe}".`),Pe+=`
|
||
Known schemas:
|
||
- ${Object.keys(n).join(`
|
||
- `)}`,new Error(Pe)}let ue=`${s}/$ref`,pe=da(t,Ne,r,n,o,i,a,ue,u);if(pe.valid||ce.push({instanceLocation:a,keyword:"$ref",keywordLocation:ue,error:"A subschema had errors."},...pe.errors),r==="4"||r==="7")return{valid:ce.length===0,errors:ce}}if(Array.isArray(m)){let Ze=m.length,Ne=!1;for(let ue=0;ue<Ze;ue++)if(c===m[ue]||m[ue]==="integer"&&c==="number"&&t%1===0&&t===t){Ne=!0;break}Ne||ce.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(c!=="number"||t%1||t!==t)&&ce.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&ce.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?jO(t,h)||ce.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&ce.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),b!==void 0&&(c==="object"||c==="array"?b.some(Ze=>jO(t,Ze))||ce.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`}):b.some(Ze=>t===Ze)||ce.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`})),y!==void 0){let Ze=`${s}/not`;da(t,y,r,n,o,i,a,Ze).valid&&ce.push({instanceLocation:a,keyword:"not",keywordLocation:Ze,error:'Instance matched "not" schema.'})}let qt=[];if(x!==void 0){let Ze=`${s}/anyOf`,Ne=ce.length,ue=!1;for(let pe=0;pe<x.length;pe++){let Pe=x[pe],Ae=Object.create(u),ot=da(t,Pe,r,n,o,p===!0?i:null,a,`${Ze}/${pe}`,Ae);ce.push(...ot.errors),ue=ue||ot.valid,ot.valid&&qt.push(Ae)}ue?ce.length=Ne:ce.splice(Ne,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:Ze,error:"Instance does not match any subschemas."})}if(S!==void 0){let Ze=`${s}/allOf`,Ne=ce.length,ue=!0;for(let pe=0;pe<S.length;pe++){let Pe=S[pe],Ae=Object.create(u),ot=da(t,Pe,r,n,o,p===!0?i:null,a,`${Ze}/${pe}`,Ae);ce.push(...ot.errors),ue=ue&&ot.valid,ot.valid&&qt.push(Ae)}ue?ce.length=Ne:ce.splice(Ne,0,{instanceLocation:a,keyword:"allOf",keywordLocation:Ze,error:"Instance does not match every subschema."})}if(O!==void 0){let Ze=`${s}/oneOf`,Ne=ce.length,ue=O.filter((pe,Pe)=>{let Ae=Object.create(u),ot=da(t,pe,r,n,o,p===!0?i:null,a,`${Ze}/${Pe}`,Ae);return ce.push(...ot.errors),ot.valid&&qt.push(Ae),ot.valid}).length;ue===1?ce.length=Ne:ce.splice(Ne,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:Ze,error:`Instance does not match exactly one subschema (${ue} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...qt),E!==void 0){let Ze=`${s}/if`;if(da(t,E,r,n,o,i,a,Ze,u).valid){if(P!==void 0){let ue=da(t,P,r,n,o,i,a,`${s}/then`,u);ue.valid||ce.push({instanceLocation:a,keyword:"if",keywordLocation:Ze,error:'Instance does not match "then" schema.'},...ue.errors)}}else if(A!==void 0){let ue=da(t,A,r,n,o,i,a,`${s}/else`,u);ue.valid||ce.push({instanceLocation:a,keyword:"if",keywordLocation:Ze,error:'Instance does not match "else" schema.'},...ue.errors)}}if(c==="object"){if(g!==void 0)for(let pe of g)pe in t||ce.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${pe}".`});let Ze=Object.keys(t);if(k!==void 0&&Ze.length<k&&ce.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${k} properties.`}),H!==void 0&&Ze.length>H&&ce.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${H} properties.`}),V!==void 0){let pe=`${s}/propertyNames`;for(let Pe in t){let Ae=`${a}/${Hm(Pe)}`,ot=da(Pe,V,r,n,o,i,Ae,pe);ot.valid||ce.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:pe,error:`Property name "${Pe}" does not match schema.`},...ot.errors)}}if(Q!==void 0){let pe=`${s}/dependantRequired`;for(let Pe in Q)if(Pe in t){let Ae=Q[Pe];for(let ot of Ae)ot in t||ce.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:pe,error:`Instance has "${Pe}" but does not have "${ot}".`})}}if(Z!==void 0)for(let pe in Z){let Pe=`${s}/dependentSchemas`;if(pe in t){let Ae=da(t,Z[pe],r,n,o,i,a,`${Pe}/${Hm(pe)}`,u);Ae.valid||ce.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:Pe,error:`Instance has "${pe}" but does not match dependant schema.`},...Ae.errors)}}if(D!==void 0){let pe=`${s}/dependencies`;for(let Pe in D)if(Pe in t){let Ae=D[Pe];if(Array.isArray(Ae))for(let ot of Ae)ot in t||ce.push({instanceLocation:a,keyword:"dependencies",keywordLocation:pe,error:`Instance has "${Pe}" but does not have "${ot}".`});else{let ot=da(t,Ae,r,n,o,i,a,`${pe}/${Hm(Pe)}`);ot.valid||ce.push({instanceLocation:a,keyword:"dependencies",keywordLocation:pe,error:`Instance has "${Pe}" but does not match dependant schema.`},...ot.errors)}}}let Ne=Object.create(null),ue=!1;if(R!==void 0){let pe=`${s}/properties`;for(let Pe in R){if(!(Pe in t))continue;let Ae=`${a}/${Hm(Pe)}`,ot=da(t[Pe],R[Pe],r,n,o,i,Ae,`${pe}/${Hm(Pe)}`);if(ot.valid)u[Pe]=Ne[Pe]=!0;else if(ue=o,ce.push({instanceLocation:a,keyword:"properties",keywordLocation:pe,error:`Property "${Pe}" does not match schema.`},...ot.errors),ue)break}}if(!ue&&N!==void 0){let pe=`${s}/patternProperties`;for(let Pe in N){let Ae=new RegExp(Pe,"u"),ot=N[Pe];for(let Nr in t){if(!Ae.test(Nr))continue;let ua=`${a}/${Hm(Nr)}`,Va=da(t[Nr],ot,r,n,o,i,ua,`${pe}/${Hm(Pe)}`);Va.valid?u[Nr]=Ne[Nr]=!0:(ue=o,ce.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:pe,error:`Property "${Nr}" matches pattern "${Pe}" but does not match associated schema.`},...Va.errors))}}}if(!ue&&j!==void 0){let pe=`${s}/additionalProperties`;for(let Pe in t){if(Ne[Pe])continue;let Ae=`${a}/${Hm(Pe)}`,ot=da(t[Pe],j,r,n,o,i,Ae,pe);ot.valid?u[Pe]=!0:(ue=o,ce.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:pe,error:`Property "${Pe}" does not match additional properties schema.`},...ot.errors))}}else if(!ue&&$!==void 0){let pe=`${s}/unevaluatedProperties`;for(let Pe in t)if(!u[Pe]){let Ae=`${a}/${Hm(Pe)}`,ot=da(t[Pe],$,r,n,o,i,Ae,pe);ot.valid?u[Pe]=!0:ce.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:pe,error:`Property "${Pe}" does not match unevaluated properties schema.`},...ot.errors)}}}else if(c==="array"){se!==void 0&&t.length>se&&ce.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${se}).`}),Y!==void 0&&t.length<Y&&ce.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${Y}).`});let Ze=t.length,Ne=0,ue=!1;if(z!==void 0){let pe=`${s}/prefixItems`,Pe=Math.min(z.length,Ze);for(;Ne<Pe;Ne++){let Ae=da(t[Ne],z[Ne],r,n,o,i,`${a}/${Ne}`,`${pe}/${Ne}`);if(u[Ne]=!0,!Ae.valid&&(ue=o,ce.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:pe,error:"Items did not match schema."},...Ae.errors),ue))break}}if(B!==void 0){let pe=`${s}/items`;if(Array.isArray(B)){let Pe=Math.min(B.length,Ze);for(;Ne<Pe;Ne++){let Ae=da(t[Ne],B[Ne],r,n,o,i,`${a}/${Ne}`,`${pe}/${Ne}`);if(u[Ne]=!0,!Ae.valid&&(ue=o,ce.push({instanceLocation:a,keyword:"items",keywordLocation:pe,error:"Items did not match schema."},...Ae.errors),ue))break}}else for(;Ne<Ze;Ne++){let Pe=da(t[Ne],B,r,n,o,i,`${a}/${Ne}`,pe);if(u[Ne]=!0,!Pe.valid&&(ue=o,ce.push({instanceLocation:a,keyword:"items",keywordLocation:pe,error:"Items did not match schema."},...Pe.errors),ue))break}if(!ue&&K!==void 0){let Pe=`${s}/additionalItems`;for(;Ne<Ze;Ne++){let Ae=da(t[Ne],K,r,n,o,i,`${a}/${Ne}`,Pe);u[Ne]=!0,Ae.valid||(ue=o,ce.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:Pe,error:"Items did not match additional items schema."},...Ae.errors))}}}if(te!==void 0)if(Ze===0&&U===void 0)ce.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(U!==void 0&&Ze<U)ce.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${Ze}) than minContains (${U}).`});else{let pe=`${s}/contains`,Pe=ce.length,Ae=0;for(let ot=0;ot<Ze;ot++){let Nr=da(t[ot],te,r,n,o,i,`${a}/${ot}`,pe);Nr.valid?(u[ot]=!0,Ae++):ce.push(...Nr.errors)}Ae>=(U||0)&&(ce.length=Pe),U===void 0&&W===void 0&&Ae===0?ce.splice(Pe,0,{instanceLocation:a,keyword:"contains",keywordLocation:pe,error:"Array does not contain item matching schema."}):U!==void 0&&Ae<U?ce.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${U} items matching schema. Only ${Ae} items were found.`}):W!==void 0&&Ae>W&&ce.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${W} items matching schema. ${Ae} items were found.`})}if(!ue&&q!==void 0){let pe=`${s}/unevaluatedItems`;for(Ne;Ne<Ze;Ne++){if(u[Ne])continue;let Pe=da(t[Ne],q,r,n,o,i,`${a}/${Ne}`,pe);u[Ne]=!0,Pe.valid||ce.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:pe,error:"Items did not match unevaluated items schema."},...Pe.errors)}}if(Te)for(let pe=0;pe<Ze;pe++){let Pe=t[pe],Ae=typeof Pe=="object"&&Pe!==null;for(let ot=0;ot<Ze;ot++){if(pe===ot)continue;let Nr=t[ot];(Pe===Nr||Ae&&(typeof Nr=="object"&&Nr!==null)&&jO(Pe,Nr))&&(ce.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${pe} and ${ot}.`}),pe=Number.MAX_SAFE_INTEGER,ot=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(de!==void 0&&(Ke===!0&&t<=de||t<de)&&ce.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${Ke?"or equal to ":""} ${de}.`}),Ue!==void 0&&(at===!0&&t>=Ue||t>Ue)&&ce.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${at?"or equal to ":""} ${Ue}.`})):(de!==void 0&&t<de&&ce.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${de}.`}),Ue!==void 0&&t>Ue&&ce.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Ue}.`}),Ke!==void 0&&t<=Ke&&ce.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${Ke}.`}),at!==void 0&&t>=at&&ce.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${at}.`})),hr!==void 0){let Ze=t%hr;Math.abs(0-Ze)>=11920929e-14&&Math.abs(hr-Ze)>=11920929e-14&&ce.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${hr}.`})}}else if(c==="string"){let Ze=Nn===void 0&&De===void 0?0:mKe(t);Nn!==void 0&&Ze<Nn&&ce.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${Ze} < ${Nn}).`}),De!==void 0&&Ze>De&&ce.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${Ze} > ${De}).`}),_t!==void 0&&!new RegExp(_t,"u").test(t)&&ce.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&ove[I]&&!ove[I](t)&&ce.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:ce.length===0,errors:ce}}var sve=w(()=>{nve();gY();ive();hY();ave()});var hKe=w(()=>{gY();sve()});var $H=w(()=>{nve();gY();ive();hY();pKe();ave();sve();hKe()});function Vp(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 Vm(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 k_(t){return Vp(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),Vm(t)}function Wm(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(Vp(t)||Vm(t))}async function gKe(t,e){if(Vp(t))try{return{success:!0,data:await yWe(t,e)}}catch(r){return{success:!1,error:r}}if(Vm(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function f$(t,e){if(Vp(t))return oY(t,e);if(Vm(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function nA(t){if(Vp(t))return F_.get(t)?.description;if(Vm(t)||"description"in t&&typeof t.description=="string")return t.description}function bY(t){return Wm(t)?Vm(t)?t._def.typeName==="ZodString":Vp(t)?t._zod.def.type==="string":!1:!1}function d$(t){return Vp(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 yKe(t){return Vp(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 yY(t,e=!1){if(Vm(t))return t.strict();if(d$(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(d$(a)){let u=yY(a,e);r[i]=u}else if(yKe(a)){let u=a._zod.def.element;d$(u)&&(u=yY(u,e)),r[i]=s$(a,{...a._zod.def,element:u})}else r[i]=a;let s=F_.get(a);s&&F_.add(r[i],s)}let n=s$(t,{...t._zod.def,shape:r,catchall:EWe(CWe)}),o=F_.get(t);return o&&F_.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Agr(t){return Vm(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function Igr(t){return Vp(t)&&t._zod.def.type==="pipe"}function c$(t,e=!1){if(Vm(t))return Agr(t)?c$(t._def.schema,e):t;if(Vp(t)){let r=t;if(Igr(t)&&(r=c$(t._zod.def.in,e)),e){if(d$(r)){let o=r._zod.def.shape;for(let[i,a]of Object.entries(r._zod.def.shape))o[i]=c$(a,e);r=s$(r,{...r._zod.def,shape:o})}else if(yKe(r)){let o=c$(r._zod.def.element,e);r=s$(r,{...r._zod.def,element:o})}}let n=F_.get(t);return n&&F_.add(r,n),r}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}var LO=w(()=>{aY()});function Wp(t){if(Vp(t)){let e=c$(t,!0);if(d$(e)){let r=yY(e,!0);return FH(r)}else return FH(t)}return Vm(t)?Ga(t):t}function zH(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>zH(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>zH(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=DO(t);return r[e]?zH(r[e]):!1}return!1}var uN=w(()=>{aY();ug();$H();LO();$H()});function Mgr(t,e){if(t!==void 0&&!WT(t))return t;if(NH(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 Rgr(t){return NH(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Wp(t.data.schema),title:t.data.name}}}function bKe(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 _Ke(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 BH,vKe=w(()=>{G1();g_e();cWe();uN();BH=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]=WT(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...Rgr(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??_s(),i={id:o,data:e,name:Mgr(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 bKe(this)}lastNode(){return _Ke(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(WT)&&(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&&bKe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&_Ke(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 WT(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 uWe(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 lWe(r,{backgroundColor:e?.backgroundColor})}}});function wKe(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 af.fromReadableStream(r)}var xKe=w(()=>{L_()});function uve(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function _Y(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*lve(t,e){for(;;){let{value:r,done:n}=Yc.runWithConfig(Up(t),e.next.bind(e),!0);if(n)break;yield r}}async function*vY(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Yc.runWithConfig(Up(t),r.next.bind(e),!0);if(o)break;yield n}}var SKe,CKe=w(()=>{sN();j_();SKe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function Ul(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function Ngr(t){if(nZ(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function FO(t){if(typeof t=="function")return new tp({func:t});if(jn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=FO(n);return new oA({steps:e})}else throw new Error(`Expected a Runnable, function or object.
|
||
Instead got an unsupported type.`)}function jgr(t,e){let r=e.name??t.getName(),n=e.description??nA(e.schema);return bY(e.schema)?new qH({name:r,description:n,schema:rn.object({input:rn.string()}).transform(o=>o.input),bound:t}):new qH({name:r,description:n,schema:e.schema,bound:t})}var cve,jn,$_,wY,UH,Pi,oA,dve,tp,xY,p$,SY,qH,sf=w(()=>{J7();cve=F(X7(),1);G1();Bye();nWe();iWe();Q1();L_();m_e();j_();o$();sWe();g_e();sN();vKe();xKe();CKe();qZ();LO();jn=class extends kp{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 $_({bound:this,kwargs:e,config:{}})}map(){return new wY({bound:this})}withRetry(e){return new UH({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new $_({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new xY({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(_n);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)=>_n(i===0?e:n))}return Array.from({length:r},()=>_n(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new qm({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=_n(r),o=new NO({generator:this._streamIterator(e,n),config:n});return await o.setup,af.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=_n(e):r=_n({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=_n(n),a=await(await Bp(o))?.handleChainStart(this.toJSON(),Ul(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 D_(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(Ul(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Bp)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Ul(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 D_(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(Ul(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=_n(n),l=await Bp(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=fc(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await Q9e(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(oWe),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(rWe);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let b of m)if(yield b,s)if(a===void 0)a=b;else try{a=fc(a,b)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ul(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:Ul(o,"input")})}getGraph(e){let r=new BH,n=r.addNode({name:`${this.getName()}Input`,schema:rn.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:rn.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new Pi({first:this,last:FO(e)})}pick(e){return this.pipe(new SY(e))}assign(e){return this.pipe(new p$(new oA({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=fc(n,o);yield*this._streamIterator(n,_n(r))}async*streamLog(e,r,n){let o=new IH({...n,autoClose:!1,_schemaFormat:"original"}),i=_n(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 Yy({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"?wKe(o):af.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new QZ({...n,autoClose:!1}),i=_n(r),a=i.runId??_s();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[o];else if(Array.isArray(s))i.callbacks=s.concat(o);else{let m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){let m,h=null;try{r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,h=()=>{u.abort()},r.signal.addEventListener("abort",h,{once:!0})):m=u.signal;let b=await l.stream(e,{...i,signal:m}),g=o.tapOutputIterable(a,b);for await(let y of g)if(u.signal.aborted)break}finally{await o.finish(),m&&h&&m.removeEventListener("abort",h)}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=_n(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new IH({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new tY({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=AH.fromRunLogPatch(m),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let y={...o.state},x={run_id:y.id,event:`on_${y.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(x,y.type)&&(yield x)}let h=m.ops.filter(y=>y.path.startsWith("/logs/")).map(y=>y.path.split("/")[2]),b=[...new Set(h)];for(let y of b){let x,S={},O=o.state.logs[y];if(O.end_time===void 0?O.streamed_output.length>0?x="stream":x="start":x="end",x==="start")O.inputs!==void 0&&(S.input=O.inputs);else if(x==="end")O.inputs!==void 0&&(S.input=O.inputs),S.output=O.final_output;else if(x==="stream"){let E=O.streamed_output.length;if(E!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${E} instead. Encountered in: "${O.name}"`);S={chunk:O.streamed_output[0]},O.streamed_output=[]}yield{event:`on_${O.type}_${x}`,name:O.name,run_id:O.id,tags:O.tags,metadata:O.metadata,data:S}}let{state:g}=o;if(g.streamed_output.length>0){let y=g.streamed_output.length;if(y!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${y} instead. Encountered in: "${g.name}"`);let x={chunk:g.streamed_output[0]};g.streamed_output=[];let S={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:x};d.includeEvent(S,g.type)&&(yield S)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return NH(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new $_({bound:this,config:{},configFactories:[o=>({callbacks:[new RH({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return jgr(this,e)}},$_=class t extends jn{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=r$(this.config,...e);return r$(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 UH({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(_n(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(_n(i),this.kwargs))):await this._mergeConfig(_n(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(_n(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(_n(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(_n(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(_n(r),o.kwargs),version:r.version},n)};return af.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&jn.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 RH({config:o,onStart:e,onEnd:r,onError:n})]})]})}},wY=class t extends jn{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,Ka(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},UH=class extends $_{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 Ka(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,cve.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,cve.default)(async a=>{let s=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>e[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],m=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[m.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,r,n){return this._batchWithConfig(this._batch.bind(this),e,r,n)}},Pi=class t extends jn{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=_n(r),i=await(await Bp(n))?.handleChainStart(this.toJSON(),Ul(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,Ka(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await D_(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,Ka(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(Ul(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(Bp)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Ul(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 Ka(o[f],{callbacks:p})}),n);s=await D_(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(Ul(s,"output")))),s}async*_streamIterator(e,r){let n=await Bp(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),Ul(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(),Ka(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,Ka(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=fc(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(Ul(l,"output"))}getGraph(e){let r=new BH,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:FO(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&jn.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:FO(e),middle:r.slice(0,-1).map(FO),last:FO(r[r.length-1])})}},oA=class t extends jn{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]=FO(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=_n(r),i=await(await Bp(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,Ka(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await D_(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=h_e(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],Ka(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 D_(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=_n(r),i=new NO({generator:this.transform(n(),o),config:o});return await i.setup,af.fromAsyncGenerator(i)}},dve=class t extends jn{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}),!nZ(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 Bp(n),i=this.func(Ka(n,{callbacks:o}),e);return D_(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(_Y(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(SKe(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 jn{static lc_name(){return"RunnableLambda"}constructor(e){if(nZ(e.func))return dve.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}),Ngr(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=Ka(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??YZ)-1});Yc.runWithConfig(Up(a),async()=>{try{let s=await this.func(e,{...a});if(s&&jn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??YZ)-1})}else if(_Y(s)){let u;for await(let l of vY(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=fc(u,l)}catch{u=l}s=u}else if(uve(s)){let u;for(let l of lve(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=fc(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=fc(o,s)}catch{o=s}let i=Ka(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??YZ)-1}),a=await new Promise((s,u)=>{Yc.runWithConfig(Up(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&jn.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(_Y(a))for await(let s of vY(i,a))n?.signal?.throwIfAborted(),yield s;else if(uve(a))for(let s of lve(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=_n(r),i=new NO({generator:this.transform(n(),o),config:o});return await i.setup,af.fromAsyncGenerator(i)}},xY=class extends jn{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=_n(r),o=await Bp(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Ul(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Ka(a,{callbacks:s?.getChild()});return await Yc.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(Ul(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=_n(r),o=await Bp(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Ul(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Ka(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=vY(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:fc(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(Ul(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=>Bp(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Ul(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)=>Ka(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(Ul(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.")}};p$=class extends jn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof oA&&(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]=h_e(e),s=this.mapper.transform(a,Ka(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=_n(r),i=new NO({generator:this.transform(n(),o),config:o});return await i.setup,af.fromAsyncGenerator(i)}},SY=class extends jn{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=_n(r),i=new NO({generator:this.transform(n(),o),config:o});return await i.setup,af.fromAsyncGenerator(i)}},qH=class extends $_{constructor(e){let r=Pi.from([tp.from(async n=>{let o;if(ZT(n))try{o=await f$(this.schema,n.args)}catch{throw new nN("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 Eo,CY=w(()=>{L_();sf();j_();Eo=class extends jn{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=_n(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=_n(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=fc(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new p$(new oA({steps:e}))}}});var OKe=w(()=>{sf();j_()});var PKe=w(()=>{sf();j_();L_()});var fve=w(()=>{ag()});var EKe=w(()=>{sf();oN();ag();HZ();VZ();OH();fve();WZ();Qk();YT()});var lN=w(()=>{oN();ag();HZ();VZ();OH();WZ();YT();EKe();fve();e_e();Qk()});var TKe=w(()=>{lN();sf();CY()});var pve=w(()=>{sf();j_();CY();OKe();PKe();TKe()});var cN,dN,Km,m$=w(()=>{pve();xH();cN=class extends jn{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"})}},dN=class extends cN{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")}},Km=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");JT(this,"OUTPUT_PARSING_FAILURE")}}});var fN,pN,iA=w(()=>{$H();m$();ag();YT();n$();fN=class extends dN{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"})}},pN=class extends fN{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(t_e(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new eo({message:o,text:o.content})}else if(ig(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new eo({message:o_e(o),text:o.content})}else i=new qp({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!jO(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var AKe=w(()=>{iA()});var IKe=w(()=>{m$();iA()});var OY,MKe=w(()=>{iA();OY=class extends fN{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 Xc,RKe=w(()=>{J7();m$();LO();uN();Xc=class extends dN{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=rn.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,rn.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(Wp(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 f$(this.schema,JSON.parse(n))}catch(r){throw new Km(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var mve=w(()=>{qye()});var Qc,hve=w(()=>{iA();mve();Xbe();Qc=class extends pN{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?dZ(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Ybe(e[0].text)}async parse(e){return Ybe(e,JSON.parse)}getFormatInstructions(){return""}}});var NKe=w(()=>{});var jKe=w(()=>{iA();mve();NKe()});var DKe=w(()=>{m$();AKe();IKe();MKe();RKe();iA();hve();jKe()});var eb=w(()=>{DKe()});var HH,h$,g$,PY,VH=w(()=>{Q1();OH();YT();HH=class extends kp{},h$=class extends HH{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 $s(this.value)]}},g$=class extends HH{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 Xf(this.messages)}toChatMessages(){return this.messages}},PY=class extends HH{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 $s({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var kO,WH=w(()=>{VH();y$();kO=class extends z_{async formatPromptValue(e){let r=await this.format(e);return new h$(r)}}});function yve(t){return typeof t=="function"}function Lgr(t){return _$(t)?"array":typeof t}function gve(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function LKe(t,e){return t!=null&&typeof t=="object"&&e in t}function Fgr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function $gr(t,e){return kgr.call(t,e)}function Bgr(t){return!$gr(zgr,t)}function qgr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return Ugr[r]})}function Ggr(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function m(A){if(typeof A=="string"&&(A=A.split(Vgr,2)),!_$(A)||A.length!==2)throw new Error("Invalid tags: "+A);d=new RegExp(gve(A[0])+"\\s*"),f=new RegExp("\\s*"+gve(A[1])),p=new RegExp("\\s*"+gve("}"+A[1]))}m(e||lg.tags);for(var h=new GH(t),b,g,y,x,S,O;!h.eos();){if(b=h.pos,y=h.scanUntil(d),y)for(var E=0,P=y.length;E<P;++E)x=y.charAt(E),Bgr(x)?(i.push(o.length),u+=x):(s=!0,r=!0,u+=" "),o.push(["text",x,b,b+1]),b+=1,x===`
|
||
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(Kgr)||"name",h.scan(Hgr),g==="="?(y=h.scanUntil(FKe),h.scan(FKe),h.scanUntil(f)):g==="{"?(y=h.scanUntil(p),h.scan(Wgr),h.scanUntil(f),g="&"):y=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?S=[g,y,b,h.pos,u,l,r]:S=[g,y,b,h.pos],l++,o.push(S),g==="#"||g==="^")n.push(S);else if(g==="/"){if(O=n.pop(),!O)throw new Error('Unopened section "'+y+'" at '+b);if(O[1]!==y)throw new Error('Unclosed section "'+O[1]+'" at '+b)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(y)}if(c(),O=n.pop(),O)throw new Error('Unclosed section "'+O[1]+'" at '+h.pos);return Zgr(Jgr(o))}function Jgr(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 Zgr(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 GH(t){this.string=t,this.tail=t,this.pos=0}function b$(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function rp(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var Dgr,_$,kgr,zgr,Ugr,Hgr,Vgr,FKe,Wgr,Kgr,lg,KH,EY,kKe=w(()=>{Dgr=Object.prototype.toString,_$=Array.isArray||function(e){return Dgr.call(e)==="[object Array]"};kgr=RegExp.prototype.test;zgr=/\S/;Ugr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};Hgr=/\s*/,Vgr=/\s+/,FKe=/\s*=/,Wgr=/\s*\}/,Kgr=/#|\^|\/|>|\{|&|=|!/;GH.prototype.eos=function(){return this.tail===""};GH.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};GH.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};b$.prototype.push=function(e){return new b$(e,this)};b$.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=LKe(i,a[s])||Fgr(i,a[s])),i=i[a[s++]];else i=o.view[e],u=LKe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return yve(n)&&(n=n.call(this.view)),n};rp.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};rp.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||lg.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=Ggr(e,r),i&&n.set(o,a)),a};rp.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof b$?r:new b$(r,void 0);return this.renderTokens(a,s,n,e,o)};rp.prototype.renderTokens=function(e,r,n,o,i){for(var a="",s,u,l,c=0,d=e.length;c<d;++c)l=void 0,s=e[c],u=s[0],u==="#"?l=this.renderSection(s,r,n,o,i):u==="^"?l=this.renderInverted(s,r,n,o,i):u===">"?l=this.renderPartial(s,r,n,i):u==="&"?l=this.unescapedValue(s,r):u==="name"?l=this.escapedValue(s,r,i):u==="text"&&(l=this.rawValue(s)),l!==void 0&&(a+=l);return a};rp.prototype.renderSection=function(e,r,n,o,i){var a=this,s="",u=r.lookup(e[1]);function l(f){return a.render(f,r,n,i)}if(u){if(_$(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(yve(u)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(r.view,o.slice(e[3],e[5]),l),u!=null&&(s+=u)}else s+=this.renderTokens(e[4],r,n,o,i);return s}};rp.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||_$(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};rp.prototype.indentPartial=function(e,r,n){for(var o=r.replace(/[^ \t]/g,""),i=e.split(`
|
||
`),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=o+i[a]);return i.join(`
|
||
`)};rp.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=yve(n)?n(e[1]):n[e[1]];if(a!=null){var s=e[6],u=e[5],l=e[4],c=a;u==0&&l&&(c=this.indentPartial(a,l,s));var d=this.parse(c,i);return this.renderTokens(d,r,n,c,o)}}};rp.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};rp.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||lg.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===lg.escape?String(i):o(i)};rp.prototype.rawValue=function(e){return e[1]};rp.prototype.getConfigTags=function(e){return _$(e)?e:e&&typeof e=="object"?e.tags:void 0};rp.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!_$(e))return e.escape};lg={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){KH.templateCache=t},get templateCache(){return KH.templateCache}},KH=new rp;lg.clearCache=function(){return KH.clearCache()};lg.parse=function(e,r){return KH.parse(e,r)};lg.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Lgr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return KH.render(e,r,n,o)};lg.escape=qgr;lg.Scanner=GH;lg.Context=b$;lg.Writer=rp;EY=lg});function $Ke(){EY.escape=t=>t}var JH,zKe,TY,Ygr,Xgr,bve,Qgr,Kp,ZH,mN,hN=w(()=>{kKe();xH();JH=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},zKe=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=zKe(r[4]);e.push(...n)}}else e.push({type:"literal",text:r[1]});return e},TY=t=>{$Ke();let e=EY.parse(t);return zKe(e)},Ygr=(t,e)=>JH(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},""),Xgr=(t,e)=>($Ke(),EY.render(t,e)),bve={"f-string":Ygr,mustache:Xgr},Qgr={"f-string":JH,mustache:TY},Kp=(t,e,r)=>{try{return bve[e](t,r)}catch(n){throw JT(n,"INVALID_PROMPT_INPUT")}},ZH=(t,e)=>Qgr[e](t),mN=(t,e,r)=>{if(!(e in bve)){let n=Object.keys(bve);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")Kp(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Kp(o.image_url,e,n);else{let i=o.image_url.url;Kp(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Kp(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var _ve={};Qd(_ve,{PromptTemplate:()=>uf});var uf,v$=w(()=>{WH();hN();uf=class t extends kO{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))),mN(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Kp(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 ZH(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 w$,vve=w(()=>{VH();y$();hN();w$=class t extends z_{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))),mN([{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]=Kp(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 PY(r)}}});function wve(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")ZH(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?ZH(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...wve(o,e));else typeof n=="object"&&n!==null&&r.push(...wve(n,e));return Array.from(new Set(r))}function xve(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Kp(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Kp(s,r,e)):typeof s=="object"&&a.push(xve(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=xve(i,e,r):n[o]=i;return n}var YH,Sve=w(()=>{sf();hN();YH=class extends jn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=wve(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 xve(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function eyr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function tyr(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 ryr(t){return typeof t.formatMessages=="function"}function nyr(t,e){if(ryr(t)||ig(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 B_({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new B_({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=Zy(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 U_.fromTemplate(n,e);if(r._getType()==="ai")return Pve.fromTemplate(n,e);if(r._getType()==="system")return aA.fromTemplate(n,e);if(ks.isInstance(r))return Ove.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function oyr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var XH,B_,Cve,QH,Ove,e6,U_,Pve,aA,Gp,t6=w(()=>{lN();VH();sf();WH();y$();v$();vve();hN();xH();Sve();XH=class extends jn{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"})}},B_=class extends XH{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(Zy):n=[Zy(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}},Cve=class extends XH{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)]}},QH=class extends z_{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new g$(r)}},Ove=class extends Cve{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 ks(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(uf.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};e6=class extends XH{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(uf.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(uf.fromTemplate(o,r));else if(o!==null)if(eyr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(uf.fromTemplate(i,a))}else if(tyr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=TY(i):u=JH(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 w$({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=TY(i.url):u=JH(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new w$({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 YH({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof kO){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 kO){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof w$){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 YH){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)]}},U_=class extends e6{static _messageClass(){return $s}static lc_name(){return"HumanMessagePromptTemplate"}},Pve=class extends e6{static _messageClass(){return En}static lc_name(){return"AIMessagePromptTemplate"}},aA=class extends e6{static _messageClass(){return RO}static lc_name(){return"SystemMessagePromptTemplate"}};Gp=class t extends QH{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 zl))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 uf.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 zl)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(oyr(o)&&o.optional))throw JT(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=uf.fromTemplate(e,r),o=new U_({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[nyr(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 zl))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 BKe={};Qd(BKe,{FewShotChatMessagePromptTemplate:()=>Tve,FewShotPromptTemplate:()=>Eve});var Eve,Tve,Ave=w(()=>{WH();hN();v$();t6();Eve=class t extends kO{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))),mN(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 Kp(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 uf.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})}},Tve=class t extends QH{_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))),mN(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 Kp(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 z_,y$=w(()=>{sf();z_=class extends jn{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(()=>(v$(),_ve));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(v$(),_ve));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(Ave(),BKe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var UKe=w(()=>{y$();t6()});var qKe=w(()=>{});var HKe=w(()=>{sf();t6()});var VKe=w(()=>{y$();t6();Ave();UKe();v$();qKe();WH();hN();vve();HKe();Sve()});var sA=w(()=>{VKe()});var Jp=w(()=>{pve()});var Ive,Mve=w(()=>{Ive=t=>t.map(e=>e.pageContent).join(`
|
||
|
||
`)});var WKe=w(()=>{Mve()});function cg(t,e){let r=`atom${++iyr}`,n={toString(){return(Ia.env?Ia.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=ayr,n.write=syr),e&&(n.write=e),n}function ayr(t){return t(this)}function syr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Ia,iyr,KKe,Rve,Nve,IY,Dve,uyr,lyr,Lve,GKe,AY,YKe,JKe,x$,jve,cyr,dyr,ZKe,uA,XKe,S$,r6,QKe,Fve=w(()=>{Ia={},iyr=0;KKe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Rve=t=>"init"in t,Nve=t=>!!t.write,IY=new WeakMap,Dve=t=>{var e;return Lve(t)&&!((e=IY.get(t))!=null&&e[1])},uyr=(t,e)=>{let r=IY.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Ia.env?Ia.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},lyr=t=>{if(IY.has(t))return;let e=[new Set,!1];IY.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Lve=t=>typeof t?.then=="function",GKe=t=>"v"in t||"e"in t,AY=t=>{if("e"in t)throw t.e;if((Ia.env?Ia.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},YKe=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},JKe=(t,e,r,n,o)=>{var i;if((Ia.env?Ia.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),Dve(r.v)&&YKe(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&cyr(t,n,e)},x$=()=>[new Map,new Map,new Set],jve=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},cyr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},dyr=(t,e)=>t[0].get(e),ZKe=(t,e)=>{t[2].add(e)},uA=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},XKe=(...[t,e,r,n])=>{let o;(Ia.env?Ia.env.MODE:void 0)!=="production"&&(o=new Set);let i=(x,S,O)=>{let E="v"in S,P=S.v,A=Dve(S.v)?S.v:null;if(Lve(O)){lyr(O);for(let I of S.d.keys())YKe(x,O,t(I));S.v=O,delete S.e}else S.v=O,delete S.e;(!E||!Object.is(P,S.v))&&(++S.n,A&&uyr(A,O))},a=(x,S,O)=>{var E;let P=t(S);if(GKe(P)&&(P.m&&!O?.has(S)||Array.from(P.d).every(([$,k])=>a(x,$,O).n===k)))return P;P.d.clear();let A=!0,I=$=>{if(KKe(S,$)){let H=t($);if(!GKe(H))if(Rve($))i($,H,$.init);else throw new Error("no atom init");return AY(H)}let k=a(x,$,O);try{return AY(k)}finally{if(A)JKe(x,S,P,$,k);else{let H=x$();JKe(H,S,P,$,k),p(H,S,P),uA(H)}}},R,N,j={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(Ia.env?Ia.env.MODE:void 0)!=="production"&&!Nve(S)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&Nve(S)&&(N=(...$)=>{if((Ia.env?Ia.env.MODE:void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)return f(S,...$)}),N}};try{let $=e(S,I,j);if(i(S,P,$),Lve($)){(E=$.onCancel)==null||E.call($,()=>R?.abort());let k=()=>{if(P.m){let H=x$();p(H,S,P),uA(H)}};$.then(k,k)}return P}catch($){return delete P.v,P.e=$,++P.n,P}finally{A=!1}},s=x=>AY(a(void 0,x)),u=(x,S,O)=>{var E,P;let A=new Map;for(let I of((E=O.m)==null?void 0:E.t)||[])A.set(I,t(I));for(let I of O.p)A.set(I,t(I));return(P=dyr(x,S))==null||P.forEach(I=>{A.set(I,t(I))}),A};function l(x,S,O){let E=[],P=new Set,A=new Set,I=[[S,O]];for(;I.length>0;){let[R,N]=I[I.length-1];if(A.has(R)){I.pop();continue}if(P.has(R)){E.push([R,N,N.n]),A.add(R),I.pop();continue}P.add(R);for(let[j,$]of u(x,R,N))R!==j&&!P.has(j)&&I.push([j,$])}return[E,A]}let c=(x,S,O)=>{let[E,P]=l(x,S,O),A=new Set([S]);for(let I=E.length-1;I>=0;--I){let[R,N,j]=E[I],$=!1;for(let k of N.d.keys())if(k!==R&&A.has(k)){$=!0;break}$&&(a(x,R,P),p(x,R,N),j!==N.n&&(jve(x,R,N),A.add(R))),P.delete(R)}},d=(x,S,...O)=>{let E=!0,P=I=>AY(a(x,I)),A=(I,...R)=>{let N=t(I);try{if(KKe(S,I)){if(!Rve(I))throw new Error("atom not writable");let j=N.n,$=R[0];i(I,N,$),p(x,I,N),j!==N.n&&(jve(x,I,N),c(x,I,N));return}else return d(x,I,...R)}finally{E||uA(x)}};try{return r(S,P,A,...O)}finally{E=!1}},f=(x,...S)=>{let O=x$();try{return d(O,x,...S)}finally{uA(O)}},p=(x,S,O)=>{if(O.m&&!Dve(O.v)){for(let E of O.d.keys())O.m.d.has(E)||(m(x,E,t(E)).t.add(S),O.m.d.add(E));for(let E of O.m.d||[])if(!O.d.has(E)){O.m.d.delete(E);let P=h(x,E,t(E));P?.t.delete(S)}}},m=(x,S,O)=>{if(!O.m){a(x,S);for(let E of O.d.keys())m(x,E,t(E)).t.add(S);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(Ia.env?Ia.env.MODE:void 0)!=="production"&&o.add(S),Nve(S)){let E=O.m,P,A=(I,R)=>{let N=!0;P=(...j)=>{try{return d(I,S,...j)}finally{N||uA(I)}};try{return R()}finally{N=!1}};ZKe(x,()=>{let I=A(x,()=>n(S,(...R)=>P(...R)));I&&(E.u=R=>A(R,I))})}}return O.m},h=(x,S,O)=>{if(O.m&&!O.m.l.size&&!Array.from(O.m.t).some(E=>{var P;return(P=t(E).m)==null?void 0:P.d.has(S)})){let E=O.m.u;E&&ZKe(x,()=>E(x)),delete O.m,(Ia.env?Ia.env.MODE:void 0)!=="production"&&o.delete(S);for(let P of O.d.keys()){let A=h(x,P,t(P));A?.t.delete(S)}return}return O.m},y={get:s,set:f,sub:(x,S)=>{let O=x$(),E=t(x),A=m(O,x,E).l;return A.add(S),uA(O),()=>{A.delete(S);let I=x$();h(I,x,E),uA(I)}},unstable_derive:x=>XKe(...x(t,e,r,n))};return(Ia.env?Ia.env.MODE:void 0)!=="production"&&Object.assign(y,{dev4_get_internal_weak_map:()=>({get:S=>{let O=t(S);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:S=>{let O=x$();for(let[E,P]of S)if(Rve(E)){let A=t(E),I=A.n;i(E,A,P),p(O,E,A),I!==A.n&&(jve(O,E,A),c(O,E,A))}uA(O)}}),y},S$=()=>{let t=new WeakMap;return XKe(r=>{if((Ia.env?Ia.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)})},QKe=()=>(r6||(r6=S$(),(Ia.env?Ia.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=r6),globalThis.__JOTAI_DEFAULT_STORE__!==r6&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),r6)});var cGe=v(qn=>{"use strict";var n6=Symbol.for("react.element"),fyr=Symbol.for("react.portal"),pyr=Symbol.for("react.fragment"),myr=Symbol.for("react.strict_mode"),hyr=Symbol.for("react.profiler"),gyr=Symbol.for("react.provider"),yyr=Symbol.for("react.context"),byr=Symbol.for("react.forward_ref"),_yr=Symbol.for("react.suspense"),vyr=Symbol.for("react.memo"),wyr=Symbol.for("react.lazy"),eGe=Symbol.iterator;function xyr(t){return t===null||typeof t!="object"?null:(t=eGe&&t[eGe]||t["@@iterator"],typeof t=="function"?t:null)}var nGe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oGe=Object.assign,iGe={};function C$(t,e,r){this.props=t,this.context=e,this.refs=iGe,this.updater=r||nGe}C$.prototype.isReactComponent={};C$.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")};C$.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function aGe(){}aGe.prototype=C$.prototype;function $ve(t,e,r){this.props=t,this.context=e,this.refs=iGe,this.updater=r||nGe}var zve=$ve.prototype=new aGe;zve.constructor=$ve;oGe(zve,C$.prototype);zve.isPureReactComponent=!0;var tGe=Array.isArray,sGe=Object.prototype.hasOwnProperty,Bve={current:null},uGe={key:!0,ref:!0,__self:!0,__source:!0};function lGe(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)sGe.call(e,n)&&!uGe.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:n6,type:t,key:i,ref:a,props:o,_owner:Bve.current}}function Syr(t,e){return{$$typeof:n6,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Uve(t){return typeof t=="object"&&t!==null&&t.$$typeof===n6}function Cyr(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var rGe=/\/+/g;function kve(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Cyr(""+t.key):e.toString(36)}function RY(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 n6:case fyr:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+kve(a,0):n,tGe(o)?(r="",t!=null&&(r=t.replace(rGe,"$&/")+"/"),RY(o,e,r,"",function(l){return l})):o!=null&&(Uve(o)&&(o=Syr(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(rGe,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",tGe(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+kve(i,s);a+=RY(i,e,r,u,o)}else if(u=xyr(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+kve(i,s++),a+=RY(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 MY(t,e,r){if(t==null)return t;var n=[],o=0;return RY(t,n,"","",function(i){return e.call(r,i,o++)}),n}function Oyr(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var np={current:null},NY={transition:null},Pyr={ReactCurrentDispatcher:np,ReactCurrentBatchConfig:NY,ReactCurrentOwner:Bve};qn.Children={map:MY,forEach:function(t,e,r){MY(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return MY(t,function(){e++}),e},toArray:function(t){return MY(t,function(e){return e})||[]},only:function(t){if(!Uve(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};qn.Component=C$;qn.Fragment=pyr;qn.Profiler=hyr;qn.PureComponent=$ve;qn.StrictMode=myr;qn.Suspense=_yr;qn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Pyr;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=oGe({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=Bve.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)sGe.call(e,u)&&!uGe.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:n6,type:t.type,key:o,ref:i,props:n,_owner:a}};qn.createContext=function(t){return t={$$typeof:yyr,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:gyr,_context:t},t.Consumer=t};qn.createElement=lGe;qn.createFactory=function(t){var e=lGe.bind(null,t);return e.type=t,e};qn.createRef=function(){return{current:null}};qn.forwardRef=function(t){return{$$typeof:byr,render:t}};qn.isValidElement=Uve;qn.lazy=function(t){return{$$typeof:wyr,_payload:{_status:-1,_result:t},_init:Oyr}};qn.memo=function(t,e){return{$$typeof:vyr,type:t,compare:e===void 0?null:e}};qn.startTransition=function(t){var e=NY.transition;NY.transition={};try{t()}finally{NY.transition=e}};qn.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};qn.useCallback=function(t,e){return np.current.useCallback(t,e)};qn.useContext=function(t){return np.current.useContext(t)};qn.useDebugValue=function(){};qn.useDeferredValue=function(t){return np.current.useDeferredValue(t)};qn.useEffect=function(t,e){return np.current.useEffect(t,e)};qn.useId=function(){return np.current.useId()};qn.useImperativeHandle=function(t,e,r){return np.current.useImperativeHandle(t,e,r)};qn.useInsertionEffect=function(t,e){return np.current.useInsertionEffect(t,e)};qn.useLayoutEffect=function(t,e){return np.current.useLayoutEffect(t,e)};qn.useMemo=function(t,e){return np.current.useMemo(t,e)};qn.useReducer=function(t,e,r){return np.current.useReducer(t,e,r)};qn.useRef=function(t){return np.current.useRef(t)};qn.useState=function(t){return np.current.useState(t)};qn.useSyncExternalStore=function(t,e,r){return np.current.useSyncExternalStore(t,e,r)};qn.useTransition=function(){return np.current.useTransition()};qn.version="18.2.0"});var ee=v((uJn,dGe)=>{"use strict";dGe.exports=cGe()});function o6(t,e){let r=pGe(e),[[n,o,i],a]=(0,lf.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,lf.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);Hve(c)&&mGe(fGe(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,lf.useDebugValue)(s),Hve(s)){let l=fGe(s);return Tyr(l)}return s}function Ayr(t,e){let r=pGe(e);return(0,lf.useCallback)((...o)=>{if((jY.env?jY.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function i6(t,e){return[o6(t,e),Ayr(t,e)]}var lf,jY,Eyr,pGe,Hve,mGe,Tyr,qve,fGe,hGe=w(()=>{"use client";lf=F(ee(),1);Fve();jY={},Eyr=(0,lf.createContext)(void 0),pGe=t=>{let e=(0,lf.useContext)(Eyr);return t?.store||e||QKe()},Hve=t=>typeof t?.then=="function",mGe=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Tyr=lf.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(mGe(t),t)}),qve=new WeakMap,fGe=t=>{let e=qve.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((jY.env?jY.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");Hve(l)?(qve.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),qve.set(t,e)),e}});var a6=w(()=>{Fve();hGe()});function lA(t){let e=Iyr({...ae(),...t});ws.set(gN,e)}function ht(t,e){let r=ae();lA({...r,[t]:e})}function ae(){return ws.get(gN)}function yGe(){let t={...ed,activeModels:H_.map(e=>({...e,enabled:!0})),activeEmbeddingModels:yN.map(e=>({...e,enabled:!0}))};lA(t)}function Ma(t){let e=ae();return ws.sub(gN,()=>{let r=ae();t(e,r),e=r})}function Hn(){return o6(gN,{store:ws})}function bGe(t){let e=t||ed;e.userId||(e.userId=Rp()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=yN.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?ed.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?ed.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?ed.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?ed.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?ed.embeddingBatchSize:s,typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=ed.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=ed.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=ed.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=ed.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=ed.enableWordCompletion),r}function _Ge(){return ae().isPlusUser?wGe:""}function q_(){let t=ae().userSystemPrompt,e=vGe;return t?`${e}
|
||
<user_custom_instructions>
|
||
${t}
|
||
</user_custom_instructions>`:e}function Iyr(t){return t.activeModels=gGe(t.activeModels,H_),t.activeEmbeddingModels=gGe(t.activeEmbeddingModels,yN),t}function Yr(t){return`${t.name}|${t.provider}`}function gGe(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(Yr(n),{...n})}),t.forEach(n=>{let o=Yr(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 ws,gN,er=w(()=>{a6();I1();Ur();ws=S$(),gN=cg(ed)});function J(...t){ae().debug&&console.log(...t)}function fe(...t){ae().debug&&console.error(...t)}function dg(...t){ae().debug&&console.warn(...t)}var Tn=w(()=>{er()});var xGe=v((Vve,O$)=>{(function(t,e){typeof Vve=="object"&&typeof O$<"u"?O$.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Vve,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(_){t=_}function n(_){return _ instanceof Array||Object.prototype.toString.call(_)==="[object Array]"}function o(_){return _!=null&&Object.prototype.toString.call(_)==="[object Object]"}function i(_,C){return Object.prototype.hasOwnProperty.call(_,C)}function a(_){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(_).length===0;var C;for(C in _)if(i(_,C))return!1;return!0}function s(_){return _===void 0}function u(_){return typeof _=="number"||Object.prototype.toString.call(_)==="[object Number]"}function l(_){return _ instanceof Date||Object.prototype.toString.call(_)==="[object Date]"}function c(_,C){var T=[],M,L=_.length;for(M=0;M<L;++M)T.push(C(_[M],M));return T}function d(_,C){for(var T in C)i(C,T)&&(_[T]=C[T]);return i(C,"toString")&&(_.toString=C.toString),i(C,"valueOf")&&(_.valueOf=C.valueOf),_}function f(_,C,T,M){return KHe(_,C,T,M,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function m(_){return _._pf==null&&(_._pf=p()),_._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(_){var C=Object(this),T=C.length>>>0,M;for(M=0;M<T;M++)if(M in C&&_.call(this,C[M],M,C))return!0;return!1};function b(_){if(_._isValid==null){var C=m(_),T=h.call(C.parsedDateParts,function(L){return L!=null}),M=!isNaN(_._d.getTime())&&C.overflow<0&&!C.empty&&!C.invalidEra&&!C.invalidMonth&&!C.invalidWeekday&&!C.weekdayMismatch&&!C.nullInput&&!C.invalidFormat&&!C.userInvalidated&&(!C.meridiem||C.meridiem&&T);if(_._strict&&(M=M&&C.charsLeftOver===0&&C.unusedTokens.length===0&&C.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(_))_._isValid=M;else return M}return _._isValid}function g(_){var C=f(NaN);return _!=null?d(m(C),_):m(C).userInvalidated=!0,C}var y=e.momentProperties=[],x=!1;function S(_,C){var T,M,L,X=y.length;if(s(C._isAMomentObject)||(_._isAMomentObject=C._isAMomentObject),s(C._i)||(_._i=C._i),s(C._f)||(_._f=C._f),s(C._l)||(_._l=C._l),s(C._strict)||(_._strict=C._strict),s(C._tzm)||(_._tzm=C._tzm),s(C._isUTC)||(_._isUTC=C._isUTC),s(C._offset)||(_._offset=C._offset),s(C._pf)||(_._pf=m(C)),s(C._locale)||(_._locale=C._locale),X>0)for(T=0;T<X;T++)M=y[T],L=C[M],s(L)||(_[M]=L);return _}function O(_){S(this,_),this._d=new Date(_._d!=null?_._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),x===!1&&(x=!0,e.updateOffset(this),x=!1)}function E(_){return _ instanceof O||_!=null&&_._isAMomentObject!=null}function P(_){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+_)}function A(_,C){var T=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,_),T){var M=[],L,X,ge,ur=arguments.length;for(X=0;X<ur;X++){if(L="",typeof arguments[X]=="object"){L+=`
|
||
[`+X+"] ";for(ge in arguments[0])i(arguments[0],ge)&&(L+=ge+": "+arguments[0][ge]+", ");L=L.slice(0,-2)}else L=arguments[X];M.push(L)}P(_+`
|
||
Arguments: `+Array.prototype.slice.call(M).join("")+`
|
||
`+new Error().stack),T=!1}return C.apply(this,arguments)},C)}var I={};function R(_,C){e.deprecationHandler!=null&&e.deprecationHandler(_,C),I[_]||(P(C),I[_]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function N(_){return typeof Function<"u"&&_ instanceof Function||Object.prototype.toString.call(_)==="[object Function]"}function j(_){var C,T;for(T in _)i(_,T)&&(C=_[T],N(C)?this[T]=C:this["_"+T]=C);this._config=_,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function $(_,C){var T=d({},_),M;for(M in C)i(C,M)&&(o(_[M])&&o(C[M])?(T[M]={},d(T[M],_[M]),d(T[M],C[M])):C[M]!=null?T[M]=C[M]:delete T[M]);for(M in _)i(_,M)&&!i(C,M)&&o(_[M])&&(T[M]=d({},T[M]));return T}function k(_){_!=null&&this.set(_)}var H;Object.keys?H=Object.keys:H=function(_){var C,T=[];for(C in _)i(_,C)&&T.push(C);return T};var V={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Q(_,C,T){var M=this._calendar[_]||this._calendar.sameElse;return N(M)?M.call(C,T):M}function Z(_,C,T){var M=""+Math.abs(_),L=C-M.length,X=_>=0;return(X?T?"+":"":"-")+Math.pow(10,Math.max(0,L)).toString().substr(1)+M}var D=/(\[[^\[]*\])|(\\)?([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,z=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,B={},K={};function q(_,C,T,M){var L=M;typeof M=="string"&&(L=function(){return this[M]()}),_&&(K[_]=L),C&&(K[C[0]]=function(){return Z(L.apply(this,arguments),C[1],C[2])}),T&&(K[T]=function(){return this.localeData().ordinal(L.apply(this,arguments),_)})}function te(_){return _.match(/\[[\s\S]/)?_.replace(/^\[|\]$/g,""):_.replace(/\\/g,"")}function U(_){var C=_.match(D),T,M;for(T=0,M=C.length;T<M;T++)K[C[T]]?C[T]=K[C[T]]:C[T]=te(C[T]);return function(L){var X="",ge;for(ge=0;ge<M;ge++)X+=N(C[ge])?C[ge].call(L,_):C[ge];return X}}function W(_,C){return _.isValid()?(C=Y(C,_.localeData()),B[C]=B[C]||U(C),B[C](_)):_.localeData().invalidDate()}function Y(_,C){var T=5;function M(L){return C.longDateFormat(L)||L}for(z.lastIndex=0;T>=0&&z.test(_);)_=_.replace(z,M),z.lastIndex=0,T-=1;return _}var se={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Te(_){var C=this._longDateFormat[_],T=this._longDateFormat[_.toUpperCase()];return C||!T?C:(this._longDateFormat[_]=T.match(D).map(function(M){return M==="MMMM"||M==="MM"||M==="DD"||M==="dddd"?M.slice(1):M}).join(""),this._longDateFormat[_])}var de="Invalid date";function Ue(){return this._invalidDate}var Ke="%d",at=/\d{1,2}/;function hr(_){return this._ordinal.replace("%d",_)}var Nn={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 De(_,C,T,M){var L=this._relativeTime[T];return N(L)?L(_,C,T,M):L.replace(/%d/i,_)}function _t(_,C){var T=this._relativeTime[_>0?"future":"past"];return N(T)?T(C):T.replace(/%s/i,C)}var Oe={};function $e(_,C){var T=_.toLowerCase();Oe[T]=Oe[T+"s"]=Oe[C]=_}function ce(_){return typeof _=="string"?Oe[_]||Oe[_.toLowerCase()]:void 0}function qt(_){var C={},T,M;for(M in _)i(_,M)&&(T=ce(M),T&&(C[T]=_[M]));return C}var Ze={};function Ne(_,C){Ze[_]=C}function ue(_){var C=[],T;for(T in _)i(_,T)&&C.push({unit:T,priority:Ze[T]});return C.sort(function(M,L){return M.priority-L.priority}),C}function pe(_){return _%4===0&&_%100!==0||_%400===0}function Pe(_){return _<0?Math.ceil(_)||0:Math.floor(_)}function Ae(_){var C=+_,T=0;return C!==0&&isFinite(C)&&(T=Pe(C)),T}function ot(_,C){return function(T){return T!=null?(ua(this,_,T),e.updateOffset(this,C),this):Nr(this,_)}}function Nr(_,C){return _.isValid()?_._d["get"+(_._isUTC?"UTC":"")+C]():NaN}function ua(_,C,T){_.isValid()&&!isNaN(T)&&(C==="FullYear"&&pe(_.year())&&_.month()===1&&_.date()===29?(T=Ae(T),_._d["set"+(_._isUTC?"UTC":"")+C](T,_.month(),A7(T,_.month()))):_._d["set"+(_._isUTC?"UTC":"")+C](T))}function Va(_){return _=ce(_),N(this[_])?this[_]():this}function km(_,C){if(typeof _=="object"){_=qt(_);var T=ue(_),M,L=T.length;for(M=0;M<L;M++)this[T[M].unit](_[T[M].unit])}else if(_=ce(_),N(this[_]))return this[_](C);return this}var qy=/\d/,ys=/\d\d/,Jh=/\d{3}/,$m=/\d{4}/,Zh=/[+-]?\d{6}/,Qn=/\d\d?/,FT=/\d\d\d\d?/,P1=/\d\d\d\d\d\d?/,kT=/\d{1,3}/,bs=/\d{1,4}/,tu=/[+-]?\d{1,6}/,Wa=/\d+/,Uf=/[+-]?\d+/,Yd=/Z|[+-]\d\d:?\d\d/gi,Ds=/Z|[+-]\d\d(?::?\d\d)?/gi,Mp=/[+-]?\d+(\.\d{1,3})?/,qf=/[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,Un;Un={};function et(_,C,T){Un[_]=N(C)?C:function(M,L){return M&&T?T:C}}function Hf(_,C){return i(Un,_)?Un[_](C._strict,C._locale):new RegExp(zm(_))}function zm(_){return Fl(_.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(C,T,M,L,X){return T||M||L||X}))}function Fl(_){return _.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var mO={};function Fn(_,C){var T,M=C,L;for(typeof _=="string"&&(_=[_]),u(C)&&(M=function(X,ge){ge[C]=Ae(X)}),L=_.length,T=0;T<L;T++)mO[_[T]]=M}function Hy(_,C){Fn(_,function(T,M,L,X){L._w=L._w||{},C(T,L._w,L,X)})}function G3(_,C,T){C!=null&&i(mO,_)&&mO[_](C,T._a,T,_)}var Xd=0,hO=1,A_=2,kl=3,Vy=4,gO=5,E1=6,tar=7,rar=8;function nar(_,C){return(_%C+C)%C}var Ls;Array.prototype.indexOf?Ls=Array.prototype.indexOf:Ls=function(_){var C;for(C=0;C<this.length;++C)if(this[C]===_)return C;return-1};function A7(_,C){if(isNaN(_)||isNaN(C))return NaN;var T=nar(C,12);return _+=(C-T)/12,T===1?pe(_)?29:28:31-T%7%2}q("M",["MM",2],"Mo",function(){return this.month()+1}),q("MMM",0,0,function(_){return this.localeData().monthsShort(this,_)}),q("MMMM",0,0,function(_){return this.localeData().months(this,_)}),$e("month","M"),Ne("month",8),et("M",Qn),et("MM",Qn,ys),et("MMM",function(_,C){return C.monthsShortRegex(_)}),et("MMMM",function(_,C){return C.monthsRegex(_)}),Fn(["M","MM"],function(_,C){C[hO]=Ae(_)-1}),Fn(["MMM","MMMM"],function(_,C,T,M){var L=T._locale.monthsParse(_,M,T._strict);L!=null?C[hO]=L:m(T).invalidMonth=_});var oar="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),RHe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),NHe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,iar=qf,aar=qf;function sar(_,C){return _?n(this._months)?this._months[_.month()]:this._months[(this._months.isFormat||NHe).test(C)?"format":"standalone"][_.month()]:n(this._months)?this._months:this._months.standalone}function uar(_,C){return _?n(this._monthsShort)?this._monthsShort[_.month()]:this._monthsShort[NHe.test(C)?"format":"standalone"][_.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function lar(_,C,T){var M,L,X,ge=_.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],M=0;M<12;++M)X=f([2e3,M]),this._shortMonthsParse[M]=this.monthsShort(X,"").toLocaleLowerCase(),this._longMonthsParse[M]=this.months(X,"").toLocaleLowerCase();return T?C==="MMM"?(L=Ls.call(this._shortMonthsParse,ge),L!==-1?L:null):(L=Ls.call(this._longMonthsParse,ge),L!==-1?L:null):C==="MMM"?(L=Ls.call(this._shortMonthsParse,ge),L!==-1?L:(L=Ls.call(this._longMonthsParse,ge),L!==-1?L:null)):(L=Ls.call(this._longMonthsParse,ge),L!==-1?L:(L=Ls.call(this._shortMonthsParse,ge),L!==-1?L:null))}function car(_,C,T){var M,L,X;if(this._monthsParseExact)return lar.call(this,_,C,T);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),M=0;M<12;M++){if(L=f([2e3,M]),T&&!this._longMonthsParse[M]&&(this._longMonthsParse[M]=new RegExp("^"+this.months(L,"").replace(".","")+"$","i"),this._shortMonthsParse[M]=new RegExp("^"+this.monthsShort(L,"").replace(".","")+"$","i")),!T&&!this._monthsParse[M]&&(X="^"+this.months(L,"")+"|^"+this.monthsShort(L,""),this._monthsParse[M]=new RegExp(X.replace(".",""),"i")),T&&C==="MMMM"&&this._longMonthsParse[M].test(_))return M;if(T&&C==="MMM"&&this._shortMonthsParse[M].test(_))return M;if(!T&&this._monthsParse[M].test(_))return M}}function jHe(_,C){var T;if(!_.isValid())return _;if(typeof C=="string"){if(/^\d+$/.test(C))C=Ae(C);else if(C=_.localeData().monthsParse(C),!u(C))return _}return T=Math.min(_.date(),A7(_.year(),C)),_._d["set"+(_._isUTC?"UTC":"")+"Month"](C,T),_}function DHe(_){return _!=null?(jHe(this,_),e.updateOffset(this,!0),this):Nr(this,"Month")}function dar(){return A7(this.year(),this.month())}function far(_){return this._monthsParseExact?(i(this,"_monthsRegex")||LHe.call(this),_?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=iar),this._monthsShortStrictRegex&&_?this._monthsShortStrictRegex:this._monthsShortRegex)}function par(_){return this._monthsParseExact?(i(this,"_monthsRegex")||LHe.call(this),_?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=aar),this._monthsStrictRegex&&_?this._monthsStrictRegex:this._monthsRegex)}function LHe(){function _(ge,ur){return ur.length-ge.length}var C=[],T=[],M=[],L,X;for(L=0;L<12;L++)X=f([2e3,L]),C.push(this.monthsShort(X,"")),T.push(this.months(X,"")),M.push(this.months(X,"")),M.push(this.monthsShort(X,""));for(C.sort(_),T.sort(_),M.sort(_),L=0;L<12;L++)C[L]=Fl(C[L]),T[L]=Fl(T[L]);for(L=0;L<24;L++)M[L]=Fl(M[L]);this._monthsRegex=new RegExp("^("+M.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+C.join("|")+")","i")}q("Y",0,0,function(){var _=this.year();return _<=9999?Z(_,4):"+"+_}),q(0,["YY",2],0,function(){return this.year()%100}),q(0,["YYYY",4],0,"year"),q(0,["YYYYY",5],0,"year"),q(0,["YYYYYY",6,!0],0,"year"),$e("year","y"),Ne("year",1),et("Y",Uf),et("YY",Qn,ys),et("YYYY",bs,$m),et("YYYYY",tu,Zh),et("YYYYYY",tu,Zh),Fn(["YYYYY","YYYYYY"],Xd),Fn("YYYY",function(_,C){C[Xd]=_.length===2?e.parseTwoDigitYear(_):Ae(_)}),Fn("YY",function(_,C){C[Xd]=e.parseTwoDigitYear(_)}),Fn("Y",function(_,C){C[Xd]=parseInt(_,10)});function J3(_){return pe(_)?366:365}e.parseTwoDigitYear=function(_){return Ae(_)+(Ae(_)>68?1900:2e3)};var FHe=ot("FullYear",!0);function mar(){return pe(this.year())}function har(_,C,T,M,L,X,ge){var ur;return _<100&&_>=0?(ur=new Date(_+400,C,T,M,L,X,ge),isFinite(ur.getFullYear())&&ur.setFullYear(_)):ur=new Date(_,C,T,M,L,X,ge),ur}function Z3(_){var C,T;return _<100&&_>=0?(T=Array.prototype.slice.call(arguments),T[0]=_+400,C=new Date(Date.UTC.apply(null,T)),isFinite(C.getUTCFullYear())&&C.setUTCFullYear(_)):C=new Date(Date.UTC.apply(null,arguments)),C}function I7(_,C,T){var M=7+C-T,L=(7+Z3(_,0,M).getUTCDay()-C)%7;return-L+M-1}function kHe(_,C,T,M,L){var X=(7+T-M)%7,ge=I7(_,M,L),ur=1+7*(C-1)+X+ge,yn,ji;return ur<=0?(yn=_-1,ji=J3(yn)+ur):ur>J3(_)?(yn=_+1,ji=ur-J3(_)):(yn=_,ji=ur),{year:yn,dayOfYear:ji}}function Y3(_,C,T){var M=I7(_.year(),C,T),L=Math.floor((_.dayOfYear()-M-1)/7)+1,X,ge;return L<1?(ge=_.year()-1,X=L+yO(ge,C,T)):L>yO(_.year(),C,T)?(X=L-yO(_.year(),C,T),ge=_.year()+1):(ge=_.year(),X=L),{week:X,year:ge}}function yO(_,C,T){var M=I7(_,C,T),L=I7(_+1,C,T);return(J3(_)-M+L)/7}q("w",["ww",2],"wo","week"),q("W",["WW",2],"Wo","isoWeek"),$e("week","w"),$e("isoWeek","W"),Ne("week",5),Ne("isoWeek",5),et("w",Qn),et("ww",Qn,ys),et("W",Qn),et("WW",Qn,ys),Hy(["w","ww","W","WW"],function(_,C,T,M){C[M.substr(0,1)]=Ae(_)});function gar(_){return Y3(_,this._week.dow,this._week.doy).week}var yar={dow:0,doy:6};function bar(){return this._week.dow}function _ar(){return this._week.doy}function war(_){var C=this.localeData().week(this);return _==null?C:this.add((_-C)*7,"d")}function xar(_){var C=Y3(this,1,4).week;return _==null?C:this.add((_-C)*7,"d")}q("d",0,"do","day"),q("dd",0,0,function(_){return this.localeData().weekdaysMin(this,_)}),q("ddd",0,0,function(_){return this.localeData().weekdaysShort(this,_)}),q("dddd",0,0,function(_){return this.localeData().weekdays(this,_)}),q("e",0,0,"weekday"),q("E",0,0,"isoWeekday"),$e("day","d"),$e("weekday","e"),$e("isoWeekday","E"),Ne("day",11),Ne("weekday",11),Ne("isoWeekday",11),et("d",Qn),et("e",Qn),et("E",Qn),et("dd",function(_,C){return C.weekdaysMinRegex(_)}),et("ddd",function(_,C){return C.weekdaysShortRegex(_)}),et("dddd",function(_,C){return C.weekdaysRegex(_)}),Hy(["dd","ddd","dddd"],function(_,C,T,M){var L=T._locale.weekdaysParse(_,M,T._strict);L!=null?C.d=L:m(T).invalidWeekday=_}),Hy(["d","e","E"],function(_,C,T,M){C[M]=Ae(_)});function Sar(_,C){return typeof _!="string"?_:isNaN(_)?(_=C.weekdaysParse(_),typeof _=="number"?_:null):parseInt(_,10)}function Car(_,C){return typeof _=="string"?C.weekdaysParse(_)%7||7:isNaN(_)?null:_}function sye(_,C){return _.slice(C,7).concat(_.slice(0,C))}var Oar="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),$He="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Par="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ear=qf,Tar=qf,Aar=qf;function Iar(_,C){var T=n(this._weekdays)?this._weekdays:this._weekdays[_&&_!==!0&&this._weekdays.isFormat.test(C)?"format":"standalone"];return _===!0?sye(T,this._week.dow):_?T[_.day()]:T}function Mar(_){return _===!0?sye(this._weekdaysShort,this._week.dow):_?this._weekdaysShort[_.day()]:this._weekdaysShort}function Rar(_){return _===!0?sye(this._weekdaysMin,this._week.dow):_?this._weekdaysMin[_.day()]:this._weekdaysMin}function Nar(_,C,T){var M,L,X,ge=_.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],M=0;M<7;++M)X=f([2e3,1]).day(M),this._minWeekdaysParse[M]=this.weekdaysMin(X,"").toLocaleLowerCase(),this._shortWeekdaysParse[M]=this.weekdaysShort(X,"").toLocaleLowerCase(),this._weekdaysParse[M]=this.weekdays(X,"").toLocaleLowerCase();return T?C==="dddd"?(L=Ls.call(this._weekdaysParse,ge),L!==-1?L:null):C==="ddd"?(L=Ls.call(this._shortWeekdaysParse,ge),L!==-1?L:null):(L=Ls.call(this._minWeekdaysParse,ge),L!==-1?L:null):C==="dddd"?(L=Ls.call(this._weekdaysParse,ge),L!==-1||(L=Ls.call(this._shortWeekdaysParse,ge),L!==-1)?L:(L=Ls.call(this._minWeekdaysParse,ge),L!==-1?L:null)):C==="ddd"?(L=Ls.call(this._shortWeekdaysParse,ge),L!==-1||(L=Ls.call(this._weekdaysParse,ge),L!==-1)?L:(L=Ls.call(this._minWeekdaysParse,ge),L!==-1?L:null)):(L=Ls.call(this._minWeekdaysParse,ge),L!==-1||(L=Ls.call(this._weekdaysParse,ge),L!==-1)?L:(L=Ls.call(this._shortWeekdaysParse,ge),L!==-1?L:null))}function jar(_,C,T){var M,L,X;if(this._weekdaysParseExact)return Nar.call(this,_,C,T);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),M=0;M<7;M++){if(L=f([2e3,1]).day(M),T&&!this._fullWeekdaysParse[M]&&(this._fullWeekdaysParse[M]=new RegExp("^"+this.weekdays(L,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[M]=new RegExp("^"+this.weekdaysShort(L,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[M]=new RegExp("^"+this.weekdaysMin(L,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[M]||(X="^"+this.weekdays(L,"")+"|^"+this.weekdaysShort(L,"")+"|^"+this.weekdaysMin(L,""),this._weekdaysParse[M]=new RegExp(X.replace(".",""),"i")),T&&C==="dddd"&&this._fullWeekdaysParse[M].test(_))return M;if(T&&C==="ddd"&&this._shortWeekdaysParse[M].test(_))return M;if(T&&C==="dd"&&this._minWeekdaysParse[M].test(_))return M;if(!T&&this._weekdaysParse[M].test(_))return M}}function Dar(_){if(!this.isValid())return _!=null?this:NaN;var C=this._isUTC?this._d.getUTCDay():this._d.getDay();return _!=null?(_=Sar(_,this.localeData()),this.add(_-C,"d")):C}function Lar(_){if(!this.isValid())return _!=null?this:NaN;var C=(this.day()+7-this.localeData()._week.dow)%7;return _==null?C:this.add(_-C,"d")}function Far(_){if(!this.isValid())return _!=null?this:NaN;if(_!=null){var C=Car(_,this.localeData());return this.day(this.day()%7?C:C-7)}else return this.day()||7}function kar(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||uye.call(this),_?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=Ear),this._weekdaysStrictRegex&&_?this._weekdaysStrictRegex:this._weekdaysRegex)}function $ar(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||uye.call(this),_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Tar),this._weekdaysShortStrictRegex&&_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function zar(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||uye.call(this),_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Aar),this._weekdaysMinStrictRegex&&_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function uye(){function _(Vf,xO){return xO.length-Vf.length}var C=[],T=[],M=[],L=[],X,ge,ur,yn,ji;for(X=0;X<7;X++)ge=f([2e3,1]).day(X),ur=Fl(this.weekdaysMin(ge,"")),yn=Fl(this.weekdaysShort(ge,"")),ji=Fl(this.weekdays(ge,"")),C.push(ur),T.push(yn),M.push(ji),L.push(ur),L.push(yn),L.push(ji);C.sort(_),T.sort(_),M.sort(_),L.sort(_),this._weekdaysRegex=new RegExp("^("+L.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+M.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+C.join("|")+")","i")}function lye(){return this.hours()%12||12}function Bar(){return this.hours()||24}q("H",["HH",2],0,"hour"),q("h",["hh",2],0,lye),q("k",["kk",2],0,Bar),q("hmm",0,0,function(){return""+lye.apply(this)+Z(this.minutes(),2)}),q("hmmss",0,0,function(){return""+lye.apply(this)+Z(this.minutes(),2)+Z(this.seconds(),2)}),q("Hmm",0,0,function(){return""+this.hours()+Z(this.minutes(),2)}),q("Hmmss",0,0,function(){return""+this.hours()+Z(this.minutes(),2)+Z(this.seconds(),2)});function zHe(_,C){q(_,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),C)})}zHe("a",!0),zHe("A",!1),$e("hour","h"),Ne("hour",13);function BHe(_,C){return C._meridiemParse}et("a",BHe),et("A",BHe),et("H",Qn),et("h",Qn),et("k",Qn),et("HH",Qn,ys),et("hh",Qn,ys),et("kk",Qn,ys),et("hmm",FT),et("hmmss",P1),et("Hmm",FT),et("Hmmss",P1),Fn(["H","HH"],kl),Fn(["k","kk"],function(_,C,T){var M=Ae(_);C[kl]=M===24?0:M}),Fn(["a","A"],function(_,C,T){T._isPm=T._locale.isPM(_),T._meridiem=_}),Fn(["h","hh"],function(_,C,T){C[kl]=Ae(_),m(T).bigHour=!0}),Fn("hmm",function(_,C,T){var M=_.length-2;C[kl]=Ae(_.substr(0,M)),C[Vy]=Ae(_.substr(M)),m(T).bigHour=!0}),Fn("hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[kl]=Ae(_.substr(0,M)),C[Vy]=Ae(_.substr(M,2)),C[gO]=Ae(_.substr(L)),m(T).bigHour=!0}),Fn("Hmm",function(_,C,T){var M=_.length-2;C[kl]=Ae(_.substr(0,M)),C[Vy]=Ae(_.substr(M))}),Fn("Hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[kl]=Ae(_.substr(0,M)),C[Vy]=Ae(_.substr(M,2)),C[gO]=Ae(_.substr(L))});function Uar(_){return(_+"").toLowerCase().charAt(0)==="p"}var qar=/[ap]\.?m?\.?/i,Har=ot("Hours",!0);function Var(_,C,T){return _>11?T?"pm":"PM":T?"am":"AM"}var UHe={calendar:V,longDateFormat:se,invalidDate:de,ordinal:Ke,dayOfMonthOrdinalParse:at,relativeTime:Nn,months:oar,monthsShort:RHe,week:yar,weekdays:Oar,weekdaysMin:Par,weekdaysShort:$He,meridiemParse:qar},Aa={},X3={},Q3;function War(_,C){var T,M=Math.min(_.length,C.length);for(T=0;T<M;T+=1)if(_[T]!==C[T])return T;return M}function qHe(_){return _&&_.toLowerCase().replace("_","-")}function Kar(_){for(var C=0,T,M,L,X;C<_.length;){for(X=qHe(_[C]).split("-"),T=X.length,M=qHe(_[C+1]),M=M?M.split("-"):null;T>0;){if(L=M7(X.slice(0,T).join("-")),L)return L;if(M&&M.length>=T&&War(X,M)>=T-1)break;T--}C++}return Q3}function Gar(_){return _.match("^[^/\\\\]*$")!=null}function M7(_){var C=null,T;if(Aa[_]===void 0&&typeof O$<"u"&&O$&&O$.exports&&Gar(_))try{C=Q3._abbr,T=require,T("./locale/"+_),$T(C)}catch{Aa[_]=null}return Aa[_]}function $T(_,C){var T;return _&&(s(C)?T=bO(_):T=cye(_,C),T?Q3=T:typeof console<"u"&&console.warn&&console.warn("Locale "+_+" not found. Did you forget to load it?")),Q3._abbr}function cye(_,C){if(C!==null){var T,M=UHe;if(C.abbr=_,Aa[_]!=null)R("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."),M=Aa[_]._config;else if(C.parentLocale!=null)if(Aa[C.parentLocale]!=null)M=Aa[C.parentLocale]._config;else if(T=M7(C.parentLocale),T!=null)M=T._config;else return X3[C.parentLocale]||(X3[C.parentLocale]=[]),X3[C.parentLocale].push({name:_,config:C}),null;return Aa[_]=new k($(M,C)),X3[_]&&X3[_].forEach(function(L){cye(L.name,L.config)}),$T(_),Aa[_]}else return delete Aa[_],null}function Jar(_,C){if(C!=null){var T,M,L=UHe;Aa[_]!=null&&Aa[_].parentLocale!=null?Aa[_].set($(Aa[_]._config,C)):(M=M7(_),M!=null&&(L=M._config),C=$(L,C),M==null&&(C.abbr=_),T=new k(C),T.parentLocale=Aa[_],Aa[_]=T),$T(_)}else Aa[_]!=null&&(Aa[_].parentLocale!=null?(Aa[_]=Aa[_].parentLocale,_===$T()&&$T(_)):Aa[_]!=null&&delete Aa[_]);return Aa[_]}function bO(_){var C;if(_&&_._locale&&_._locale._abbr&&(_=_._locale._abbr),!_)return Q3;if(!n(_)){if(C=M7(_),C)return C;_=[_]}return Kar(_)}function Zar(){return H(Aa)}function dye(_){var C,T=_._a;return T&&m(_).overflow===-2&&(C=T[hO]<0||T[hO]>11?hO:T[A_]<1||T[A_]>A7(T[Xd],T[hO])?A_:T[kl]<0||T[kl]>24||T[kl]===24&&(T[Vy]!==0||T[gO]!==0||T[E1]!==0)?kl:T[Vy]<0||T[Vy]>59?Vy:T[gO]<0||T[gO]>59?gO:T[E1]<0||T[E1]>999?E1:-1,m(_)._overflowDayOfYear&&(C<Xd||C>A_)&&(C=A_),m(_)._overflowWeeks&&C===-1&&(C=tar),m(_)._overflowWeekday&&C===-1&&(C=rar),m(_).overflow=C),_}var Yar=/^\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)?)?$/,Xar=/^\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)?)?$/,Qar=/Z|[+-]\d\d(?::?\d\d)?/,R7=[["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]],fye=[["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/]],esr=/^\/?Date\((-?\d+)/i,tsr=/^(?:(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}))$/,rsr={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 HHe(_){var C,T,M=_._i,L=Yar.exec(M)||Xar.exec(M),X,ge,ur,yn,ji=R7.length,Vf=fye.length;if(L){for(m(_).iso=!0,C=0,T=ji;C<T;C++)if(R7[C][1].exec(L[1])){ge=R7[C][0],X=R7[C][2]!==!1;break}if(ge==null){_._isValid=!1;return}if(L[3]){for(C=0,T=Vf;C<T;C++)if(fye[C][1].exec(L[3])){ur=(L[2]||" ")+fye[C][0];break}if(ur==null){_._isValid=!1;return}}if(!X&&ur!=null){_._isValid=!1;return}if(L[4])if(Qar.exec(L[4]))yn="Z";else{_._isValid=!1;return}_._f=ge+(ur||"")+(yn||""),mye(_)}else _._isValid=!1}function nsr(_,C,T,M,L,X){var ge=[osr(_),RHe.indexOf(C),parseInt(T,10),parseInt(M,10),parseInt(L,10)];return X&&ge.push(parseInt(X,10)),ge}function osr(_){var C=parseInt(_,10);return C<=49?2e3+C:C<=999?1900+C:C}function isr(_){return _.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function asr(_,C,T){if(_){var M=$He.indexOf(_),L=new Date(C[0],C[1],C[2]).getDay();if(M!==L)return m(T).weekdayMismatch=!0,T._isValid=!1,!1}return!0}function ssr(_,C,T){if(_)return rsr[_];if(C)return 0;var M=parseInt(T,10),L=M%100,X=(M-L)/100;return X*60+L}function VHe(_){var C=tsr.exec(isr(_._i)),T;if(C){if(T=nsr(C[4],C[3],C[2],C[5],C[6],C[7]),!asr(C[1],T,_))return;_._a=T,_._tzm=ssr(C[8],C[9],C[10]),_._d=Z3.apply(null,_._a),_._d.setUTCMinutes(_._d.getUTCMinutes()-_._tzm),m(_).rfc2822=!0}else _._isValid=!1}function usr(_){var C=esr.exec(_._i);if(C!==null){_._d=new Date(+C[1]);return}if(HHe(_),_._isValid===!1)delete _._isValid;else return;if(VHe(_),_._isValid===!1)delete _._isValid;else return;_._strict?_._isValid=!1:e.createFromInputFallback(_)}e.createFromInputFallback=A("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(_){_._d=new Date(_._i+(_._useUTC?" UTC":""))});function Nk(_,C,T){return _??C??T}function lsr(_){var C=new Date(e.now());return _._useUTC?[C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate()]:[C.getFullYear(),C.getMonth(),C.getDate()]}function pye(_){var C,T,M=[],L,X,ge;if(!_._d){for(L=lsr(_),_._w&&_._a[A_]==null&&_._a[hO]==null&&csr(_),_._dayOfYear!=null&&(ge=Nk(_._a[Xd],L[Xd]),(_._dayOfYear>J3(ge)||_._dayOfYear===0)&&(m(_)._overflowDayOfYear=!0),T=Z3(ge,0,_._dayOfYear),_._a[hO]=T.getUTCMonth(),_._a[A_]=T.getUTCDate()),C=0;C<3&&_._a[C]==null;++C)_._a[C]=M[C]=L[C];for(;C<7;C++)_._a[C]=M[C]=_._a[C]==null?C===2?1:0:_._a[C];_._a[kl]===24&&_._a[Vy]===0&&_._a[gO]===0&&_._a[E1]===0&&(_._nextDay=!0,_._a[kl]=0),_._d=(_._useUTC?Z3:har).apply(null,M),X=_._useUTC?_._d.getUTCDay():_._d.getDay(),_._tzm!=null&&_._d.setUTCMinutes(_._d.getUTCMinutes()-_._tzm),_._nextDay&&(_._a[kl]=24),_._w&&typeof _._w.d<"u"&&_._w.d!==X&&(m(_).weekdayMismatch=!0)}}function csr(_){var C,T,M,L,X,ge,ur,yn,ji;C=_._w,C.GG!=null||C.W!=null||C.E!=null?(X=1,ge=4,T=Nk(C.GG,_._a[Xd],Y3(la(),1,4).year),M=Nk(C.W,1),L=Nk(C.E,1),(L<1||L>7)&&(yn=!0)):(X=_._locale._week.dow,ge=_._locale._week.doy,ji=Y3(la(),X,ge),T=Nk(C.gg,_._a[Xd],ji.year),M=Nk(C.w,ji.week),C.d!=null?(L=C.d,(L<0||L>6)&&(yn=!0)):C.e!=null?(L=C.e+X,(C.e<0||C.e>6)&&(yn=!0)):L=X),M<1||M>yO(T,X,ge)?m(_)._overflowWeeks=!0:yn!=null?m(_)._overflowWeekday=!0:(ur=kHe(T,M,L,X,ge),_._a[Xd]=ur.year,_._dayOfYear=ur.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function mye(_){if(_._f===e.ISO_8601){HHe(_);return}if(_._f===e.RFC_2822){VHe(_);return}_._a=[],m(_).empty=!0;var C=""+_._i,T,M,L,X,ge,ur=C.length,yn=0,ji,Vf;for(L=Y(_._f,_._locale).match(D)||[],Vf=L.length,T=0;T<Vf;T++)X=L[T],M=(C.match(Hf(X,_))||[])[0],M&&(ge=C.substr(0,C.indexOf(M)),ge.length>0&&m(_).unusedInput.push(ge),C=C.slice(C.indexOf(M)+M.length),yn+=M.length),K[X]?(M?m(_).empty=!1:m(_).unusedTokens.push(X),G3(X,M,_)):_._strict&&!M&&m(_).unusedTokens.push(X);m(_).charsLeftOver=ur-yn,C.length>0&&m(_).unusedInput.push(C),_._a[kl]<=12&&m(_).bigHour===!0&&_._a[kl]>0&&(m(_).bigHour=void 0),m(_).parsedDateParts=_._a.slice(0),m(_).meridiem=_._meridiem,_._a[kl]=dsr(_._locale,_._a[kl],_._meridiem),ji=m(_).era,ji!==null&&(_._a[Xd]=_._locale.erasConvertYear(ji,_._a[Xd])),pye(_),dye(_)}function dsr(_,C,T){var M;return T==null?C:_.meridiemHour!=null?_.meridiemHour(C,T):(_.isPM!=null&&(M=_.isPM(T),M&&C<12&&(C+=12),!M&&C===12&&(C=0)),C)}function fsr(_){var C,T,M,L,X,ge,ur=!1,yn=_._f.length;if(yn===0){m(_).invalidFormat=!0,_._d=new Date(NaN);return}for(L=0;L<yn;L++)X=0,ge=!1,C=S({},_),_._useUTC!=null&&(C._useUTC=_._useUTC),C._f=_._f[L],mye(C),b(C)&&(ge=!0),X+=m(C).charsLeftOver,X+=m(C).unusedTokens.length*10,m(C).score=X,ur?X<M&&(M=X,T=C):(M==null||X<M||ge)&&(M=X,T=C,ge&&(ur=!0));d(_,T||C)}function psr(_){if(!_._d){var C=qt(_._i),T=C.day===void 0?C.date:C.day;_._a=c([C.year,C.month,T,C.hour,C.minute,C.second,C.millisecond],function(M){return M&&parseInt(M,10)}),pye(_)}}function msr(_){var C=new O(dye(WHe(_)));return C._nextDay&&(C.add(1,"d"),C._nextDay=void 0),C}function WHe(_){var C=_._i,T=_._f;return _._locale=_._locale||bO(_._l),C===null||T===void 0&&C===""?g({nullInput:!0}):(typeof C=="string"&&(_._i=C=_._locale.preparse(C)),E(C)?new O(dye(C)):(l(C)?_._d=C:n(T)?fsr(_):T?mye(_):hsr(_),b(_)||(_._d=null),_))}function hsr(_){var C=_._i;s(C)?_._d=new Date(e.now()):l(C)?_._d=new Date(C.valueOf()):typeof C=="string"?usr(_):n(C)?(_._a=c(C.slice(0),function(T){return parseInt(T,10)}),pye(_)):o(C)?psr(_):u(C)?_._d=new Date(C):e.createFromInputFallback(_)}function KHe(_,C,T,M,L){var X={};return(C===!0||C===!1)&&(M=C,C=void 0),(T===!0||T===!1)&&(M=T,T=void 0),(o(_)&&a(_)||n(_)&&_.length===0)&&(_=void 0),X._isAMomentObject=!0,X._useUTC=X._isUTC=L,X._l=T,X._i=_,X._f=C,X._strict=M,msr(X)}function la(_,C,T,M){return KHe(_,C,T,M,!1)}var gsr=A("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var _=la.apply(null,arguments);return this.isValid()&&_.isValid()?_<this?this:_:g()}),ysr=A("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var _=la.apply(null,arguments);return this.isValid()&&_.isValid()?_>this?this:_:g()});function GHe(_,C){var T,M;if(C.length===1&&n(C[0])&&(C=C[0]),!C.length)return la();for(T=C[0],M=1;M<C.length;++M)(!C[M].isValid()||C[M][_](T))&&(T=C[M]);return T}function bsr(){var _=[].slice.call(arguments,0);return GHe("isBefore",_)}function _sr(){var _=[].slice.call(arguments,0);return GHe("isAfter",_)}var vsr=function(){return Date.now?Date.now():+new Date},eH=["year","quarter","month","week","day","hour","minute","second","millisecond"];function wsr(_){var C,T=!1,M,L=eH.length;for(C in _)if(i(_,C)&&!(Ls.call(eH,C)!==-1&&(_[C]==null||!isNaN(_[C]))))return!1;for(M=0;M<L;++M)if(_[eH[M]]){if(T)return!1;parseFloat(_[eH[M]])!==Ae(_[eH[M]])&&(T=!0)}return!0}function xsr(){return this._isValid}function Ssr(){return Wy(NaN)}function N7(_){var C=qt(_),T=C.year||0,M=C.quarter||0,L=C.month||0,X=C.week||C.isoWeek||0,ge=C.day||0,ur=C.hour||0,yn=C.minute||0,ji=C.second||0,Vf=C.millisecond||0;this._isValid=wsr(C),this._milliseconds=+Vf+ji*1e3+yn*6e4+ur*1e3*60*60,this._days=+ge+X*7,this._months=+L+M*3+T*12,this._data={},this._locale=bO(),this._bubble()}function j7(_){return _ instanceof N7}function hye(_){return _<0?Math.round(-1*_)*-1:Math.round(_)}function Csr(_,C,T){var M=Math.min(_.length,C.length),L=Math.abs(_.length-C.length),X=0,ge;for(ge=0;ge<M;ge++)(T&&_[ge]!==C[ge]||!T&&Ae(_[ge])!==Ae(C[ge]))&&X++;return X+L}function JHe(_,C){q(_,0,0,function(){var T=this.utcOffset(),M="+";return T<0&&(T=-T,M="-"),M+Z(~~(T/60),2)+C+Z(~~T%60,2)})}JHe("Z",":"),JHe("ZZ",""),et("Z",Ds),et("ZZ",Ds),Fn(["Z","ZZ"],function(_,C,T){T._useUTC=!0,T._tzm=gye(Ds,_)});var Osr=/([\+\-]|\d\d)/gi;function gye(_,C){var T=(C||"").match(_),M,L,X;return T===null?null:(M=T[T.length-1]||[],L=(M+"").match(Osr)||["-",0,0],X=+(L[1]*60)+Ae(L[2]),X===0?0:L[0]==="+"?X:-X)}function yye(_,C){var T,M;return C._isUTC?(T=C.clone(),M=(E(_)||l(_)?_.valueOf():la(_).valueOf())-T.valueOf(),T._d.setTime(T._d.valueOf()+M),e.updateOffset(T,!1),T):la(_).local()}function bye(_){return-Math.round(_._d.getTimezoneOffset())}e.updateOffset=function(){};function Psr(_,C,T){var M=this._offset||0,L;if(!this.isValid())return _!=null?this:NaN;if(_!=null){if(typeof _=="string"){if(_=gye(Ds,_),_===null)return this}else Math.abs(_)<16&&!T&&(_=_*60);return!this._isUTC&&C&&(L=bye(this)),this._offset=_,this._isUTC=!0,L!=null&&this.add(L,"m"),M!==_&&(!C||this._changeInProgress?QHe(this,Wy(_-M,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?M:bye(this)}function Esr(_,C){return _!=null?(typeof _!="string"&&(_=-_),this.utcOffset(_,C),this):-this.utcOffset()}function Tsr(_){return this.utcOffset(0,_)}function Asr(_){return this._isUTC&&(this.utcOffset(0,_),this._isUTC=!1,_&&this.subtract(bye(this),"m")),this}function Isr(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var _=gye(Yd,this._i);_!=null?this.utcOffset(_):this.utcOffset(0,!0)}return this}function Msr(_){return this.isValid()?(_=_?la(_).utcOffset():0,(this.utcOffset()-_)%60===0):!1}function Rsr(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Nsr(){if(!s(this._isDSTShifted))return this._isDSTShifted;var _={},C;return S(_,this),_=WHe(_),_._a?(C=_._isUTC?f(_._a):la(_._a),this._isDSTShifted=this.isValid()&&Csr(_._a,C.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function jsr(){return this.isValid()?!this._isUTC:!1}function Dsr(){return this.isValid()?this._isUTC:!1}function ZHe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Lsr=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Fsr=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Wy(_,C){var T=_,M=null,L,X,ge;return j7(_)?T={ms:_._milliseconds,d:_._days,M:_._months}:u(_)||!isNaN(+_)?(T={},C?T[C]=+_:T.milliseconds=+_):(M=Lsr.exec(_))?(L=M[1]==="-"?-1:1,T={y:0,d:Ae(M[A_])*L,h:Ae(M[kl])*L,m:Ae(M[Vy])*L,s:Ae(M[gO])*L,ms:Ae(hye(M[E1]*1e3))*L}):(M=Fsr.exec(_))?(L=M[1]==="-"?-1:1,T={y:T1(M[2],L),M:T1(M[3],L),w:T1(M[4],L),d:T1(M[5],L),h:T1(M[6],L),m:T1(M[7],L),s:T1(M[8],L)}):T==null?T={}:typeof T=="object"&&("from"in T||"to"in T)&&(ge=ksr(la(T.from),la(T.to)),T={},T.ms=ge.milliseconds,T.M=ge.months),X=new N7(T),j7(_)&&i(_,"_locale")&&(X._locale=_._locale),j7(_)&&i(_,"_isValid")&&(X._isValid=_._isValid),X}Wy.fn=N7.prototype,Wy.invalid=Ssr;function T1(_,C){var T=_&&parseFloat(_.replace(",","."));return(isNaN(T)?0:T)*C}function YHe(_,C){var T={};return T.months=C.month()-_.month()+(C.year()-_.year())*12,_.clone().add(T.months,"M").isAfter(C)&&--T.months,T.milliseconds=+C-+_.clone().add(T.months,"M"),T}function ksr(_,C){var T;return _.isValid()&&C.isValid()?(C=yye(C,_),_.isBefore(C)?T=YHe(_,C):(T=YHe(C,_),T.milliseconds=-T.milliseconds,T.months=-T.months),T):{milliseconds:0,months:0}}function XHe(_,C){return function(T,M){var L,X;return M!==null&&!isNaN(+M)&&(R(C,"moment()."+C+"(period, number) is deprecated. Please use moment()."+C+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),X=T,T=M,M=X),L=Wy(T,M),QHe(this,L,_),this}}function QHe(_,C,T,M){var L=C._milliseconds,X=hye(C._days),ge=hye(C._months);_.isValid()&&(M=M??!0,ge&&jHe(_,Nr(_,"Month")+ge*T),X&&ua(_,"Date",Nr(_,"Date")+X*T),L&&_._d.setTime(_._d.valueOf()+L*T),M&&e.updateOffset(_,X||ge))}var $sr=XHe(1,"add"),zsr=XHe(-1,"subtract");function e6e(_){return typeof _=="string"||_ instanceof String}function Bsr(_){return E(_)||l(_)||e6e(_)||u(_)||qsr(_)||Usr(_)||_===null||_===void 0}function Usr(_){var C=o(_)&&!a(_),T=!1,M=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],L,X,ge=M.length;for(L=0;L<ge;L+=1)X=M[L],T=T||i(_,X);return C&&T}function qsr(_){var C=n(_),T=!1;return C&&(T=_.filter(function(M){return!u(M)&&e6e(_)}).length===0),C&&T}function Hsr(_){var C=o(_)&&!a(_),T=!1,M=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],L,X;for(L=0;L<M.length;L+=1)X=M[L],T=T||i(_,X);return C&&T}function Vsr(_,C){var T=_.diff(C,"days",!0);return T<-6?"sameElse":T<-1?"lastWeek":T<0?"lastDay":T<1?"sameDay":T<2?"nextDay":T<7?"nextWeek":"sameElse"}function Wsr(_,C){arguments.length===1&&(arguments[0]?Bsr(arguments[0])?(_=arguments[0],C=void 0):Hsr(arguments[0])&&(C=arguments[0],_=void 0):(_=void 0,C=void 0));var T=_||la(),M=yye(T,this).startOf("day"),L=e.calendarFormat(this,M)||"sameElse",X=C&&(N(C[L])?C[L].call(this,T):C[L]);return this.format(X||this.localeData().calendar(L,this,la(T)))}function Ksr(){return new O(this)}function Gsr(_,C){var T=E(_)?_:la(_);return this.isValid()&&T.isValid()?(C=ce(C)||"millisecond",C==="millisecond"?this.valueOf()>T.valueOf():T.valueOf()<this.clone().startOf(C).valueOf()):!1}function Jsr(_,C){var T=E(_)?_:la(_);return this.isValid()&&T.isValid()?(C=ce(C)||"millisecond",C==="millisecond"?this.valueOf()<T.valueOf():this.clone().endOf(C).valueOf()<T.valueOf()):!1}function Zsr(_,C,T,M){var L=E(_)?_:la(_),X=E(C)?C:la(C);return this.isValid()&&L.isValid()&&X.isValid()?(M=M||"()",(M[0]==="("?this.isAfter(L,T):!this.isBefore(L,T))&&(M[1]===")"?this.isBefore(X,T):!this.isAfter(X,T))):!1}function Ysr(_,C){var T=E(_)?_:la(_),M;return this.isValid()&&T.isValid()?(C=ce(C)||"millisecond",C==="millisecond"?this.valueOf()===T.valueOf():(M=T.valueOf(),this.clone().startOf(C).valueOf()<=M&&M<=this.clone().endOf(C).valueOf())):!1}function Xsr(_,C){return this.isSame(_,C)||this.isAfter(_,C)}function Qsr(_,C){return this.isSame(_,C)||this.isBefore(_,C)}function eur(_,C,T){var M,L,X;if(!this.isValid())return NaN;if(M=yye(_,this),!M.isValid())return NaN;switch(L=(M.utcOffset()-this.utcOffset())*6e4,C=ce(C),C){case"year":X=D7(this,M)/12;break;case"month":X=D7(this,M);break;case"quarter":X=D7(this,M)/3;break;case"second":X=(this-M)/1e3;break;case"minute":X=(this-M)/6e4;break;case"hour":X=(this-M)/36e5;break;case"day":X=(this-M-L)/864e5;break;case"week":X=(this-M-L)/6048e5;break;default:X=this-M}return T?X:Pe(X)}function D7(_,C){if(_.date()<C.date())return-D7(C,_);var T=(C.year()-_.year())*12+(C.month()-_.month()),M=_.clone().add(T,"months"),L,X;return C-M<0?(L=_.clone().add(T-1,"months"),X=(C-M)/(M-L)):(L=_.clone().add(T+1,"months"),X=(C-M)/(L-M)),-(T+X)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function tur(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function rur(_){if(!this.isValid())return null;var C=_!==!0,T=C?this.clone().utc():this;return T.year()<0||T.year()>9999?W(T,C?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?C?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",W(T,"Z")):W(T,C?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function nur(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var _="moment",C="",T,M,L,X;return this.isLocal()||(_=this.utcOffset()===0?"moment.utc":"moment.parseZone",C="Z"),T="["+_+'("]',M=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",L="-MM-DD[T]HH:mm:ss.SSS",X=C+'[")]',this.format(T+M+L+X)}function our(_){_||(_=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var C=W(this,_);return this.localeData().postformat(C)}function iur(_,C){return this.isValid()&&(E(_)&&_.isValid()||la(_).isValid())?Wy({to:this,from:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function aur(_){return this.from(la(),_)}function sur(_,C){return this.isValid()&&(E(_)&&_.isValid()||la(_).isValid())?Wy({from:this,to:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function uur(_){return this.to(la(),_)}function t6e(_){var C;return _===void 0?this._locale._abbr:(C=bO(_),C!=null&&(this._locale=C),this)}var r6e=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(_){return _===void 0?this.localeData():this.locale(_)});function n6e(){return this._locale}var L7=1e3,jk=60*L7,F7=60*jk,o6e=(365*400+97)*24*F7;function Dk(_,C){return(_%C+C)%C}function i6e(_,C,T){return _<100&&_>=0?new Date(_+400,C,T)-o6e:new Date(_,C,T).valueOf()}function a6e(_,C,T){return _<100&&_>=0?Date.UTC(_+400,C,T)-o6e:Date.UTC(_,C,T)}function lur(_){var C,T;if(_=ce(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?a6e:i6e,_){case"year":C=T(this.year(),0,1);break;case"quarter":C=T(this.year(),this.month()-this.month()%3,1);break;case"month":C=T(this.year(),this.month(),1);break;case"week":C=T(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":C=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":C=T(this.year(),this.month(),this.date());break;case"hour":C=this._d.valueOf(),C-=Dk(C+(this._isUTC?0:this.utcOffset()*jk),F7);break;case"minute":C=this._d.valueOf(),C-=Dk(C,jk);break;case"second":C=this._d.valueOf(),C-=Dk(C,L7);break}return this._d.setTime(C),e.updateOffset(this,!0),this}function cur(_){var C,T;if(_=ce(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?a6e:i6e,_){case"year":C=T(this.year()+1,0,1)-1;break;case"quarter":C=T(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":C=T(this.year(),this.month()+1,1)-1;break;case"week":C=T(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":C=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":C=T(this.year(),this.month(),this.date()+1)-1;break;case"hour":C=this._d.valueOf(),C+=F7-Dk(C+(this._isUTC?0:this.utcOffset()*jk),F7)-1;break;case"minute":C=this._d.valueOf(),C+=jk-Dk(C,jk)-1;break;case"second":C=this._d.valueOf(),C+=L7-Dk(C,L7)-1;break}return this._d.setTime(C),e.updateOffset(this,!0),this}function dur(){return this._d.valueOf()-(this._offset||0)*6e4}function fur(){return Math.floor(this.valueOf()/1e3)}function pur(){return new Date(this.valueOf())}function mur(){var _=this;return[_.year(),_.month(),_.date(),_.hour(),_.minute(),_.second(),_.millisecond()]}function hur(){var _=this;return{years:_.year(),months:_.month(),date:_.date(),hours:_.hours(),minutes:_.minutes(),seconds:_.seconds(),milliseconds:_.milliseconds()}}function gur(){return this.isValid()?this.toISOString():null}function yur(){return b(this)}function bur(){return d({},m(this))}function _ur(){return m(this).overflow}function vur(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}q("N",0,0,"eraAbbr"),q("NN",0,0,"eraAbbr"),q("NNN",0,0,"eraAbbr"),q("NNNN",0,0,"eraName"),q("NNNNN",0,0,"eraNarrow"),q("y",["y",1],"yo","eraYear"),q("y",["yy",2],0,"eraYear"),q("y",["yyy",3],0,"eraYear"),q("y",["yyyy",4],0,"eraYear"),et("N",_ye),et("NN",_ye),et("NNN",_ye),et("NNNN",Mur),et("NNNNN",Rur),Fn(["N","NN","NNN","NNNN","NNNNN"],function(_,C,T,M){var L=T._locale.erasParse(_,M,T._strict);L?m(T).era=L:m(T).invalidEra=_}),et("y",Wa),et("yy",Wa),et("yyy",Wa),et("yyyy",Wa),et("yo",Nur),Fn(["y","yy","yyy","yyyy"],Xd),Fn(["yo"],function(_,C,T,M){var L;T._locale._eraYearOrdinalRegex&&(L=_.match(T._locale._eraYearOrdinalRegex)),T._locale.eraYearOrdinalParse?C[Xd]=T._locale.eraYearOrdinalParse(_,L):C[Xd]=parseInt(_,10)});function wur(_,C){var T,M,L,X=this._eras||bO("en")._eras;for(T=0,M=X.length;T<M;++T){switch(typeof X[T].since){case"string":L=e(X[T].since).startOf("day"),X[T].since=L.valueOf();break}switch(typeof X[T].until){case"undefined":X[T].until=1/0;break;case"string":L=e(X[T].until).startOf("day").valueOf(),X[T].until=L.valueOf();break}}return X}function xur(_,C,T){var M,L,X=this.eras(),ge,ur,yn;for(_=_.toUpperCase(),M=0,L=X.length;M<L;++M)if(ge=X[M].name.toUpperCase(),ur=X[M].abbr.toUpperCase(),yn=X[M].narrow.toUpperCase(),T)switch(C){case"N":case"NN":case"NNN":if(ur===_)return X[M];break;case"NNNN":if(ge===_)return X[M];break;case"NNNNN":if(yn===_)return X[M];break}else if([ge,ur,yn].indexOf(_)>=0)return X[M]}function Sur(_,C){var T=_.since<=_.until?1:-1;return C===void 0?e(_.since).year():e(_.since).year()+(C-_.offset)*T}function Cur(){var _,C,T,M=this.localeData().eras();for(_=0,C=M.length;_<C;++_)if(T=this.clone().startOf("day").valueOf(),M[_].since<=T&&T<=M[_].until||M[_].until<=T&&T<=M[_].since)return M[_].name;return""}function Our(){var _,C,T,M=this.localeData().eras();for(_=0,C=M.length;_<C;++_)if(T=this.clone().startOf("day").valueOf(),M[_].since<=T&&T<=M[_].until||M[_].until<=T&&T<=M[_].since)return M[_].narrow;return""}function Pur(){var _,C,T,M=this.localeData().eras();for(_=0,C=M.length;_<C;++_)if(T=this.clone().startOf("day").valueOf(),M[_].since<=T&&T<=M[_].until||M[_].until<=T&&T<=M[_].since)return M[_].abbr;return""}function Eur(){var _,C,T,M,L=this.localeData().eras();for(_=0,C=L.length;_<C;++_)if(T=L[_].since<=L[_].until?1:-1,M=this.clone().startOf("day").valueOf(),L[_].since<=M&&M<=L[_].until||L[_].until<=M&&M<=L[_].since)return(this.year()-e(L[_].since).year())*T+L[_].offset;return this.year()}function Tur(_){return i(this,"_erasNameRegex")||vye.call(this),_?this._erasNameRegex:this._erasRegex}function Aur(_){return i(this,"_erasAbbrRegex")||vye.call(this),_?this._erasAbbrRegex:this._erasRegex}function Iur(_){return i(this,"_erasNarrowRegex")||vye.call(this),_?this._erasNarrowRegex:this._erasRegex}function _ye(_,C){return C.erasAbbrRegex(_)}function Mur(_,C){return C.erasNameRegex(_)}function Rur(_,C){return C.erasNarrowRegex(_)}function Nur(_,C){return C._eraYearOrdinalRegex||Wa}function vye(){var _=[],C=[],T=[],M=[],L,X,ge=this.eras();for(L=0,X=ge.length;L<X;++L)C.push(Fl(ge[L].name)),_.push(Fl(ge[L].abbr)),T.push(Fl(ge[L].narrow)),M.push(Fl(ge[L].name)),M.push(Fl(ge[L].abbr)),M.push(Fl(ge[L].narrow));this._erasRegex=new RegExp("^("+M.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+C.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+_.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+T.join("|")+")","i")}q(0,["gg",2],0,function(){return this.weekYear()%100}),q(0,["GG",2],0,function(){return this.isoWeekYear()%100});function k7(_,C){q(0,[_,_.length],0,C)}k7("gggg","weekYear"),k7("ggggg","weekYear"),k7("GGGG","isoWeekYear"),k7("GGGGG","isoWeekYear"),$e("weekYear","gg"),$e("isoWeekYear","GG"),Ne("weekYear",1),Ne("isoWeekYear",1),et("G",Uf),et("g",Uf),et("GG",Qn,ys),et("gg",Qn,ys),et("GGGG",bs,$m),et("gggg",bs,$m),et("GGGGG",tu,Zh),et("ggggg",tu,Zh),Hy(["gggg","ggggg","GGGG","GGGGG"],function(_,C,T,M){C[M.substr(0,2)]=Ae(_)}),Hy(["gg","GG"],function(_,C,T,M){C[M]=e.parseTwoDigitYear(_)});function jur(_){return s6e.call(this,_,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Dur(_){return s6e.call(this,_,this.isoWeek(),this.isoWeekday(),1,4)}function Lur(){return yO(this.year(),1,4)}function Fur(){return yO(this.isoWeekYear(),1,4)}function kur(){var _=this.localeData()._week;return yO(this.year(),_.dow,_.doy)}function $ur(){var _=this.localeData()._week;return yO(this.weekYear(),_.dow,_.doy)}function s6e(_,C,T,M,L){var X;return _==null?Y3(this,M,L).year:(X=yO(_,M,L),C>X&&(C=X),zur.call(this,_,C,T,M,L))}function zur(_,C,T,M,L){var X=kHe(_,C,T,M,L),ge=Z3(X.year,0,X.dayOfYear);return this.year(ge.getUTCFullYear()),this.month(ge.getUTCMonth()),this.date(ge.getUTCDate()),this}q("Q",0,"Qo","quarter"),$e("quarter","Q"),Ne("quarter",7),et("Q",qy),Fn("Q",function(_,C){C[hO]=(Ae(_)-1)*3});function Bur(_){return _==null?Math.ceil((this.month()+1)/3):this.month((_-1)*3+this.month()%3)}q("D",["DD",2],"Do","date"),$e("date","D"),Ne("date",9),et("D",Qn),et("DD",Qn,ys),et("Do",function(_,C){return _?C._dayOfMonthOrdinalParse||C._ordinalParse:C._dayOfMonthOrdinalParseLenient}),Fn(["D","DD"],A_),Fn("Do",function(_,C){C[A_]=Ae(_.match(Qn)[0])});var u6e=ot("Date",!0);q("DDD",["DDDD",3],"DDDo","dayOfYear"),$e("dayOfYear","DDD"),Ne("dayOfYear",4),et("DDD",kT),et("DDDD",Jh),Fn(["DDD","DDDD"],function(_,C,T){T._dayOfYear=Ae(_)});function Uur(_){var C=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return _==null?C:this.add(_-C,"d")}q("m",["mm",2],0,"minute"),$e("minute","m"),Ne("minute",14),et("m",Qn),et("mm",Qn,ys),Fn(["m","mm"],Vy);var qur=ot("Minutes",!1);q("s",["ss",2],0,"second"),$e("second","s"),Ne("second",15),et("s",Qn),et("ss",Qn,ys),Fn(["s","ss"],gO);var Hur=ot("Seconds",!1);q("S",0,0,function(){return~~(this.millisecond()/100)}),q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),q(0,["SSS",3],0,"millisecond"),q(0,["SSSS",4],0,function(){return this.millisecond()*10}),q(0,["SSSSS",5],0,function(){return this.millisecond()*100}),q(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),q(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),q(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),q(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),$e("millisecond","ms"),Ne("millisecond",16),et("S",kT,qy),et("SS",kT,ys),et("SSS",kT,Jh);var zT,l6e;for(zT="SSSS";zT.length<=9;zT+="S")et(zT,Wa);function Vur(_,C){C[E1]=Ae(("0."+_)*1e3)}for(zT="S";zT.length<=9;zT+="S")Fn(zT,Vur);l6e=ot("Milliseconds",!1),q("z",0,0,"zoneAbbr"),q("zz",0,0,"zoneName");function Wur(){return this._isUTC?"UTC":""}function Kur(){return this._isUTC?"Coordinated Universal Time":""}var Ge=O.prototype;Ge.add=$sr,Ge.calendar=Wsr,Ge.clone=Ksr,Ge.diff=eur,Ge.endOf=cur,Ge.format=our,Ge.from=iur,Ge.fromNow=aur,Ge.to=sur,Ge.toNow=uur,Ge.get=Va,Ge.invalidAt=_ur,Ge.isAfter=Gsr,Ge.isBefore=Jsr,Ge.isBetween=Zsr,Ge.isSame=Ysr,Ge.isSameOrAfter=Xsr,Ge.isSameOrBefore=Qsr,Ge.isValid=yur,Ge.lang=r6e,Ge.locale=t6e,Ge.localeData=n6e,Ge.max=ysr,Ge.min=gsr,Ge.parsingFlags=bur,Ge.set=km,Ge.startOf=lur,Ge.subtract=zsr,Ge.toArray=mur,Ge.toObject=hur,Ge.toDate=pur,Ge.toISOString=rur,Ge.inspect=nur,typeof Symbol<"u"&&Symbol.for!=null&&(Ge[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Ge.toJSON=gur,Ge.toString=tur,Ge.unix=fur,Ge.valueOf=dur,Ge.creationData=vur,Ge.eraName=Cur,Ge.eraNarrow=Our,Ge.eraAbbr=Pur,Ge.eraYear=Eur,Ge.year=FHe,Ge.isLeapYear=mar,Ge.weekYear=jur,Ge.isoWeekYear=Dur,Ge.quarter=Ge.quarters=Bur,Ge.month=DHe,Ge.daysInMonth=dar,Ge.week=Ge.weeks=war,Ge.isoWeek=Ge.isoWeeks=xar,Ge.weeksInYear=kur,Ge.weeksInWeekYear=$ur,Ge.isoWeeksInYear=Lur,Ge.isoWeeksInISOWeekYear=Fur,Ge.date=u6e,Ge.day=Ge.days=Dar,Ge.weekday=Lar,Ge.isoWeekday=Far,Ge.dayOfYear=Uur,Ge.hour=Ge.hours=Har,Ge.minute=Ge.minutes=qur,Ge.second=Ge.seconds=Hur,Ge.millisecond=Ge.milliseconds=l6e,Ge.utcOffset=Psr,Ge.utc=Tsr,Ge.local=Asr,Ge.parseZone=Isr,Ge.hasAlignedHourOffset=Msr,Ge.isDST=Rsr,Ge.isLocal=jsr,Ge.isUtcOffset=Dsr,Ge.isUtc=ZHe,Ge.isUTC=ZHe,Ge.zoneAbbr=Wur,Ge.zoneName=Kur,Ge.dates=A("dates accessor is deprecated. Use date instead.",u6e),Ge.months=A("months accessor is deprecated. Use month instead",DHe),Ge.years=A("years accessor is deprecated. Use year instead",FHe),Ge.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Esr),Ge.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Nsr);function Gur(_){return la(_*1e3)}function Jur(){return la.apply(null,arguments).parseZone()}function c6e(_){return _}var Io=k.prototype;Io.calendar=Q,Io.longDateFormat=Te,Io.invalidDate=Ue,Io.ordinal=hr,Io.preparse=c6e,Io.postformat=c6e,Io.relativeTime=De,Io.pastFuture=_t,Io.set=j,Io.eras=wur,Io.erasParse=xur,Io.erasConvertYear=Sur,Io.erasAbbrRegex=Aur,Io.erasNameRegex=Tur,Io.erasNarrowRegex=Iur,Io.months=sar,Io.monthsShort=uar,Io.monthsParse=car,Io.monthsRegex=par,Io.monthsShortRegex=far,Io.week=gar,Io.firstDayOfYear=_ar,Io.firstDayOfWeek=bar,Io.weekdays=Iar,Io.weekdaysMin=Rar,Io.weekdaysShort=Mar,Io.weekdaysParse=jar,Io.weekdaysRegex=kar,Io.weekdaysShortRegex=$ar,Io.weekdaysMinRegex=zar,Io.isPM=Uar,Io.meridiem=Var;function $7(_,C,T,M){var L=bO(),X=f().set(M,C);return L[T](X,_)}function d6e(_,C,T){if(u(_)&&(C=_,_=void 0),_=_||"",C!=null)return $7(_,C,T,"month");var M,L=[];for(M=0;M<12;M++)L[M]=$7(_,M,T,"month");return L}function wye(_,C,T,M){typeof _=="boolean"?(u(C)&&(T=C,C=void 0),C=C||""):(C=_,T=C,_=!1,u(C)&&(T=C,C=void 0),C=C||"");var L=bO(),X=_?L._week.dow:0,ge,ur=[];if(T!=null)return $7(C,(T+X)%7,M,"day");for(ge=0;ge<7;ge++)ur[ge]=$7(C,(ge+X)%7,M,"day");return ur}function Zur(_,C){return d6e(_,C,"months")}function Yur(_,C){return d6e(_,C,"monthsShort")}function Xur(_,C,T){return wye(_,C,T,"weekdays")}function Qur(_,C,T){return wye(_,C,T,"weekdaysShort")}function elr(_,C,T){return wye(_,C,T,"weekdaysMin")}$T("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(_){var C=_%10,T=Ae(_%100/10)===1?"th":C===1?"st":C===2?"nd":C===3?"rd":"th";return _+T}}),e.lang=A("moment.lang is deprecated. Use moment.locale instead.",$T),e.langData=A("moment.langData is deprecated. Use moment.localeData instead.",bO);var _O=Math.abs;function tlr(){var _=this._data;return this._milliseconds=_O(this._milliseconds),this._days=_O(this._days),this._months=_O(this._months),_.milliseconds=_O(_.milliseconds),_.seconds=_O(_.seconds),_.minutes=_O(_.minutes),_.hours=_O(_.hours),_.months=_O(_.months),_.years=_O(_.years),this}function f6e(_,C,T,M){var L=Wy(C,T);return _._milliseconds+=M*L._milliseconds,_._days+=M*L._days,_._months+=M*L._months,_._bubble()}function rlr(_,C){return f6e(this,_,C,1)}function nlr(_,C){return f6e(this,_,C,-1)}function p6e(_){return _<0?Math.floor(_):Math.ceil(_)}function olr(){var _=this._milliseconds,C=this._days,T=this._months,M=this._data,L,X,ge,ur,yn;return _>=0&&C>=0&&T>=0||_<=0&&C<=0&&T<=0||(_+=p6e(xye(T)+C)*864e5,C=0,T=0),M.milliseconds=_%1e3,L=Pe(_/1e3),M.seconds=L%60,X=Pe(L/60),M.minutes=X%60,ge=Pe(X/60),M.hours=ge%24,C+=Pe(ge/24),yn=Pe(m6e(C)),T+=yn,C-=p6e(xye(yn)),ur=Pe(T/12),T%=12,M.days=C,M.months=T,M.years=ur,this}function m6e(_){return _*4800/146097}function xye(_){return _*146097/4800}function ilr(_){if(!this.isValid())return NaN;var C,T,M=this._milliseconds;if(_=ce(_),_==="month"||_==="quarter"||_==="year")switch(C=this._days+M/864e5,T=this._months+m6e(C),_){case"month":return T;case"quarter":return T/3;case"year":return T/12}else switch(C=this._days+Math.round(xye(this._months)),_){case"week":return C/7+M/6048e5;case"day":return C+M/864e5;case"hour":return C*24+M/36e5;case"minute":return C*1440+M/6e4;case"second":return C*86400+M/1e3;case"millisecond":return Math.floor(C*864e5)+M;default:throw new Error("Unknown unit "+_)}}function alr(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ae(this._months/12)*31536e6:NaN}function vO(_){return function(){return this.as(_)}}var slr=vO("ms"),ulr=vO("s"),llr=vO("m"),clr=vO("h"),dlr=vO("d"),flr=vO("w"),plr=vO("M"),mlr=vO("Q"),hlr=vO("y");function glr(){return Wy(this)}function ylr(_){return _=ce(_),this.isValid()?this[_+"s"]():NaN}function A1(_){return function(){return this.isValid()?this._data[_]:NaN}}var blr=A1("milliseconds"),_lr=A1("seconds"),vlr=A1("minutes"),wlr=A1("hours"),xlr=A1("days"),Slr=A1("months"),Clr=A1("years");function Olr(){return Pe(this.days()/7)}var wO=Math.round,Lk={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Plr(_,C,T,M,L){return L.relativeTime(C||1,!!T,_,M)}function Elr(_,C,T,M){var L=Wy(_).abs(),X=wO(L.as("s")),ge=wO(L.as("m")),ur=wO(L.as("h")),yn=wO(L.as("d")),ji=wO(L.as("M")),Vf=wO(L.as("w")),xO=wO(L.as("y")),BT=X<=T.ss&&["s",X]||X<T.s&&["ss",X]||ge<=1&&["m"]||ge<T.m&&["mm",ge]||ur<=1&&["h"]||ur<T.h&&["hh",ur]||yn<=1&&["d"]||yn<T.d&&["dd",yn];return T.w!=null&&(BT=BT||Vf<=1&&["w"]||Vf<T.w&&["ww",Vf]),BT=BT||ji<=1&&["M"]||ji<T.M&&["MM",ji]||xO<=1&&["y"]||["yy",xO],BT[2]=C,BT[3]=+_>0,BT[4]=M,Plr.apply(null,BT)}function Tlr(_){return _===void 0?wO:typeof _=="function"?(wO=_,!0):!1}function Alr(_,C){return Lk[_]===void 0?!1:C===void 0?Lk[_]:(Lk[_]=C,_==="s"&&(Lk.ss=C-1),!0)}function Ilr(_,C){if(!this.isValid())return this.localeData().invalidDate();var T=!1,M=Lk,L,X;return typeof _=="object"&&(C=_,_=!1),typeof _=="boolean"&&(T=_),typeof C=="object"&&(M=Object.assign({},Lk,C),C.s!=null&&C.ss==null&&(M.ss=C.s-1)),L=this.localeData(),X=Elr(this,!T,M,L),T&&(X=L.pastFuture(+this,X)),L.postformat(X)}var Sye=Math.abs;function Fk(_){return(_>0)-(_<0)||+_}function z7(){if(!this.isValid())return this.localeData().invalidDate();var _=Sye(this._milliseconds)/1e3,C=Sye(this._days),T=Sye(this._months),M,L,X,ge,ur=this.asSeconds(),yn,ji,Vf,xO;return ur?(M=Pe(_/60),L=Pe(M/60),_%=60,M%=60,X=Pe(T/12),T%=12,ge=_?_.toFixed(3).replace(/\.?0+$/,""):"",yn=ur<0?"-":"",ji=Fk(this._months)!==Fk(ur)?"-":"",Vf=Fk(this._days)!==Fk(ur)?"-":"",xO=Fk(this._milliseconds)!==Fk(ur)?"-":"",yn+"P"+(X?ji+X+"Y":"")+(T?ji+T+"M":"")+(C?Vf+C+"D":"")+(L||M||_?"T":"")+(L?xO+L+"H":"")+(M?xO+M+"M":"")+(_?xO+ge+"S":"")):"P0D"}var fo=N7.prototype;fo.isValid=xsr,fo.abs=tlr,fo.add=rlr,fo.subtract=nlr,fo.as=ilr,fo.asMilliseconds=slr,fo.asSeconds=ulr,fo.asMinutes=llr,fo.asHours=clr,fo.asDays=dlr,fo.asWeeks=flr,fo.asMonths=plr,fo.asQuarters=mlr,fo.asYears=hlr,fo.valueOf=alr,fo._bubble=olr,fo.clone=glr,fo.get=ylr,fo.milliseconds=blr,fo.seconds=_lr,fo.minutes=vlr,fo.hours=wlr,fo.days=xlr,fo.weeks=Olr,fo.months=Slr,fo.years=Clr,fo.humanize=Ilr,fo.toISOString=z7,fo.toString=z7,fo.toJSON=z7,fo.locale=t6e,fo.localeData=n6e,fo.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",z7),fo.lang=r6e,q("X",0,0,"unix"),q("x",0,0,"valueOf"),et("x",Uf),et("X",Mp),Fn("X",function(_,C,T){T._d=new Date(parseFloat(_)*1e3)}),Fn("x",function(_,C,T){T._d=new Date(Ae(_))});return e.version="2.29.4",r(la),e.fn=Ge,e.min=bsr,e.max=_sr,e.now=vsr,e.utc=f,e.unix=Gur,e.months=Zur,e.isDate=l,e.locale=$T,e.invalid=g,e.duration=Wy,e.isMoment=E,e.weekdays=Xur,e.parseZone=Jur,e.localeData=bO,e.isDuration=j7,e.monthsShort=Yur,e.weekdaysMin=elr,e.defineLocale=cye,e.updateLocale=Jar,e.locales=Zar,e.weekdaysShort=Qur,e.normalizeUnits=ce,e.relativeTimeRounding=Tlr,e.relativeTimeThreshold=Alr,e.calendarFormat=Vsr,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})});function SGe(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function Myr(t){let e=SGe(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function CGe(t){let e=SGe(t);return Myr(t)?Wve.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:Wve.UNKNOWN_ERROR)}function P$(t){return t.replace(/^#/,"").trim().toLowerCase()}function bN(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(P$(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(P$(i))}):typeof n=="string"&&o.add(P$(n))),Array.from(o)}function OGe(t,e,r){if(e.length===0)return[];e=e.map(i=>P$(i));let n=r&&r.length>0?r:Jve(t,"/"),o=[];for(let i of n){let a=bN(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function Zve(t){let e=(0,Gve.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()}:Bs(new Date)}async function E$(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function DY(t){return t.basename}function _N(t){return t?t.extension==="md"||t.extension==="pdf"||t.extension==="canvas":!1}function EGe(t,e){return!t||!e?!1:t.includes(Kve)&&e.includes(Kve)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function vN(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 tb(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 fg.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(Yve(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 Yve(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function TGe(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function AGe(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function IGe(t){return Xve.test(t)}function Qve(t){let e=t.match(Xve);return e?e[0]:null}function MGe(t){let e=t.matchAll(new RegExp(Xve,"g"));return Array.from(e,r=>r[0])}async function ou(t,e={}){let r=e.headers?{...e.headers}:{};delete r["content-length"],J("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,fg.requestUrl)({url:t,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:e.body?.toString()},throw:!1});if(i.status>=400){let a;try{a=typeof i.json=="string"?JSON.parse(i.json):i.json}catch{try{a=typeof i.text=="string"?JSON.parse(i.text):i.text}catch{a=null}}let s=new Error(Wve.REQUEST_FAILED(i.status));if(s.json=a,a?.detail?.reason==="Invalid license key"||a?.reason==="Invalid license key")s.message="Invalid license key";else if(a?.detail?.message||a?.message){let u=a?.detail?.message||a?.message,l=a?.detail?.reason||a?.reason;s.message=l?`${u}: ${l}`:u}else a?.detail&&(s.message=JSON.stringify(a.detail));throw s}return{ok:i.status>=200&&i.status<300,status:i.status,statusText:i.status.toString(),headers:new Headers(i.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:jyr(i.text),bodyUsed:!0,json:()=>i.json,text:async()=>i.text,arrayBuffer:async()=>{if(i.arrayBuffer)return i.arrayBuffer;let a=i.text.replace(/^data:.*;base64,/,""),s=atob(a),u=new Uint8Array(s.length);for(let l=0;l<s.length;l++)u[l]=s.charCodeAt(l);return u.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function jyr(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function ci(t,e=!1){return t instanceof Error?t.message+`
|
||
${t?.cause?"more message: "+t.cause.message:""}
|
||
${e?t.stack:""}`:JSON.stringify(t)}function s6(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function LY(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 V_(t){let e=A$[t];return{...e,label:e.label||t}}function op(t,e){let r=A$[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function u6(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new fg.Notice("No active leaf found.");return}if(r.view instanceof fg.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof fg.MarkdownView)){new fg.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=wN(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new fg.Notice("Message inserted into the active note.")}function FY(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function kY(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 RGe(){try{return{version:(await(0,fg.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 l6(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 Dyr(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function ewe(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=l6(e),n=Dyr(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function $Y(t,e="system"){return l6(t)?"human":e}function twe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(A$).filter(([e])=>!t.includes(e)).map(([e])=>e)}function T$(t,e){let r=!!twe().find(i=>i===t.provider),n=W_[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 Lyr(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function wN(t){let r=Lyr(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function NGe(){return crypto.randomUUID()}async function rb(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}}var Gve,fg,Wve,Jve,Ryr,Nyr,PGe,Bs,Xve,on=w(()=>{td();Ur();Tn();Gve=F(xGe()),fg=require("obsidian"),Wve={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}`};Jve=(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})};Ryr=t=>t.last.bound.modelName||t.last.bound.model,Nyr=t=>t.last.bound.retriever!==void 0,PGe=t=>Ryr(t)||Nyr(t),Bs=(t,e="local")=>{let r=(0,Gve.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};Xve=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var I$,rwe,c6,td=w(()=>{eb();sA();Jp();WKe();on();I$=class I${static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=Pi.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return I$.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=I$.instances.get("llm_chain");return r||(r=I$.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=uf.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=uf.fromTemplate(`{system_message}
|
||
|
||
Answer the question with as detailed as possible based only on the following context:
|
||
{context}
|
||
|
||
Question: {question}
|
||
`),d=b=>b.map(y=>`Human: ${y[0]}
|
||
Assistant: ${y[1]}`).join(`
|
||
`),f=Pi.from([{question:b=>(n&&console.log("Input Question: ",b.question),b.question),chat_history:b=>{let g=d(b.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new OY,b=>{let g=wN(b);return n&&console.log("Standalone Question: ",g),g}]),p=async b=>(r(b),Ive(b)),m=Pi.from([{context:i.pipe(p),question:new Eo,system_message:()=>a},c,o]);return f.pipe(m)}};I$.instances=new Map;rwe=I$,c6=rwe});var d6=w(()=>{});var dA,xs,Ei,mg,jGe,DGe,vGe,wGe,f6,zY,FGe,nwe,kGe,owe,iwe,K_,zO,pg,$O,fA,H_,cA,yN,Kve,A$,W_,$Ge,qr,awe,hg,ed,gg,Ur=w(()=>{I1();td();d6();dA="https://api.brevilabs.com/v1",xs="copilot-chat-view",Ei="user",mg="ai",jGe="copilot-conversations",DGe="copilot-custom-prompts",vGe=`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  format and do not wrap them in \` \`.
|
||
10. When generating a table, use compact formatting without excessive whitespace.
|
||
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.`,wGe=`Return the new note content or canvas JSON in a special JSON format.
|
||
|
||
# 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.
|
||
|
||
# JSON Format
|
||
Provide the content in JSON format and wrap it in a code block with the following structure:
|
||
|
||
For a single markdown file:
|
||
\`\`\`json
|
||
{
|
||
"type": "composer",
|
||
"path": "path/to/file.md",
|
||
"content": "The FULL CONTENT of the md note goes here"
|
||
}
|
||
\`\`\`
|
||
|
||
For a canvas file:
|
||
\`\`\`json
|
||
{
|
||
"type": "composer",
|
||
"path": "path/to/file.canvas",
|
||
"canvas_json": {
|
||
"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"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
\`\`\`
|
||
|
||
# Important
|
||
* ALL JSON objects must be complete and valid - ensure all arrays and objects have matching closing brackets
|
||
* For canvas files, both 'nodes' and 'edges' arrays must be properly closed with ]
|
||
* Properly escape all special characters in the content field, especially backticks and quotes
|
||
* 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 JSON objects
|
||
* Each JSON object must be parseable independently
|
||
* 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`,f6="note_context",zY=`Copilot index does not exist. Please index your vault first!
|
||
|
||
1. Set a working embedding model in QA settings. If it's not a local model, don't forget to set the API key.
|
||
|
||
2. Click 'Refresh Index for Vault' and wait for indexing to complete. If you encounter the rate limiting error, please turn your request per second down in QA setting.`,FGe=6e3,nwe=.4,kGe=.4,owe=15,iwe=448e3,K_={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},zO={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},pg={MAX_TOKENS:6e3,TEMPERATURE:.1},$O=(m=>(m.OPENAI="openai",m.OPENAI_FORMAT="3rd party (openai-format)",m.AZURE_OPENAI="azure openai",m.ANTHROPIC="anthropic",m.COHEREAI="cohereai",m.GOOGLE="google",m.XAI="xai",m.OPENROUTERAI="openrouterai",m.GROQ="groq",m.OLLAMA="ollama",m.LM_STUDIO="lm-studio",m.COPILOT_PLUS="copilot-plus",m.MISTRAL="mistralai",m.DEEPSEEK="deepseek",m))($O||{}),fA={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},H_=[{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-preview-06-17",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-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"]}],cA=(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))(cA||{}),yN=[{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:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],Kve="nomic-embed-text",A$={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"},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"},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"},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"},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:""}},W_={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},$Ge=["NEVER","ON STARTUP","ON MODE SWITCH"],qr={APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",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"},awe={[qr.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[qr.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[qr.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[qr.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[qr.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[qr.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[qr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[qr.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[qr.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[qr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[qr.LIST_INDEXED_FILES]:"List all indexed files (debug)",[qr.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[qr.NEW_CHAT]:"New Copilot Chat",[qr.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[qr.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[qr.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[qr.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[qr.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[qr.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[qr.ADD_CUSTOM_COMMAND]:"Add new custom command"},hg={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},ed={userId:Rp(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"gpt-4.1|openai",embeddingModelKey:"text-embedding-3-small|openai",temperature:pg.TEMPERATURE,maxTokens:pg.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:jGe,defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:DGe,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:`${jGe},${DGe}`,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:H_,activeEmbeddingModels:yN,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:hg.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableCustomPromptTemplating:!0,suggestedDefaultCommands:!1,reasoningEffort:"low",verbosity:"medium"},gg={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var uwe=v(BY=>{"use strict";BY.byteLength=kyr;BY.toByteArray=zyr;BY.fromByteArray=qyr;var G_=[],yg=[],Fyr=typeof Uint8Array<"u"?Uint8Array:Array,swe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(xN=0,zGe=swe.length;xN<zGe;++xN)G_[xN]=swe[xN],yg[swe.charCodeAt(xN)]=xN;var xN,zGe;yg[45]=62;yg[95]=63;function BGe(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 kyr(t){var e=BGe(t),r=e[0],n=e[1];return(r+n)*3/4-n}function $yr(t,e,r){return(e+r)*3/4-r}function zyr(t){var e,r=BGe(t),n=r[0],o=r[1],i=new Fyr($yr(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=yg[t.charCodeAt(u)]<<18|yg[t.charCodeAt(u+1)]<<12|yg[t.charCodeAt(u+2)]<<6|yg[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=yg[t.charCodeAt(u)]<<2|yg[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=yg[t.charCodeAt(u)]<<10|yg[t.charCodeAt(u+1)]<<4|yg[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function Byr(t){return G_[t>>18&63]+G_[t>>12&63]+G_[t>>6&63]+G_[t&63]}function Uyr(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(Byr(n));return o.join("")}function qyr(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(Uyr(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(G_[e>>2]+G_[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(G_[e>>10]+G_[e>>4&63]+G_[e<<2&63]+"=")),o.join("")}});var UGe=v(lwe=>{lwe.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)};lwe.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<<l)-1,d=c>>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=m,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=m,a/=256,l-=8);t[r+p-m]|=h*128}});var Yp=v(j$=>{"use strict";var cwe=uwe(),R$=UGe(),qGe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j$.Buffer=_e;j$.SlowBuffer=Jyr;j$.INSPECT_MAX_BYTES=50;var UY=2147483647;j$.kMaxLength=UY;_e.TYPED_ARRAY_SUPPORT=Hyr();!_e.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 Hyr(){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(_e.prototype,"parent",{enumerable:!0,get:function(){if(_e.isBuffer(this))return this.buffer}});Object.defineProperty(_e.prototype,"offset",{enumerable:!0,get:function(){if(_e.isBuffer(this))return this.byteOffset}});function BO(t){if(t>UY)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,_e.prototype),e}function _e(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 mwe(t)}return KGe(t,e,r)}_e.poolSize=8192;function KGe(t,e,r){if(typeof t=="string")return Wyr(t,e);if(ArrayBuffer.isView(t))return Kyr(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(J_(t,ArrayBuffer)||t&&J_(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(J_(t,SharedArrayBuffer)||t&&J_(t.buffer,SharedArrayBuffer)))return fwe(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 _e.from(n,e,r);let o=Gyr(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return _e.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)}_e.from=function(t,e,r){return KGe(t,e,r)};Object.setPrototypeOf(_e.prototype,Uint8Array.prototype);Object.setPrototypeOf(_e,Uint8Array);function GGe(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 Vyr(t,e,r){return GGe(t),t<=0?BO(t):e!==void 0?typeof r=="string"?BO(t).fill(e,r):BO(t).fill(e):BO(t)}_e.alloc=function(t,e,r){return Vyr(t,e,r)};function mwe(t){return GGe(t),BO(t<0?0:hwe(t)|0)}_e.allocUnsafe=function(t){return mwe(t)};_e.allocUnsafeSlow=function(t){return mwe(t)};function Wyr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!_e.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=JGe(t,e)|0,n=BO(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function dwe(t){let e=t.length<0?0:hwe(t.length)|0,r=BO(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Kyr(t){if(J_(t,Uint8Array)){let e=new Uint8Array(t);return fwe(e.buffer,e.byteOffset,e.byteLength)}return dwe(t)}function fwe(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,_e.prototype),n}function Gyr(t){if(_e.isBuffer(t)){let e=hwe(t.length)|0,r=BO(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ywe(t.length)?BO(0):dwe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return dwe(t.data)}function hwe(t){if(t>=UY)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+UY.toString(16)+" bytes");return t|0}function Jyr(t){return+t!=t&&(t=0),_e.alloc(+t)}_e.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==_e.prototype};_e.compare=function(e,r){if(J_(e,Uint8Array)&&(e=_e.from(e,e.offset,e.byteLength)),J_(r,Uint8Array)&&(r=_e.from(r,r.offset,r.byteLength)),!_e.isBuffer(e)||!_e.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};_e.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}};_e.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return _e.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=_e.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(J_(a,Uint8Array))i+a.length>o.length?(_e.isBuffer(a)||(a=_e.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(_e.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function JGe(t,e){if(_e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J_(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 pwe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oJe(t).length;default:if(o)return n?-1:pwe(t).length;e=(""+e).toLowerCase(),o=!0}}_e.byteLength=JGe;function Zyr(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 abr(this,e,r);case"utf8":case"utf-8":return YGe(this,e,r);case"ascii":return obr(this,e,r);case"latin1":case"binary":return ibr(this,e,r);case"base64":return rbr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sbr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}_e.prototype._isBuffer=!0;function SN(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}_e.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)SN(this,r,r+1);return this};_e.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)SN(this,r,r+3),SN(this,r+1,r+2);return this};_e.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)SN(this,r,r+7),SN(this,r+1,r+6),SN(this,r+2,r+5),SN(this,r+3,r+4);return this};_e.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?YGe(this,0,e):Zyr.apply(this,arguments)};_e.prototype.toLocaleString=_e.prototype.toString;_e.prototype.equals=function(e){if(!_e.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:_e.compare(this,e)===0};_e.prototype.inspect=function(){let e="",r=j$.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};qGe&&(_e.prototype[qGe]=_e.prototype.inspect);_e.prototype.compare=function(e,r,n,o,i){if(J_(e,Uint8Array)&&(e=_e.from(e,e.offset,e.byteLength)),!_e.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 ZGe(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,ywe(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=_e.from(e,n)),_e.isBuffer(e))return e.length===0?-1:HGe(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):HGe(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function HGe(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}_e.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};_e.prototype.indexOf=function(e,r,n){return ZGe(this,e,r,n,!0)};_e.prototype.lastIndexOf=function(e,r,n){return ZGe(this,e,r,n,!1)};function Yyr(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(ywe(s))return a;t[r+a]=s}return a}function Xyr(t,e,r,n){return qY(pwe(e,t.length-r),t,r,n)}function Qyr(t,e,r,n){return qY(dbr(e),t,r,n)}function ebr(t,e,r,n){return qY(oJe(e),t,r,n)}function tbr(t,e,r,n){return qY(fbr(e,t.length-r),t,r,n)}_e.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 Yyr(this,e,r,n);case"utf8":case"utf-8":return Xyr(this,e,r,n);case"ascii":case"latin1":case"binary":return Qyr(this,e,r,n);case"base64":return ebr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tbr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};_e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rbr(t,e,r){return e===0&&r===t.length?cwe.fromByteArray(t):cwe.fromByteArray(t.slice(e,r))}function YGe(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 nbr(n)}var VGe=4096;function nbr(t){let e=t.length;if(e<=VGe)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=VGe));return r}function obr(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 ibr(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 abr(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+=pbr[t[i]];return o}function sbr(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}_e.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,_e.prototype),o};function pc(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")}_e.prototype.readUintLE=_e.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||pc(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};_e.prototype.readUintBE=_e.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||pc(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};_e.prototype.readUint8=_e.prototype.readUInt8=function(e,r){return e=e>>>0,r||pc(e,1,this.length),this[e]};_e.prototype.readUint16LE=_e.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||pc(e,2,this.length),this[e]|this[e+1]<<8};_e.prototype.readUint16BE=_e.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||pc(e,2,this.length),this[e]<<8|this[e+1]};_e.prototype.readUint32LE=_e.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||pc(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};_e.prototype.readUint32BE=_e.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||pc(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};_e.prototype.readBigUInt64LE=pA(function(e){e=e>>>0,N$(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p6(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))});_e.prototype.readBigUInt64BE=pA(function(e){e=e>>>0,N$(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p6(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)});_e.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||pc(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};_e.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||pc(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};_e.prototype.readInt8=function(e,r){return e=e>>>0,r||pc(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};_e.prototype.readInt16LE=function(e,r){e=e>>>0,r||pc(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};_e.prototype.readInt16BE=function(e,r){e=e>>>0,r||pc(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};_e.prototype.readInt32LE=function(e,r){return e=e>>>0,r||pc(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};_e.prototype.readInt32BE=function(e,r){return e=e>>>0,r||pc(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};_e.prototype.readBigInt64LE=pA(function(e){e=e>>>0,N$(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p6(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)});_e.prototype.readBigInt64BE=pA(function(e){e=e>>>0,N$(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p6(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)});_e.prototype.readFloatLE=function(e,r){return e=e>>>0,r||pc(e,4,this.length),R$.read(this,e,!0,23,4)};_e.prototype.readFloatBE=function(e,r){return e=e>>>0,r||pc(e,4,this.length),R$.read(this,e,!1,23,4)};_e.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||pc(e,8,this.length),R$.read(this,e,!0,52,8)};_e.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||pc(e,8,this.length),R$.read(this,e,!1,52,8)};function Zp(t,e,r,n,o,i){if(!_e.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")}_e.prototype.writeUintLE=_e.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;Zp(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};_e.prototype.writeUintBE=_e.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;Zp(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};_e.prototype.writeUint8=_e.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Zp(this,e,r,1,255,0),this[r]=e&255,r+1};_e.prototype.writeUint16LE=_e.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};_e.prototype.writeUint16BE=_e.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};_e.prototype.writeUint32LE=_e.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(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};_e.prototype.writeUint32BE=_e.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(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 XGe(t,e,r,n,o){nJe(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 QGe(t,e,r,n,o){nJe(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}_e.prototype.writeBigUInt64LE=pA(function(e,r=0){return XGe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});_e.prototype.writeBigUInt64BE=pA(function(e,r=0){return QGe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});_e.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Zp(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};_e.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Zp(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};_e.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Zp(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};_e.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};_e.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};_e.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(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};_e.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Zp(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};_e.prototype.writeBigInt64LE=pA(function(e,r=0){return XGe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});_e.prototype.writeBigInt64BE=pA(function(e,r=0){return QGe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function eJe(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 tJe(t,e,r,n,o){return e=+e,r=r>>>0,o||eJe(t,e,r,4,34028234663852886e22,-34028234663852886e22),R$.write(t,e,r,n,23,4),r+4}_e.prototype.writeFloatLE=function(e,r,n){return tJe(this,e,r,!0,n)};_e.prototype.writeFloatBE=function(e,r,n){return tJe(this,e,r,!1,n)};function rJe(t,e,r,n,o){return e=+e,r=r>>>0,o||eJe(t,e,r,8,17976931348623157e292,-17976931348623157e292),R$.write(t,e,r,n,52,8),r+8}_e.prototype.writeDoubleLE=function(e,r,n){return rJe(this,e,r,!0,n)};_e.prototype.writeDoubleBE=function(e,r,n){return rJe(this,e,r,!1,n)};_e.prototype.copy=function(e,r,n,o){if(!_e.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};_e.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"&&!_e.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=_e.isBuffer(e)?e:_e.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 M$={};function gwe(t,e,r){M$[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}`}}}gwe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);gwe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);gwe("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=WGe(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=WGe(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function WGe(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){N$(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&p6(e,t.length-(r+1))}function nJe(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 M$.ERR_OUT_OF_RANGE("value",s,t)}ubr(n,o,i)}function N$(t,e){if(typeof t!="number")throw new M$.ERR_INVALID_ARG_TYPE(e,"number",t)}function p6(t,e,r){throw Math.floor(t)!==t?(N$(t,r),new M$.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new M$.ERR_BUFFER_OUT_OF_BOUNDS:new M$.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var lbr=/[^+/0-9A-Za-z-_]/g;function cbr(t){if(t=t.split("=")[0],t=t.trim().replace(lbr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function pwe(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 dbr(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function fbr(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 oJe(t){return cwe.toByteArray(cbr(t))}function qY(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 J_(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ywe(t){return t!==t}var pbr=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 pA(t){return typeof BigInt>"u"?mbr:t}function mbr(){throw new Error("BigInt not supported")}});function m6(){return aJe.Platform.isDesktop&&HY||(HY=require("electron")?.remote?.safeStorage),HY}async function xwe(){return await crypto.subtle.importKey("raw",hbr,VY.name,!1,["encrypt","decrypt"])}async function sJe(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 bwe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await bwe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await bwe(n.apiKey||"")})))),e}async function bwe(t){if(!t||t.startsWith(Swe))return t;uJe(t)&&(t=t.replace(WY,""));try{if(m6()?.isEncryptionAvailable()){let o=m6().encryptString(t);return vwe+o.toString("base64")}let e=await xwe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(VY,e,r);return wwe+ybr(n)}catch(e){return console.error("Encryption failed:",e),t}}async function po(t){if(!t||gbr(t))return t;if(uJe(t))return t.replace(WY,"");if(t.startsWith(vwe)){let r=t.replace(vwe,""),n=_we.Buffer.from(r,"base64");return m6().decryptString(n)}if(t.startsWith(wwe)){let r=t.replace(wwe,""),n=await xwe(),o=iJe(r),i=await crypto.subtle.decrypt(VY,n,o);return new TextDecoder().decode(i)}let e=t.replace(Swe,"");try{if(m6()?.isEncryptionAvailable())try{let i=_we.Buffer.from(e,"base64");return m6().decryptString(i)}catch{}let r=await xwe(),n=iJe(e),o=await crypto.subtle.decrypt(VY,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function gbr(t){return!t.startsWith(Swe)&&!t.startsWith(WY)}function uJe(t){return t.startsWith(WY)}function ybr(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 iJe(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 _we,aJe,HY,vwe,wwe,Swe,WY,hbr,VY,CN=w(()=>{_we=F(Yp()),aJe=require("obsidian"),HY=null;vwe="enc_desk_",wwe="enc_web_",Swe="enc_",WY="dec_",hbr=new TextEncoder().encode("obsidian-copilot-v1"),VY={name:"AES-GCM",iv:new Uint8Array(12)}});function fJe(t){ws.set(GY,t)}function ZY(){return ws.get(GY)}function pJe(t){return ws.sub(GY,t)}function D$(){return i6(GY,{store:ws})}function bg(){return ws.get(JY)}function ON(t){ws.set(JY,t)}function mJe(t){return ws.sub(JY,t)}function nb(){return i6(JY,{store:ws})}function PN(t){ws.set(KY,t)}function iu(){return ws.get(KY)}function L$(t){return ws.sub(KY,()=>{t(ws.get(KY))})}function mA(t){ws.set(dJe,t)}function hJe(){return i6(dJe,{store:ws})}function EN(){return bg()==="project"}function Owe(t){ws.set(Cwe,t)}function TN(){return ws.get(Cwe)}function gJe(t){let e=TN();Owe([...e,t])}function yJe(t){let e=TN();Owe(e.filter(r=>r.id!==t))}function bJe(){Owe([])}function _Je(){return i6(Cwe,{store:ws})}var lJe,GY,cJe,JY,KY,dJe,Cwe,Us=w(()=>{td();er();a6();lJe=cg(null),GY=cg(t=>{let e=t(lJe);return e!==null?e:t(gN).defaultModelKey},(t,e,r)=>{e(lJe,r)}),cJe=cg(null),JY=cg(t=>{let e=t(cJe);return e!==null?e:t(gN).defaultChainType},(t,e,r)=>{e(cJe,r)}),KY=cg(null),dJe=cg(!1),Cwe=cg([])});var AJe=v(Zi=>{"use strict";function Awe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<YY(o,e))t[n]=e,t[r]=o,r=n;else break e}}function ob(t){return t.length===0?null:t[0]}function QY(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>YY(s,r))u<o&&0>YY(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>YY(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function YY(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(vJe=performance,Zi.unstable_now=function(){return vJe.now()}):(Pwe=Date,wJe=Pwe.now(),Zi.unstable_now=function(){return Pwe.now()-wJe});var vJe,Pwe,wJe,Z_=[],hA=[],bbr=1,_g=null,cf=3,eX=!1,AN=!1,g6=!1,CJe=typeof setTimeout=="function"?setTimeout:null,OJe=typeof clearTimeout=="function"?clearTimeout:null,xJe=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Iwe(t){for(var e=ob(hA);e!==null;){if(e.callback===null)QY(hA);else if(e.startTime<=t)QY(hA),e.sortIndex=e.expirationTime,Awe(Z_,e);else break;e=ob(hA)}}function Mwe(t){if(g6=!1,Iwe(t),!AN)if(ob(Z_)!==null)AN=!0,Nwe(Rwe);else{var e=ob(hA);e!==null&&jwe(Mwe,e.startTime-t)}}function Rwe(t,e){AN=!1,g6&&(g6=!1,OJe(y6),y6=-1),eX=!0;var r=cf;try{for(Iwe(e),_g=ob(Z_);_g!==null&&(!(_g.expirationTime>e)||t&&!TJe());){var n=_g.callback;if(typeof n=="function"){_g.callback=null,cf=_g.priorityLevel;var o=n(_g.expirationTime<=e);e=Zi.unstable_now(),typeof o=="function"?_g.callback=o:_g===ob(Z_)&&QY(Z_),Iwe(e)}else QY(Z_);_g=ob(Z_)}if(_g!==null)var i=!0;else{var a=ob(hA);a!==null&&jwe(Mwe,a.startTime-e),i=!1}return i}finally{_g=null,cf=r,eX=!1}}var tX=!1,XY=null,y6=-1,PJe=5,EJe=-1;function TJe(){return!(Zi.unstable_now()-EJe<PJe)}function Ewe(){if(XY!==null){var t=Zi.unstable_now();EJe=t;var e=!0;try{e=XY(!0,t)}finally{e?h6():(tX=!1,XY=null)}}else tX=!1}var h6;typeof xJe=="function"?h6=function(){xJe(Ewe)}:typeof MessageChannel<"u"?(Twe=new MessageChannel,SJe=Twe.port2,Twe.port1.onmessage=Ewe,h6=function(){SJe.postMessage(null)}):h6=function(){CJe(Ewe,0)};var Twe,SJe;function Nwe(t){XY=t,tX||(tX=!0,h6())}function jwe(t,e){y6=CJe(function(){t(Zi.unstable_now())},e)}Zi.unstable_IdlePriority=5;Zi.unstable_ImmediatePriority=1;Zi.unstable_LowPriority=4;Zi.unstable_NormalPriority=3;Zi.unstable_Profiling=null;Zi.unstable_UserBlockingPriority=2;Zi.unstable_cancelCallback=function(t){t.callback=null};Zi.unstable_continueExecution=function(){AN||eX||(AN=!0,Nwe(Rwe))};Zi.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"):PJe=0<t?Math.floor(1e3/t):5};Zi.unstable_getCurrentPriorityLevel=function(){return cf};Zi.unstable_getFirstCallbackNode=function(){return ob(Z_)};Zi.unstable_next=function(t){switch(cf){case 1:case 2:case 3:var e=3;break;default:e=cf}var r=cf;cf=e;try{return t()}finally{cf=r}};Zi.unstable_pauseExecution=function(){};Zi.unstable_requestPaint=function(){};Zi.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=cf;cf=t;try{return e()}finally{cf=r}};Zi.unstable_scheduleCallback=function(t,e,r){var n=Zi.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:bbr++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,Awe(hA,t),ob(Z_)===null&&t===ob(hA)&&(g6?(OJe(y6),y6=-1):g6=!0,jwe(Mwe,r-n))):(t.sortIndex=o,Awe(Z_,t),AN||eX||(AN=!0,Nwe(Rwe))),t};Zi.unstable_shouldYield=TJe;Zi.unstable_wrapCallback=function(t){var e=cf;return function(){var r=cf;cf=e;try{return t.apply(this,arguments)}finally{cf=r}}}});var MJe=v((XJn,IJe)=>{"use strict";IJe.exports=AJe()});var FYe=v(Qm=>{"use strict";var k7e=ee(),Ym=MJe();function Ve(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 $7e=new Set,$6={};function UN(t,e){nz(t,e),nz(t+"Capture",e)}function nz(t,e){for($6[t]=e,t=0;t<e.length;t++)$7e.add(e[t])}var KO=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),n0e=Object.prototype.hasOwnProperty,_br=/^[: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]*$/,RJe={},NJe={};function vbr(t){return n0e.call(NJe,t)?!0:n0e.call(RJe,t)?!1:_br.test(t)?NJe[t]=!0:(RJe[t]=!0,!1)}function wbr(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 xbr(t,e,r,n){if(e===null||typeof e>"u"||wbr(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 up(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 od={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){od[t]=new up(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];od[e]=new up(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){od[t]=new up(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){od[t]=new up(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){od[t]=new up(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){od[t]=new up(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){od[t]=new up(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){od[t]=new up(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){od[t]=new up(t,5,!1,t.toLowerCase(),null,!1,!1)});var J0e=/[\-:]([a-z])/g;function Z0e(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(J0e,Z0e);od[e]=new up(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(J0e,Z0e);od[e]=new up(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(J0e,Z0e);od[e]=new up(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){od[t]=new up(t,1,!1,t.toLowerCase(),null,!1,!1)});od.xlinkHref=new up("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){od[t]=new up(t,1,!1,t.toLowerCase(),null,!0,!0)});function Y0e(t,e,r,n){var o=od.hasOwnProperty(e)?od[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(xbr(e,r,o,n)&&(r=null),n||o===null?vbr(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 YO=k7e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,rX=Symbol.for("react.element"),$$=Symbol.for("react.portal"),z$=Symbol.for("react.fragment"),X0e=Symbol.for("react.strict_mode"),o0e=Symbol.for("react.profiler"),z7e=Symbol.for("react.provider"),B7e=Symbol.for("react.context"),Q0e=Symbol.for("react.forward_ref"),i0e=Symbol.for("react.suspense"),a0e=Symbol.for("react.suspense_list"),exe=Symbol.for("react.memo"),yA=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var U7e=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var jJe=Symbol.iterator;function b6(t){return t===null||typeof t!="object"?null:(t=jJe&&t[jJe]||t["@@iterator"],typeof t=="function"?t:null)}var Ya=Object.assign,Dwe;function P6(t){if(Dwe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);Dwe=e&&e[1]||""}return`
|
||
`+Dwe+t}var Lwe=!1;function Fwe(t,e){if(!t||Lwe)return"";Lwe=!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{Lwe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?P6(t):""}function Sbr(t){switch(t.tag){case 5:return P6(t.type);case 16:return P6("Lazy");case 13:return P6("Suspense");case 19:return P6("SuspenseList");case 0:case 2:case 15:return t=Fwe(t.type,!1),t;case 11:return t=Fwe(t.type.render,!1),t;case 1:return t=Fwe(t.type,!0),t;default:return""}}function s0e(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 z$:return"Fragment";case $$:return"Portal";case o0e:return"Profiler";case X0e:return"StrictMode";case i0e:return"Suspense";case a0e:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case B7e:return(t.displayName||"Context")+".Consumer";case z7e:return(t._context.displayName||"Context")+".Provider";case Q0e:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case exe:return e=t.displayName||null,e!==null?e:s0e(t.type)||"Memo";case yA:e=t._payload,t=t._init;try{return s0e(t(e))}catch{}}return null}function Cbr(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 s0e(e);case 8:return e===X0e?"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 MA(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function q7e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Obr(t){var e=q7e(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 nX(t){t._valueTracker||(t._valueTracker=Obr(t))}function H7e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=q7e(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function MX(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 u0e(t,e){var r=e.checked;return Ya({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function DJe(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=MA(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 V7e(t,e){e=e.checked,e!=null&&Y0e(t,"checked",e,!1)}function l0e(t,e){V7e(t,e);var r=MA(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")?c0e(t,e.type,r):e.hasOwnProperty("defaultValue")&&c0e(t,e.type,MA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function LJe(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 c0e(t,e,r){(e!=="number"||MX(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var E6=Array.isArray;function Y$(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=""+MA(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 d0e(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Ve(91));return Ya({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function FJe(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Ve(92));if(E6(r)){if(1<r.length)throw Error(Ve(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:MA(r)}}function W7e(t,e){var r=MA(e.value),n=MA(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 kJe(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function K7e(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 f0e(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?K7e(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var oX,G7e=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(oX=oX||document.createElement("div"),oX.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=oX.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function z6(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var I6={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},Pbr=["Webkit","ms","Moz","O"];Object.keys(I6).forEach(function(t){Pbr.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),I6[e]=I6[t]})});function J7e(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||I6.hasOwnProperty(t)&&I6[t]?(""+e).trim():e+"px"}function Z7e(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=J7e(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var Ebr=Ya({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 p0e(t,e){if(e){if(Ebr[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ve(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ve(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ve(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ve(62))}}function m0e(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 h0e=null;function txe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var g0e=null,X$=null,Q$=null;function $Je(t){if(t=o8(t)){if(typeof g0e!="function")throw Error(Ve(280));var e=t.stateNode;e&&(e=iQ(e),g0e(t.stateNode,t.type,e))}}function Y7e(t){X$?Q$?Q$.push(t):Q$=[t]:X$=t}function X7e(){if(X$){var t=X$,e=Q$;if(Q$=X$=null,$Je(t),e)for(t=0;t<e.length;t++)$Je(e[t])}}function Q7e(t,e){return t(e)}function eZe(){}var kwe=!1;function tZe(t,e,r){if(kwe)return t(e,r);kwe=!0;try{return Q7e(t,e,r)}finally{kwe=!1,(X$!==null||Q$!==null)&&(eZe(),X7e())}}function B6(t,e){var r=t.stateNode;if(r===null)return null;var n=iQ(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(Ve(231,e,typeof r));return r}var y0e=!1;if(KO)try{F$={},Object.defineProperty(F$,"passive",{get:function(){y0e=!0}}),window.addEventListener("test",F$,F$),window.removeEventListener("test",F$,F$)}catch{y0e=!1}var F$;function Tbr(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 M6=!1,RX=null,NX=!1,b0e=null,Abr={onError:function(t){M6=!0,RX=t}};function Ibr(t,e,r,n,o,i,a,s,u){M6=!1,RX=null,Tbr.apply(Abr,arguments)}function Mbr(t,e,r,n,o,i,a,s,u){if(Ibr.apply(this,arguments),M6){if(M6){var l=RX;M6=!1,RX=null}else throw Error(Ve(198));NX||(NX=!0,b0e=l)}}function qN(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 rZe(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 zJe(t){if(qN(t)!==t)throw Error(Ve(188))}function Rbr(t){var e=t.alternate;if(!e){if(e=qN(t),e===null)throw Error(Ve(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 zJe(o),t;if(i===n)return zJe(o),e;i=i.sibling}throw Error(Ve(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(Ve(189))}}if(r.alternate!==n)throw Error(Ve(190))}if(r.tag!==3)throw Error(Ve(188));return r.stateNode.current===r?t:e}function nZe(t){return t=Rbr(t),t!==null?oZe(t):null}function oZe(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=oZe(t);if(e!==null)return e;t=t.sibling}return null}var iZe=Ym.unstable_scheduleCallback,BJe=Ym.unstable_cancelCallback,Nbr=Ym.unstable_shouldYield,jbr=Ym.unstable_requestPaint,qs=Ym.unstable_now,Dbr=Ym.unstable_getCurrentPriorityLevel,rxe=Ym.unstable_ImmediatePriority,aZe=Ym.unstable_UserBlockingPriority,jX=Ym.unstable_NormalPriority,Lbr=Ym.unstable_LowPriority,sZe=Ym.unstable_IdlePriority,tQ=null,ev=null;function Fbr(t){if(ev&&typeof ev.onCommitFiberRoot=="function")try{ev.onCommitFiberRoot(tQ,t,void 0,(t.current.flags&128)===128)}catch{}}var lb=Math.clz32?Math.clz32:zbr,kbr=Math.log,$br=Math.LN2;function zbr(t){return t>>>=0,t===0?32:31-(kbr(t)/$br|0)|0}var iX=64,aX=4194304;function T6(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 DX(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=T6(s):(i&=a,i!==0&&(n=T6(i)))}else a=r&~o,a!==0?n=T6(a):i!==0&&(n=T6(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-lb(e),o=1<<r,n|=t[r],e&=~o;return n}function Bbr(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 Ubr(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-lb(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=Bbr(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function _0e(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function uZe(){var t=iX;return iX<<=1,(iX&4194240)===0&&(iX=64),t}function $we(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function r8(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-lb(e),t[e]=r}function qbr(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-lb(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function nxe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-lb(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var Ti=0;function lZe(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var cZe,oxe,dZe,fZe,pZe,v0e=!1,sX=[],SA=null,CA=null,OA=null,U6=new Map,q6=new Map,_A=[],Hbr="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 UJe(t,e){switch(t){case"focusin":case"focusout":SA=null;break;case"dragenter":case"dragleave":CA=null;break;case"mouseover":case"mouseout":OA=null;break;case"pointerover":case"pointerout":U6.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":q6.delete(e.pointerId)}}function _6(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=o8(e),e!==null&&oxe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function Vbr(t,e,r,n,o){switch(e){case"focusin":return SA=_6(SA,t,e,r,n,o),!0;case"dragenter":return CA=_6(CA,t,e,r,n,o),!0;case"mouseover":return OA=_6(OA,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return U6.set(i,_6(U6.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,q6.set(i,_6(q6.get(i)||null,t,e,r,n,o)),!0}return!1}function mZe(t){var e=RN(t.target);if(e!==null){var r=qN(e);if(r!==null){if(e=r.tag,e===13){if(e=rZe(r),e!==null){t.blockedOn=e,pZe(t.priority,function(){dZe(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 wX(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=w0e(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);h0e=n,r.target.dispatchEvent(n),h0e=null}else return e=o8(r),e!==null&&oxe(e),t.blockedOn=r,!1;e.shift()}return!0}function qJe(t,e,r){wX(t)&&r.delete(e)}function Wbr(){v0e=!1,SA!==null&&wX(SA)&&(SA=null),CA!==null&&wX(CA)&&(CA=null),OA!==null&&wX(OA)&&(OA=null),U6.forEach(qJe),q6.forEach(qJe)}function v6(t,e){t.blockedOn===e&&(t.blockedOn=null,v0e||(v0e=!0,Ym.unstable_scheduleCallback(Ym.unstable_NormalPriority,Wbr)))}function H6(t){function e(o){return v6(o,t)}if(0<sX.length){v6(sX[0],t);for(var r=1;r<sX.length;r++){var n=sX[r];n.blockedOn===t&&(n.blockedOn=null)}}for(SA!==null&&v6(SA,t),CA!==null&&v6(CA,t),OA!==null&&v6(OA,t),U6.forEach(e),q6.forEach(e),r=0;r<_A.length;r++)n=_A[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<_A.length&&(r=_A[0],r.blockedOn===null);)mZe(r),r.blockedOn===null&&_A.shift()}var ez=YO.ReactCurrentBatchConfig,LX=!0;function Kbr(t,e,r,n){var o=Ti,i=ez.transition;ez.transition=null;try{Ti=1,ixe(t,e,r,n)}finally{Ti=o,ez.transition=i}}function Gbr(t,e,r,n){var o=Ti,i=ez.transition;ez.transition=null;try{Ti=4,ixe(t,e,r,n)}finally{Ti=o,ez.transition=i}}function ixe(t,e,r,n){if(LX){var o=w0e(t,e,r,n);if(o===null)Wwe(t,e,n,FX,r),UJe(t,n);else if(Vbr(o,t,e,r,n))n.stopPropagation();else if(UJe(t,n),e&4&&-1<Hbr.indexOf(t)){for(;o!==null;){var i=o8(o);if(i!==null&&cZe(i),i=w0e(t,e,r,n),i===null&&Wwe(t,e,n,FX,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else Wwe(t,e,n,null,r)}}var FX=null;function w0e(t,e,r,n){if(FX=null,t=txe(n),t=RN(t),t!==null)if(e=qN(t),e===null)t=null;else if(r=e.tag,r===13){if(t=rZe(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 FX=t,null}function hZe(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(Dbr()){case rxe:return 1;case aZe:return 4;case jX:case Lbr:return 16;case sZe:return 536870912;default:return 16}default:return 16}}var wA=null,axe=null,xX=null;function gZe(){if(xX)return xX;var t,e=axe,r=e.length,n,o="value"in wA?wA.value:wA.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 xX=o.slice(t,1<n?1-n:void 0)}function SX(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 uX(){return!0}function HJe(){return!1}function Xm(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)?uX:HJe,this.isPropagationStopped=HJe,this}return Ya(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=uX)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=uX)},persist:function(){},isPersistent:uX}),e}var cz={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sxe=Xm(cz),n8=Ya({},cz,{view:0,detail:0}),Jbr=Xm(n8),zwe,Bwe,w6,rQ=Ya({},n8,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uxe,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!==w6&&(w6&&t.type==="mousemove"?(zwe=t.screenX-w6.screenX,Bwe=t.screenY-w6.screenY):Bwe=zwe=0,w6=t),zwe)},movementY:function(t){return"movementY"in t?t.movementY:Bwe}}),VJe=Xm(rQ),Zbr=Ya({},rQ,{dataTransfer:0}),Ybr=Xm(Zbr),Xbr=Ya({},n8,{relatedTarget:0}),Uwe=Xm(Xbr),Qbr=Ya({},cz,{animationName:0,elapsedTime:0,pseudoElement:0}),e_r=Xm(Qbr),t_r=Ya({},cz,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),r_r=Xm(t_r),n_r=Ya({},cz,{data:0}),WJe=Xm(n_r),o_r={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i_r={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"},a_r={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function s_r(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=a_r[t])?!!e[t]:!1}function uxe(){return s_r}var u_r=Ya({},n8,{key:function(t){if(t.key){var e=o_r[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=SX(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?i_r[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uxe,charCode:function(t){return t.type==="keypress"?SX(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?SX(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),l_r=Xm(u_r),c_r=Ya({},rQ,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),KJe=Xm(c_r),d_r=Ya({},n8,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uxe}),f_r=Xm(d_r),p_r=Ya({},cz,{propertyName:0,elapsedTime:0,pseudoElement:0}),m_r=Xm(p_r),h_r=Ya({},rQ,{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}),g_r=Xm(h_r),y_r=[9,13,27,32],lxe=KO&&"CompositionEvent"in window,R6=null;KO&&"documentMode"in document&&(R6=document.documentMode);var b_r=KO&&"TextEvent"in window&&!R6,yZe=KO&&(!lxe||R6&&8<R6&&11>=R6),GJe=" ",JJe=!1;function bZe(t,e){switch(t){case"keyup":return y_r.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _Ze(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var B$=!1;function __r(t,e){switch(t){case"compositionend":return _Ze(e);case"keypress":return e.which!==32?null:(JJe=!0,GJe);case"textInput":return t=e.data,t===GJe&&JJe?null:t;default:return null}}function v_r(t,e){if(B$)return t==="compositionend"||!lxe&&bZe(t,e)?(t=gZe(),xX=axe=wA=null,B$=!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 yZe&&e.locale!=="ko"?null:e.data;default:return null}}var w_r={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 ZJe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!w_r[t.type]:e==="textarea"}function vZe(t,e,r,n){Y7e(n),e=kX(e,"onChange"),0<e.length&&(r=new sxe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var N6=null,V6=null;function x_r(t){MZe(t,0)}function nQ(t){var e=H$(t);if(H7e(e))return t}function S_r(t,e){if(t==="change")return e}var wZe=!1;KO&&(KO?(cX="oninput"in document,cX||(qwe=document.createElement("div"),qwe.setAttribute("oninput","return;"),cX=typeof qwe.oninput=="function"),lX=cX):lX=!1,wZe=lX&&(!document.documentMode||9<document.documentMode));var lX,cX,qwe;function YJe(){N6&&(N6.detachEvent("onpropertychange",xZe),V6=N6=null)}function xZe(t){if(t.propertyName==="value"&&nQ(V6)){var e=[];vZe(e,V6,t,txe(t)),tZe(x_r,e)}}function C_r(t,e,r){t==="focusin"?(YJe(),N6=e,V6=r,N6.attachEvent("onpropertychange",xZe)):t==="focusout"&&YJe()}function O_r(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return nQ(V6)}function P_r(t,e){if(t==="click")return nQ(e)}function E_r(t,e){if(t==="input"||t==="change")return nQ(e)}function T_r(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var db=typeof Object.is=="function"?Object.is:T_r;function W6(t,e){if(db(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(!n0e.call(e,o)||!db(t[o],e[o]))return!1}return!0}function XJe(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function QJe(t,e){var r=XJe(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=XJe(r)}}function SZe(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?SZe(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function CZe(){for(var t=window,e=MX();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=MX(t.document)}return e}function cxe(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 A_r(t){var e=CZe(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&SZe(r.ownerDocument.documentElement,r)){if(n!==null&&cxe(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=QJe(r,i);var a=QJe(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 I_r=KO&&"documentMode"in document&&11>=document.documentMode,U$=null,x0e=null,j6=null,S0e=!1;function e7e(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;S0e||U$==null||U$!==MX(n)||(n=U$,"selectionStart"in n&&cxe(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}),j6&&W6(j6,n)||(j6=n,n=kX(x0e,"onSelect"),0<n.length&&(e=new sxe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=U$)))}function dX(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var q$={animationend:dX("Animation","AnimationEnd"),animationiteration:dX("Animation","AnimationIteration"),animationstart:dX("Animation","AnimationStart"),transitionend:dX("Transition","TransitionEnd")},Hwe={},OZe={};KO&&(OZe=document.createElement("div").style,"AnimationEvent"in window||(delete q$.animationend.animation,delete q$.animationiteration.animation,delete q$.animationstart.animation),"TransitionEvent"in window||delete q$.transitionend.transition);function oQ(t){if(Hwe[t])return Hwe[t];if(!q$[t])return t;var e=q$[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in OZe)return Hwe[t]=e[r];return t}var PZe=oQ("animationend"),EZe=oQ("animationiteration"),TZe=oQ("animationstart"),AZe=oQ("transitionend"),IZe=new Map,t7e="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 NA(t,e){IZe.set(t,e),UN(e,[t])}for(fX=0;fX<t7e.length;fX++)pX=t7e[fX],r7e=pX.toLowerCase(),n7e=pX[0].toUpperCase()+pX.slice(1),NA(r7e,"on"+n7e);var pX,r7e,n7e,fX;NA(PZe,"onAnimationEnd");NA(EZe,"onAnimationIteration");NA(TZe,"onAnimationStart");NA("dblclick","onDoubleClick");NA("focusin","onFocus");NA("focusout","onBlur");NA(AZe,"onTransitionEnd");nz("onMouseEnter",["mouseout","mouseover"]);nz("onMouseLeave",["mouseout","mouseover"]);nz("onPointerEnter",["pointerout","pointerover"]);nz("onPointerLeave",["pointerout","pointerover"]);UN("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));UN("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));UN("onBeforeInput",["compositionend","keypress","textInput","paste"]);UN("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));UN("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));UN("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var A6="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(" "),M_r=new Set("cancel close invalid load scroll toggle".split(" ").concat(A6));function o7e(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,Mbr(n,e,void 0,t),t.currentTarget=null}function MZe(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;o7e(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;o7e(o,s,l),i=u}}}if(NX)throw t=b0e,NX=!1,b0e=null,t}function fa(t,e){var r=e[T0e];r===void 0&&(r=e[T0e]=new Set);var n=t+"__bubble";r.has(n)||(RZe(e,t,2,!1),r.add(n))}function Vwe(t,e,r){var n=0;e&&(n|=4),RZe(r,t,n,e)}var mX="_reactListening"+Math.random().toString(36).slice(2);function K6(t){if(!t[mX]){t[mX]=!0,$7e.forEach(function(r){r!=="selectionchange"&&(M_r.has(r)||Vwe(r,!1,t),Vwe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[mX]||(e[mX]=!0,Vwe("selectionchange",!1,e))}}function RZe(t,e,r,n){switch(hZe(e)){case 1:var o=Kbr;break;case 4:o=Gbr;break;default:o=ixe}r=o.bind(null,e,r,t),o=void 0,!y0e||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 Wwe(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=RN(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}tZe(function(){var l=i,c=txe(r),d=[];e:{var f=IZe.get(t);if(f!==void 0){var p=sxe,m=t;switch(t){case"keypress":if(SX(r)===0)break e;case"keydown":case"keyup":p=l_r;break;case"focusin":m="focus",p=Uwe;break;case"focusout":m="blur",p=Uwe;break;case"beforeblur":case"afterblur":p=Uwe;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=VJe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Ybr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=f_r;break;case PZe:case EZe:case TZe:p=e_r;break;case AZe:p=m_r;break;case"scroll":p=Jbr;break;case"wheel":p=g_r;break;case"copy":case"cut":case"paste":p=r_r;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=KJe}var h=(e&4)!==0,b=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var y=l,x;y!==null;){x=y;var S=x.stateNode;if(x.tag===5&&S!==null&&(x=S,g!==null&&(S=B6(y,g),S!=null&&h.push(G6(y,S,x)))),b)break;y=y.return}0<h.length&&(f=new p(f,m,null,r,c),d.push({event:f,listeners:h}))}}if((e&7)===0){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==h0e&&(m=r.relatedTarget||r.fromElement)&&(RN(m)||m[GO]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=l,m=m?RN(m):null,m!==null&&(b=qN(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=VJe,S="onMouseLeave",g="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(h=KJe,S="onPointerLeave",g="onPointerEnter",y="pointer"),b=p==null?f:H$(p),x=m==null?f:H$(m),f=new h(S,y+"leave",p,r,c),f.target=b,f.relatedTarget=x,S=null,RN(c)===l&&(h=new h(g,y+"enter",m,r,c),h.target=x,h.relatedTarget=b,S=h),b=S,p&&m)t:{for(h=p,g=m,y=0,x=h;x;x=k$(x))y++;for(x=0,S=g;S;S=k$(S))x++;for(;0<y-x;)h=k$(h),y--;for(;0<x-y;)g=k$(g),x--;for(;y--;){if(h===g||g!==null&&h===g.alternate)break t;h=k$(h),g=k$(g)}h=null}else h=null;p!==null&&i7e(d,f,p,h,!1),m!==null&&b!==null&&i7e(d,b,m,h,!0)}}e:{if(f=l?H$(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var O=S_r;else if(ZJe(f))if(wZe)O=E_r;else{O=O_r;var E=C_r}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(O=P_r);if(O&&(O=O(t,l))){vZe(d,O,r,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&c0e(f,"number",f.value)}switch(E=l?H$(l):window,t){case"focusin":(ZJe(E)||E.contentEditable==="true")&&(U$=E,x0e=l,j6=null);break;case"focusout":j6=x0e=U$=null;break;case"mousedown":S0e=!0;break;case"contextmenu":case"mouseup":case"dragend":S0e=!1,e7e(d,r,c);break;case"selectionchange":if(I_r)break;case"keydown":case"keyup":e7e(d,r,c)}var P;if(lxe)e:{switch(t){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else B$?bZe(t,r)&&(A="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(A="onCompositionStart");A&&(yZe&&r.locale!=="ko"&&(B$||A!=="onCompositionStart"?A==="onCompositionEnd"&&B$&&(P=gZe()):(wA=c,axe="value"in wA?wA.value:wA.textContent,B$=!0)),E=kX(l,A),0<E.length&&(A=new WJe(A,t,null,r,c),d.push({event:A,listeners:E}),P?A.data=P:(P=_Ze(r),P!==null&&(A.data=P)))),(P=b_r?__r(t,r):v_r(t,r))&&(l=kX(l,"onBeforeInput"),0<l.length&&(c=new WJe("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=P))}MZe(d,e)})}function G6(t,e,r){return{instance:t,listener:e,currentTarget:r}}function kX(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=B6(t,r),i!=null&&n.unshift(G6(t,i,o)),i=B6(t,e),i!=null&&n.push(G6(t,i,o))),t=t.return}return n}function k$(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function i7e(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=B6(r,i),u!=null&&a.unshift(G6(r,u,s))):o||(u=B6(r,i),u!=null&&a.push(G6(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var R_r=/\r\n?/g,N_r=/\u0000|\uFFFD/g;function a7e(t){return(typeof t=="string"?t:""+t).replace(R_r,`
|
||
`).replace(N_r,"")}function hX(t,e,r){if(e=a7e(e),a7e(t)!==e&&r)throw Error(Ve(425))}function $X(){}var C0e=null,O0e=null;function P0e(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 E0e=typeof setTimeout=="function"?setTimeout:void 0,j_r=typeof clearTimeout=="function"?clearTimeout:void 0,s7e=typeof Promise=="function"?Promise:void 0,D_r=typeof queueMicrotask=="function"?queueMicrotask:typeof s7e<"u"?function(t){return s7e.resolve(null).then(t).catch(L_r)}:E0e;function L_r(t){setTimeout(function(){throw t})}function Kwe(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),H6(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);H6(e)}function PA(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 u7e(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 dz=Math.random().toString(36).slice(2),Q_="__reactFiber$"+dz,J6="__reactProps$"+dz,GO="__reactContainer$"+dz,T0e="__reactEvents$"+dz,F_r="__reactListeners$"+dz,k_r="__reactHandles$"+dz;function RN(t){var e=t[Q_];if(e)return e;for(var r=t.parentNode;r;){if(e=r[GO]||r[Q_]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=u7e(t);t!==null;){if(r=t[Q_])return r;t=u7e(t)}return e}t=r,r=t.parentNode}return null}function o8(t){return t=t[Q_]||t[GO],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function H$(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Ve(33))}function iQ(t){return t[J6]||null}var A0e=[],V$=-1;function jA(t){return{current:t}}function pa(t){0>V$||(t.current=A0e[V$],A0e[V$]=null,V$--)}function Yi(t,e){V$++,A0e[V$]=t.current,t.current=e}var RA={},mf=jA(RA),em=jA(!1),FN=RA;function oz(t,e){var r=t.type.contextTypes;if(!r)return RA;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 tm(t){return t=t.childContextTypes,t!=null}function zX(){pa(em),pa(mf)}function l7e(t,e,r){if(mf.current!==RA)throw Error(Ve(168));Yi(mf,e),Yi(em,r)}function NZe(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(Ve(108,Cbr(t)||"Unknown",o));return Ya({},r,n)}function BX(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||RA,FN=mf.current,Yi(mf,t),Yi(em,em.current),!0}function c7e(t,e,r){var n=t.stateNode;if(!n)throw Error(Ve(169));r?(t=NZe(t,e,FN),n.__reactInternalMemoizedMergedChildContext=t,pa(em),pa(mf),Yi(mf,t)):pa(em),Yi(em,r)}var qO=null,aQ=!1,Gwe=!1;function jZe(t){qO===null?qO=[t]:qO.push(t)}function $_r(t){aQ=!0,jZe(t)}function DA(){if(!Gwe&&qO!==null){Gwe=!0;var t=0,e=Ti;try{var r=qO;for(Ti=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}qO=null,aQ=!1}catch(o){throw qO!==null&&(qO=qO.slice(t+1)),iZe(rxe,DA),o}finally{Ti=e,Gwe=!1}}return null}var W$=[],K$=0,UX=null,qX=0,vg=[],wg=0,kN=null,HO=1,VO="";function IN(t,e){W$[K$++]=qX,W$[K$++]=UX,UX=t,qX=e}function DZe(t,e,r){vg[wg++]=HO,vg[wg++]=VO,vg[wg++]=kN,kN=t;var n=HO;t=VO;var o=32-lb(n)-1;n&=~(1<<o),r+=1;var i=32-lb(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,HO=1<<32-lb(e)+o|r<<o|n,VO=i+t}else HO=1<<i|r<<o|n,VO=t}function dxe(t){t.return!==null&&(IN(t,1),DZe(t,1,0))}function fxe(t){for(;t===UX;)UX=W$[--K$],W$[K$]=null,qX=W$[--K$],W$[K$]=null;for(;t===kN;)kN=vg[--wg],vg[wg]=null,VO=vg[--wg],vg[wg]=null,HO=vg[--wg],vg[wg]=null}var Zm=null,Jm=null,Ra=!1,ub=null;function LZe(t,e){var r=xg(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 d7e(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,Zm=t,Jm=PA(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Zm=t,Jm=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=kN!==null?{id:HO,overflow:VO}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=xg(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Zm=t,Jm=null,!0):!1;default:return!1}}function I0e(t){return(t.mode&1)!==0&&(t.flags&128)===0}function M0e(t){if(Ra){var e=Jm;if(e){var r=e;if(!d7e(t,e)){if(I0e(t))throw Error(Ve(418));e=PA(r.nextSibling);var n=Zm;e&&d7e(t,e)?LZe(n,r):(t.flags=t.flags&-4097|2,Ra=!1,Zm=t)}}else{if(I0e(t))throw Error(Ve(418));t.flags=t.flags&-4097|2,Ra=!1,Zm=t}}}function f7e(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Zm=t}function gX(t){if(t!==Zm)return!1;if(!Ra)return f7e(t),Ra=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!P0e(t.type,t.memoizedProps)),e&&(e=Jm)){if(I0e(t))throw FZe(),Error(Ve(418));for(;e;)LZe(t,e),e=PA(e.nextSibling)}if(f7e(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Ve(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Jm=PA(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Jm=null}}else Jm=Zm?PA(t.stateNode.nextSibling):null;return!0}function FZe(){for(var t=Jm;t;)t=PA(t.nextSibling)}function iz(){Jm=Zm=null,Ra=!1}function pxe(t){ub===null?ub=[t]:ub.push(t)}var z_r=YO.ReactCurrentBatchConfig;function ab(t,e){if(t&&t.defaultProps){e=Ya({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var HX=jA(null),VX=null,G$=null,mxe=null;function hxe(){mxe=G$=VX=null}function gxe(t){var e=HX.current;pa(HX),t._currentValue=e}function R0e(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 tz(t,e){VX=t,mxe=G$=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(Qp=!0),t.firstContext=null)}function Cg(t){var e=t._currentValue;if(mxe!==t)if(t={context:t,memoizedValue:e,next:null},G$===null){if(VX===null)throw Error(Ve(308));G$=t,VX.dependencies={lanes:0,firstContext:t}}else G$=G$.next=t;return e}var NN=null;function yxe(t){NN===null?NN=[t]:NN.push(t)}function kZe(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,yxe(e)):(r.next=o.next,o.next=r),e.interleaved=r,JO(t,n)}function JO(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 bA=!1;function bxe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $Ze(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 WO(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function EA(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(To&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,JO(t,r)}return o=n.interleaved,o===null?(e.next=e,yxe(n)):(e.next=o.next,o.next=e),n.interleaved=e,JO(t,r)}function CX(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,nxe(t,r)}}function p7e(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 WX(t,e,r,n){var o=t.updateQueue;bA=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,l=u.next;u.next=null,a===null?i=l:a.next=l,a=u;var c=t.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==a&&(s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;a=0,c=l=u=null,s=i;do{var f=s.lane,p=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var m=t,h=s;switch(f=e,p=r,h.tag){case 1:if(m=h.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=Ya({},d,f);break e;case 2:bA=!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);zN|=a,t.lanes=a,t.memoizedState=d}}function m7e(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(Ve(191,o));o.call(n)}}}var zZe=new k7e.Component().refs;function N0e(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:Ya({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var sQ={isMounted:function(t){return(t=t._reactInternals)?qN(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=sp(),o=AA(t),i=WO(n,o);i.payload=e,r!=null&&(i.callback=r),e=EA(t,i,o),e!==null&&(cb(e,t,o,n),CX(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=sp(),o=AA(t),i=WO(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=EA(t,i,o),e!==null&&(cb(e,t,o,n),CX(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=sp(),n=AA(t),o=WO(r,n);o.tag=2,e!=null&&(o.callback=e),e=EA(t,o,n),e!==null&&(cb(e,t,n,r),CX(e,t,n))}};function h7e(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?!W6(r,n)||!W6(o,i):!0}function BZe(t,e,r){var n=!1,o=RA,i=e.contextType;return typeof i=="object"&&i!==null?i=Cg(i):(o=tm(e)?FN:mf.current,n=e.contextTypes,i=(n=n!=null)?oz(t,o):RA),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=sQ,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function g7e(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&&sQ.enqueueReplaceState(e,e.state,null)}function j0e(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=zZe,bxe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=Cg(i):(i=tm(e)?FN:mf.current,o.context=oz(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(N0e(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&&sQ.enqueueReplaceState(o,o.state,null),WX(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function x6(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(Ve(309));var n=r.stateNode}if(!n)throw Error(Ve(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===zZe&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(Ve(284));if(!r._owner)throw Error(Ve(290,t))}return t}function yX(t,e){throw t=Object.prototype.toString.call(e),Error(Ve(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function y7e(t){var e=t._init;return e(t._payload)}function UZe(t){function e(g,y){if(t){var x=g.deletions;x===null?(g.deletions=[y],g.flags|=16):x.push(y)}}function r(g,y){if(!t)return null;for(;y!==null;)e(g,y),y=y.sibling;return null}function n(g,y){for(g=new Map;y!==null;)y.key!==null?g.set(y.key,y):g.set(y.index,y),y=y.sibling;return g}function o(g,y){return g=IA(g,y),g.index=0,g.sibling=null,g}function i(g,y,x){return g.index=x,t?(x=g.alternate,x!==null?(x=x.index,x<y?(g.flags|=2,y):x):(g.flags|=2,y)):(g.flags|=1048576,y)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,y,x,S){return y===null||y.tag!==6?(y=t0e(x,g.mode,S),y.return=g,y):(y=o(y,x),y.return=g,y)}function u(g,y,x,S){var O=x.type;return O===z$?c(g,y,x.props.children,S,x.key):y!==null&&(y.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===yA&&y7e(O)===y.type)?(S=o(y,x.props),S.ref=x6(g,y,x),S.return=g,S):(S=IX(x.type,x.key,x.props,null,g.mode,S),S.ref=x6(g,y,x),S.return=g,S)}function l(g,y,x,S){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=r0e(x,g.mode,S),y.return=g,y):(y=o(y,x.children||[]),y.return=g,y)}function c(g,y,x,S,O){return y===null||y.tag!==7?(y=LN(x,g.mode,S,O),y.return=g,y):(y=o(y,x),y.return=g,y)}function d(g,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=t0e(""+y,g.mode,x),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case rX:return x=IX(y.type,y.key,y.props,null,g.mode,x),x.ref=x6(g,null,y),x.return=g,x;case $$:return y=r0e(y,g.mode,x),y.return=g,y;case yA:var S=y._init;return d(g,S(y._payload),x)}if(E6(y)||b6(y))return y=LN(y,g.mode,x,null),y.return=g,y;yX(g,y)}return null}function f(g,y,x,S){var O=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return O!==null?null:s(g,y,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case rX:return x.key===O?u(g,y,x,S):null;case $$:return x.key===O?l(g,y,x,S):null;case yA:return O=x._init,f(g,y,O(x._payload),S)}if(E6(x)||b6(x))return O!==null?null:c(g,y,x,S,null);yX(g,x)}return null}function p(g,y,x,S,O){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(x)||null,s(y,g,""+S,O);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case rX:return g=g.get(S.key===null?x:S.key)||null,u(y,g,S,O);case $$:return g=g.get(S.key===null?x:S.key)||null,l(y,g,S,O);case yA:var E=S._init;return p(g,y,x,E(S._payload),O)}if(E6(S)||b6(S))return g=g.get(x)||null,c(y,g,S,O,null);yX(y,S)}return null}function m(g,y,x,S){for(var O=null,E=null,P=y,A=y=0,I=null;P!==null&&A<x.length;A++){P.index>A?(I=P,P=null):I=P.sibling;var R=f(g,P,x[A],S);if(R===null){P===null&&(P=I);break}t&&P&&R.alternate===null&&e(g,P),y=i(R,y,A),E===null?O=R:E.sibling=R,E=R,P=I}if(A===x.length)return r(g,P),Ra&&IN(g,A),O;if(P===null){for(;A<x.length;A++)P=d(g,x[A],S),P!==null&&(y=i(P,y,A),E===null?O=P:E.sibling=P,E=P);return Ra&&IN(g,A),O}for(P=n(g,P);A<x.length;A++)I=p(P,g,A,x[A],S),I!==null&&(t&&I.alternate!==null&&P.delete(I.key===null?A:I.key),y=i(I,y,A),E===null?O=I:E.sibling=I,E=I);return t&&P.forEach(function(N){return e(g,N)}),Ra&&IN(g,A),O}function h(g,y,x,S){var O=b6(x);if(typeof O!="function")throw Error(Ve(150));if(x=O.call(x),x==null)throw Error(Ve(151));for(var E=O=null,P=y,A=y=0,I=null,R=x.next();P!==null&&!R.done;A++,R=x.next()){P.index>A?(I=P,P=null):I=P.sibling;var N=f(g,P,R.value,S);if(N===null){P===null&&(P=I);break}t&&P&&N.alternate===null&&e(g,P),y=i(N,y,A),E===null?O=N:E.sibling=N,E=N,P=I}if(R.done)return r(g,P),Ra&&IN(g,A),O;if(P===null){for(;!R.done;A++,R=x.next())R=d(g,R.value,S),R!==null&&(y=i(R,y,A),E===null?O=R:E.sibling=R,E=R);return Ra&&IN(g,A),O}for(P=n(g,P);!R.done;A++,R=x.next())R=p(P,g,A,R.value,S),R!==null&&(t&&R.alternate!==null&&P.delete(R.key===null?A:R.key),y=i(R,y,A),E===null?O=R:E.sibling=R,E=R);return t&&P.forEach(function(j){return e(g,j)}),Ra&&IN(g,A),O}function b(g,y,x,S){if(typeof x=="object"&&x!==null&&x.type===z$&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case rX:e:{for(var O=x.key,E=y;E!==null;){if(E.key===O){if(O=x.type,O===z$){if(E.tag===7){r(g,E.sibling),y=o(E,x.props.children),y.return=g,g=y;break e}}else if(E.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===yA&&y7e(O)===E.type){r(g,E.sibling),y=o(E,x.props),y.ref=x6(g,E,x),y.return=g,g=y;break e}r(g,E);break}else e(g,E);E=E.sibling}x.type===z$?(y=LN(x.props.children,g.mode,S,x.key),y.return=g,g=y):(S=IX(x.type,x.key,x.props,null,g.mode,S),S.ref=x6(g,y,x),S.return=g,g=S)}return a(g);case $$:e:{for(E=x.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){r(g,y.sibling),y=o(y,x.children||[]),y.return=g,g=y;break e}else{r(g,y);break}else e(g,y);y=y.sibling}y=r0e(x,g.mode,S),y.return=g,g=y}return a(g);case yA:return E=x._init,b(g,y,E(x._payload),S)}if(E6(x))return m(g,y,x,S);if(b6(x))return h(g,y,x,S);yX(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(r(g,y.sibling),y=o(y,x),y.return=g,g=y):(r(g,y),y=t0e(x,g.mode,S),y.return=g,g=y),a(g)):r(g,y)}return b}var az=UZe(!0),qZe=UZe(!1),i8={},tv=jA(i8),Z6=jA(i8),Y6=jA(i8);function jN(t){if(t===i8)throw Error(Ve(174));return t}function _xe(t,e){switch(Yi(Y6,e),Yi(Z6,t),Yi(tv,i8),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:f0e(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=f0e(e,t)}pa(tv),Yi(tv,e)}function sz(){pa(tv),pa(Z6),pa(Y6)}function HZe(t){jN(Y6.current);var e=jN(tv.current),r=f0e(e,t.type);e!==r&&(Yi(Z6,t),Yi(tv,r))}function vxe(t){Z6.current===t&&(pa(tv),pa(Z6))}var Ja=jA(0);function KX(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 Jwe=[];function wxe(){for(var t=0;t<Jwe.length;t++)Jwe[t]._workInProgressVersionPrimary=null;Jwe.length=0}var OX=YO.ReactCurrentDispatcher,Zwe=YO.ReactCurrentBatchConfig,$N=0,Za=null,ql=null,mc=null,GX=!1,D6=!1,X6=0,B_r=0;function df(){throw Error(Ve(321))}function xxe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!db(t[r],e[r]))return!1;return!0}function Sxe(t,e,r,n,o,i){if($N=i,Za=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,OX.current=t===null||t.memoizedState===null?V_r:W_r,t=r(n,o),D6){i=0;do{if(D6=!1,X6=0,25<=i)throw Error(Ve(301));i+=1,mc=ql=null,e.updateQueue=null,OX.current=K_r,t=r(n,o)}while(D6)}if(OX.current=JX,e=ql!==null&&ql.next!==null,$N=0,mc=ql=Za=null,GX=!1,e)throw Error(Ve(300));return t}function Cxe(){var t=X6!==0;return X6=0,t}function X_(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mc===null?Za.memoizedState=mc=t:mc=mc.next=t,mc}function Og(){if(ql===null){var t=Za.alternate;t=t!==null?t.memoizedState:null}else t=ql.next;var e=mc===null?Za.memoizedState:mc.next;if(e!==null)mc=e,ql=t;else{if(t===null)throw Error(Ve(310));ql=t,t={memoizedState:ql.memoizedState,baseState:ql.baseState,baseQueue:ql.baseQueue,queue:ql.queue,next:null},mc===null?Za.memoizedState=mc=t:mc=mc.next=t}return mc}function Q6(t,e){return typeof e=="function"?e(t):e}function Ywe(t){var e=Og(),r=e.queue;if(r===null)throw Error(Ve(311));r.lastRenderedReducer=t;var n=ql,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(($N&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,Za.lanes|=c,zN|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,db(n,e.memoizedState)||(Qp=!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,Za.lanes|=i,zN|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Xwe(t){var e=Og(),r=e.queue;if(r===null)throw Error(Ve(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);db(i,e.memoizedState)||(Qp=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function VZe(){}function WZe(t,e){var r=Za,n=Og(),o=e(),i=!db(n.memoizedState,o);if(i&&(n.memoizedState=o,Qp=!0),n=n.queue,Oxe(JZe.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||mc!==null&&mc.memoizedState.tag&1){if(r.flags|=2048,e8(9,GZe.bind(null,r,n,o,e),void 0,null),hc===null)throw Error(Ve(349));($N&30)!==0||KZe(r,e,o)}return o}function KZe(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=Za.updateQueue,e===null?(e={lastEffect:null,stores:null},Za.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function GZe(t,e,r,n){e.value=r,e.getSnapshot=n,ZZe(e)&&YZe(t)}function JZe(t,e,r){return r(function(){ZZe(e)&&YZe(t)})}function ZZe(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!db(t,r)}catch{return!0}}function YZe(t){var e=JO(t,1);e!==null&&cb(e,t,1,-1)}function b7e(t){var e=X_();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Q6,lastRenderedState:t},e.queue=t,t=t.dispatch=H_r.bind(null,Za,t),[e.memoizedState,t]}function e8(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=Za.updateQueue,e===null?(e={lastEffect:null,stores:null},Za.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 XZe(){return Og().memoizedState}function PX(t,e,r,n){var o=X_();Za.flags|=t,o.memoizedState=e8(1|e,r,void 0,n===void 0?null:n)}function uQ(t,e,r,n){var o=Og();n=n===void 0?null:n;var i=void 0;if(ql!==null){var a=ql.memoizedState;if(i=a.destroy,n!==null&&xxe(n,a.deps)){o.memoizedState=e8(e,r,i,n);return}}Za.flags|=t,o.memoizedState=e8(1|e,r,i,n)}function _7e(t,e){return PX(8390656,8,t,e)}function Oxe(t,e){return uQ(2048,8,t,e)}function QZe(t,e){return uQ(4,2,t,e)}function eYe(t,e){return uQ(4,4,t,e)}function tYe(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 rYe(t,e,r){return r=r!=null?r.concat([t]):null,uQ(4,4,tYe.bind(null,e,t),r)}function Pxe(){}function nYe(t,e){var r=Og();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&xxe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function oYe(t,e){var r=Og();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&xxe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function iYe(t,e,r){return($N&21)===0?(t.baseState&&(t.baseState=!1,Qp=!0),t.memoizedState=r):(db(r,e)||(r=uZe(),Za.lanes|=r,zN|=r,t.baseState=!0),e)}function U_r(t,e){var r=Ti;Ti=r!==0&&4>r?r:4,t(!0);var n=Zwe.transition;Zwe.transition={};try{t(!1),e()}finally{Ti=r,Zwe.transition=n}}function aYe(){return Og().memoizedState}function q_r(t,e,r){var n=AA(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},sYe(t))uYe(e,r);else if(r=kZe(t,e,r,n),r!==null){var o=sp();cb(r,t,n,o),lYe(r,e,n)}}function H_r(t,e,r){var n=AA(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(sYe(t))uYe(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,db(s,a)){var u=e.interleaved;u===null?(o.next=o,yxe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=kZe(t,e,o,n),r!==null&&(o=sp(),cb(r,t,n,o),lYe(r,e,n))}}function sYe(t){var e=t.alternate;return t===Za||e!==null&&e===Za}function uYe(t,e){D6=GX=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function lYe(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,nxe(t,r)}}var JX={readContext:Cg,useCallback:df,useContext:df,useEffect:df,useImperativeHandle:df,useInsertionEffect:df,useLayoutEffect:df,useMemo:df,useReducer:df,useRef:df,useState:df,useDebugValue:df,useDeferredValue:df,useTransition:df,useMutableSource:df,useSyncExternalStore:df,useId:df,unstable_isNewReconciler:!1},V_r={readContext:Cg,useCallback:function(t,e){return X_().memoizedState=[t,e===void 0?null:e],t},useContext:Cg,useEffect:_7e,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,PX(4194308,4,tYe.bind(null,e,t),r)},useLayoutEffect:function(t,e){return PX(4194308,4,t,e)},useInsertionEffect:function(t,e){return PX(4,2,t,e)},useMemo:function(t,e){var r=X_();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=X_();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=q_r.bind(null,Za,t),[n.memoizedState,t]},useRef:function(t){var e=X_();return t={current:t},e.memoizedState=t},useState:b7e,useDebugValue:Pxe,useDeferredValue:function(t){return X_().memoizedState=t},useTransition:function(){var t=b7e(!1),e=t[0];return t=U_r.bind(null,t[1]),X_().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=Za,o=X_();if(Ra){if(r===void 0)throw Error(Ve(407));r=r()}else{if(r=e(),hc===null)throw Error(Ve(349));($N&30)!==0||KZe(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,_7e(JZe.bind(null,n,i,t),[t]),n.flags|=2048,e8(9,GZe.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=X_(),e=hc.identifierPrefix;if(Ra){var r=VO,n=HO;r=(n&~(1<<32-lb(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=X6++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=B_r++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},W_r={readContext:Cg,useCallback:nYe,useContext:Cg,useEffect:Oxe,useImperativeHandle:rYe,useInsertionEffect:QZe,useLayoutEffect:eYe,useMemo:oYe,useReducer:Ywe,useRef:XZe,useState:function(){return Ywe(Q6)},useDebugValue:Pxe,useDeferredValue:function(t){var e=Og();return iYe(e,ql.memoizedState,t)},useTransition:function(){var t=Ywe(Q6)[0],e=Og().memoizedState;return[t,e]},useMutableSource:VZe,useSyncExternalStore:WZe,useId:aYe,unstable_isNewReconciler:!1},K_r={readContext:Cg,useCallback:nYe,useContext:Cg,useEffect:Oxe,useImperativeHandle:rYe,useInsertionEffect:QZe,useLayoutEffect:eYe,useMemo:oYe,useReducer:Xwe,useRef:XZe,useState:function(){return Xwe(Q6)},useDebugValue:Pxe,useDeferredValue:function(t){var e=Og();return ql===null?e.memoizedState=t:iYe(e,ql.memoizedState,t)},useTransition:function(){var t=Xwe(Q6)[0],e=Og().memoizedState;return[t,e]},useMutableSource:VZe,useSyncExternalStore:WZe,useId:aYe,unstable_isNewReconciler:!1};function uz(t,e){try{var r="",n=e;do r+=Sbr(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 Qwe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function D0e(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var G_r=typeof WeakMap=="function"?WeakMap:Map;function cYe(t,e,r){r=WO(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){YX||(YX=!0,V0e=n),D0e(t,e)},r}function dYe(t,e,r){r=WO(-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(){D0e(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){D0e(t,e),typeof n!="function"&&(TA===null?TA=new Set([this]):TA.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function v7e(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new G_r;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=uvr.bind(null,t,e,r),e.then(t,t))}function w7e(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 x7e(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=WO(-1,1),e.tag=2,EA(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var J_r=YO.ReactCurrentOwner,Qp=!1;function ap(t,e,r,n){e.child=t===null?qZe(e,null,r,n):az(e,t.child,r,n)}function S7e(t,e,r,n,o){r=r.render;var i=e.ref;return tz(e,o),n=Sxe(t,e,r,n,i,o),r=Cxe(),t!==null&&!Qp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,ZO(t,e,o)):(Ra&&r&&dxe(e),e.flags|=1,ap(t,e,n,o),e.child)}function C7e(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!jxe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,fYe(t,e,i,n,o)):(t=IX(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:W6,r(a,n)&&t.ref===e.ref)return ZO(t,e,o)}return e.flags|=1,t=IA(i,n),t.ref=e.ref,t.return=e,e.child=t}function fYe(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(W6(i,n)&&t.ref===e.ref)if(Qp=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(Qp=!0);else return e.lanes=t.lanes,ZO(t,e,o)}return L0e(t,e,r,n,o)}function pYe(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},Yi(Z$,Gm),Gm|=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,Yi(Z$,Gm),Gm|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Yi(Z$,Gm),Gm|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,Yi(Z$,Gm),Gm|=n;return ap(t,e,o,r),e.child}function mYe(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function L0e(t,e,r,n,o){var i=tm(r)?FN:mf.current;return i=oz(e,i),tz(e,o),r=Sxe(t,e,r,n,i,o),n=Cxe(),t!==null&&!Qp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,ZO(t,e,o)):(Ra&&n&&dxe(e),e.flags|=1,ap(t,e,r,o),e.child)}function O7e(t,e,r,n,o){if(tm(r)){var i=!0;BX(e)}else i=!1;if(tz(e,o),e.stateNode===null)EX(t,e),BZe(e,r,n),j0e(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=Cg(l):(l=tm(r)?FN:mf.current,l=oz(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)&&g7e(e,a,n,l),bA=!1;var f=e.memoizedState;a.state=f,WX(e,n,a,o),u=e.memoizedState,s!==n||f!==u||em.current||bA?(typeof c=="function"&&(N0e(e,r,c,n),u=e.memoizedState),(s=bA||h7e(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,$Ze(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:ab(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=Cg(u):(u=tm(r)?FN:mf.current,u=oz(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)&&g7e(e,a,n,u),bA=!1,f=e.memoizedState,a.state=f,WX(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||em.current||bA?(typeof p=="function"&&(N0e(e,r,p,n),m=e.memoizedState),(l=bA||h7e(e,r,l,n,f,m,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return F0e(t,e,r,n,i,o)}function F0e(t,e,r,n,o,i){mYe(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&c7e(e,r,!1),ZO(t,e,i);n=e.stateNode,J_r.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=az(e,t.child,null,i),e.child=az(e,null,s,i)):ap(t,e,s,i),e.memoizedState=n.state,o&&c7e(e,r,!0),e.child}function hYe(t){var e=t.stateNode;e.pendingContext?l7e(t,e.pendingContext,e.pendingContext!==e.context):e.context&&l7e(t,e.context,!1),_xe(t,e.containerInfo)}function P7e(t,e,r,n,o){return iz(),pxe(o),e.flags|=256,ap(t,e,r,n),e.child}var k0e={dehydrated:null,treeContext:null,retryLane:0};function $0e(t){return{baseLanes:t,cachePool:null,transitions:null}}function gYe(t,e,r){var n=e.pendingProps,o=Ja.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),Yi(Ja,o&1),t===null)return M0e(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=dQ(a,n,0,null),t=LN(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=$0e(r),e.memoizedState=k0e,t):Exe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return Z_r(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=IA(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=IA(s,i):(i=LN(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?$0e(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=k0e,n}return i=t.child,t=i.sibling,n=IA(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 Exe(t,e){return e=dQ({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function bX(t,e,r,n){return n!==null&&pxe(n),az(e,t.child,null,r),t=Exe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Z_r(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=Qwe(Error(Ve(422))),bX(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=dQ({mode:"visible",children:n.children},o,0,null),i=LN(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&az(e,t.child,null,a),e.child.memoizedState=$0e(a),e.memoizedState=k0e,i);if((e.mode&1)===0)return bX(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Ve(419)),n=Qwe(i,n,void 0),bX(t,e,a,n)}if(s=(a&t.childLanes)!==0,Qp||s){if(n=hc,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,JO(t,o),cb(n,t,o,-1))}return Nxe(),n=Qwe(Error(Ve(421))),bX(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=lvr.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Jm=PA(o.nextSibling),Zm=e,Ra=!0,ub=null,t!==null&&(vg[wg++]=HO,vg[wg++]=VO,vg[wg++]=kN,HO=t.id,VO=t.overflow,kN=e),e=Exe(e,n.children),e.flags|=4096,e)}function E7e(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),R0e(t.return,e,r)}function e0e(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 yYe(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(ap(t,e,n.children,r),n=Ja.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&&E7e(t,r,e);else if(t.tag===19)E7e(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(Yi(Ja,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&&KX(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),e0e(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&&KX(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}e0e(e,!0,r,null,i);break;case"together":e0e(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function EX(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ZO(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),zN|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(Ve(153));if(e.child!==null){for(t=e.child,r=IA(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=IA(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function Y_r(t,e,r){switch(e.tag){case 3:hYe(e),iz();break;case 5:HZe(e);break;case 1:tm(e.type)&&BX(e);break;case 4:_xe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;Yi(HX,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Yi(Ja,Ja.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?gYe(t,e,r):(Yi(Ja,Ja.current&1),t=ZO(t,e,r),t!==null?t.sibling:null);Yi(Ja,Ja.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return yYe(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Yi(Ja,Ja.current),n)break;return null;case 22:case 23:return e.lanes=0,pYe(t,e,r)}return ZO(t,e,r)}var bYe,z0e,_Ye,vYe;bYe=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}};z0e=function(){};_Ye=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,jN(tv.current);var i=null;switch(r){case"input":o=u0e(t,o),n=u0e(t,n),i=[];break;case"select":o=Ya({},o,{value:void 0}),n=Ya({},n,{value:void 0}),i=[];break;case"textarea":o=d0e(t,o),n=d0e(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=$X)}p0e(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"&&($6.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"&&($6.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&fa("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)}};vYe=function(t,e,r,n){r!==n&&(e.flags|=4)};function S6(t,e){if(!Ra)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 ff(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 X_r(t,e,r){var n=e.pendingProps;switch(fxe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ff(e),null;case 1:return tm(e.type)&&zX(),ff(e),null;case 3:return n=e.stateNode,sz(),pa(em),pa(mf),wxe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(gX(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,ub!==null&&(G0e(ub),ub=null))),z0e(t,e),ff(e),null;case 5:vxe(e);var o=jN(Y6.current);if(r=e.type,t!==null&&e.stateNode!=null)_Ye(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Ve(166));return ff(e),null}if(t=jN(tv.current),gX(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[Q_]=e,n[J6]=i,t=(e.mode&1)!==0,r){case"dialog":fa("cancel",n),fa("close",n);break;case"iframe":case"object":case"embed":fa("load",n);break;case"video":case"audio":for(o=0;o<A6.length;o++)fa(A6[o],n);break;case"source":fa("error",n);break;case"img":case"image":case"link":fa("error",n),fa("load",n);break;case"details":fa("toggle",n);break;case"input":DJe(n,i),fa("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},fa("invalid",n);break;case"textarea":FJe(n,i),fa("invalid",n)}p0e(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&&hX(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&hX(n.textContent,s,t),o=["children",""+s]):$6.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&fa("scroll",n)}switch(r){case"input":nX(n),LJe(n,i,!0);break;case"textarea":nX(n),kJe(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=$X)}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=K7e(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[Q_]=e,t[J6]=n,bYe(t,e,!1,!1),e.stateNode=t;e:{switch(a=m0e(r,n),r){case"dialog":fa("cancel",t),fa("close",t),o=n;break;case"iframe":case"object":case"embed":fa("load",t),o=n;break;case"video":case"audio":for(o=0;o<A6.length;o++)fa(A6[o],t);o=n;break;case"source":fa("error",t),o=n;break;case"img":case"image":case"link":fa("error",t),fa("load",t),o=n;break;case"details":fa("toggle",t),o=n;break;case"input":DJe(t,n),o=u0e(t,n),fa("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=Ya({},n,{value:void 0}),fa("invalid",t);break;case"textarea":FJe(t,n),o=d0e(t,n),fa("invalid",t);break;default:o=n}p0e(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?Z7e(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&G7e(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&z6(t,u):typeof u=="number"&&z6(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($6.hasOwnProperty(i)?u!=null&&i==="onScroll"&&fa("scroll",t):u!=null&&Y0e(t,i,u,a))}switch(r){case"input":nX(t),LJe(t,n,!1);break;case"textarea":nX(t),kJe(t);break;case"option":n.value!=null&&t.setAttribute("value",""+MA(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?Y$(t,!!n.multiple,i,!1):n.defaultValue!=null&&Y$(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=$X)}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 ff(e),null;case 6:if(t&&e.stateNode!=null)vYe(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(Ve(166));if(r=jN(Y6.current),jN(tv.current),gX(e)){if(n=e.stateNode,r=e.memoizedProps,n[Q_]=e,(i=n.nodeValue!==r)&&(t=Zm,t!==null))switch(t.tag){case 3:hX(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&hX(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Q_]=e,e.stateNode=n}return ff(e),null;case 13:if(pa(Ja),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ra&&Jm!==null&&(e.mode&1)!==0&&(e.flags&128)===0)FZe(),iz(),e.flags|=98560,i=!1;else if(i=gX(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(Ve(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ve(317));i[Q_]=e}else iz(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;ff(e),i=!1}else ub!==null&&(G0e(ub),ub=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||(Ja.current&1)!==0?Hl===0&&(Hl=3):Nxe())),e.updateQueue!==null&&(e.flags|=4),ff(e),null);case 4:return sz(),z0e(t,e),t===null&&K6(e.stateNode.containerInfo),ff(e),null;case 10:return gxe(e.type._context),ff(e),null;case 17:return tm(e.type)&&zX(),ff(e),null;case 19:if(pa(Ja),i=e.memoizedState,i===null)return ff(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)S6(i,!1);else{if(Hl!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=KX(t),a!==null){for(e.flags|=128,S6(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 Yi(Ja,Ja.current&1|2),e.child}t=t.sibling}i.tail!==null&&qs()>lz&&(e.flags|=128,n=!0,S6(i,!1),e.lanes=4194304)}else{if(!n)if(t=KX(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),S6(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ra)return ff(e),null}else 2*qs()-i.renderingStartTime>lz&&r!==1073741824&&(e.flags|=128,n=!0,S6(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=qs(),e.sibling=null,r=Ja.current,Yi(Ja,n?r&1|2:r&1),e):(ff(e),null);case 22:case 23:return Rxe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(Gm&1073741824)!==0&&(ff(e),e.subtreeFlags&6&&(e.flags|=8192)):ff(e),null;case 24:return null;case 25:return null}throw Error(Ve(156,e.tag))}function Q_r(t,e){switch(fxe(e),e.tag){case 1:return tm(e.type)&&zX(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return sz(),pa(em),pa(mf),wxe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return vxe(e),null;case 13:if(pa(Ja),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ve(340));iz()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return pa(Ja),null;case 4:return sz(),null;case 10:return gxe(e.type._context),null;case 22:case 23:return Rxe(),null;case 24:return null;default:return null}}var _X=!1,pf=!1,evr=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function J$(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ss(t,e,n)}else r.current=null}function B0e(t,e,r){try{r()}catch(n){Ss(t,e,n)}}var T7e=!1;function tvr(t,e){if(C0e=LX,t=CZe(),cxe(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(O0e={focusedElem:t,selectionRange:r},LX=!1,Pt=e;Pt!==null;)if(e=Pt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Pt=t;else for(;Pt!==null;){e=Pt;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,b=m.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:ab(e.type,h),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=e.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ve(163))}}catch(S){Ss(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Pt=t;break}Pt=e.return}return m=T7e,T7e=!1,m}function L6(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&&B0e(e,r,i)}o=o.next}while(o!==n)}}function lQ(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 U0e(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 wYe(t){var e=t.alternate;e!==null&&(t.alternate=null,wYe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Q_],delete e[J6],delete e[T0e],delete e[F_r],delete e[k_r])),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 xYe(t){return t.tag===5||t.tag===3||t.tag===4}function A7e(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||xYe(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 q0e(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=$X));else if(n!==4&&(t=t.child,t!==null))for(q0e(t,e,r),t=t.sibling;t!==null;)q0e(t,e,r),t=t.sibling}function H0e(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(H0e(t,e,r),t=t.sibling;t!==null;)H0e(t,e,r),t=t.sibling}var rd=null,sb=!1;function gA(t,e,r){for(r=r.child;r!==null;)SYe(t,e,r),r=r.sibling}function SYe(t,e,r){if(ev&&typeof ev.onCommitFiberUnmount=="function")try{ev.onCommitFiberUnmount(tQ,r)}catch{}switch(r.tag){case 5:pf||J$(r,e);case 6:var n=rd,o=sb;rd=null,gA(t,e,r),rd=n,sb=o,rd!==null&&(sb?(t=rd,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):rd.removeChild(r.stateNode));break;case 18:rd!==null&&(sb?(t=rd,r=r.stateNode,t.nodeType===8?Kwe(t.parentNode,r):t.nodeType===1&&Kwe(t,r),H6(t)):Kwe(rd,r.stateNode));break;case 4:n=rd,o=sb,rd=r.stateNode.containerInfo,sb=!0,gA(t,e,r),rd=n,sb=o;break;case 0:case 11:case 14:case 15:if(!pf&&(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)&&B0e(r,e,a),o=o.next}while(o!==n)}gA(t,e,r);break;case 1:if(!pf&&(J$(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Ss(r,e,s)}gA(t,e,r);break;case 21:gA(t,e,r);break;case 22:r.mode&1?(pf=(n=pf)||r.memoizedState!==null,gA(t,e,r),pf=n):gA(t,e,r);break;default:gA(t,e,r)}}function I7e(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new evr),e.forEach(function(n){var o=cvr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function ib(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:rd=s.stateNode,sb=!1;break e;case 3:rd=s.stateNode.containerInfo,sb=!0;break e;case 4:rd=s.stateNode.containerInfo,sb=!0;break e}s=s.return}if(rd===null)throw Error(Ve(160));SYe(i,a,o),rd=null,sb=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Ss(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)CYe(e,t),e=e.sibling}function CYe(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(ib(e,t),Y_(t),n&4){try{L6(3,t,t.return),lQ(3,t)}catch(h){Ss(t,t.return,h)}try{L6(5,t,t.return)}catch(h){Ss(t,t.return,h)}}break;case 1:ib(e,t),Y_(t),n&512&&r!==null&&J$(r,r.return);break;case 5:if(ib(e,t),Y_(t),n&512&&r!==null&&J$(r,r.return),t.flags&32){var o=t.stateNode;try{z6(o,"")}catch(h){Ss(t,t.return,h)}}if(n&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,a=r!==null?r.memoizedProps:i,s=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{s==="input"&&i.type==="radio"&&i.name!=null&&V7e(o,i),m0e(s,a);var l=m0e(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?Z7e(o,d):c==="dangerouslySetInnerHTML"?G7e(o,d):c==="children"?z6(o,d):Y0e(o,c,d,l)}switch(s){case"input":l0e(o,i);break;case"textarea":W7e(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Y$(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Y$(o,!!i.multiple,i.defaultValue,!0):Y$(o,!!i.multiple,i.multiple?[]:"",!1))}o[J6]=i}catch(h){Ss(t,t.return,h)}}break;case 6:if(ib(e,t),Y_(t),n&4){if(t.stateNode===null)throw Error(Ve(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){Ss(t,t.return,h)}}break;case 3:if(ib(e,t),Y_(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{H6(e.containerInfo)}catch(h){Ss(t,t.return,h)}break;case 4:ib(e,t),Y_(t);break;case 13:ib(e,t),Y_(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Ixe=qs())),n&4&&I7e(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(pf=(l=pf)||c,ib(e,t),pf=l):ib(e,t),Y_(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(Pt=t,c=t.child;c!==null;){for(d=Pt=c;Pt!==null;){switch(f=Pt,p=f.child,f.tag){case 0:case 11:case 14:case 15:L6(4,f,f.return);break;case 1:J$(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(h){Ss(n,r,h)}}break;case 5:J$(f,f.return);break;case 22:if(f.memoizedState!==null){R7e(d);continue}}p!==null?(p.return=f,Pt=p):R7e(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=J7e("display",a))}catch(h){Ss(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){Ss(t,t.return,h)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:ib(e,t),Y_(t),n&4&&I7e(t);break;case 21:break;default:ib(e,t),Y_(t)}}function Y_(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(xYe(r)){var n=r;break e}r=r.return}throw Error(Ve(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(z6(o,""),n.flags&=-33);var i=A7e(t);H0e(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=A7e(t);q0e(t,s,a);break;default:throw Error(Ve(161))}}catch(u){Ss(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function rvr(t,e,r){Pt=t,OYe(t,e,r)}function OYe(t,e,r){for(var n=(t.mode&1)!==0;Pt!==null;){var o=Pt,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||_X;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||pf;s=_X;var l=pf;if(_X=a,(pf=u)&&!l)for(Pt=o;Pt!==null;)a=Pt,u=a.child,a.tag===22&&a.memoizedState!==null?N7e(o):u!==null?(u.return=a,Pt=u):N7e(o);for(;i!==null;)Pt=i,OYe(i,e,r),i=i.sibling;Pt=o,_X=s,pf=l}M7e(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,Pt=i):M7e(t,e,r)}}function M7e(t){for(;Pt!==null;){var e=Pt;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:pf||lQ(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!pf)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:ab(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&m7e(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}m7e(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&&H6(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ve(163))}pf||e.flags&512&&U0e(e)}catch(f){Ss(e,e.return,f)}}if(e===t){Pt=null;break}if(r=e.sibling,r!==null){r.return=e.return,Pt=r;break}Pt=e.return}}function R7e(t){for(;Pt!==null;){var e=Pt;if(e===t){Pt=null;break}var r=e.sibling;if(r!==null){r.return=e.return,Pt=r;break}Pt=e.return}}function N7e(t){for(;Pt!==null;){var e=Pt;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{lQ(4,e)}catch(u){Ss(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Ss(e,o,u)}}var i=e.return;try{U0e(e)}catch(u){Ss(e,i,u)}break;case 5:var a=e.return;try{U0e(e)}catch(u){Ss(e,a,u)}}}catch(u){Ss(e,e.return,u)}if(e===t){Pt=null;break}var s=e.sibling;if(s!==null){s.return=e.return,Pt=s;break}Pt=e.return}}var nvr=Math.ceil,ZX=YO.ReactCurrentDispatcher,Txe=YO.ReactCurrentOwner,Sg=YO.ReactCurrentBatchConfig,To=0,hc=null,au=null,nd=0,Gm=0,Z$=jA(0),Hl=0,t8=null,zN=0,cQ=0,Axe=0,F6=null,Xp=null,Ixe=0,lz=1/0,UO=null,YX=!1,V0e=null,TA=null,vX=!1,xA=null,XX=0,k6=0,W0e=null,TX=-1,AX=0;function sp(){return(To&6)!==0?qs():TX!==-1?TX:TX=qs()}function AA(t){return(t.mode&1)===0?1:(To&2)!==0&&nd!==0?nd&-nd:z_r.transition!==null?(AX===0&&(AX=uZe()),AX):(t=Ti,t!==0||(t=window.event,t=t===void 0?16:hZe(t.type)),t)}function cb(t,e,r,n){if(50<k6)throw k6=0,W0e=null,Error(Ve(185));r8(t,r,n),((To&2)===0||t!==hc)&&(t===hc&&((To&2)===0&&(cQ|=r),Hl===4&&vA(t,nd)),rm(t,n),r===1&&To===0&&(e.mode&1)===0&&(lz=qs()+500,aQ&&DA()))}function rm(t,e){var r=t.callbackNode;Ubr(t,e);var n=DX(t,t===hc?nd:0);if(n===0)r!==null&&BJe(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&BJe(r),e===1)t.tag===0?$_r(j7e.bind(null,t)):jZe(j7e.bind(null,t)),D_r(function(){(To&6)===0&&DA()}),r=null;else{switch(lZe(n)){case 1:r=rxe;break;case 4:r=aZe;break;case 16:r=jX;break;case 536870912:r=sZe;break;default:r=jX}r=NYe(r,PYe.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function PYe(t,e){if(TX=-1,AX=0,(To&6)!==0)throw Error(Ve(327));var r=t.callbackNode;if(rz()&&t.callbackNode!==r)return null;var n=DX(t,t===hc?nd:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=QX(t,n);else{e=n;var o=To;To|=2;var i=TYe();(hc!==t||nd!==e)&&(UO=null,lz=qs()+500,DN(t,e));do try{avr();break}catch(s){EYe(t,s)}while(!0);hxe(),ZX.current=i,To=o,au!==null?e=0:(hc=null,nd=0,e=Hl)}if(e!==0){if(e===2&&(o=_0e(t),o!==0&&(n=o,e=K0e(t,o))),e===1)throw r=t8,DN(t,0),vA(t,n),rm(t,qs()),r;if(e===6)vA(t,n);else{if(o=t.current.alternate,(n&30)===0&&!ovr(o)&&(e=QX(t,n),e===2&&(i=_0e(t),i!==0&&(n=i,e=K0e(t,i))),e===1))throw r=t8,DN(t,0),vA(t,n),rm(t,qs()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(Ve(345));case 2:MN(t,Xp,UO);break;case 3:if(vA(t,n),(n&130023424)===n&&(e=Ixe+500-qs(),10<e)){if(DX(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){sp(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=E0e(MN.bind(null,t,Xp,UO),e);break}MN(t,Xp,UO);break;case 4:if(vA(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-lb(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=qs()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*nvr(n/1960))-n,10<n){t.timeoutHandle=E0e(MN.bind(null,t,Xp,UO),n);break}MN(t,Xp,UO);break;case 5:MN(t,Xp,UO);break;default:throw Error(Ve(329))}}}return rm(t,qs()),t.callbackNode===r?PYe.bind(null,t):null}function K0e(t,e){var r=F6;return t.current.memoizedState.isDehydrated&&(DN(t,e).flags|=256),t=QX(t,e),t!==2&&(e=Xp,Xp=r,e!==null&&G0e(e)),t}function G0e(t){Xp===null?Xp=t:Xp.push.apply(Xp,t)}function ovr(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(!db(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 vA(t,e){for(e&=~Axe,e&=~cQ,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-lb(e),n=1<<r;t[r]=-1,e&=~n}}function j7e(t){if((To&6)!==0)throw Error(Ve(327));rz();var e=DX(t,0);if((e&1)===0)return rm(t,qs()),null;var r=QX(t,e);if(t.tag!==0&&r===2){var n=_0e(t);n!==0&&(e=n,r=K0e(t,n))}if(r===1)throw r=t8,DN(t,0),vA(t,e),rm(t,qs()),r;if(r===6)throw Error(Ve(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,MN(t,Xp,UO),rm(t,qs()),null}function Mxe(t,e){var r=To;To|=1;try{return t(e)}finally{To=r,To===0&&(lz=qs()+500,aQ&&DA())}}function BN(t){xA!==null&&xA.tag===0&&(To&6)===0&&rz();var e=To;To|=1;var r=Sg.transition,n=Ti;try{if(Sg.transition=null,Ti=1,t)return t()}finally{Ti=n,Sg.transition=r,To=e,(To&6)===0&&DA()}}function Rxe(){Gm=Z$.current,pa(Z$)}function DN(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,j_r(r)),au!==null)for(r=au.return;r!==null;){var n=r;switch(fxe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&zX();break;case 3:sz(),pa(em),pa(mf),wxe();break;case 5:vxe(n);break;case 4:sz();break;case 13:pa(Ja);break;case 19:pa(Ja);break;case 10:gxe(n.type._context);break;case 22:case 23:Rxe()}r=r.return}if(hc=t,au=t=IA(t.current,null),nd=Gm=e,Hl=0,t8=null,Axe=cQ=zN=0,Xp=F6=null,NN!==null){for(e=0;e<NN.length;e++)if(r=NN[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}NN=null}return t}function EYe(t,e){do{var r=au;try{if(hxe(),OX.current=JX,GX){for(var n=Za.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}GX=!1}if($N=0,mc=ql=Za=null,D6=!1,X6=0,Txe.current=null,r===null||r.return===null){Hl=1,t8=e,au=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=nd,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=w7e(a);if(p!==null){p.flags&=-257,x7e(p,a,s,i,e),p.mode&1&&v7e(i,l,e),e=p,u=l;var m=e.updateQueue;if(m===null){var h=new Set;h.add(u),e.updateQueue=h}else m.add(u);break e}else{if((e&1)===0){v7e(i,l,e),Nxe();break e}u=Error(Ve(426))}}else if(Ra&&s.mode&1){var b=w7e(a);if(b!==null){(b.flags&65536)===0&&(b.flags|=256),x7e(b,a,s,i,e),pxe(uz(u,s));break e}}i=u=uz(u,s),Hl!==4&&(Hl=2),F6===null?F6=[i]:F6.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=cYe(i,u,e);p7e(i,g);break e;case 1:s=u;var y=i.type,x=i.stateNode;if((i.flags&128)===0&&(typeof y.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(TA===null||!TA.has(x)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=dYe(i,s,e);p7e(i,S);break e}}i=i.return}while(i!==null)}IYe(r)}catch(O){e=O,au===r&&r!==null&&(au=r=r.return);continue}break}while(!0)}function TYe(){var t=ZX.current;return ZX.current=JX,t===null?JX:t}function Nxe(){(Hl===0||Hl===3||Hl===2)&&(Hl=4),hc===null||(zN&268435455)===0&&(cQ&268435455)===0||vA(hc,nd)}function QX(t,e){var r=To;To|=2;var n=TYe();(hc!==t||nd!==e)&&(UO=null,DN(t,e));do try{ivr();break}catch(o){EYe(t,o)}while(!0);if(hxe(),To=r,ZX.current=n,au!==null)throw Error(Ve(261));return hc=null,nd=0,Hl}function ivr(){for(;au!==null;)AYe(au)}function avr(){for(;au!==null&&!Nbr();)AYe(au)}function AYe(t){var e=RYe(t.alternate,t,Gm);t.memoizedProps=t.pendingProps,e===null?IYe(t):au=e,Txe.current=null}function IYe(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=X_r(r,e,Gm),r!==null){au=r;return}}else{if(r=Q_r(r,e),r!==null){r.flags&=32767,au=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Hl=6,au=null;return}}if(e=e.sibling,e!==null){au=e;return}au=e=t}while(e!==null);Hl===0&&(Hl=5)}function MN(t,e,r){var n=Ti,o=Sg.transition;try{Sg.transition=null,Ti=1,svr(t,e,r,n)}finally{Sg.transition=o,Ti=n}return null}function svr(t,e,r,n){do rz();while(xA!==null);if((To&6)!==0)throw Error(Ve(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(Ve(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(qbr(t,i),t===hc&&(au=hc=null,nd=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||vX||(vX=!0,NYe(jX,function(){return rz(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=Sg.transition,Sg.transition=null;var a=Ti;Ti=1;var s=To;To|=4,Txe.current=null,tvr(t,r),CYe(r,t),A_r(O0e),LX=!!C0e,O0e=C0e=null,t.current=r,rvr(r,t,o),jbr(),To=s,Ti=a,Sg.transition=i}else t.current=r;if(vX&&(vX=!1,xA=t,XX=o),i=t.pendingLanes,i===0&&(TA=null),Fbr(r.stateNode,n),rm(t,qs()),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(YX)throw YX=!1,t=V0e,V0e=null,t;return(XX&1)!==0&&t.tag!==0&&rz(),i=t.pendingLanes,(i&1)!==0?t===W0e?k6++:(k6=0,W0e=t):k6=0,DA(),null}function rz(){if(xA!==null){var t=lZe(XX),e=Sg.transition,r=Ti;try{if(Sg.transition=null,Ti=16>t?16:t,xA===null)var n=!1;else{if(t=xA,xA=null,XX=0,(To&6)!==0)throw Error(Ve(331));var o=To;for(To|=4,Pt=t.current;Pt!==null;){var i=Pt,a=i.child;if((Pt.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(Pt=l;Pt!==null;){var c=Pt;switch(c.tag){case 0:case 11:case 15:L6(8,c,i)}var d=c.child;if(d!==null)d.return=c,Pt=d;else for(;Pt!==null;){c=Pt;var f=c.sibling,p=c.return;if(wYe(c),c===l){Pt=null;break}if(f!==null){f.return=p,Pt=f;break}Pt=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var b=h.sibling;h.sibling=null,h=b}while(h!==null)}}Pt=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,Pt=a;else e:for(;Pt!==null;){if(i=Pt,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:L6(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Pt=g;break e}Pt=i.return}}var y=t.current;for(Pt=y;Pt!==null;){a=Pt;var x=a.child;if((a.subtreeFlags&2064)!==0&&x!==null)x.return=a,Pt=x;else e:for(a=y;Pt!==null;){if(s=Pt,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:lQ(9,s)}}catch(O){Ss(s,s.return,O)}if(s===a){Pt=null;break e}var S=s.sibling;if(S!==null){S.return=s.return,Pt=S;break e}Pt=s.return}}if(To=o,DA(),ev&&typeof ev.onPostCommitFiberRoot=="function")try{ev.onPostCommitFiberRoot(tQ,t)}catch{}n=!0}return n}finally{Ti=r,Sg.transition=e}}return!1}function D7e(t,e,r){e=uz(r,e),e=cYe(t,e,1),t=EA(t,e,1),e=sp(),t!==null&&(r8(t,1,e),rm(t,e))}function Ss(t,e,r){if(t.tag===3)D7e(t,t,r);else for(;e!==null;){if(e.tag===3){D7e(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(TA===null||!TA.has(n))){t=uz(r,t),t=dYe(e,t,1),e=EA(e,t,1),t=sp(),e!==null&&(r8(e,1,t),rm(e,t));break}}e=e.return}}function uvr(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=sp(),t.pingedLanes|=t.suspendedLanes&r,hc===t&&(nd&r)===r&&(Hl===4||Hl===3&&(nd&130023424)===nd&&500>qs()-Ixe?DN(t,0):Axe|=r),rm(t,e)}function MYe(t,e){e===0&&((t.mode&1)===0?e=1:(e=aX,aX<<=1,(aX&130023424)===0&&(aX=4194304)));var r=sp();t=JO(t,e),t!==null&&(r8(t,e,r),rm(t,r))}function lvr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),MYe(t,r)}function cvr(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(Ve(314))}n!==null&&n.delete(e),MYe(t,r)}var RYe;RYe=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||em.current)Qp=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Qp=!1,Y_r(t,e,r);Qp=(t.flags&131072)!==0}else Qp=!1,Ra&&(e.flags&1048576)!==0&&DZe(e,qX,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;EX(t,e),t=e.pendingProps;var o=oz(e,mf.current);tz(e,r),o=Sxe(null,e,n,t,o,r);var i=Cxe();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,tm(n)?(i=!0,BX(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,bxe(e),o.updater=sQ,e.stateNode=o,o._reactInternals=e,j0e(e,n,t,r),e=F0e(null,e,n,!0,i,r)):(e.tag=0,Ra&&i&&dxe(e),ap(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(EX(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=fvr(n),t=ab(n,t),o){case 0:e=L0e(null,e,n,t,r);break e;case 1:e=O7e(null,e,n,t,r);break e;case 11:e=S7e(null,e,n,t,r);break e;case 14:e=C7e(null,e,n,ab(n.type,t),r);break e}throw Error(Ve(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ab(n,o),L0e(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ab(n,o),O7e(t,e,n,o,r);case 3:e:{if(hYe(e),t===null)throw Error(Ve(387));n=e.pendingProps,i=e.memoizedState,o=i.element,$Ze(t,e),WX(e,n,null,r);var a=e.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=uz(Error(Ve(423)),e),e=P7e(t,e,n,r,o);break e}else if(n!==o){o=uz(Error(Ve(424)),e),e=P7e(t,e,n,r,o);break e}else for(Jm=PA(e.stateNode.containerInfo.firstChild),Zm=e,Ra=!0,ub=null,r=qZe(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(iz(),n===o){e=ZO(t,e,r);break e}ap(t,e,n,r)}e=e.child}return e;case 5:return HZe(e),t===null&&M0e(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,P0e(n,o)?a=null:i!==null&&P0e(n,i)&&(e.flags|=32),mYe(t,e),ap(t,e,a,r),e.child;case 6:return t===null&&M0e(e),null;case 13:return gYe(t,e,r);case 4:return _xe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=az(e,null,n,r):ap(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ab(n,o),S7e(t,e,n,o,r);case 7:return ap(t,e,e.pendingProps,r),e.child;case 8:return ap(t,e,e.pendingProps.children,r),e.child;case 12:return ap(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,Yi(HX,n._currentValue),n._currentValue=a,i!==null)if(db(i.value,a)){if(i.children===o.children&&!em.current){e=ZO(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=WO(-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),R0e(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(Ve(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),R0e(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}ap(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,tz(e,r),o=Cg(o),n=n(o),e.flags|=1,ap(t,e,n,r),e.child;case 14:return n=e.type,o=ab(n,e.pendingProps),o=ab(n.type,o),C7e(t,e,n,o,r);case 15:return fYe(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ab(n,o),EX(t,e),e.tag=1,tm(n)?(t=!0,BX(e)):t=!1,tz(e,r),BZe(e,n,o),j0e(e,n,o,r),F0e(null,e,n,!0,t,r);case 19:return yYe(t,e,r);case 22:return pYe(t,e,r)}throw Error(Ve(156,e.tag))};function NYe(t,e){return iZe(t,e)}function dvr(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 xg(t,e,r,n){return new dvr(t,e,r,n)}function jxe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function fvr(t){if(typeof t=="function")return jxe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Q0e)return 11;if(t===exe)return 14}return 2}function IA(t,e){var r=t.alternate;return r===null?(r=xg(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 IX(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")jxe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case z$:return LN(r.children,o,i,e);case X0e:a=8,o|=8;break;case o0e:return t=xg(12,r,e,o|2),t.elementType=o0e,t.lanes=i,t;case i0e:return t=xg(13,r,e,o),t.elementType=i0e,t.lanes=i,t;case a0e:return t=xg(19,r,e,o),t.elementType=a0e,t.lanes=i,t;case U7e:return dQ(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case z7e:a=10;break e;case B7e:a=9;break e;case Q0e:a=11;break e;case exe:a=14;break e;case yA:a=16,n=null;break e}throw Error(Ve(130,t==null?t:typeof t,""))}return e=xg(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function LN(t,e,r,n){return t=xg(7,t,n,e),t.lanes=r,t}function dQ(t,e,r,n){return t=xg(22,t,n,e),t.elementType=U7e,t.lanes=r,t.stateNode={isHidden:!1},t}function t0e(t,e,r){return t=xg(6,t,null,e),t.lanes=r,t}function r0e(t,e,r){return e=xg(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function pvr(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=$we(0),this.expirationTimes=$we(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$we(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Dxe(t,e,r,n,o,i,a,s,u){return t=new pvr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=xg(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},bxe(i),t}function mvr(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$$,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function jYe(t){if(!t)return RA;t=t._reactInternals;e:{if(qN(t)!==t||t.tag!==1)throw Error(Ve(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(tm(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Ve(171))}if(t.tag===1){var r=t.type;if(tm(r))return NZe(t,r,e)}return e}function DYe(t,e,r,n,o,i,a,s,u){return t=Dxe(r,n,!0,t,o,i,a,s,u),t.context=jYe(null),r=t.current,n=sp(),o=AA(r),i=WO(n,o),i.callback=e??null,EA(r,i,o),t.current.lanes=o,r8(t,o,n),rm(t,n),t}function fQ(t,e,r,n){var o=e.current,i=sp(),a=AA(o);return r=jYe(r),e.context===null?e.context=r:e.pendingContext=r,e=WO(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=EA(o,e,a),t!==null&&(cb(t,o,a,i),CX(t,o,a)),a}function eQ(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 L7e(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function Lxe(t,e){L7e(t,e),(t=t.alternate)&&L7e(t,e)}function hvr(){return null}var LYe=typeof reportError=="function"?reportError:function(t){console.error(t)};function Fxe(t){this._internalRoot=t}pQ.prototype.render=Fxe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Ve(409));fQ(t,e,null,null)};pQ.prototype.unmount=Fxe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;BN(function(){fQ(null,t,null,null)}),e[GO]=null}};function pQ(t){this._internalRoot=t}pQ.prototype.unstable_scheduleHydration=function(t){if(t){var e=fZe();t={blockedOn:null,target:t,priority:e};for(var r=0;r<_A.length&&e!==0&&e<_A[r].priority;r++);_A.splice(r,0,t),r===0&&mZe(t)}};function kxe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function mQ(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function F7e(){}function gvr(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=eQ(a);i.call(l)}}var a=DYe(e,n,t,0,null,!1,!1,"",F7e);return t._reactRootContainer=a,t[GO]=a.current,K6(t.nodeType===8?t.parentNode:t),BN(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=eQ(u);s.call(l)}}var u=Dxe(t,0,!1,null,null,!1,!1,"",F7e);return t._reactRootContainer=u,t[GO]=u.current,K6(t.nodeType===8?t.parentNode:t),BN(function(){fQ(e,u,r,n)}),u}function hQ(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=eQ(a);s.call(u)}}fQ(e,a,t,o)}else a=gvr(r,e,t,o,n);return eQ(a)}cZe=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=T6(e.pendingLanes);r!==0&&(nxe(e,r|1),rm(e,qs()),(To&6)===0&&(lz=qs()+500,DA()))}break;case 13:BN(function(){var n=JO(t,1);if(n!==null){var o=sp();cb(n,t,1,o)}}),Lxe(t,1)}};oxe=function(t){if(t.tag===13){var e=JO(t,134217728);if(e!==null){var r=sp();cb(e,t,134217728,r)}Lxe(t,134217728)}};dZe=function(t){if(t.tag===13){var e=AA(t),r=JO(t,e);if(r!==null){var n=sp();cb(r,t,e,n)}Lxe(t,e)}};fZe=function(){return Ti};pZe=function(t,e){var r=Ti;try{return Ti=t,e()}finally{Ti=r}};g0e=function(t,e,r){switch(e){case"input":if(l0e(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=iQ(n);if(!o)throw Error(Ve(90));H7e(n),l0e(n,o)}}}break;case"textarea":W7e(t,r);break;case"select":e=r.value,e!=null&&Y$(t,!!r.multiple,e,!1)}};Q7e=Mxe;eZe=BN;var yvr={usingClientEntryPoint:!1,Events:[o8,H$,iQ,Y7e,X7e,Mxe]},C6={findFiberByHostInstance:RN,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},bvr={bundleType:C6.bundleType,version:C6.version,rendererPackageName:C6.rendererPackageName,rendererConfig:C6.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:YO.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=nZe(t),t===null?null:t.stateNode},findFiberByHostInstance:C6.findFiberByHostInstance||hvr,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(O6=__REACT_DEVTOOLS_GLOBAL_HOOK__,!O6.isDisabled&&O6.supportsFiber))try{tQ=O6.inject(bvr),ev=O6}catch{}var O6;Qm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yvr;Qm.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kxe(e))throw Error(Ve(200));return mvr(t,e,null,r)};Qm.createRoot=function(t,e){if(!kxe(t))throw Error(Ve(299));var r=!1,n="",o=LYe;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Dxe(t,1,!1,null,null,r,!1,n,o),t[GO]=e.current,K6(t.nodeType===8?t.parentNode:t),new Fxe(e)};Qm.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(Ve(188)):(t=Object.keys(t).join(","),Error(Ve(268,t)));return t=nZe(e),t=t===null?null:t.stateNode,t};Qm.flushSync=function(t){return BN(t)};Qm.hydrate=function(t,e,r){if(!mQ(e))throw Error(Ve(200));return hQ(null,t,e,!0,r)};Qm.hydrateRoot=function(t,e,r){if(!kxe(t))throw Error(Ve(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=LYe;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=DYe(e,null,t,1,r??null,o,!1,i,a),t[GO]=e.current,K6(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 pQ(e)};Qm.render=function(t,e,r){if(!mQ(e))throw Error(Ve(200));return hQ(null,t,e,!1,r)};Qm.unmountComponentAtNode=function(t){if(!mQ(t))throw Error(Ve(40));return t._reactRootContainer?(BN(function(){hQ(null,null,t,!1,function(){t._reactRootContainer=null,t[GO]=null})}),!0):!1};Qm.unstable_batchedUpdates=Mxe;Qm.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!mQ(r))throw Error(Ve(200));if(t==null||t._reactInternals===void 0)throw Error(Ve(38));return hQ(t,e,r,!1,n)};Qm.version="18.2.0-next-9e3b772b8-20220608"});var Cs=v((e7n,$Ye)=>{"use strict";function kYe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kYe)}catch(t){console.error(t)}}kYe(),$Ye.exports=FYe()});var id=v($xe=>{"use strict";var zYe=Cs();$xe.createRoot=zYe.createRoot,$xe.hydrateRoot=zYe.hydrateRoot;var t7n});function BYe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function UYe(...t){return e=>{let r=!1,n=t.map(o=>{let i=BYe(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():BYe(t[o],null)}}}}var _vr,qYe=w(()=>{_vr=F(ee(),1)});var VYe=v(gQ=>{"use strict";var vvr=ee(),wvr=Symbol.for("react.element"),xvr=Symbol.for("react.fragment"),Svr=Object.prototype.hasOwnProperty,Cvr=vvr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ovr={key:!0,ref:!0,__self:!0,__source:!0};function HYe(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)Svr.call(e,n)&&!Ovr.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:wvr,type:t,key:i,ref:a,props:o,_owner:Cvr.current}}gQ.Fragment=xvr;gQ.jsx=HYe;gQ.jsxs=HYe});var bt=v((i7n,WYe)=>{"use strict";WYe.exports=VYe()});function XO(t){let e=Pvr(t),r=Vl.forwardRef((n,o)=>{let{children:i,...a}=n,s=Vl.Children.toArray(i),u=s.find(Evr);if(u){let l=u.props.children,c=s.map(d=>d===u?Vl.Children.count(l)>1?Vl.Children.only(null):Vl.isValidElement(l)?l.props.children:null:d);return(0,fz.jsx)(e,{...a,ref:o,children:Vl.isValidElement(l)?Vl.cloneElement(l,void 0,c):null})}return(0,fz.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Pvr(t){let e=Vl.forwardRef((r,n)=>{let{children:o,...i}=r;if(Vl.isValidElement(o)){let a=Avr(o),s=Tvr(i,o.props);return o.type!==Vl.Fragment&&(s.ref=n?UYe(n,a):a),Vl.cloneElement(o,s)}return Vl.Children.count(o)>1?Vl.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function JYe(t){let e=({children:r})=>(0,fz.jsx)(fz.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=GYe,e}function Evr(t){return Vl.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===GYe}function Tvr(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 Avr(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 Vl,fz,KYe,GYe,HN=w(()=>{Vl=F(ee(),1);qYe();fz=F(bt(),1);KYe=XO("Slot");GYe=Symbol("radix.slottable")});function ZYe(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=ZYe(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function yQ(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=ZYe(t))&&(n&&(n+=" "),n+=e);return n}var zxe=w(()=>{});var YYe,XYe,pz,bQ=w(()=>{zxe();YYe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,XYe=yQ,pz=(t,e)=>r=>{var n;if(e?.variants==null)return XYe(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=YYe(c)||YYe(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,b]=m;return Array.isArray(b)?b.includes({...i,...s}[h]):{...i,...s}[h]===b})?[...l,d,f]:l},[]);return XYe(t,a,u,r?.class,r?.className)}});function Bvr(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=iXe(e))&&(n&&(n+=" "),n+=r);return n}function tXe(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=kvr(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=zvr(u,r);return o(u,c),c}return function(){return i(Bvr.apply(null,arguments))}}var qxe,Ivr,nXe,QYe,Mvr,Rvr,Uxe,eXe,Nvr,jvr,Dvr,oXe,Lvr,Fvr,kvr,$vr,zvr,iXe,ma,aXe,Uvr,qvr,Hvr,Vvr,Wvr,Kvr,Gvr,QO,LA,mz,Bxe,a8,Jvr,pn,FA,Zvr,Yvr,Xvr,Qvr,ewr,twr,s8,hz,rwr,sXe,nwr,owr,rXe,iwr,u8,awr,swr,uXe,lXe=w(()=>{qxe="-",Ivr=t=>{let e=Rvr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(qxe);return s[0]===""&&s.length!==1&&s.shift(),nXe(s,e)||Mvr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},nXe=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?nXe(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(qxe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},QYe=/^\[(.+)\]$/,Mvr=t=>{if(QYe.test(t)){let e=QYe.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Rvr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return jvr(Object.entries(t.classGroups),r).forEach(([i,a])=>{Uxe(a,n,i,e)}),n},Uxe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:eXe(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(Nvr(o)){Uxe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{Uxe(a,eXe(e,i),r,n)})})},eXe=(t,e)=>{let r=t;return e.split(qxe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Nvr=t=>t.isThemeGetter,jvr=(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,Dvr=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)}}},oXe="!",Lvr=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 b=0;b<s.length;b++){let g=s[b];if(l===0){if(g===o&&(n||s.slice(b,b+i)===e)){u.push(s.slice(c,b)),c=b+i;continue}if(g==="/"){d=b;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(oXe),m=p?f.substring(1):f,h=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return r?s=>r({className:s,parseClassName:a}):a},Fvr=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},kvr=t=>({cache:Dvr(t.cacheSize),parseClassName:Lvr(t),...Ivr(t)}),$vr=/\s+/,zvr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split($vr),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let b=Fvr(c).join(":"),g=d?b+oXe:b,y=g+h;if(i.includes(y))continue;i.push(y);let x=o(h,m);for(let S=0;S<x.length;++S){let O=x[S];i.push(g+O)}s=l+(s.length>0?" "+s:s)}return s};iXe=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=iXe(t[n]))&&(r&&(r+=" "),r+=e);return r};ma=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},aXe=/^\[(?:([a-z-]+):)?(.+)\]$/i,Uvr=/^\d+\/\d+$/,qvr=new Set(["px","full","screen"]),Hvr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vvr=/\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$/,Wvr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Kvr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Gvr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,QO=t=>mz(t)||qvr.has(t)||Uvr.test(t),LA=t=>hz(t,"length",rwr),mz=t=>!!t&&!Number.isNaN(Number(t)),Bxe=t=>hz(t,"number",mz),a8=t=>!!t&&Number.isInteger(Number(t)),Jvr=t=>t.endsWith("%")&&mz(t.slice(0,-1)),pn=t=>aXe.test(t),FA=t=>Hvr.test(t),Zvr=new Set(["length","size","percentage"]),Yvr=t=>hz(t,Zvr,sXe),Xvr=t=>hz(t,"position",sXe),Qvr=new Set(["image","url"]),ewr=t=>hz(t,Qvr,owr),twr=t=>hz(t,"",nwr),s8=()=>!0,hz=(t,e,r)=>{let n=aXe.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},rwr=t=>Vvr.test(t)&&!Wvr.test(t),sXe=()=>!1,nwr=t=>Kvr.test(t),owr=t=>Gvr.test(t),rXe=()=>{let t=ma("colors"),e=ma("spacing"),r=ma("blur"),n=ma("brightness"),o=ma("borderColor"),i=ma("borderRadius"),a=ma("borderSpacing"),s=ma("borderWidth"),u=ma("contrast"),l=ma("grayscale"),c=ma("hueRotate"),d=ma("invert"),f=ma("gap"),p=ma("gradientColorStops"),m=ma("gradientColorStopPositions"),h=ma("inset"),b=ma("margin"),g=ma("opacity"),y=ma("padding"),x=ma("saturate"),S=ma("scale"),O=ma("sepia"),E=ma("skew"),P=ma("space"),A=ma("translate"),I=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",pn,e],j=()=>[pn,e],$=()=>["",QO,LA],k=()=>["auto",mz,pn],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",pn],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[mz,pn];return{cacheSize:500,separator:":",theme:{colors:[s8],spacing:[QO,LA],blur:["none","",FA,pn],brightness:B(),borderColor:[t],borderRadius:["none","","full",FA,pn],borderSpacing:j(),borderWidth:$(),contrast:B(),grayscale:D(),hueRotate:B(),invert:D(),gap:j(),gradientColorStops:[t],gradientColorStopPositions:[Jvr,LA],inset:N(),margin:N(),opacity:B(),padding:j(),saturate:B(),scale:B(),sepia:D(),skew:B(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",pn]}],container:["container"],columns:[{columns:[FA]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),pn]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",a8,pn]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pn]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",a8,pn]}],"grid-cols":[{"grid-cols":[s8]}],"col-start-end":[{col:["auto",{span:["full",a8,pn]},pn]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[s8]}],"row-start-end":[{row:["auto",{span:[a8,pn]},pn]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",pn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"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",pn,e]}],"min-w":[{"min-w":[pn,e,"min","max","fit"]}],"max-w":[{"max-w":[pn,e,"none","full","min","max","fit","prose",{screen:[FA]},FA]}],h:[{h:[pn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[pn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[pn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[pn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",FA,LA]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bxe]}],"font-family":[{font:[s8]}],"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",pn]}],"line-clamp":[{"line-clamp":["none",mz,Bxe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",QO,pn]}],"list-image":[{"list-image":["none",pn]}],"list-style-type":[{list:["none","disc","decimal",pn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",QO,LA]}],"underline-offset":[{"underline-offset":["auto",QO,pn]}],"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:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pn]}],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",pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),Xvr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Yvr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ewr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:V()}],"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:["",...V()]}],"outline-offset":[{"outline-offset":[QO,pn]}],"outline-w":[{outline:[QO,LA]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[QO,LA]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",FA,twr]}],"shadow-color":[{shadow:[s8]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",FA,pn]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[x]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"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",pn]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",pn]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",pn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[a8,pn]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"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",pn]}],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",pn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",pn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[QO,LA,Bxe]}],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"]}}},iwr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{u8(t,"cacheSize",e),u8(t,"prefix",r),u8(t,"separator",n),u8(t,"experimentalParseClassName",o);for(let s in a)awr(t[s],a[s]);for(let s in i)swr(t[s],i[s]);return t},u8=(t,e,r)=>{r!==void 0&&(t[e]=r)},awr=(t,e)=>{if(e)for(let r in e)u8(t,r,e[r])},swr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},uXe=(t,...e)=>typeof t=="function"?tXe(rXe,t,...e):tXe(()=>iwr(rXe(),t),...e)});function ve(...t){return uwr(yQ(t))}var uwr,$n=w(()=>{zxe();lXe();uwr=uXe({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 _Q,lwr,be,di=w(()=>{_Q=F(ee());HN();bQ();$n();lwr=pz("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"}}),be=_Q.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>_Q.createElement(n?KYe:"button",{className:ve(lwr({variant:e,size:r,className:t})),ref:i,...o}));be.displayName="Button"});var cXe,vQ,Hxe=w(()=>{cXe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vQ=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var dXe,fXe=w(()=>{dXe={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 l8,pXe,mXe=w(()=>{l8=F(ee());fXe();Hxe();pXe=(0,l8.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,l8.createElement)("svg",{ref:u,...dXe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:vQ("lucide",o),...s},[...a.map(([l,c])=>(0,l8.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var wQ,xe,Lt=w(()=>{wQ=F(ee());Hxe();mXe();xe=(t,e)=>{let r=(0,wQ.forwardRef)(({className:n,...o},i)=>(0,wQ.createElement)(pXe,{ref:i,iconNode:e,className:vQ(`lucide-${cXe(t)}`,n),...o}));return r.displayName=`${t}`,r}});var eP,hXe=w(()=>{Lt();eP=xe("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var c8,gXe=w(()=>{Lt();c8=xe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var VN,yXe=w(()=>{Lt();VN=xe("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 gc,bXe=w(()=>{Lt();gc=xe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Xi,_Xe=w(()=>{Lt();Xi=xe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var tP,vXe=w(()=>{Lt();tP=xe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var fb,wXe=w(()=>{Lt();fb=xe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var Mo,xXe=w(()=>{Lt();Mo=xe("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 eh,SXe=w(()=>{Lt();eh=xe("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var kA,CXe=w(()=>{Lt();kA=xe("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var $A,OXe=w(()=>{Lt();$A=xe("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 d8,PXe=w(()=>{Lt();d8=xe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var f8,EXe=w(()=>{Lt();f8=xe("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]])});var p8,TXe=w(()=>{Lt();p8=xe("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 rv,AXe=w(()=>{Lt();rv=xe("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 th,IXe=w(()=>{Lt();th=xe("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 rh,MXe=w(()=>{Lt();rh=xe("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var m8,RXe=w(()=>{Lt();m8=xe("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 h8,NXe=w(()=>{Lt();h8=xe("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 g8,jXe=w(()=>{Lt();g8=xe("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 rP,DXe=w(()=>{Lt();rP=xe("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 zA,LXe=w(()=>{Lt();zA=xe("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 WN,FXe=w(()=>{Lt();WN=xe("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 y8,kXe=w(()=>{Lt();y8=xe("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 nP,$Xe=w(()=>{Lt();nP=xe("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 b8,zXe=w(()=>{Lt();b8=xe("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 _8,BXe=w(()=>{Lt();_8=xe("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 v8,UXe=w(()=>{Lt();v8=xe("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 w8,qXe=w(()=>{Lt();w8=xe("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 pb,HXe=w(()=>{Lt();pb=xe("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 x8,VXe=w(()=>{Lt();x8=xe("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 S8,WXe=w(()=>{Lt();S8=xe("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 mb,KXe=w(()=>{Lt();mb=xe("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 KN,GXe=w(()=>{Lt();KN=xe("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 nv,JXe=w(()=>{Lt();nv=xe("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 C8,ZXe=w(()=>{Lt();C8=xe("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 O8,YXe=w(()=>{Lt();O8=xe("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 ov,XXe=w(()=>{Lt();ov=xe("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 P8,QXe=w(()=>{Lt();P8=xe("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 GN,eQe=w(()=>{Lt();GN=xe("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 oP,tQe=w(()=>{Lt();oP=xe("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 yc,rQe=w(()=>{Lt();yc=xe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var E8,nQe=w(()=>{Lt();E8=xe("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 gz,oQe=w(()=>{Lt();gz=xe("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 iv,iQe=w(()=>{Lt();iv=xe("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 iP,aQe=w(()=>{Lt();iP=xe("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 yz,sQe=w(()=>{Lt();yz=xe("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 bz,uQe=w(()=>{Lt();bz=xe("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 nh,lQe=w(()=>{Lt();nh=xe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var T8,cQe=w(()=>{Lt();T8=xe("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 av,dQe=w(()=>{Lt();av=xe("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 A8,fQe=w(()=>{Lt();A8=xe("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 JN,pQe=w(()=>{Lt();JN=xe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Pg,mQe=w(()=>{Lt();Pg=xe("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 aP,hQe=w(()=>{Lt();aP=xe("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 nm,gQe=w(()=>{Lt();nm=xe("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 ZN,yQe=w(()=>{Lt();ZN=xe("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 I8,bQe=w(()=>{Lt();I8=xe("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 oh,_Qe=w(()=>{Lt();oh=xe("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,vQe=w(()=>{Lt();lp=xe("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 M8,wQe=w(()=>{Lt();M8=xe("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 YN,xQe=w(()=>{Lt();YN=xe("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 Qi,SQe=w(()=>{Lt();Qi=xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var An=w(()=>{xXe();SXe();CXe();OXe();DXe();LXe();rQe();iQe();aQe();mQe();hQe();gQe();vQe();hXe();gXe();yXe();bXe();_Xe();vXe();wXe();PXe();EXe();TXe();AXe();IXe();MXe();RXe();NXe();jXe();FXe();kXe();$Xe();zXe();BXe();UXe();qXe();HXe();VXe();WXe();KXe();GXe();JXe();ZXe();YXe();XXe();QXe();eQe();tQe();nQe();oQe();sQe();uQe();lQe();cQe();dQe();fQe();pQe();yQe();bQe();_Qe();wQe();xQe();SQe();});function cwr({onCancel:t}){let e=ae(),r=Vxe(e.defaultModelKey)&&Vxe(e.embeddingModelKey);return sv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},sv.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},sv.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&sv.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.")),sv.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},sv.default.createElement(be,{variant:"ghost",onClick:t},"Close"),sv.default.createElement(be,{variant:"default",onClick:()=>{XN(zO.EXPIRED_MODAL)}},"Renew Now ",sv.default.createElement(WN,{className:"tw-size-4"}))))}var sv,CQe,OQe,xQ,PQe=w(()=>{sv=F(ee()),CQe=require("obsidian"),OQe=F(id());di();sP();Ur();An();er();xQ=class extends CQe.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,OQe.createRoot)(e);let r=()=>{this.close()};this.root.render(sv.default.createElement(cwr,{onCancel:r}))}onClose(){this.root.unmount()}}});var Hr,BA=w(()=>{Hr=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}}});var EQe=v(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:!0});SQ.V2ChatStreamRequestCitationMode=void 0;SQ.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var TQe=v(CQ=>{"use strict";Object.defineProperty(CQ,"__esModule",{value:!0});CQ.V2ChatRequestCitationMode=void 0;CQ.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var IQe=v(AQe=>{"use strict";Object.defineProperty(AQe,"__esModule",{value:!0})});var RQe=v(MQe=>{"use strict";Object.defineProperty(MQe,"__esModule",{value:!0})});var jQe=v(NQe=>{"use strict";Object.defineProperty(NQe,"__esModule",{value:!0})});var LQe=v(DQe=>{"use strict";Object.defineProperty(DQe,"__esModule",{value:!0})});var kQe=v(FQe=>{"use strict";Object.defineProperty(FQe,"__esModule",{value:!0})});var zQe=v($Qe=>{"use strict";Object.defineProperty($Qe,"__esModule",{value:!0})});var UQe=v(BQe=>{"use strict";Object.defineProperty(BQe,"__esModule",{value:!0})});var HQe=v(qQe=>{"use strict";Object.defineProperty(qQe,"__esModule",{value:!0})});var WQe=v(VQe=>{"use strict";Object.defineProperty(VQe,"__esModule",{value:!0})});var GQe=v(KQe=>{"use strict";Object.defineProperty(KQe,"__esModule",{value:!0})});var ZQe=v(JQe=>{"use strict";Object.defineProperty(JQe,"__esModule",{value:!0})});var XQe=v(YQe=>{"use strict";Object.defineProperty(YQe,"__esModule",{value:!0})});var eet=v(QQe=>{"use strict";Object.defineProperty(QQe,"__esModule",{value:!0})});var ret=v(tet=>{"use strict";Object.defineProperty(tet,"__esModule",{value:!0})});var oet=v(net=>{"use strict";Object.defineProperty(net,"__esModule",{value:!0})});var aet=v(iet=>{"use strict";Object.defineProperty(iet,"__esModule",{value:!0})});var uet=v(set=>{"use strict";Object.defineProperty(set,"__esModule",{value:!0})});var det=v(cet=>{"use strict";Object.defineProperty(cet,"__esModule",{value:!0})});var pet=v(fet=>{"use strict";Object.defineProperty(fet,"__esModule",{value:!0})});var het=v(met=>{"use strict";Object.defineProperty(met,"__esModule",{value:!0})});var yet=v(get=>{"use strict";Object.defineProperty(get,"__esModule",{value:!0})});var _et=v(bet=>{"use strict";Object.defineProperty(bet,"__esModule",{value:!0})});var wet=v(vet=>{"use strict";Object.defineProperty(vet,"__esModule",{value:!0})});var xet=v(OQ=>{"use strict";Object.defineProperty(OQ,"__esModule",{value:!0});OQ.ChatFinishReason=void 0;OQ.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var Oet=v(Cet=>{"use strict";Object.defineProperty(Cet,"__esModule",{value:!0})});var Eet=v(Pet=>{"use strict";Object.defineProperty(Pet,"__esModule",{value:!0})});var Aet=v(Tet=>{"use strict";Object.defineProperty(Tet,"__esModule",{value:!0})});var Met=v(Iet=>{"use strict";Object.defineProperty(Iet,"__esModule",{value:!0})});var Net=v(Ret=>{"use strict";Object.defineProperty(Ret,"__esModule",{value:!0})});var Det=v(jet=>{"use strict";Object.defineProperty(jet,"__esModule",{value:!0})});var Fet=v(Let=>{"use strict";Object.defineProperty(Let,"__esModule",{value:!0})});var $et=v(ket=>{"use strict";Object.defineProperty(ket,"__esModule",{value:!0})});var Bet=v(zet=>{"use strict";Object.defineProperty(zet,"__esModule",{value:!0})});var qet=v(Uet=>{"use strict";Object.defineProperty(Uet,"__esModule",{value:!0})});var Vet=v(Het=>{"use strict";Object.defineProperty(Het,"__esModule",{value:!0})});var Ket=v(Wet=>{"use strict";Object.defineProperty(Wet,"__esModule",{value:!0})});var Jet=v(Get=>{"use strict";Object.defineProperty(Get,"__esModule",{value:!0})});var Yet=v(Zet=>{"use strict";Object.defineProperty(Zet,"__esModule",{value:!0})});var Qet=v(Xet=>{"use strict";Object.defineProperty(Xet,"__esModule",{value:!0})});var ttt=v(ett=>{"use strict";Object.defineProperty(ett,"__esModule",{value:!0})});var ntt=v(rtt=>{"use strict";Object.defineProperty(rtt,"__esModule",{value:!0})});var itt=v(ott=>{"use strict";Object.defineProperty(ott,"__esModule",{value:!0})});var stt=v(att=>{"use strict";Object.defineProperty(att,"__esModule",{value:!0})});var ltt=v(utt=>{"use strict";Object.defineProperty(utt,"__esModule",{value:!0})});var dtt=v(ctt=>{"use strict";Object.defineProperty(ctt,"__esModule",{value:!0})});var ptt=v(ftt=>{"use strict";Object.defineProperty(ftt,"__esModule",{value:!0})});var htt=v(mtt=>{"use strict";Object.defineProperty(mtt,"__esModule",{value:!0})});var ytt=v(gtt=>{"use strict";Object.defineProperty(gtt,"__esModule",{value:!0})});var _tt=v(btt=>{"use strict";Object.defineProperty(btt,"__esModule",{value:!0})});var wtt=v(vtt=>{"use strict";Object.defineProperty(vtt,"__esModule",{value:!0})});var Stt=v(xtt=>{"use strict";Object.defineProperty(xtt,"__esModule",{value:!0})});var Ott=v(Ctt=>{"use strict";Object.defineProperty(Ctt,"__esModule",{value:!0})});var Ett=v(Ptt=>{"use strict";Object.defineProperty(Ptt,"__esModule",{value:!0})});var Att=v(Ttt=>{"use strict";Object.defineProperty(Ttt,"__esModule",{value:!0})});var Mtt=v(Itt=>{"use strict";Object.defineProperty(Itt,"__esModule",{value:!0})});var Ntt=v(Rtt=>{"use strict";Object.defineProperty(Rtt,"__esModule",{value:!0})});var Dtt=v(jtt=>{"use strict";Object.defineProperty(jtt,"__esModule",{value:!0})});var Wxe=v(Mt=>{"use strict";var dwr=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]}),Wt=Mt&&Mt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dwr(e,t,r)};Object.defineProperty(Mt,"__esModule",{value:!0});Wt(EQe(),Mt);Wt(TQe(),Mt);Wt(IQe(),Mt);Wt(RQe(),Mt);Wt(jQe(),Mt);Wt(LQe(),Mt);Wt(kQe(),Mt);Wt(zQe(),Mt);Wt(UQe(),Mt);Wt(HQe(),Mt);Wt(WQe(),Mt);Wt(GQe(),Mt);Wt(ZQe(),Mt);Wt(XQe(),Mt);Wt(eet(),Mt);Wt(ret(),Mt);Wt(oet(),Mt);Wt(aet(),Mt);Wt(uet(),Mt);Wt(det(),Mt);Wt(pet(),Mt);Wt(het(),Mt);Wt(yet(),Mt);Wt(_et(),Mt);Wt(wet(),Mt);Wt(xet(),Mt);Wt(Oet(),Mt);Wt(Eet(),Mt);Wt(Aet(),Mt);Wt(Met(),Mt);Wt(Net(),Mt);Wt(Det(),Mt);Wt(Fet(),Mt);Wt($et(),Mt);Wt(Bet(),Mt);Wt(qet(),Mt);Wt(Vet(),Mt);Wt(Ket(),Mt);Wt(Jet(),Mt);Wt(Yet(),Mt);Wt(Qet(),Mt);Wt(ttt(),Mt);Wt(ntt(),Mt);Wt(itt(),Mt);Wt(stt(),Mt);Wt(ltt(),Mt);Wt(dtt(),Mt);Wt(ptt(),Mt);Wt(htt(),Mt);Wt(ytt(),Mt);Wt(_tt(),Mt);Wt(wtt(),Mt);Wt(Stt(),Mt);Wt(Ott(),Mt);Wt(Ett(),Mt);Wt(Att(),Mt);Wt(Mtt(),Mt);Wt(Ntt(),Mt);Wt(Dtt(),Mt)});var Kxe=v(Ltt=>{"use strict";Object.defineProperty(Ltt,"__esModule",{value:!0})});var Ftt=v(QN=>{"use strict";var fwr=QN&&QN.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=QN&&QN.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fwr(e,t,r)};Object.defineProperty(QN,"__esModule",{value:!0});pwr(Kxe(),QN)});var $tt=v(UA=>{"use strict";var mwr=UA&&UA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ktt=UA&&UA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mwr(e,t,r)};Object.defineProperty(UA,"__esModule",{value:!0});ktt(Wxe(),UA);ktt(Ftt(),UA)});var ztt=v(PQ=>{"use strict";Object.defineProperty(PQ,"__esModule",{value:!0});PQ.CreateEmbedJobRequestTruncate=void 0;PQ.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Gxe=v(ej=>{"use strict";var hwr=ej&&ej.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gwr=ej&&ej.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hwr(e,t,r)};Object.defineProperty(ej,"__esModule",{value:!0});gwr(ztt(),ej)});var Jxe=v(Btt=>{"use strict";Object.defineProperty(Btt,"__esModule",{value:!0})});var Utt=v(tj=>{"use strict";var ywr=tj&&tj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bwr=tj&&tj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ywr(e,t,r)};Object.defineProperty(tj,"__esModule",{value:!0});bwr(Jxe(),tj)});var Htt=v(qA=>{"use strict";var _wr=qA&&qA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qtt=qA&&qA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_wr(e,t,r)};Object.defineProperty(qA,"__esModule",{value:!0});qtt(Gxe(),qA);qtt(Utt(),qA)});var Wtt=v(Vtt=>{"use strict";Object.defineProperty(Vtt,"__esModule",{value:!0})});var Gtt=v(Ktt=>{"use strict";Object.defineProperty(Ktt,"__esModule",{value:!0})});var Ztt=v(Jtt=>{"use strict";Object.defineProperty(Jtt,"__esModule",{value:!0})});var Xtt=v(Ytt=>{"use strict";Object.defineProperty(Ytt,"__esModule",{value:!0})});var ert=v(Qtt=>{"use strict";Object.defineProperty(Qtt,"__esModule",{value:!0})});var Zxe=v(hb=>{"use strict";var vwr=hb&&hb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R8=hb&&hb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vwr(e,t,r)};Object.defineProperty(hb,"__esModule",{value:!0});R8(Wtt(),hb);R8(Gtt(),hb);R8(Ztt(),hb);R8(Xtt(),hb);R8(ert(),hb)});var Yxe=v(trt=>{"use strict";Object.defineProperty(trt,"__esModule",{value:!0})});var rrt=v(rj=>{"use strict";var wwr=rj&&rj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xwr=rj&&rj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wwr(e,t,r)};Object.defineProperty(rj,"__esModule",{value:!0});xwr(Yxe(),rj)});var ort=v(HA=>{"use strict";var Swr=HA&&HA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nrt=HA&&HA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Swr(e,t,r)};Object.defineProperty(HA,"__esModule",{value:!0});nrt(Zxe(),HA);nrt(rrt(),HA)});var irt=v(EQ=>{"use strict";Object.defineProperty(EQ,"__esModule",{value:!0});EQ.BaseType=void 0;EQ.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var art=v(TQ=>{"use strict";Object.defineProperty(TQ,"__esModule",{value:!0});TQ.Strategy=void 0;TQ.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var urt=v(srt=>{"use strict";Object.defineProperty(srt,"__esModule",{value:!0})});var crt=v(lrt=>{"use strict";Object.defineProperty(lrt,"__esModule",{value:!0})});var frt=v(drt=>{"use strict";Object.defineProperty(drt,"__esModule",{value:!0})});var mrt=v(prt=>{"use strict";Object.defineProperty(prt,"__esModule",{value:!0})});var hrt=v(AQ=>{"use strict";Object.defineProperty(AQ,"__esModule",{value:!0});AQ.Status=void 0;AQ.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 yrt=v(grt=>{"use strict";Object.defineProperty(grt,"__esModule",{value:!0})});var _rt=v(brt=>{"use strict";Object.defineProperty(brt,"__esModule",{value:!0})});var wrt=v(vrt=>{"use strict";Object.defineProperty(vrt,"__esModule",{value:!0})});var Srt=v(xrt=>{"use strict";Object.defineProperty(xrt,"__esModule",{value:!0})});var Ort=v(Crt=>{"use strict";Object.defineProperty(Crt,"__esModule",{value:!0})});var Ert=v(Prt=>{"use strict";Object.defineProperty(Prt,"__esModule",{value:!0})});var Art=v(Trt=>{"use strict";Object.defineProperty(Trt,"__esModule",{value:!0})});var Mrt=v(Irt=>{"use strict";Object.defineProperty(Irt,"__esModule",{value:!0})});var Nrt=v(Rrt=>{"use strict";Object.defineProperty(Rrt,"__esModule",{value:!0})});var Drt=v(jrt=>{"use strict";Object.defineProperty(jrt,"__esModule",{value:!0})});var Xxe=v(Xa=>{"use strict";var Cwr=Xa&&Xa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Xa&&Xa.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cwr(e,t,r)};Object.defineProperty(Xa,"__esModule",{value:!0});ad(irt(),Xa);ad(art(),Xa);ad(urt(),Xa);ad(crt(),Xa);ad(frt(),Xa);ad(mrt(),Xa);ad(hrt(),Xa);ad(yrt(),Xa);ad(_rt(),Xa);ad(wrt(),Xa);ad(Srt(),Xa);ad(Ort(),Xa);ad(Ert(),Xa);ad(Art(),Xa);ad(Mrt(),Xa);ad(Nrt(),Xa);ad(Drt(),Xa)});var Lrt=v(nj=>{"use strict";var Owr=nj&&nj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=nj&&nj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Owr(e,t,r)};Object.defineProperty(nj,"__esModule",{value:!0});Pwr(Xxe(),nj)});var krt=v(ih=>{"use strict";var Frt=ih&&ih.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ewr=ih&&ih.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Twr=ih&&ih.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Frt(e,t,r);return Ewr(e,t),e},Awr=ih&&ih.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Frt(e,t,r)};Object.defineProperty(ih,"__esModule",{value:!0});ih.finetuning=void 0;ih.finetuning=Twr(Lrt());Awr(Xxe(),ih)});var Qxe=v($rt=>{"use strict";Object.defineProperty($rt,"__esModule",{value:!0})});var zrt=v(oj=>{"use strict";var Iwr=oj&&oj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=oj&&oj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Iwr(e,t,r)};Object.defineProperty(oj,"__esModule",{value:!0});Mwr(Qxe(),oj)});var Urt=v(VA=>{"use strict";var Rwr=VA&&VA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Brt=VA&&VA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rwr(e,t,r)};Object.defineProperty(VA,"__esModule",{value:!0});Brt(krt(),VA);Brt(zrt(),VA)});var eSe=v(qrt=>{"use strict";Object.defineProperty(qrt,"__esModule",{value:!0})});var Hrt=v(ij=>{"use strict";var Nwr=ij&&ij.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jwr=ij&&ij.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Nwr(e,t,r)};Object.defineProperty(ij,"__esModule",{value:!0});jwr(eSe(),ij)});var Vrt=v(aj=>{"use strict";var Dwr=aj&&aj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=aj&&aj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Dwr(e,t,r)};Object.defineProperty(aj,"__esModule",{value:!0});Lwr(Hrt(),aj)});var tSe=v(Wrt=>{"use strict";Object.defineProperty(Wrt,"__esModule",{value:!0})});var Krt=v(sj=>{"use strict";var Fwr=sj&&sj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=sj&&sj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fwr(e,t,r)};Object.defineProperty(sj,"__esModule",{value:!0});kwr(tSe(),sj)});var Grt=v(uj=>{"use strict";var $wr=uj&&uj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zwr=uj&&uj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$wr(e,t,r)};Object.defineProperty(uj,"__esModule",{value:!0});zwr(Krt(),uj)});var Zrt=v(fi=>{"use strict";var Jrt=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]}),Bwr=fi&&fi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_z=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)&&Jrt(e,t,r);return Bwr(e,t),e},uP=fi&&fi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jrt(e,t,r)};Object.defineProperty(fi,"__esModule",{value:!0});fi.models=fi.connectors=fi.finetuning=fi.datasets=fi.embedJobs=fi.v2=void 0;fi.v2=_z($tt());uP(Wxe(),fi);fi.embedJobs=_z(Htt());uP(Gxe(),fi);fi.datasets=_z(ort());uP(Zxe(),fi);fi.finetuning=_z(Urt());fi.connectors=_z(Vrt());fi.models=_z(Grt());uP(Kxe(),fi);uP(Jxe(),fi);uP(Yxe(),fi);uP(eSe(),fi);uP(tSe(),fi);uP(Qxe(),fi)});var Yrt=v(IQ=>{"use strict";Object.defineProperty(IQ,"__esModule",{value:!0});IQ.ChatStreamRequestPromptTruncation=void 0;IQ.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var Xrt=v(MQ=>{"use strict";Object.defineProperty(MQ,"__esModule",{value:!0});MQ.ChatStreamRequestCitationQuality=void 0;MQ.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var ent=v(Qrt=>{"use strict";Object.defineProperty(Qrt,"__esModule",{value:!0})});var tnt=v(RQ=>{"use strict";Object.defineProperty(RQ,"__esModule",{value:!0});RQ.ChatStreamRequestSafetyMode=void 0;RQ.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var nnt=v(rnt=>{"use strict";Object.defineProperty(rnt,"__esModule",{value:!0})});var int=v(ont=>{"use strict";Object.defineProperty(ont,"__esModule",{value:!0})});var snt=v(ant=>{"use strict";Object.defineProperty(ant,"__esModule",{value:!0})});var lnt=v(unt=>{"use strict";Object.defineProperty(unt,"__esModule",{value:!0})});var dnt=v(cnt=>{"use strict";Object.defineProperty(cnt,"__esModule",{value:!0})});var fnt=v(NQ=>{"use strict";Object.defineProperty(NQ,"__esModule",{value:!0});NQ.ChatRequestPromptTruncation=void 0;NQ.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var pnt=v(jQ=>{"use strict";Object.defineProperty(jQ,"__esModule",{value:!0});jQ.ChatRequestCitationQuality=void 0;jQ.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var hnt=v(mnt=>{"use strict";Object.defineProperty(mnt,"__esModule",{value:!0})});var gnt=v(DQ=>{"use strict";Object.defineProperty(DQ,"__esModule",{value:!0});DQ.ChatRequestSafetyMode=void 0;DQ.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var ynt=v(LQ=>{"use strict";Object.defineProperty(LQ,"__esModule",{value:!0});LQ.GenerateStreamRequestTruncate=void 0;LQ.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var bnt=v(FQ=>{"use strict";Object.defineProperty(FQ,"__esModule",{value:!0});FQ.GenerateStreamRequestReturnLikelihoods=void 0;FQ.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var _nt=v(kQ=>{"use strict";Object.defineProperty(kQ,"__esModule",{value:!0});kQ.GenerateRequestTruncate=void 0;kQ.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var vnt=v($Q=>{"use strict";Object.defineProperty($Q,"__esModule",{value:!0});$Q.GenerateRequestReturnLikelihoods=void 0;$Q.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var wnt=v(zQ=>{"use strict";Object.defineProperty(zQ,"__esModule",{value:!0});zQ.EmbedRequestTruncate=void 0;zQ.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Snt=v(xnt=>{"use strict";Object.defineProperty(xnt,"__esModule",{value:!0})});var Ont=v(Cnt=>{"use strict";Object.defineProperty(Cnt,"__esModule",{value:!0})});var Ent=v(Pnt=>{"use strict";Object.defineProperty(Pnt,"__esModule",{value:!0})});var Ant=v(Tnt=>{"use strict";Object.defineProperty(Tnt,"__esModule",{value:!0})});var Mnt=v(Int=>{"use strict";Object.defineProperty(Int,"__esModule",{value:!0})});var Rnt=v(BQ=>{"use strict";Object.defineProperty(BQ,"__esModule",{value:!0});BQ.ClassifyRequestTruncate=void 0;BQ.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var jnt=v(Nnt=>{"use strict";Object.defineProperty(Nnt,"__esModule",{value:!0})});var Dnt=v(UQ=>{"use strict";Object.defineProperty(UQ,"__esModule",{value:!0});UQ.ClassifyResponseClassificationsItemClassificationType=void 0;UQ.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var Fnt=v(Lnt=>{"use strict";Object.defineProperty(Lnt,"__esModule",{value:!0})});var $nt=v(knt=>{"use strict";Object.defineProperty(knt,"__esModule",{value:!0})});var znt=v(qQ=>{"use strict";Object.defineProperty(qQ,"__esModule",{value:!0});qQ.SummarizeRequestLength=void 0;qQ.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var Bnt=v(HQ=>{"use strict";Object.defineProperty(HQ,"__esModule",{value:!0});HQ.SummarizeRequestFormat=void 0;HQ.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var Unt=v(VQ=>{"use strict";Object.defineProperty(VQ,"__esModule",{value:!0});VQ.SummarizeRequestExtractiveness=void 0;VQ.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var Hnt=v(qnt=>{"use strict";Object.defineProperty(qnt,"__esModule",{value:!0})});var Wnt=v(Vnt=>{"use strict";Object.defineProperty(Vnt,"__esModule",{value:!0})});var Gnt=v(Knt=>{"use strict";Object.defineProperty(Knt,"__esModule",{value:!0})});var Znt=v(Jnt=>{"use strict";Object.defineProperty(Jnt,"__esModule",{value:!0})});var Xnt=v(Ynt=>{"use strict";Object.defineProperty(Ynt,"__esModule",{value:!0})});var eot=v(Qnt=>{"use strict";Object.defineProperty(Qnt,"__esModule",{value:!0})});var rot=v(tot=>{"use strict";Object.defineProperty(tot,"__esModule",{value:!0})});var oot=v(not=>{"use strict";Object.defineProperty(not,"__esModule",{value:!0})});var aot=v(iot=>{"use strict";Object.defineProperty(iot,"__esModule",{value:!0})});var uot=v(sot=>{"use strict";Object.defineProperty(sot,"__esModule",{value:!0})});var cot=v(lot=>{"use strict";Object.defineProperty(lot,"__esModule",{value:!0})});var fot=v(dot=>{"use strict";Object.defineProperty(dot,"__esModule",{value:!0})});var mot=v(pot=>{"use strict";Object.defineProperty(pot,"__esModule",{value:!0})});var got=v(hot=>{"use strict";Object.defineProperty(hot,"__esModule",{value:!0})});var bot=v(yot=>{"use strict";Object.defineProperty(yot,"__esModule",{value:!0})});var vot=v(_ot=>{"use strict";Object.defineProperty(_ot,"__esModule",{value:!0})});var xot=v(wot=>{"use strict";Object.defineProperty(wot,"__esModule",{value:!0})});var Cot=v(Sot=>{"use strict";Object.defineProperty(Sot,"__esModule",{value:!0})});var Pot=v(Oot=>{"use strict";Object.defineProperty(Oot,"__esModule",{value:!0})});var Tot=v(Eot=>{"use strict";Object.defineProperty(Eot,"__esModule",{value:!0})});var Aot=v(WQ=>{"use strict";Object.defineProperty(WQ,"__esModule",{value:!0});WQ.FinishReason=void 0;WQ.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var Mot=v(Iot=>{"use strict";Object.defineProperty(Iot,"__esModule",{value:!0})});var Not=v(Rot=>{"use strict";Object.defineProperty(Rot,"__esModule",{value:!0})});var Dot=v(jot=>{"use strict";Object.defineProperty(jot,"__esModule",{value:!0})});var Fot=v(Lot=>{"use strict";Object.defineProperty(Lot,"__esModule",{value:!0})});var $ot=v(kot=>{"use strict";Object.defineProperty(kot,"__esModule",{value:!0})});var Bot=v(zot=>{"use strict";Object.defineProperty(zot,"__esModule",{value:!0})});var qot=v(Uot=>{"use strict";Object.defineProperty(Uot,"__esModule",{value:!0})});var Vot=v(Hot=>{"use strict";Object.defineProperty(Hot,"__esModule",{value:!0})});var Kot=v(Wot=>{"use strict";Object.defineProperty(Wot,"__esModule",{value:!0})});var Jot=v(Got=>{"use strict";Object.defineProperty(Got,"__esModule",{value:!0})});var Yot=v(Zot=>{"use strict";Object.defineProperty(Zot,"__esModule",{value:!0})});var Qot=v(Xot=>{"use strict";Object.defineProperty(Xot,"__esModule",{value:!0})});var eit=v(KQ=>{"use strict";Object.defineProperty(KQ,"__esModule",{value:!0});KQ.ChatStreamEndEventFinishReason=void 0;KQ.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var rit=v(tit=>{"use strict";Object.defineProperty(tit,"__esModule",{value:!0})});var oit=v(nit=>{"use strict";Object.defineProperty(nit,"__esModule",{value:!0})});var ait=v(iit=>{"use strict";Object.defineProperty(iit,"__esModule",{value:!0})});var uit=v(sit=>{"use strict";Object.defineProperty(sit,"__esModule",{value:!0})});var cit=v(lit=>{"use strict";Object.defineProperty(lit,"__esModule",{value:!0})});var fit=v(dit=>{"use strict";Object.defineProperty(dit,"__esModule",{value:!0})});var mit=v(pit=>{"use strict";Object.defineProperty(pit,"__esModule",{value:!0})});var git=v(hit=>{"use strict";Object.defineProperty(hit,"__esModule",{value:!0})});var bit=v(yit=>{"use strict";Object.defineProperty(yit,"__esModule",{value:!0})});var vit=v(_it=>{"use strict";Object.defineProperty(_it,"__esModule",{value:!0})});var xit=v(wit=>{"use strict";Object.defineProperty(wit,"__esModule",{value:!0})});var Cit=v(Sit=>{"use strict";Object.defineProperty(Sit,"__esModule",{value:!0})});var Pit=v(Oit=>{"use strict";Object.defineProperty(Oit,"__esModule",{value:!0})});var Tit=v(Eit=>{"use strict";Object.defineProperty(Eit,"__esModule",{value:!0})});var Iit=v(Ait=>{"use strict";Object.defineProperty(Ait,"__esModule",{value:!0})});var Rit=v(Mit=>{"use strict";Object.defineProperty(Mit,"__esModule",{value:!0})});var jit=v(Nit=>{"use strict";Object.defineProperty(Nit,"__esModule",{value:!0})});var Lit=v(Dit=>{"use strict";Object.defineProperty(Dit,"__esModule",{value:!0})});var kit=v(Fit=>{"use strict";Object.defineProperty(Fit,"__esModule",{value:!0})});var zit=v($it=>{"use strict";Object.defineProperty($it,"__esModule",{value:!0})});var Bit=v(GQ=>{"use strict";Object.defineProperty(GQ,"__esModule",{value:!0});GQ.EmbedInputType=void 0;GQ.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var Uit=v(JQ=>{"use strict";Object.defineProperty(JQ,"__esModule",{value:!0});JQ.EmbeddingType=void 0;JQ.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var Hit=v(qit=>{"use strict";Object.defineProperty(qit,"__esModule",{value:!0})});var Wit=v(Vit=>{"use strict";Object.defineProperty(Vit,"__esModule",{value:!0})});var Git=v(Kit=>{"use strict";Object.defineProperty(Kit,"__esModule",{value:!0})});var Jit=v(ZQ=>{"use strict";Object.defineProperty(ZQ,"__esModule",{value:!0});ZQ.EmbedJobStatus=void 0;ZQ.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var Zit=v(YQ=>{"use strict";Object.defineProperty(YQ,"__esModule",{value:!0});YQ.EmbedJobTruncate=void 0;YQ.EmbedJobTruncate={Start:"START",End:"END"}});var Xit=v(Yit=>{"use strict";Object.defineProperty(Yit,"__esModule",{value:!0})});var eat=v(Qit=>{"use strict";Object.defineProperty(Qit,"__esModule",{value:!0})});var rat=v(tat=>{"use strict";Object.defineProperty(tat,"__esModule",{value:!0})});var oat=v(nat=>{"use strict";Object.defineProperty(nat,"__esModule",{value:!0})});var aat=v(iat=>{"use strict";Object.defineProperty(iat,"__esModule",{value:!0})});var sat=v(XQ=>{"use strict";Object.defineProperty(XQ,"__esModule",{value:!0});XQ.DatasetValidationStatus=void 0;XQ.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var uat=v(QQ=>{"use strict";Object.defineProperty(QQ,"__esModule",{value:!0});QQ.DatasetType=void 0;QQ.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 cat=v(lat=>{"use strict";Object.defineProperty(lat,"__esModule",{value:!0})});var fat=v(dat=>{"use strict";Object.defineProperty(dat,"__esModule",{value:!0})});var mat=v(pat=>{"use strict";Object.defineProperty(pat,"__esModule",{value:!0})});var gat=v(hat=>{"use strict";Object.defineProperty(hat,"__esModule",{value:!0})});var bat=v(yat=>{"use strict";Object.defineProperty(yat,"__esModule",{value:!0})});var vat=v(_at=>{"use strict";Object.defineProperty(_at,"__esModule",{value:!0})});var xat=v(wat=>{"use strict";Object.defineProperty(wat,"__esModule",{value:!0})});var Cat=v(Sat=>{"use strict";Object.defineProperty(Sat,"__esModule",{value:!0})});var Pat=v(Oat=>{"use strict";Object.defineProperty(Oat,"__esModule",{value:!0})});var Tat=v(Eat=>{"use strict";Object.defineProperty(Eat,"__esModule",{value:!0})});var Iat=v(Aat=>{"use strict";Object.defineProperty(Aat,"__esModule",{value:!0})});var Rat=v(Mat=>{"use strict";Object.defineProperty(Mat,"__esModule",{value:!0})});var Nat=v(eee=>{"use strict";Object.defineProperty(eee,"__esModule",{value:!0});eee.ConnectorAuthStatus=void 0;eee.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var Dat=v(jat=>{"use strict";Object.defineProperty(jat,"__esModule",{value:!0})});var Fat=v(Lat=>{"use strict";Object.defineProperty(Lat,"__esModule",{value:!0})});var $at=v(kat=>{"use strict";Object.defineProperty(kat,"__esModule",{value:!0})});var zat=v(tee=>{"use strict";Object.defineProperty(tee,"__esModule",{value:!0});tee.AuthTokenType=void 0;tee.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var Uat=v(Bat=>{"use strict";Object.defineProperty(Bat,"__esModule",{value:!0})});var Hat=v(qat=>{"use strict";Object.defineProperty(qat,"__esModule",{value:!0})});var Wat=v(Vat=>{"use strict";Object.defineProperty(Vat,"__esModule",{value:!0})});var Gat=v(Kat=>{"use strict";Object.defineProperty(Kat,"__esModule",{value:!0})});var Zat=v(Jat=>{"use strict";Object.defineProperty(Jat,"__esModule",{value:!0})});var Xat=v(Yat=>{"use strict";Object.defineProperty(Yat,"__esModule",{value:!0})});var Qat=v(ree=>{"use strict";Object.defineProperty(ree,"__esModule",{value:!0});ree.CompatibleEndpoint=void 0;ree.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var tst=v(est=>{"use strict";Object.defineProperty(est,"__esModule",{value:!0})});var nst=v(rst=>{"use strict";Object.defineProperty(rst,"__esModule",{value:!0})});var ost=v(me=>{"use strict";var Uwr=me&&me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Se=me&&me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Uwr(e,t,r)};Object.defineProperty(me,"__esModule",{value:!0});Se(Yrt(),me);Se(Xrt(),me);Se(ent(),me);Se(tnt(),me);Se(nnt(),me);Se(int(),me);Se(snt(),me);Se(lnt(),me);Se(dnt(),me);Se(fnt(),me);Se(pnt(),me);Se(hnt(),me);Se(gnt(),me);Se(ynt(),me);Se(bnt(),me);Se(_nt(),me);Se(vnt(),me);Se(wnt(),me);Se(Snt(),me);Se(Ont(),me);Se(Ent(),me);Se(Ant(),me);Se(Mnt(),me);Se(Rnt(),me);Se(jnt(),me);Se(Dnt(),me);Se(Fnt(),me);Se($nt(),me);Se(znt(),me);Se(Bnt(),me);Se(Unt(),me);Se(Hnt(),me);Se(Wnt(),me);Se(Gnt(),me);Se(Znt(),me);Se(Xnt(),me);Se(eot(),me);Se(rot(),me);Se(oot(),me);Se(aot(),me);Se(uot(),me);Se(cot(),me);Se(fot(),me);Se(mot(),me);Se(got(),me);Se(bot(),me);Se(vot(),me);Se(xot(),me);Se(Cot(),me);Se(Pot(),me);Se(Tot(),me);Se(Aot(),me);Se(Mot(),me);Se(Not(),me);Se(Dot(),me);Se(Fot(),me);Se($ot(),me);Se(Bot(),me);Se(qot(),me);Se(Vot(),me);Se(Kot(),me);Se(Jot(),me);Se(Yot(),me);Se(Qot(),me);Se(eit(),me);Se(rit(),me);Se(oit(),me);Se(ait(),me);Se(uit(),me);Se(cit(),me);Se(fit(),me);Se(mit(),me);Se(git(),me);Se(bit(),me);Se(vit(),me);Se(xit(),me);Se(Cit(),me);Se(Pit(),me);Se(Tit(),me);Se(Iit(),me);Se(Rit(),me);Se(jit(),me);Se(Lit(),me);Se(kit(),me);Se(zit(),me);Se(Bit(),me);Se(Uit(),me);Se(Hit(),me);Se(Wit(),me);Se(Git(),me);Se(Jit(),me);Se(Zit(),me);Se(Xit(),me);Se(eat(),me);Se(rat(),me);Se(oat(),me);Se(aat(),me);Se(sat(),me);Se(uat(),me);Se(cat(),me);Se(fat(),me);Se(mat(),me);Se(gat(),me);Se(bat(),me);Se(vat(),me);Se(xat(),me);Se(Cat(),me);Se(Pat(),me);Se(Tat(),me);Se(Iat(),me);Se(Rat(),me);Se(Nat(),me);Se(Dat(),me);Se(Fat(),me);Se($at(),me);Se(zat(),me);Se(Uat(),me);Se(Hat(),me);Se(Wat(),me);Se(Gat(),me);Se(Zat(),me);Se(Xat(),me);Se(Qat(),me);Se(tst(),me);Se(nst(),me)});var ist=v(nee=>{"use strict";Object.defineProperty(nee,"__esModule",{value:!0});nee.CohereError=void 0;var rSe=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(qwr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};nee.CohereError=rSe;function qwr({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 ast=v(oee=>{"use strict";Object.defineProperty(oee,"__esModule",{value:!0});oee.CohereTimeoutError=void 0;var nSe=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};oee.CohereTimeoutError=nSe});var Hs=v(vz=>{"use strict";Object.defineProperty(vz,"__esModule",{value:!0});vz.CohereTimeoutError=vz.CohereError=void 0;var Hwr=ist();Object.defineProperty(vz,"CohereError",{enumerable:!0,get:function(){return Hwr.CohereError}});var Vwr=ast();Object.defineProperty(vz,"CohereTimeoutError",{enumerable:!0,get:function(){return Vwr.CohereTimeoutError}})});var sst=v(uv=>{"use strict";var Wwr=uv&&uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=uv&&uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gwr=uv&&uv.__importStar||function(t){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(uv,"__esModule",{value:!0});uv.BadRequestError=void 0;var Jwr=Gwr(Hs()),oSe=class t extends Jwr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};uv.BadRequestError=oSe});var ust=v(lv=>{"use strict";var Zwr=lv&&lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xwr=lv&&lv.__importStar||function(t){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(lv,"__esModule",{value:!0});lv.UnauthorizedError=void 0;var Qwr=Xwr(Hs()),iSe=class t extends Qwr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};lv.UnauthorizedError=iSe});var lst=v(cv=>{"use strict";var e0r=cv&&cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t0r=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r0r=cv&&cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e0r(e,t,r);return t0r(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.ForbiddenError=void 0;var n0r=r0r(Hs()),aSe=class t extends n0r.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};cv.ForbiddenError=aSe});var cst=v(dv=>{"use strict";var o0r=dv&&dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i0r=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a0r=dv&&dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o0r(e,t,r);return i0r(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.NotFoundError=void 0;var s0r=a0r(Hs()),sSe=class t extends s0r.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};dv.NotFoundError=sSe});var dst=v(fv=>{"use strict";var u0r=fv&&fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l0r=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c0r=fv&&fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u0r(e,t,r);return l0r(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.UnprocessableEntityError=void 0;var d0r=c0r(Hs()),uSe=class t extends d0r.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};fv.UnprocessableEntityError=uSe});var fst=v(pv=>{"use strict";var f0r=pv&&pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p0r=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m0r=pv&&pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f0r(e,t,r);return p0r(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.TooManyRequestsError=void 0;var h0r=m0r(Hs()),lSe=class t extends h0r.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};pv.TooManyRequestsError=lSe});var pst=v(mv=>{"use strict";var g0r=mv&&mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y0r=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b0r=mv&&mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g0r(e,t,r);return y0r(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.ClientClosedRequestError=void 0;var _0r=b0r(Hs()),cSe=class t extends _0r.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};mv.ClientClosedRequestError=cSe});var mst=v(hv=>{"use strict";var v0r=hv&&hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w0r=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x0r=hv&&hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&v0r(e,t,r);return w0r(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.InternalServerError=void 0;var S0r=x0r(Hs()),dSe=class t extends S0r.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};hv.InternalServerError=dSe});var hst=v(gv=>{"use strict";var C0r=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]}),O0r=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P0r=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)&&C0r(e,t,r);return O0r(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.NotImplementedError=void 0;var E0r=P0r(Hs()),fSe=class t extends E0r.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};gv.NotImplementedError=fSe});var gst=v(yv=>{"use strict";var T0r=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]}),A0r=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I0r=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)&&T0r(e,t,r);return A0r(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.ServiceUnavailableError=void 0;var M0r=I0r(Hs()),pSe=class t extends M0r.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};yv.ServiceUnavailableError=pSe});var yst=v(bv=>{"use strict";var R0r=bv&&bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N0r=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j0r=bv&&bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&R0r(e,t,r);return N0r(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.GatewayTimeoutError=void 0;var D0r=j0r(Hs()),mSe=class t extends D0r.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};bv.GatewayTimeoutError=mSe});var bst=v(sd=>{"use strict";var L0r=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]}),gb=sd&&sd.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&L0r(e,t,r)};Object.defineProperty(sd,"__esModule",{value:!0});gb(sst(),sd);gb(ust(),sd);gb(lst(),sd);gb(cst(),sd);gb(dst(),sd);gb(fst(),sd);gb(pst(),sd);gb(mst(),sd);gb(hst(),sd);gb(gst(),sd);gb(yst(),sd)});var vst=v(_st=>{"use strict";Object.defineProperty(_st,"__esModule",{value:!0})});var wst=v(lj=>{"use strict";var F0r=lj&&lj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k0r=lj&&lj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F0r(e,t,r)};Object.defineProperty(lj,"__esModule",{value:!0});k0r(vst(),lj)});var lP=v(_v=>{"use strict";var $0r=_v&&_v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iee=_v&&_v.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$0r(e,t,r)};Object.defineProperty(_v,"__esModule",{value:!0});iee(Zrt(),_v);iee(ost(),_v);iee(bst(),_v);iee(wst(),_v)});var ySe={};Qd(ySe,{__addDisposableResource:()=>Ust,__assign:()=>aee,__asyncDelegator:()=>jst,__asyncGenerator:()=>Nst,__asyncValues:()=>Dst,__await:()=>wz,__awaiter:()=>Est,__classPrivateFieldGet:()=>$st,__classPrivateFieldIn:()=>Bst,__classPrivateFieldSet:()=>zst,__createBinding:()=>uee,__decorate:()=>Cst,__disposeResources:()=>qst,__esDecorate:()=>z0r,__exportStar:()=>Ast,__extends:()=>xst,__generator:()=>Tst,__importDefault:()=>kst,__importStar:()=>Fst,__makeTemplateObject:()=>Lst,__metadata:()=>Pst,__param:()=>Ost,__propKey:()=>U0r,__read:()=>gSe,__rest:()=>Sst,__runInitializers:()=>B0r,__setFunctionName:()=>q0r,__spread:()=>Ist,__spreadArray:()=>Rst,__spreadArrays:()=>Mst,__values:()=>see,default:()=>W0r});function xst(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");hSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Sst(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 Cst(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 Ost(t,e){return function(r,n){e(r,n,t)}}function z0r(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function B0r(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 U0r(t){return typeof t=="symbol"?t:"".concat(t)}function q0r(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 Pst(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Est(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 Tst(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 Ast(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uee(e,t,r)}function see(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 gSe(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 Ist(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(gSe(arguments[e]));return t}function Mst(){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 Rst(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 wz(t){return this instanceof wz?(this.v=t,this):new wz(t)}function Nst(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(b,g){i.push([p,h,b,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof wz?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function jst(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:wz(t[o](a)),done:!1}:i?i(a):a}:i}}function Dst(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 see=="function"?see(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 Lst(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Fst(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uee(e,t,r);return H0r(e,t),e}function kst(t){return t&&t.__esModule?t:{default:t}}function $st(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 zst(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 Bst(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 Ust(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 qst(t){function e(i){t.error=t.hasError?new V0r(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 hSe,aee,uee,H0r,V0r,W0r,bSe=w(()=>{hSe=function(t,e){return hSe=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])},hSe(t,e)};aee=function(){return aee=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},aee.apply(this,arguments)};uee=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};H0r=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};V0r=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};W0r={__extends:xst,__assign:aee,__rest:Sst,__decorate:Cst,__param:Ost,__metadata:Pst,__awaiter:Est,__generator:Tst,__createBinding:uee,__exportStar:Ast,__values:see,__read:gSe,__spread:Ist,__spreadArrays:Mst,__spreadArray:Rst,__await:wz,__asyncGenerator:Nst,__asyncDelegator:jst,__asyncValues:Dst,__makeTemplateObject:Lst,__importStar:Fst,__importDefault:kst,__classPrivateFieldGet:$st,__classPrivateFieldSet:zst,__classPrivateFieldIn:Bst,__addDisposableResource:Ust,__disposeResources:qst}});var _Se=v(Eg=>{"use strict";Object.defineProperty(Eg,"__esModule",{value:!0});Eg.MAX_HASHABLE_LENGTH=Eg.INIT=Eg.KEY=Eg.DIGEST_LENGTH=Eg.BLOCK_SIZE=void 0;Eg.BLOCK_SIZE=64;Eg.DIGEST_LENGTH=32;Eg.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]);Eg.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];Eg.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var Hst=v(lee=>{"use strict";Object.defineProperty(lee,"__esModule",{value:!0});lee.RawSha256=void 0;var Tg=_Se(),K0r=function(){function t(){this.state=Int32Array.from(Tg.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>Tg.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===Tg.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%Tg.BLOCK_SIZE>=Tg.BLOCK_SIZE-8){for(var o=this.bufferLength;o<Tg.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<Tg.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(Tg.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(Tg.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(Tg.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<Tg.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var b=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(Tg.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+b|0,s=a,a=i,i=o,o=b+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();lee.RawSha256=K0r});var Kst=v((Wno,Wst)=>{var cee=Object.defineProperty,G0r=Object.getOwnPropertyDescriptor,J0r=Object.getOwnPropertyNames,Z0r=Object.prototype.hasOwnProperty,Y0r=(t,e)=>cee(t,"name",{value:e,configurable:!0}),X0r=(t,e)=>{for(var r in e)cee(t,r,{get:e[r],enumerable:!0})},Q0r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of J0r(e))!Z0r.call(t,o)&&o!==r&&cee(t,o,{get:()=>e[o],enumerable:!(n=G0r(e,o))||n.enumerable});return t},exr=t=>Q0r(cee({},"__esModule",{value:!0}),t),Vst={};X0r(Vst,{isArrayBuffer:()=>txr});Wst.exports=exr(Vst);var txr=Y0r(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var Yst=v((Kno,Zst)=>{var dee=Object.defineProperty,rxr=Object.getOwnPropertyDescriptor,nxr=Object.getOwnPropertyNames,oxr=Object.prototype.hasOwnProperty,Gst=(t,e)=>dee(t,"name",{value:e,configurable:!0}),ixr=(t,e)=>{for(var r in e)dee(t,r,{get:e[r],enumerable:!0})},axr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nxr(e))!oxr.call(t,o)&&o!==r&&dee(t,o,{get:()=>e[o],enumerable:!(n=rxr(e,o))||n.enumerable});return t},sxr=t=>axr(dee({},"__esModule",{value:!0}),t),Jst={};ixr(Jst,{fromArrayBuffer:()=>lxr,fromString:()=>cxr});Zst.exports=sxr(Jst);var uxr=Kst(),vSe=Yp(),lxr=Gst((t,e=0,r=t.byteLength-e)=>{if(!(0,uxr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return vSe.Buffer.from(t,e,r)},"fromArrayBuffer"),cxr=Gst((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?vSe.Buffer.from(t,e):vSe.Buffer.from(t)},"fromString")});var rut=v((Gno,tut)=>{var fee=Object.defineProperty,dxr=Object.getOwnPropertyDescriptor,fxr=Object.getOwnPropertyNames,pxr=Object.prototype.hasOwnProperty,wSe=(t,e)=>fee(t,"name",{value:e,configurable:!0}),mxr=(t,e)=>{for(var r in e)fee(t,r,{get:e[r],enumerable:!0})},hxr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of fxr(e))!pxr.call(t,o)&&o!==r&&fee(t,o,{get:()=>e[o],enumerable:!(n=dxr(e,o))||n.enumerable});return t},gxr=t=>hxr(fee({},"__esModule",{value:!0}),t),Xst={};mxr(Xst,{fromUtf8:()=>eut,toUint8Array:()=>yxr,toUtf8:()=>bxr});tut.exports=gxr(Xst);var Qst=Yst(),eut=wSe(t=>{let e=(0,Qst.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),yxr=wSe(t=>typeof t=="string"?eut(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),bxr=wSe(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,Qst.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var nut=v(pee=>{"use strict";Object.defineProperty(pee,"__esModule",{value:!0});pee.convertToBuffer=void 0;var _xr=rut(),vxr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:_xr.fromUtf8;function wxr(t){return t instanceof Uint8Array?t:typeof t=="string"?vxr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}pee.convertToBuffer=wxr});var out=v(mee=>{"use strict";Object.defineProperty(mee,"__esModule",{value:!0});mee.isEmptyData=void 0;function xxr(t){return typeof t=="string"?t.length===0:t.byteLength===0}mee.isEmptyData=xxr});var iut=v(hee=>{"use strict";Object.defineProperty(hee,"__esModule",{value:!0});hee.numToUint8=void 0;function Sxr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}hee.numToUint8=Sxr});var aut=v(gee=>{"use strict";Object.defineProperty(gee,"__esModule",{value:!0});gee.uint32ArrayFrom=void 0;function Cxr(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)}gee.uint32ArrayFrom=Cxr});var yee=v(vv=>{"use strict";Object.defineProperty(vv,"__esModule",{value:!0});vv.uint32ArrayFrom=vv.numToUint8=vv.isEmptyData=vv.convertToBuffer=void 0;var Oxr=nut();Object.defineProperty(vv,"convertToBuffer",{enumerable:!0,get:function(){return Oxr.convertToBuffer}});var Pxr=out();Object.defineProperty(vv,"isEmptyData",{enumerable:!0,get:function(){return Pxr.isEmptyData}});var Exr=iut();Object.defineProperty(vv,"numToUint8",{enumerable:!0,get:function(){return Exr.numToUint8}});var Txr=aut();Object.defineProperty(vv,"uint32ArrayFrom",{enumerable:!0,get:function(){return Txr.uint32ArrayFrom}})});var uut=v(vee=>{"use strict";Object.defineProperty(vee,"__esModule",{value:!0});vee.Sha256=void 0;var sut=(bSe(),dc(ySe)),_ee=_Se(),bee=Hst(),xSe=yee(),Axr=function(){function t(e){this.secret=e,this.hash=new bee.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,xSe.isEmptyData)(e)||this.error))try{this.hash.update((0,xSe.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 sut.__awaiter(this,void 0,void 0,function(){return sut.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new bee.RawSha256,this.secret){this.outer=new bee.RawSha256;var e=Ixr(this.secret),r=new Uint8Array(_ee.BLOCK_SIZE);r.set(e);for(var n=0;n<_ee.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}();vee.Sha256=Axr;function Ixr(t){var e=(0,xSe.convertToBuffer)(t);if(e.byteLength>_ee.BLOCK_SIZE){var r=new bee.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(_ee.BLOCK_SIZE);return n.set(e),n}});var CSe=v(SSe=>{"use strict";Object.defineProperty(SSe,"__esModule",{value:!0});var Mxr=(bSe(),dc(ySe));Mxr.__exportStar(uut(),SSe)});var lut=w(()=>{});var cut=w(()=>{});var dut=w(()=>{});var cj,N8=w(()=>{cj=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 Wl,fut=w(()=>{N8();Wl=class t extends cj{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var put=w(()=>{N8()});var mut=w(()=>{N8()});var hut=w(()=>{});var gut,yut=w(()=>{gut=(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 cP=w(()=>{fut();N8();put();mut();hut();yut()});function wee(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 OSe=w(()=>{});var but=w(()=>{});var _ut=w(()=>{but()});var vut=w(()=>{});var wut,xut=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(wut||(wut={}))});var PSe,Sut=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(PSe||(PSe={}))});var Cut=w(()=>{});var Out=w(()=>{});var Put=w(()=>{});var Eut=w(()=>{});var Tut=w(()=>{xut();Sut();Cut();Out();Put();Eut()});var Aut=w(()=>{});var Iut=w(()=>{});var Mut=w(()=>{});var Rut=w(()=>{});var Nut=w(()=>{});var jut=w(()=>{});var Dut=w(()=>{});var Lut=w(()=>{Nut();jut();Dut()});var Fut=w(()=>{});var kut=w(()=>{});var xz,$ut=w(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(xz||(xz={}))});var zut=w(()=>{});var But=w(()=>{});var Uut=w(()=>{});var qut=w(()=>{});var Hut=w(()=>{});var Vut=w(()=>{zut();But();Uut();qut();Hut()});var Wut=w(()=>{});var Sz,ESe=w(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Sz||(Sz={}))});var Kut=w(()=>{ESe()});var Gut=w(()=>{});var Jut=w(()=>{Kut();Gut();ESe()});var ah,Zut=w(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(ah||(ah={}))});var Yut=w(()=>{});var Xut=w(()=>{});var Qut=w(()=>{});var elt=w(()=>{});var tlt=w(()=>{});var rlt=w(()=>{Xut();Qut();elt();tlt()});var nlt=w(()=>{});var Cz,olt=w(()=>{Cz="__smithy_context"});var ilt=w(()=>{});var alt,slt=w(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(alt||(alt={}))});var ult=w(()=>{});var llt=w(()=>{});var clt=w(()=>{});var dlt=w(()=>{});var flt=w(()=>{});var plt=w(()=>{});var mlt=w(()=>{});var hlt=w(()=>{});var glt=w(()=>{});var ylt,blt=w(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(ylt||(ylt={}))});var _lt=w(()=>{});var vlt=w(()=>{});var wlt=w(()=>{});var xlt=w(()=>{});var Slt=w(()=>{});var Clt=w(()=>{});var su=w(()=>{vut();Tut();Aut();Iut();Mut();Rut();Lut();Fut();kut();$ut();Vut();Wut();Jut();Zut();Yut();rlt();nlt();olt();ilt();slt();ult();llt();clt();dlt();flt();plt();mlt();hlt();glt();blt();_lt();vlt();wlt();xlt();Slt();Clt()});var Olt=w(()=>{su()});var Plt=w(()=>{});var Elt=w(()=>{});function Rxr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var xee,Tlt=w(()=>{xee=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=Rxr(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 Alt=w(()=>{});var Ilt=w(()=>{});var Mlt=w(()=>{});var Rlt=w(()=>{_ut();Olt();Plt();Elt();Tlt();Alt();Ilt();Mlt()});var Nxr,jxr,See,TSe=w(()=>{Rlt();Nxr=t=>e=>async r=>{if(!xee.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)},jxr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},See=t=>({applyToStack:e=>{e.add(Nxr(t),jxr)}})});var Dxr,Lxr,Cee,Nlt=w(()=>{Dxr=()=>(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}},Lxr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Cee=t=>({applyToStack:e=>{e.add(Dxr(),Lxr)}})});var ASe=w(()=>{Nlt()});var jlt=w(()=>{});var Dlt=w(()=>{jlt()});var Llt=w(()=>{su()});var Flt=w(()=>{});var klt=w(()=>{});function Fxr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Oee,$lt=w(()=>{Oee=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=Fxr(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 zlt=w(()=>{});var Blt=w(()=>{});var Ult=w(()=>{});var qlt=w(()=>{Dlt();Llt();Flt();klt();$lt();zlt();Blt();Ult()});var Hlt,kxr,$xr,zxr,Bxr,Pee,ISe=w(()=>{qlt();Hlt="X-Amzn-Trace-Id",kxr="AWS_LAMBDA_FUNCTION_NAME",$xr="_X_AMZN_TRACE_ID",zxr=t=>e=>async r=>{let{request:n}=r;if(!Oee.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(Hlt))return e(r);let o=process.env[kxr],i=process.env[$xr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[Hlt]=i),e({...r,request:n})},Bxr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Pee=t=>({applyToStack:e=>{e.add(zxr(t),Bxr)}})});function Eee(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var Vlt=w(()=>{});var Uxr,j8,MSe=w(()=>{Uxr=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}$"),j8=t=>Uxr.test(t)||t.startsWith("[")&&t.endsWith("]")});var qxr,D8,RSe=w(()=>{qxr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),D8=(t,e=!1)=>{if(!e)return qxr.test(t);let r=t.split(".");for(let n of r)if(!D8(n))return!1;return!0}});var dP,Tee=w(()=>{dP={}});var fP,Wlt=w(()=>{fP="endpoints"});function Ag(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Ag(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Ag).join(", ")})`:JSON.stringify(t,null,2)}var Klt=w(()=>{});var L8=w(()=>{Wlt();Klt()});var ea,Glt=w(()=>{ea=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var Jlt=w(()=>{});var Zlt=w(()=>{});var Ylt=w(()=>{});var Xlt=w(()=>{});var Qlt=w(()=>{});var ect=w(()=>{});var Ig=w(()=>{Glt();Jlt();Zlt();Ylt();Xlt();Qlt();ect()});var tct,rct=w(()=>{tct=(t,e)=>t===e});var nct,oct=w(()=>{Ig();nct=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 ea(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new ea(`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 Aee,ict=w(()=>{Ig();oct();Aee=(t,e)=>nct(e).reduce((r,n)=>{if(typeof r!="object")throw new ea(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var act,sct=w(()=>{act=t=>t!=null});var uct,lct=w(()=>{uct=t=>!t});var NSe,cct,dct=w(()=>{su();MSe();NSe={[xz.HTTP]:80,[xz.HTTPS]:443},cct=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:b={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(b).map(([y,x])=>`${y}=${x}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(xz).includes(u))return null;let l=j8(o),c=r.includes(`${n}:${NSe[u]}`)||typeof t=="string"&&t.includes(`${n}:${NSe[u]}`),d=`${n}${c?`:${NSe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var fct,pct=w(()=>{fct=(t,e)=>t===e});var mct,hct=w(()=>{mct=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var gct,yct=w(()=>{gct=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var jSe=w(()=>{rct();ict();sct();RSe();lct();dct();pct();hct();yct()});var bct,_ct=w(()=>{jSe();bct={booleanEquals:tct,getAttr:Aee,isSet:act,isValidHostLabel:D8,not:uct,parseURL:cct,stringEquals:fct,substring:mct,uriEncode:gct}});var Iee,DSe=w(()=>{jSe();Iee=(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(Aee(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var vct,wct=w(()=>{vct=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var WA,F8=w(()=>{Ig();LSe();DSe();wct();WA=(t,e,r)=>{if(typeof t=="string")return Iee(t,r);if(t.fn)return Mee(t,r);if(t.ref)return vct(t,r);throw new ea(`'${e}': ${String(t)} is not a string, function or reference.`)}});var Mee,LSe=w(()=>{Tee();_ct();F8();Mee=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:WA(i,"arg",r)),o=t.split(".");return o[0]in dP&&o[1]!=null?dP[o[0]][o[1]](...n):bct[t](...n)}});var xct,Sct=w(()=>{L8();Ig();LSe();xct=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new ea(`'${t}' is already defined in Reference Record.`);let n=Mee(e,r);return r.logger?.debug?.(`${fP} evaluateCondition: ${Ag(e)} = ${Ag(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var Oz,Ree=w(()=>{L8();Sct();Oz=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=xct(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${fP} assign: ${i.name} := ${Ag(i.value)}`))}return{result:!0,referenceRecord:r}}});var Cct,Oct=w(()=>{Ig();F8();Cct=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=WA(i,"Header value entry",e);if(typeof a!="string")throw new ea(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var FSe,Pct=w(()=>{Ig();DSe();kSe();FSe=(t,e)=>{if(Array.isArray(t))return t.map(r=>FSe(r,e));switch(typeof t){case"string":return Iee(t,e);case"object":if(t===null)throw new ea(`Unexpected endpoint property: ${t}`);return Nee(t,e);case"boolean":return t;default:throw new ea(`Unexpected endpoint property type: ${typeof t}`)}}});var Nee,kSe=w(()=>{Pct();Nee=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:FSe(o,e)}),{})});var Ect,Tct=w(()=>{Ig();F8();Ect=(t,e)=>{let r=WA(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 ea(`Endpoint URL must be a string, got ${typeof r}`)}});var Act,Ict=w(()=>{L8();Ree();Oct();kSe();Tct();Act=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=Oz(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${fP} Resolving endpoint from template: ${Ag(n)}`),{...l!=null&&{headers:Cct(l,a)},...u!=null&&{properties:Nee(u,a)},url:Ect(s,a)}}});var Mct,Rct=w(()=>{Ig();Ree();F8();Mct=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=Oz(r,e);if(o)throw new ea(WA(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var Nct,jct=w(()=>{Ree();$Se();Nct=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=Oz(r,e);if(o)return jee(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var jee,$Se=w(()=>{Ig();Ict();Rct();jct();jee=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=Act(r,e);if(n)return n}else if(r.type==="error")Mct(r,e);else if(r.type==="tree"){let n=Nct(r,e);if(n)return n}else throw new ea(`Unknown endpoint rule: ${r}`);throw new ea("Rules evaluation failed")}});var Dct=w(()=>{Tee();$Se()});var k8,Lct=w(()=>{L8();Ig();Dct();k8=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${fP} Initial EndpointParams: ${Ag(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 ea(`Missing required parameter: '${l}'`);let u=jee(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?.(`${fP} Resolved endpoint: ${Ag(u)}`),u}});var KA=w(()=>{MSe();RSe();Tee();Lct();Ig()});var zSe=w(()=>{KA()});var BSe,Fct=w(()=>{KA();zSe();BSe=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!BSe(r))return!1;return!0}return!(!D8(t)||t.length<3||t.length>63||t!==t.toLowerCase()||j8(t))}});var kct,Hxr,$ct,zct=w(()=>{kct=":",Hxr="/",$ct=t=>{let e=t.split(kct);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(kct)==="")return null;let u=s.map(l=>l.split(Hxr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var Uct,Bct=w(()=>{Uct={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 Wxr,Kxr,qct,Hct,USe=w(()=>{Bct();Wxr=Uct,Kxr="",qct=t=>{let{partitions:e}=Wxr;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}},Hct=()=>Kxr});var $8,Vct=w(()=>{KA();Fct();zct();USe();$8={isVirtualHostableS3Bucket:BSe,parseArn:$ct,partition:qct};dP.aws=$8});var Wct=w(()=>{KA()});var Kct=w(()=>{KA()});var Gct=w(()=>{});var Jct=w(()=>{});var Zct=w(()=>{});var Yct=w(()=>{});var Xct=w(()=>{});var Qct=w(()=>{Kct();Gct();Jct();Zct();Yct();Xct()});var Dee=w(()=>{Vct();USe();zSe();Wct();Qct()});var edt=w(()=>{});var tdt=w(()=>{edt()});var rdt=w(()=>{su()});var ndt=w(()=>{});var odt=w(()=>{});function Gxr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Lee,idt=w(()=>{Lee=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=Gxr(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 adt=w(()=>{});var sdt=w(()=>{});var udt=w(()=>{});var ldt=w(()=>{tdt();rdt();ndt();odt();idt();adt();sdt();udt()});var qSe,Fee,HSe,kee,cdt,ddt,VSe,fdt=w(()=>{qSe="user-agent",Fee="x-amz-user-agent",HSe=" ",kee="/",cdt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ddt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,VSe="-"});var Jxr,WSe,Zxr,$ee,pdt=w(()=>{Dee();ldt();fdt();Jxr=t=>(e,r)=>async n=>{let{request:o}=n;if(!Lee.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(WSe)||[],s=(await t.defaultUserAgentProvider()).map(WSe),u=t?.customUserAgent?.map(WSe)||[],l=Hct(),c=(l?[l]:[]).concat([...s,...a,...u]).join(HSe),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(HSe);return t.runtime!=="browser"?(d&&(i[Fee]=i[Fee]?`${i[qSe]} ${d}`:d),i[qSe]=c):i[Fee]=c,e({...n,request:o})},WSe=t=>{let e=t[0].split(kee).map(a=>a.replace(cdt,VSe)).join(kee),r=t[1]?.replace(ddt,VSe),n=e.indexOf(kee),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}`}},"")},Zxr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},$ee=t=>({applyToStack:e=>{e.add(Jxr(t),Zxr)}})});var KSe=w(()=>{Vlt();pdt()});var mdt=w(()=>{});var hdt=w(()=>{});var zee,gdt=w(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(zee||(zee={}))});var GSe=w(()=>{mdt();hdt();gdt()});var Bee,ydt=w(()=>{GSe();Bee=!1});var Uee,bdt=w(()=>{GSe();Uee=!1});var wv,_dt=w(()=>{su();wv=t=>t[Cz]||(t[Cz]={})});var hf,vdt=w(()=>{hf=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var yb=w(()=>{_dt();vdt()});var wdt=w(()=>{yb()});var xdt=w(()=>{});var Sdt=w(()=>{yb();xdt()});var Cdt=w(()=>{ydt();bdt();wdt();Sdt()});var Odt=w(()=>{});var qee,JSe=w(()=>{qee=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var ZSe,Pdt=w(()=>{JSe();ZSe=t=>qee(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var Hee,Edt=w(()=>{Pdt();JSe();Hee=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return ZSe(e);let n=await e();return ZSe(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return qee(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var Tdt=w(()=>{Odt();Edt()});var Adt=w(()=>{});var Idt=w(()=>{});var Mdt=w(()=>{});var Rdt=w(()=>{});var Ndt=w(()=>{});var jdt=w(()=>{});var Ddt=w(()=>{Mdt();Rdt();Ndt();jdt()});var Ldt=w(()=>{Adt();Idt();Ddt()});var z8=w(()=>{Cdt();Tdt();Ldt()});function Xxr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var YSe,Vee=w(()=>{su();yb();YSe=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=Xxr(t.httpAuthSchemes),s=wv(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 Fdt,Qxr,eSr,tSr,rSr,nSr,kdt=w(()=>{Fdt=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),nSr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!rSr(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},Qxr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,eSr=/(\d+\.){3}\d+/,tSr=/\.\./,rSr=t=>Qxr.test(t)&&!eSr.test(t)&&!tSr.test(t),nSr=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 $dt=w(()=>{kdt()});var zdt,Bdt=w(()=>{zdt=(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 Udt,qdt=w(()=>{Udt=async t=>{}});function Hdt(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 Vdt=w(()=>{});var GA,Wee=w(()=>{Vdt();GA=t=>{if(typeof t=="string")return GA(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=Hdt(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var Kee,Gee=w(()=>{Wee();Kee=t=>typeof t=="object"?"url"in t?GA(t.url):t:GA(t)});var Wdt,oSr,XSe=w(()=>{$dt();Bdt();qdt();Gee();Wdt=async(t,e,r,n)=>{if(!r.endpoint){let a=await Udt(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(Kee(a)))}let o=await oSr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},oSr=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 zdt(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 Fdt(n),n}});var Kdt=w(()=>{XSe();Gee()});var Gdt,QSe=w(()=>{yb();XSe();Gdt=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await Wdt(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=wv(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 Jdt,eCe=w(()=>{Jdt=(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 Zdt,tCe=w(()=>{Zdt=(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 kt(t,e,r){return{applyToStack:n=>{n.add(Jdt(t,r),iSr),n.add(Zdt(t,e),B8)}}}var iSr,B8,Ydt=w(()=>{eCe();tCe();iSr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},B8={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var mo=w(()=>{eCe();Ydt();tCe()});var rCe,$t,Xdt=w(()=>{mo();QSe();rCe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:B8.name},$t=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Gdt({config:t,instructions:e}),rCe)}})});var Jee,Qdt=w(()=>{yb();Gee();Jee=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>Kee(await hf(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:hf(t.useDualstackEndpoint??!1),useFipsEndpoint:hf(t.useFipsEndpoint??!1)}}});var eft=w(()=>{});var ro=w(()=>{Kdt();QSe();Xdt();Qdt();eft()});var aSr,Zee,tft=w(()=>{ro();Vee();aSr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:rCe.name},Zee=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(YSe(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),aSr)}})});var Ido,rft=w(()=>{mo();Vee();Ido={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:B8.name}});var nft=w(()=>{Vee();tft();rft()});var oft=w(()=>{});var ift=w(()=>{oft()});var aft=w(()=>{su()});var sft=w(()=>{});var uft=w(()=>{});function sSr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var dj,lft=w(()=>{dj=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=sSr(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 cft=w(()=>{});var dft=w(()=>{});var fft=w(()=>{});var U8=w(()=>{ift();aft();sft();uft();lft();cft();dft();fft()});var uSr,lSr,pft,nCe=w(()=>{U8();su();yb();uSr=t=>e=>{throw e},lSr=(t,e)=>{},pft=t=>(e,r)=>async n=>{if(!dj.isInstance(n.request))return e(n);let i=wv(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||uSr)(a));return(u.successHandler||lSr)(l.response,a),l}});var bb,xv,q8,Yee=w(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(bb||(bb={}));xv=3,q8=bb.STANDARD});var mft,hft,gft,yft,bft=w(()=>{mft=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],hft=["TimeoutError","RequestTimeout","RequestTimeoutException"],gft=[500,502,503,504],yft=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var cSr,Pz,Xee,_ft,H8=w(()=>{bft();cSr=t=>t.$metadata?.clockSkewCorrected,Pz=t=>t.$metadata?.httpStatusCode===429||mft.includes(t.name)||t.$retryable?.throttling==!0,Xee=t=>cSr(t)||hft.includes(t.name)||yft.includes(t?.code||"")||gft.includes(t.$metadata?.httpStatusCode||0),_ft=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!Xee(t)}return!1}});var V8,oCe=w(()=>{H8();V8=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(),Pz(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 Qee,ete,Ez=w(()=>{Qee="amz-sdk-invocation-id",ete="amz-sdk-request"});var vft,wft=w(()=>{Ez();vft=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var iCe,xft=w(()=>{Ez();iCe=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var fj,rte=w(()=>{Yee();Ez();wft();xft();fj=class{constructor(e){this.maxAttempts=e,this.mode=bb.STANDARD,this.capacity=500,this.retryBackoffStrategy=vft(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return iCe({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,iCe({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 ${xv}`),xv}}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 nte,Eft=w(()=>{Yee();oCe();rte();nte=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=bb.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new V8,this.standardRetryStrategy=new fj(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 Tft=w(()=>{Ez();rte()});var Aft=w(()=>{});var Sv=w(()=>{Eft();Tft();oCe();rte();Yee();Ez();Aft()});var Ift=w(()=>{});var Mft=w(()=>{Ift()});var Rft=w(()=>{su()});var Nft=w(()=>{});var jft=w(()=>{});function dSr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Az,Dft=w(()=>{Az=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=dSr(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 W8,Lft=w(()=>{W8=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 Fft=w(()=>{});var kft=w(()=>{});var ote=w(()=>{Mft();Rft();Nft();jft();Dft();Lft();Fft();kft()});var $ft=w(()=>{Sv()});var sCe=w(()=>{Sv()});var uCe=w(()=>{H8()});var lCe,cCe=w(()=>{lCe=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 dCe=w(()=>{ote();H8();Sv();$ft();sCe();uCe();cCe()});var zft=w(()=>{Sv();dCe()});var ite,Bft=w(()=>{yb();Sv();ite=t=>{let{retryStrategy:e}=t,r=hf(t.maxAttempts??xv);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await hf(t.retryMode)()===bb.ADAPTIVE?new nte(r):new fj(r))}}});var Uft=w(()=>{ote();Sv()});var JA,qft=w(()=>{JA=class{trace(){}debug(){}info(){}warn(){}error(){}}});var pj,ZA,Iz,Hft,Vft,Wft=w(()=>{pj=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},ZA=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,Iz=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>Hft[p.step]-Hft[f.step]||Vft[p.priority||"normal"]-Vft[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=pj(m.name,m.aliases);if(h.includes(d)){f=!0;for(let b of h)n.delete(b);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of pj(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(b=>{let g={...b,before:[],after:[]};for(let y of pj(g.name,g.aliases))m[y]=g;f.push(g)}),e.forEach(b=>{let g={...b,before:[],after:[]};for(let y of pj(g.name,g.aliases))m[y]=g;p.push(g)}),p.forEach(b=>{if(b.toMiddleware){let g=m[b.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${b.toMiddleware} is not found when adding ${ZA(b.name,b.aliases)} middleware ${b.relation} ${b.toMiddleware}`)}b.relation==="after"&&g.after.push(b),b.relation==="before"&&g.before.push(b)}}),o(f).map(u).reduce((b,g)=>(b.push(...g),b),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,b={step:"initialize",priority:"normal",middleware:d,...f},g=pj(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${ZA(p,h)}'`);for(let y of g){let x=t.findIndex(O=>O.name===y||O.aliases?.some(E=>E===y));if(x===-1)continue;let S=t[x];if(S.step!==b.step||b.priority!==S.priority)throw new Error(`"${ZA(S.name,S.aliases)}" middleware with ${S.priority} priority in ${S.step} step cannot be overridden by "${ZA(p,h)}" middleware with ${b.priority} priority in ${b.step} step.`);t.splice(x,1)}}for(let y of g)n.add(y)}t.push(b)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,b={middleware:d,...f},g=pj(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${ZA(p,h)}'`);for(let y of g){let x=e.findIndex(O=>O.name===y||O.aliases?.some(E=>E===y));if(x===-1)continue;let S=e[x];if(S.toMiddleware!==b.toMiddleware||S.relation!==b.relation)throw new Error(`"${ZA(S.name,S.aliases)}" middleware ${S.relation} "${S.toMiddleware}" middleware cannot be overridden by "${ZA(p,h)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(x,1)}}for(let y of g)n.add(y)}e.push(b)},clone:()=>s(Iz()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:b,aliases:g}=m;if(h&&h.includes(d)){let y=pj(b,g);for(let x of y)n.delete(x);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(Iz());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 ZA(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(m=>m.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},Hft={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Vft={high:3,normal:2,low:1}});var fCe=w(()=>{Wft()});var mj,Kft=w(()=>{fCe();mj=class{constructor(e){this.middlewareStack=Iz(),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 pP,hj,YA,gj,Gft,pCe=w(()=>{pP={},hj=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);pP[n]=t,hj[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;pP[n]=o,hj[o]=n}for(let t=0;t<10;t++){pP[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;pP[e]=r,hj[r]=e}pP["+"]=62;hj[62]="+";pP["/"]=63;hj[63]="/";YA=6,gj=8,Gft=63});var XA,Jft=w(()=>{pCe();XA=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 pP))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=pP[t[l]]<<(c-l)*YA,a+=YA}else i>>=YA;let s=o/4*3;i>>=a%gj;let u=Math.floor(a/gj);for(let l=0;l<u;l++){let c=(u-l-1)*gj;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var mCe,hCe=w(()=>{mCe=t=>new TextEncoder().encode(t)});var Zft=w(()=>{hCe()});var Yft=w(()=>{});var Xft=w(()=>{hCe();Zft();Yft()});function QA(t){let e;typeof t=="string"?e=mCe(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)*gj,s+=gj;let u=Math.ceil(s/YA);a<<=u*YA-s;for(let l=1;l<=u;l++){let c=(u-l)*YA;o+=hj[(a&Gft<<c)>>c]}o+="==".slice(0,4-u)}return o}var Qft=w(()=>{Xft();pCe()});var Mz=w(()=>{Jft();Qft()});var gCe,yCe=w(()=>{gCe=t=>new TextEncoder().encode(t)});var ept=w(()=>{yCe()});var ate,tpt=w(()=>{ate=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 bCe=w(()=>{yCe();ept();tpt()});function rpt(t,e="utf-8"){return e==="base64"?QA(t):ate(t)}function npt(t,e){return e==="base64"?mP.mutate(XA(t)):mP.mutate(gCe(t))}var opt=w(()=>{Mz();bCe();_Ce()});var mP,_Ce=w(()=>{opt();mP=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return npt(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 rpt(this,e)}}});var ipt=w(()=>{});var apt=w(()=>{});var spt=w(()=>{apt()});var upt=w(()=>{su()});var lpt=w(()=>{});var cpt=w(()=>{});var dpt=w(()=>{});var K8,fpt=w(()=>{K8=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 ppt=w(()=>{});var mpt=w(()=>{});var hpt=w(()=>{spt();upt();lpt();cpt();dpt();fpt();ppt();mpt()});var Mg,fSr,vCe=w(()=>{Mg=t=>encodeURIComponent(t).replace(/[!'()*]/g,fSr),fSr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var gpt=w(()=>{vCe()});var ste=w(()=>{vCe();gpt()});function ypt(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=Mg(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${Mg(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${Mg(n)}`),e.push(o)}}return e.join("&")}var bpt=w(()=>{ste()});function _pt(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 vpt=w(()=>{});var wCe,eI,wpt=w(()=>{hpt();bpt();vpt();wCe={supported:void 0},eI=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)),wCe.supported===void 0&&(wCe.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=ypt(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let g=e.username??"",y=e.password??"";u=`${g}:${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),wCe.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),b=[fetch(h).then(g=>{let y=g.headers,x={};for(let O of y.entries())x[O[0]]=O[1];return g.body!=null?{response:new K8({headers:x,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(O=>({response:new K8({headers:x,reason:g.statusText,statusCode:g.status,body:O})}))}),_pt(n)];return r&&b.push(new Promise((g,y)=>{let x=()=>{let S=new Error("Request aborted");S.name="AbortError",y(S)};if(typeof r.addEventListener=="function"){let S=r;S.addEventListener("abort",x,{once:!0}),m=()=>S.removeEventListener("abort",x)}else r.onabort=x})),Promise.race(b).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function pSr(t){let e=await hSr(t),r=XA(e);return new Uint8Array(r)}async function mSr(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 hSr(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 Rz,xpt=w(()=>{Mz();Rz=t=>typeof Blob=="function"&&t instanceof Blob?pSr(t):mSr(t)});var G8=w(()=>{wpt();xpt()});function Cpt(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Spt[t[r]];return e}var Spt,gSr,Opt=w(()=>{Spt={},gSr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Spt[t]=e,gSr[e]=t}});var xCe,SCe=w(()=>{xCe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var Ppt,Tpt,Ept,Apt=w(()=>{G8();Mz();Opt();bCe();SCe();Ppt="The stream has already been transformed.",Tpt=t=>{if(!Ept(t)&&!xCe(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(Ppt);return e=!0,await Rz(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 QA(i);if(o==="hex")return Cpt(i);if(o===void 0||o==="utf8"||o==="utf-8")return ate(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(Ppt);if(e=!0,Ept(t))return n(t);if(xCe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Ept=t=>typeof Blob=="function"&&t instanceof Blob});var Ipt=w(()=>{});var Mpt=w(()=>{});var CCe=w(()=>{_Ce();ipt();Apt();Ipt();Mpt();SCe()});var tI,Rpt=w(()=>{CCe();tI=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return mP.mutate(t);if(!t)return mP.mutate(new Uint8Array);let r=e.streamCollector(t);return mP.mutate(await r)}});var Et,OCe,Npt=w(()=>{fCe();su();Et=class{constructor(){this.middlewareStack=Iz()}static classBuilder(){return new OCe}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let b of o.bind(this)(d,e,r,n))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[Cz]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(b=>h.handle(b.request,n||{}),m)}},OCe=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 Et{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 ute,jpt=w(()=>{ute="***SensitiveInformation***"});var lte,Dpt=w(()=>{lte=(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 yj,ySr,Lpt,bSr,Fpt,kpt,$pt,PCe,_Sr,Nz,vn,zpt,Bpt,vSr,J8,Z8,ECe,Upt,qpt,Hpt,TCe=w(()=>{yj=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Hpt.warn(qpt(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},ySr=Math.ceil(34028234663852886e22),Lpt=t=>{let e=yj(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>ySr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},bSr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},Fpt=t=>PCe(t,32),kpt=t=>PCe(t,16),$pt=t=>PCe(t,8),PCe=(t,e)=>{let r=bSr(t);if(r!==void 0&&_Sr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},_Sr=(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]}},Nz=(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},vn=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Hpt.warn(qpt(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},zpt=t=>yj(typeof t=="string"?J8(t):t),Bpt=t=>Lpt(typeof t=="string"?J8(t):t),vSr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,J8=t=>{let e=t.match(vSr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Z8=t=>Fpt(typeof t=="string"?J8(t):t),ECe=t=>kpt(typeof t=="string"?J8(t):t),Upt=t=>$pt(typeof t=="string"?J8(t):t),qpt=t=>String(new TypeError(t).stack||t).split(`
|
||
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
|
||
`),Hpt={warn:console.warn}});var wSr,xSr,Vpt,SSr,Wpt,Cho,Oho,Pho,cte,Kpt,Eho,CSr,OSr,PSr,bj,ESr,TSr,ACe,Gpt=w(()=>{TCe();wSr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],xSr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Vpt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=xSr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=ECe(ACe(n)),d=bj(o,"month",1,12),f=bj(i,"day",1,31);return Kpt(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},SSr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Wpt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=SSr.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=ECe(ACe(n)),f=bj(o,"month",1,12),p=bj(i,"day",1,31),m=Kpt(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-TSr(c)),m},Cho=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$/),Oho=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$/),Pho=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})$/),cte=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=zpt(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))},Kpt=(t,e,r,n)=>{let o=e-1;return OSr(t,o,r),new Date(Date.UTC(t,o,r,bj(n.hours,"hour",0,23),bj(n.minutes,"minute",0,59),bj(n.seconds,"seconds",0,60),ESr(n.fractionalMilliseconds)))},Eho=50*365*24*60*60*1e3,CSr=[31,28,31,30,31,30,31,31,30,31,30,31],OSr=(t,e,r)=>{let n=CSr[e];if(e===1&&PSr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${wSr[e]} in ${t}: ${r}`)},PSr=t=>t%4===0&&(t%100!==0||t%400===0),bj=(t,e,r,n)=>{let o=Upt(ACe(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},ESr=t=>t==null?0:Bpt("0."+t)*1e3,TSr=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},ACe=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var jz,Qa,ICe=w(()=>{jz=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}},Qa=(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 ASr,dte,ISr,Jpt=w(()=>{ICe();ASr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=ISr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw Qa(a,e)},dte=t=>({output:e,parsedBody:r,errorCode:n})=>{ASr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},ISr=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 fte,Zpt=w(()=>{fte=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 Ypt=w(()=>{});var Xpt,Qpt,emt=w(()=>{su();Xpt=t=>{let e=[];for(let r in Sz){let n=Sz[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}}},Qpt=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var tmt,rmt,nmt=w(()=>{tmt=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},rmt=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var pte,mte,omt=w(()=>{emt();nmt();pte=t=>({...Xpt(t),...tmt(t)}),mte=t=>({...Qpt(t),...rmt(t)})});var imt=w(()=>{omt()});function hte(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var MCe=w(()=>{});var amt=w(()=>{});var RCe,smt=w(()=>{RCe=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]=RCe(t[r]));return t}});var NCe,umt=w(()=>{NCe=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};NCe.prototype=Object.create(String.prototype,{constructor:{value:NCe,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(NCe,String)});var Y8,MSr,RSr,NSr,lmt=w(()=>{Y8=(t,e)=>{let r={};for(let n in e)MSr(r,t,e,n);return r},MSr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=RSr,u=NSr,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)}},RSr=t=>t!=null,NSr=t=>t});var cmt=w(()=>{MCe()});var dmt=w(()=>{});var cr,fmt=w(()=>{cr=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(cr);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=cr(t[r]));return e}return t}});var pmt=w(()=>{});var dr=w(()=>{qft();Kft();Rpt();Npt();jpt();Dpt();Gpt();Jpt();Zpt();Ypt();imt();ICe();MCe();amt();smt();umt();lmt();TCe();cmt();dmt();fmt();pmt()});var mmt,hmt=w(()=>{mmt=t=>t?.body instanceof ReadableStream});var jSr,DSr,LSr,FSr,jCe,gte,kSr,gmt=w(()=>{ote();H8();dr();Sv();I1();hmt();cCe();jSr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(DSr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=Az.isInstance(c);for(d&&(c.headers[Qee]=Rp());;)try{d&&(c.headers[ete]=`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=LSr(f);if(s=lCe(f),d&&mmt(c))throw(r.logger instanceof JA?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let m=a.getRetryDelay();l+=m,await new Promise(h=>setTimeout(h,m))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},DSr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",LSr=t=>{let e={error:t,errorType:FSr(t)},r=kSr(t.$response);return r&&(e.retryAfterHint=r),e},FSr=t=>Pz(t)?"THROTTLING":Xee(t)?"TRANSIENT":_ft(t)?"SERVER_ERROR":"CLIENT_ERROR",jCe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},gte=t=>({applyToStack:e=>{e.add(jSr(t),jCe)}}),kSr=t=>{if(!W8.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 yte=w(()=>{zft();dCe();Bft();sCe();Uft();uCe();gmt()});var $Sr,bte,ymt=w(()=>{yte();nCe();$Sr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:jCe.name},bte=t=>({applyToStack:e=>{e.addRelativeTo(pft(t),$Sr)}})});var bmt=w(()=>{nCe();ymt()});var Dz,_mt=w(()=>{Dz=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 vmt=w(()=>{U8();su()});var wmt=w(()=>{U8()});var Lz,xmt=w(()=>{Lz=class{async sign(e,r,n){return e}}});var Smt=w(()=>{vmt();wmt();xmt()});var zSr,Cmt,DCe,Omt,Pmt=w(()=>{zSr=t=>e=>DCe(e)&&e.expiration.getTime()-Date.now()<t,Cmt=zSr(3e5),DCe=t=>t.expiration!==void 0,Omt=(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 Emt=w(()=>{_mt();Smt();Pmt()});var Tmt=w(()=>{su()});var Fz,Amt=w(()=>{Fz=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Imt=w(()=>{U8();dr()});function LCe(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 BSr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=USr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var BSr,USr,Mmt=w(()=>{BSr=async(t,e,r,...n)=>await e.send(new t(r),...n);USr=(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 rI=w(()=>{nft();bmt();Emt();Tmt();Amt();Imt();Mmt()});var Rmt=w(()=>{});var Nmt=w(()=>{Rmt()});var jmt=w(()=>{su()});var Dmt=w(()=>{});var Lmt=w(()=>{});function qSr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var _te,Fmt=w(()=>{_te=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=qSr(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 kmt=w(()=>{});var $mt=w(()=>{});var zmt=w(()=>{});var Bmt=w(()=>{Nmt();jmt();Dmt();Lmt();Fmt();kmt();$mt();zmt()});function HSr(t){return e=>async r=>{let n=r.request;if(_te.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Umt)===-1)try{let a=t(o);n.headers={...n.headers,[Umt]:String(a)}}catch{}}return e({...r,request:n})}}var Umt,VSr,vte,FCe=w(()=>{Bmt();Umt="content-length";VSr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},vte=t=>({applyToStack:e=>{e.add(HSr(t.bodyLengthChecker),VSr)}})});var qmt=w(()=>{});var Hmt=w(()=>{qmt()});var Vmt=w(()=>{});var Wmt=w(()=>{Vmt()});var Kmt=w(()=>{su()});var Gmt=w(()=>{});var Jmt=w(()=>{});function WSr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var nI,Zmt=w(()=>{nI=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=WSr(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 wte,Ymt=w(()=>{wte=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 Xmt=w(()=>{});var Qmt=w(()=>{});var X8=w(()=>{Wmt();Kmt();Gmt();Jmt();Zmt();Ymt();Xmt();Qmt()});var kCe,eht=w(()=>{X8();kCe=t=>wte.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var xte,$Ce=w(()=>{xte=t=>new Date(Date.now()+t)});var tht,rht=w(()=>{$Ce();tht=(t,e)=>Math.abs(xte(e).getTime()-t)>=3e5});var zCe,nht=w(()=>{rht();zCe=(t,e)=>{let r=Date.parse(t);return tht(r,e)?r-Date.now():e}});var oht=w(()=>{eht();$Ce();nht()});var Q8,iht,_j,aht=w(()=>{X8();oht();Q8=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},iht=async t=>{let e=Q8("context",t.context),r=Q8("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await Q8("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},_j=class{async sign(e,r,n){if(!nI.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await iht(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:xte(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??kCe(r.$response);if(n){let o=Q8("config",e.config),i=o.systemClockOffset;o.systemClockOffset=zCe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=kCe(e);if(n){let o=Q8("config",r.config);o.systemClockOffset=zCe(n,o.systemClockOffset)}}}});var sht=w(()=>{rI();cP()});function lht(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 BCe)e[r/2]=BCe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function _b(t){let e="";for(let r=0;r<t.byteLength;r++)e+=uht[t[r]];return e}var uht,BCe,eV=w(()=>{uht={},BCe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),uht[t]=e,BCe[e]=t}});var tV,UCe=w(()=>{tV=t=>new TextEncoder().encode(t)});var oI,cht=w(()=>{UCe();oI=t=>typeof t=="string"?tV(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var dht=w(()=>{});var rV=w(()=>{UCe();cht();dht()});var fht,pht,qCe,mht,hht,HCe,VCe,WCe,KCe,KSr,ght,yht,nV,bht,_ht,vht,wht,Ste,xht,Sht,Cht,GCe,Oht,vj=w(()=>{fht="X-Amz-Algorithm",pht="X-Amz-Credential",qCe="X-Amz-Date",mht="X-Amz-SignedHeaders",hht="X-Amz-Expires",HCe="X-Amz-Signature",VCe="X-Amz-Security-Token",WCe="authorization",KCe=qCe.toLowerCase(),KSr="date",ght=[WCe,KCe,KSr],yht=HCe.toLowerCase(),nV="x-amz-content-sha256",bht=VCe.toLowerCase(),_ht={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},vht=/^proxy-/,wht=/^sec-/,Ste="AWS4-HMAC-SHA256",xht="AWS4-HMAC-SHA256-PAYLOAD",Sht="UNSIGNED-PAYLOAD",Cht=50,GCe="aws4_request",Oht=60*60*24*7});var Cte,JCe,Ote,Eht,Pht,ZCe=w(()=>{eV();rV();vj();Cte={},JCe=[],Ote=(t,e,r)=>`${t}/${e}/${r}/${GCe}`,Eht=async(t,e,r,n,o)=>{let i=await Pht(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${_b(i)}:${e.sessionToken}`;if(a in Cte)return Cte[a];for(JCe.push(a);JCe.length>Cht;)delete Cte[JCe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,GCe])s=await Pht(t,s,u);return Cte[a]=s},Pht=(t,e,r)=>{let n=new t(e);return n.update(oI(r)),n.digest()}});var Pte,YCe=w(()=>{vj();Pte=({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 _ht||e?.has(i)||vht.test(i)||wht.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var XCe,QCe=w(()=>{ste();vj();XCe=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===yht)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${Mg(n)}=${Mg(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${Mg(n)}=${Mg(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var Tht,Aht=w(()=>{Tht=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var oV,eOe=w(()=>{Aht();eV();rV();vj();oV=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===nV)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||Tht(e)){let n=new r;return n.update(oI(e)),_b(await n.digest())}return Sht}});function Mht(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Ete,Iht,GSr,tOe,Rht=w(()=>{eV();rV();Ete=class{format(e){let r=[];for(let i of Object.keys(e)){let a=tV(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=tV(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(tOe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!GSr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(lht(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"})(Iht||(Iht={}));GSr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,tOe=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&&Mht(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Mht(e),parseInt(_b(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var Nht,jht=w(()=>{Nht=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var rOe,nOe=w(()=>{X8();rOe=(t,e={})=>{let{headers:r,query:n={}}=nI.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 Tte,oOe=w(()=>{X8();vj();Tte=t=>{t=nI.clone(t);for(let e of Object.keys(t.headers))ght.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var Dht,JSr,Lht=w(()=>{Dht=t=>JSr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),JSr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var iV,Ate,Fht,kht=w(()=>{eV();yb();ste();rV();vj();ZCe();YCe();QCe();eOe();Rht();jht();nOe();oOe();Lht();iV=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Ete,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=hf(n),this.credentialProvider=hf(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}=Ate(n);if(o>Oht)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=Ote(p,d,l??this.service),h=rOe(Tte(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[VCe]=c.sessionToken),h.query[fht]=Ste,h.query[pht]=`${c.accessKeyId}/${m}`,h.query[qCe]=f,h.query[hht]=o.toString(10);let b=Pte(h,i,s);return h.query[mht]=Fht(b),h.query[HCe]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await oV(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=Ate(n),c=Ote(u,s,a??this.service),d=await oV({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=_b(await f.digest()),m=[xht,l,c,o,p,d].join(`
|
||
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=Ate(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(oI(e)),_b(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=Tte(e),{longDate:c,shortDate:d}=Ate(r),f=Ote(d,u,a??this.service);l.headers[KCe]=c,s.sessionToken&&(l.headers[bht]=s.sessionToken);let p=await oV(l,this.sha256);!Nht(nV,l.headers)&&this.applyChecksum&&(l.headers[nV]=p);let m=Pte(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[WCe]=`${Ste} Credential=${s.accessKeyId}/${f}, SignedHeaders=${Fht(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${XCe(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(oI(n));let i=await o.digest();return`${Ste}
|
||
${e}
|
||
${r}
|
||
${_b(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 Mg(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(oI(i)),_b(await a.digest())}getSigningKey(e,r,n,o){return Eht(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")}},Ate=t=>{let e=Dht(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Fht=t=>Object.keys(t).sort().join(";")});var $ht=w(()=>{kht();YCe();QCe();eOe();nOe();oOe();ZCe()});var Ite,zht=w(()=>{rI();$ht();Ite=t=>{let e;t.credentials&&(e=Omt(t.credentials,Cmt,DCe)),e||(t.credentialDefaultProvider?e=Fz(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=Fz(t.signer):t.regionInfoProvider?i=()=>Fz(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||iV;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await Fz(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||iV;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var Bht=w(()=>{aht();sht();zht()});var Uht=w(()=>{Bht()});var qht=w(()=>{});var Hht=w(()=>{dr()});var Mte,iOe=w(()=>{dr();Mte=(t,e)=>tI(t,e).then(r=>e.utf8Encoder(r))});var Vs,Vht,Wht,Kht=w(()=>{iOe();Vs=(t,e)=>Mte(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{}}),Vht=async(t,e)=>{let r=await Vs(t,e);return r.message=r.message??r.Message,r},Wht=(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 Rte=v(hP=>{"use strict";var Ght=":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",ZSr=Ght+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Jht="["+Ght+"]["+ZSr+"]*",YSr=new RegExp("^"+Jht+"$"),XSr=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},QSr=function(t){let e=YSr.exec(t);return!(e===null||typeof e>"u")};hP.isExist=function(t){return typeof t<"u"};hP.isEmptyObject=function(t){return Object.keys(t).length===0};hP.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]]}};hP.getValue=function(t){return hP.isExist(t)?t:""};hP.isName=QSr;hP.getAllMatches=XSr;hP.nameRegexp=Jht});var sOe=v(egt=>{"use strict";var aOe=Rte(),eCr={allowBooleanAttributes:!1,unpairedTags:[]};egt.validate=function(t,e){e=Object.assign({},eCr,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=Yht(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=Xht(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--),!uCr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Ws("InvalidTag",d,cp(t,i))}let l=nCr(t,i);if(l===!1)return Ws("InvalidAttr","Attributes for '"+u+"' have open quote.",cp(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=Qht(c,e);if(f===!0)n=!0;else return Ws(f.err.code,f.err.msg,cp(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return Ws("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",cp(t,a));if(r.length===0)return Ws("InvalidTag","Closing tag '"+u+"' has not been opened.",cp(t,a));{let d=r.pop();if(u!==d.tagName){let f=cp(t,d.tagStartPos);return Ws("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",cp(t,a))}r.length==0&&(o=!0)}}else return Ws("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",cp(t,i));else{let d=Qht(c,e);if(d!==!0)return Ws(d.err.code,d.err.msg,cp(t,i-c.length+d.err.line));if(o===!0)return Ws("InvalidXml","Multiple possible root nodes found.",cp(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=Xht(t,i);continue}else if(t[i+1]==="?"){if(i=Yht(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=aCr(t,i);if(d==-1)return Ws("InvalidChar","char '&' is not expected.",cp(t,i));i=d}else if(o===!0&&!Zht(t[i]))return Ws("InvalidXml","Extra text at the end",cp(t,i));t[i]==="<"&&i--}}else{if(Zht(t[i]))continue;return Ws("InvalidChar","char '"+t[i]+"' is not expected.",cp(t,i))}if(n){if(r.length==1)return Ws("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",cp(t,r[0].tagStartPos));if(r.length>0)return Ws("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ws("InvalidXml","Start tag expected.",1);return!0};function Zht(t){return t===" "||t===" "||t===`
|
||
`||t==="\r"}function Yht(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 Ws("InvalidXml","XML declaration allowed only at the start of the document.",cp(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Xht(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 tCr='"',rCr="'";function nCr(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===tCr||t[e]===rCr)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 oCr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Qht(t,e){let r=aOe.getAllMatches(t,oCr),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return Ws("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",aV(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return Ws("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",aV(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return Ws("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",aV(r[o]));let i=r[o][2];if(!sCr(i))return Ws("InvalidAttr","Attribute '"+i+"' is an invalid name.",aV(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return Ws("InvalidAttr","Attribute '"+i+"' is repeated.",aV(r[o]))}return!0}function iCr(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 aCr(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,iCr(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 Ws(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function sCr(t){return aOe.isName(t)}function uCr(t){return aOe.isName(t)}function cp(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function aV(t){return t.startIndex+t[1].length}});var rgt=v(uOe=>{var tgt={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}},lCr=function(t){return Object.assign({},tgt,t)};uOe.buildOptions=lCr;uOe.defaultOptions=tgt});var ogt=v((Y_o,ngt)=>{"use strict";var lOe=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})}};ngt.exports=lOe});var agt=v((X_o,igt)=>{var cCr=Rte();function dCr(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&&mCr(t,e))e+=7,[entityName,val,e]=fCr(t,e+1),val.indexOf("&")===-1&&(r[bCr(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&hCr(t,e))e+=8;else if(o&&gCr(t,e))e+=8;else if(o&&yCr(t,e))e+=9;else if(pCr)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 fCr(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 pCr(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function mCr(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 hCr(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 gCr(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 yCr(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 bCr(t){if(cCr.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}igt.exports=dCr});var ugt=v((Q_o,sgt)=>{var _Cr=/^[-+]?0x[a-fA-F0-9]+$/,vCr=/^([\-\+])?(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 wCr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function xCr(t,e={}){if(e=Object.assign({},wCr,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&&_Cr.test(r))return Number.parseInt(r,16);{let n=vCr.exec(r);if(n){let o=n[1],i=n[2],a=SCr(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 SCr(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}sgt.exports=xCr});var dgt=v((evo,cgt)=>{"use strict";var lgt=Rte(),sV=ogt(),CCr=agt(),OCr=ugt(),cOe=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=PCr,this.parseXml=MCr,this.parseTextData=ECr,this.resolveNameSpace=TCr,this.buildAttributesMap=ICr,this.isItStopNode=DCr,this.replaceEntitiesValue=NCr,this.readStopNodeData=FCr,this.saveTextToParentTag=jCr,this.addChild=RCr}};function PCr(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 ECr(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?fOe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?fOe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function TCr(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 ACr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function ICr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=lgt.getAllMatches(t,ACr),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]=fOe(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 MCr=function(t){t=t.replace(/\r\n?/g,`
|
||
`);let e=new sV("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=wj(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=dOe(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 sV(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=wj(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=CCr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=wj(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=dOe(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let b=this.readStopNodeData(t,l,f+1);if(!b)throw new Error(`Unexpected end of ${l}`);i=b.i,m=b.tagContent}let h=new sV(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new sV(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new sV(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function RCr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var NCr=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 jCr(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 DCr(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 LCr(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 wj(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function dOe(t,e,r,n=">"){let o=LCr(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 FCr(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=wj(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=wj(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=wj(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=wj(t,"]]>",r,"StopNode is not closed.")-2;else{let i=dOe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function fOe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:OCr(t,r)}else return lgt.isExist(t)?t:""}cgt.exports=cOe});var mgt=v(pgt=>{"use strict";function kCr(t,e){return fgt(t,e)}function fgt(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=$Cr(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=fgt(a[s],e,u),c=BCr(l,e);a[":@"]?zCr(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 $Cr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function zCr(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 BCr(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))}pgt.prettify=kCr});var ggt=v((rvo,hgt)=>{var{buildOptions:UCr}=rgt(),qCr=dgt(),{prettify:HCr}=mgt(),VCr=sOe(),pOe=class{constructor(e){this.externalEntities={},this.options=UCr(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=VCr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new qCr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:HCr(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 '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};hgt.exports=pOe});var wgt=v((nvo,vgt)=>{var WCr=`
|
||
`;function KCr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=WCr),bgt(t,e,"",r)}function bgt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=GCr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let m=s[u];JCr(l,e)||(m=e.tagValueProcessor(u,m),m=_gt(m,e)),i&&(o+=n),o+=m,i=!1;continue}else if(u===e.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][e.textNodeName]}]]>`,i=!1;continue}else if(u===e.commentPropName){o+=n+`<!--${s[u][0][e.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let m=ygt(s[":@"],e),h=u==="?xml"?"":n,b=s[u][0][e.textNodeName];b=b.length!==0?" "+b:"",o+=h+`<${u}${b}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=ygt(s[":@"],e),f=n+`<${u}${d}`,p=bgt(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 GCr(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 ygt(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=_gt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function JCr(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 _gt(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}vgt.exports=KCr});var Sgt=v((ovo,xgt)=>{"use strict";var ZCr=wgt(),YCr={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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function iI(t){this.options=Object.assign({},YCr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=eOr),this.processTextOrObjNode=XCr,this.options.format?(this.indentate=QCr,this.tagEndChar=`>
|
||
`,this.newLine=`
|
||
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}iI.prototype.build=function(t){return this.options.preserveOrder?ZCr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};iI.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}};iI.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 XCr(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)}iI.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}};iI.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};iI.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}};iI.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 QCr(t){return this.options.indentBy.repeat(t)}function eOr(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}xgt.exports=iI});var Ogt=v((ivo,Cgt)=>{"use strict";var tOr=sOe(),rOr=ggt(),nOr=Sgt();Cgt.exports={XMLParser:rOr,XMLValidator:tOr,XMLBuilder:nOr}});var Pgt,Cv,Egt,Tgt=w(()=>{dr();Pgt=F(Ogt());iOe();Cv=(t,e)=>Mte(t,e).then(r=>{if(r.length){let n=new Pgt.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]),RCe(s)}return{}}),Egt=async(t,e)=>{let r=await Cv(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var Agt=w(()=>{qht();Hht();Kht();Tgt()});var xj=w(()=>{Hmt();Uht();Agt()});function oOr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function Nte(t){return{schemeId:"smithy.api#noAuth"}}var Igt,Mgt,Rgt,mOe=w(()=>{xj();yb();Igt=async(t,e,r)=>({operation:wv(e).operation,region:await hf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Mgt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(Nte(t));break}case"GetId":{e.push(Nte(t));break}case"GetOpenIdToken":{e.push(Nte(t));break}case"UnlinkIdentity":{e.push(Nte(t));break}default:e.push(oOr(t))}return e},Rgt=t=>({...Ite(t)})});var Ngt,jr,ha=w(()=>{Ngt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),jr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var Dgt,jgt=w(()=>{Dgt={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 hOe,gOe,Lgt,Fgt=w(()=>{hOe={name:"SHA-256"},gOe={name:"HMAC",hash:hOe},Lgt=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 kz(){return typeof window<"u"?window:typeof self<"u"?self:aOr}var aOr,yOe=w(()=>{aOr={}});var $z,bOe,_Oe=w(()=>{$z=F(yee());Fgt();yOe();bOe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,$z.isEmptyData)(e)){var r=(0,$z.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 kz().crypto.subtle.sign(gOe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,$z.isEmptyData)(this.toHash)?Promise.resolve(Lgt):Promise.resolve().then(function(){return kz().crypto.subtle.digest(hOe,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){kz().crypto.subtle.importKey("raw",(0,$z.convertToBuffer)(e.secret),gOe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function kgt(t){if(uOr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return lOr(e)}return!1}function uOr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function lOr(t){return t&&sOr.every(function(e){return typeof t[e]=="function"})}var sOr,$gt=w(()=>{sOr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var zgt=w(()=>{$gt()});var Bgt,Ugt,jte,qgt=w(()=>{_Oe();Bgt=F(CSe());zgt();yOe();Ugt=F(yee()),jte=function(){function t(e){kgt(kz())?this.hash=new bOe(e):this.hash=new Bgt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Ugt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var vOe=w(()=>{qgt();_Oe()});var xOe=v((uV,wOe)=>{(function(t,e){typeof uV=="object"&&typeof wOe=="object"?wOe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof uV=="object"?uV.bowser=e():t.bowser=e()})(uV,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),b=m+new Array(h+1).join(".0");return i.map(b.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach(function(h){l[h]=m[h]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();e.default=o,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();e.default=s,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},h=0,b={},g=0;if(Object.keys(f).forEach(function(I){var R=f[I];typeof R=="string"?(b[I]=R,g+=1):typeof R=="object"&&(m[I]=R,h+=1)}),h>0){var y=Object.keys(m),x=s.default.find(y,function(I){return p.isOS(I)});if(x){var S=this.satisfies(m[x]);if(S!==void 0)return S}var O=s.default.find(y,function(I){return p.isPlatform(I)});if(O){var E=this.satisfies(m[O]);if(E!==void 0)return E}}if(g>0){var P=Object.keys(b),A=s.default.find(P,function(I){return p.isBrowser(I,!0)});if(A!==void 0)return this.compareVersion(b[A])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),b=s.default.getBrowserTypeByAlias(h);return p&&b&&(h=b.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,b=this.getBrowserVersion();if(typeof b=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(b,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var Hgt,Dte,SOe=w(()=>{Hgt=F(xOe()),Dte=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Hgt.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 Vgt=w(()=>{});var Lte,Wgt=w(()=>{Lte=t=>()=>Promise.reject(t)});var COe=w(()=>{Vgt();Wgt()});var Kgt,Fte,Ggt=w(()=>{Kgt=typeof TextEncoder=="function"?new TextEncoder:null,Fte=t=>{if(typeof t=="string"){if(Kgt)return Kgt.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 OOe=w(()=>{Ggt()});var POe,EOe=w(()=>{POe=t=>new TextEncoder().encode(t)});var Jgt=w(()=>{EOe()});var Zgt,Ygt=w(()=>{Zgt=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 Xgt=w(()=>{EOe();Jgt();Ygt()});var uyt,Pv,Ev,Bz,Qgt,cV,zz,lV,gP,TOe,eyt,tyt,ryt,lyt,cyt,Ov,nyt,oyt,iyt,ayt,syt,cOr,dyt,fyt=w(()=>{uyt="required",Pv="fn",Ev="argv",Bz="ref",Qgt="isSet",cV="booleanEquals",zz="error",lV="endpoint",gP="tree",TOe="PartitionResult",eyt={[uyt]:!1,type:"String"},tyt={[uyt]:!0,default:!1,type:"Boolean"},ryt={[Bz]:"Endpoint"},lyt={[Pv]:cV,[Ev]:[{[Bz]:"UseFIPS"},!0]},cyt={[Pv]:cV,[Ev]:[{[Bz]:"UseDualStack"},!0]},Ov={},nyt={[Pv]:"getAttr",[Ev]:[{[Bz]:TOe},"supportsFIPS"]},oyt={[Pv]:cV,[Ev]:[!0,{[Pv]:"getAttr",[Ev]:[{[Bz]:TOe},"supportsDualStack"]}]},iyt=[lyt],ayt=[cyt],syt=[{[Bz]:"Region"}],cOr={version:"1.0",parameters:{Region:eyt,UseDualStack:tyt,UseFIPS:tyt,Endpoint:eyt},rules:[{conditions:[{[Pv]:Qgt,[Ev]:[ryt]}],rules:[{conditions:iyt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:zz},{conditions:ayt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:zz},{endpoint:{url:ryt,properties:Ov,headers:Ov},type:lV}],type:gP},{conditions:[{[Pv]:Qgt,[Ev]:syt}],rules:[{conditions:[{[Pv]:"aws.partition",[Ev]:syt,assign:TOe}],rules:[{conditions:[lyt,cyt],rules:[{conditions:[{[Pv]:cV,[Ev]:[!0,nyt]},oyt],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ov,headers:Ov},type:lV}],type:gP},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:zz}],type:gP},{conditions:iyt,rules:[{conditions:[{[Pv]:cV,[Ev]:[nyt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Ov,headers:Ov},type:lV}],type:gP},{error:"FIPS is enabled but this partition does not support FIPS",type:zz}],type:gP},{conditions:ayt,rules:[{conditions:[oyt],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ov,headers:Ov},type:lV}],type:gP},{error:"DualStack is enabled but this partition does not support DualStack",type:zz}],type:gP},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Ov,headers:Ov},type:lV}],type:gP}],type:gP},{error:"Invalid Configuration: Missing Region",type:zz}]},dyt=cOr});var pyt,myt=w(()=>{Dee();KA();fyt();pyt=(t,e={})=>k8(dyt,{endpointParams:t,logger:e.logger});dP.aws=$8});var hyt,gyt=w(()=>{xj();rI();dr();Wee();Mz();Xgt();mOe();myt();hyt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??XA,base64Encoder:t?.base64Encoder??QA,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??pyt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Mgt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new _j},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Lz}],logger:t?.logger??new JA,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??GA,utf8Decoder:t?.utf8Decoder??POe,utf8Encoder:t?.utf8Encoder??Zgt})});var yyt,byt=w(()=>{yyt=["in-region","cross-region","mobile","standard","legacy"]});var _yt,kte,dOr,vyt=w(()=>{cP();_yt=F(xOe());byt();kte=({defaultsMode:t}={})=>gut(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(dOr()?"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 ${yyt.join(", ")}, got ${e}`)}}),dOr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?_yt.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var AOe=w(()=>{vyt()});var wyt,xyt=w(()=>{jgt();vOe();SOe();z8();G8();COe();OOe();Sv();gyt();dr();AOe();wyt=t=>{let e=kte(t),r=()=>e().then(fte),n=hyt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Fte,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Dte({serviceId:n.serviceId,clientVersion:Dgt.version}),maxAttempts:t?.maxAttempts??xv,region:t?.region??Lte("Region is missing"),requestHandler:eI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||q8),sha256:t?.sha256??jte,streamCollector:t?.streamCollector??Rz,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Bee)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Uee))}}});var $te,zte,Syt=w(()=>{$te=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}}},zte=t=>({region:t.region()})});var Cyt=w(()=>{});var IOe=w(()=>{});var Oyt=w(()=>{IOe()});var Pyt=w(()=>{Oyt();IOe()});var Eyt=w(()=>{Cyt();Pyt()});var MOe=w(()=>{Syt();Eyt()});var Tyt,Ayt,Iyt=w(()=>{Tyt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Ayt=t=>({httpHandler:t.httpHandler()})});var Myt=w(()=>{Iyt()});var Ryt=w(()=>{su()});var Nyt=w(()=>{});var jyt=w(()=>{});function pOr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Bte,Dyt=w(()=>{Bte=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=pOr(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 Lyt=w(()=>{});var Fyt=w(()=>{});var kyt=w(()=>{});var ROe=w(()=>{Myt();Ryt();Nyt();jyt();Dyt();Lyt();Fyt();kyt()});var $yt,zyt,Byt=w(()=>{$yt=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}}},zyt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Ute,Uyt,qyt=w(()=>{MOe();ROe();dr();Byt();Ute=t=>t,Uyt=(t,e)=>{let r={...Ute($te(t)),...Ute(pte(t)),...Ute(Tyt(t)),...Ute($yt(t))};return e.forEach(n=>n.configure(r)),{...t,...zte(r),...mte(r),...Ayt(r),...zyt(r)}}});var aI,qte=w(()=>{TSe();ASe();ISe();KSe();z8();rI();FCe();ro();yte();dr();mOe();ha();xyt();qyt();aI=class extends mj{constructor(...[e]){let r=wyt(e||{}),n=Ngt(r),o=Eee(n),i=ite(o),a=Hee(i),s=a,u=Jee(s),l=Rgt(u),c=Uyt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use($ee(this.config)),this.middlewareStack.use(gte(this.config)),this.middlewareStack.use(vte(this.config)),this.middlewareStack.use(See(this.config)),this.middlewareStack.use(Cee(this.config)),this.middlewareStack.use(Pee(this.config)),this.middlewareStack.use(Zee(this.config,{httpAuthSchemeParametersProvider:Igt,identityProviderConfigProvider:async d=>new Dz({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(bte(this.config))}destroy(){super.destroy()}}});var gf,NOe=w(()=>{dr();gf=class t extends jz{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Hte,Vte,Wte,Kte,Gte,Jte,Zte,Yte,Xte,Qte,ere,jOe=w(()=>{NOe();Hte=class t extends gf{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},Vte=class t extends gf{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Wte=class t extends gf{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Kte=class t extends gf{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Gte=class t extends gf{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Jte=class t extends gf{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Zte=class t extends gf{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Yte=class t extends gf{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Xte=class t extends gf{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Qte=class t extends gf{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},ere=class t extends gf{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function rs(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var Hyt,Vyt,Wyt,Kyt,Gyt,Jyt,Zyt,Yyt,Xyt,Qyt,ebt,tbt,rbt,nbt,obt,ibt,abt,sbt,ubt,lbt,cbt,dbt,fbt,pbt,mbt,hbt,gbt,ybt,bbt,_bt,vbt,wbt,xbt,Sbt,Cbt,Obt,Pbt,Ebt,Tbt,Abt,Ibt,Mbt,Rbt,Nbt,jbt,Dbt,es,hOr,gOr,yOr,bOr,_Or,vOr,wOr,xOr,SOr,COr,OOr,POr,EOr,TOr,Lbt,AOr,ho,IOr,ts,Na=w(()=>{xj();ROe();dr();NOe();jOe();Hyt=async(t,e)=>{let r=rs("CreateIdentityPool"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Vyt=async(t,e)=>{let r=rs("DeleteIdentities"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Wyt=async(t,e)=>{let r=rs("DeleteIdentityPool"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Kyt=async(t,e)=>{let r=rs("DescribeIdentity"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Gyt=async(t,e)=>{let r=rs("DescribeIdentityPool"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Jyt=async(t,e)=>{let r=rs("GetCredentialsForIdentity"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Zyt=async(t,e)=>{let r=rs("GetId"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Yyt=async(t,e)=>{let r=rs("GetIdentityPoolRoles"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Xyt=async(t,e)=>{let r=rs("GetOpenIdToken"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},Qyt=async(t,e)=>{let r=rs("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},ebt=async(t,e)=>{let r=rs("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},tbt=async(t,e)=>{let r=rs("ListIdentities"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},rbt=async(t,e)=>{let r=rs("ListIdentityPools"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},nbt=async(t,e)=>{let r=rs("ListTagsForResource"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},obt=async(t,e)=>{let r=rs("LookupDeveloperIdentity"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},ibt=async(t,e)=>{let r=rs("MergeDeveloperIdentities"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},abt=async(t,e)=>{let r=rs("SetIdentityPoolRoles"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},sbt=async(t,e)=>{let r=rs("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},ubt=async(t,e)=>{let r=rs("TagResource"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},lbt=async(t,e)=>{let r=rs("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},cbt=async(t,e)=>{let r=rs("UnlinkIdentity"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},dbt=async(t,e)=>{let r=rs("UntagResource"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},fbt=async(t,e)=>{let r=rs("UpdateIdentityPool"),n;return n=JSON.stringify(cr(t)),ts(e,r,"/",void 0,n)},pbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},mbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},hbt=async(t,e)=>t.statusCode>=300?es(t,e):(await tI(t.body,e),{$metadata:ho(t)}),gbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=Lbt(r,e),{$metadata:ho(t),...n}},ybt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},bbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=EOr(r,e),{$metadata:ho(t),...n}},_bt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},vbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},wbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},xbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Sbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Cbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=AOr(r,e),{$metadata:ho(t),...n}},Obt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Pbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Ebt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Tbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Abt=async(t,e)=>t.statusCode>=300?es(t,e):(await tI(t.body,e),{$metadata:ho(t)}),Ibt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Mbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Rbt=async(t,e)=>t.statusCode>=300?es(t,e):(await tI(t.body,e),{$metadata:ho(t)}),Nbt=async(t,e)=>t.statusCode>=300?es(t,e):(await tI(t.body,e),{$metadata:ho(t)}),jbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},Dbt=async(t,e)=>{if(t.statusCode>=300)return es(t,e);let r=await Vs(t.body,e),n={};return n=cr(r),{$metadata:ho(t),...n}},es=async(t,e)=>{let r={...t,body:await Vht(t.body,e)},n=Wht(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await bOr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await vOr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await wOr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await xOr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await SOr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await OOr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await COr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await yOr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await _Or(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await gOr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await hOr(r,e);default:let o=r.body;return IOr({output:t,parsedBody:o,errorCode:n})}},hOr=async(t,e)=>{let r=t.body,n=cr(r),o=new ere({$metadata:ho(t),...n});return Qa(o,r)},gOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Qte({$metadata:ho(t),...n});return Qa(o,r)},yOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Yte({$metadata:ho(t),...n});return Qa(o,r)},bOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Hte({$metadata:ho(t),...n});return Qa(o,r)},_Or=async(t,e)=>{let r=t.body,n=cr(r),o=new Xte({$metadata:ho(t),...n});return Qa(o,r)},vOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Vte({$metadata:ho(t),...n});return Qa(o,r)},wOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Wte({$metadata:ho(t),...n});return Qa(o,r)},xOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Kte({$metadata:ho(t),...n});return Qa(o,r)},SOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Gte({$metadata:ho(t),...n});return Qa(o,r)},COr=async(t,e)=>{let r=t.body,n=cr(r),o=new Zte({$metadata:ho(t),...n});return Qa(o,r)},OOr=async(t,e)=>{let r=t.body,n=cr(r),o=new Jte({$metadata:ho(t),...n});return Qa(o,r)},POr=(t,e)=>Y8(t,{AccessKeyId:vn,Expiration:r=>Nz(cte(yj(r))),SecretKey:vn,SessionToken:vn}),EOr=(t,e)=>Y8(t,{Credentials:r=>POr(r,e),IdentityId:vn}),TOr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>Lbt(n,e)),Lbt=(t,e)=>Y8(t,{CreationDate:r=>Nz(cte(yj(r))),IdentityId:vn,LastModifiedDate:r=>Nz(cte(yj(r))),Logins:cr}),AOr=(t,e)=>Y8(t,{Identities:r=>TOr(r,e),IdentityPoolId:vn,NextToken:vn}),ho=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"]}),IOr=dte(gf),ts=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 Bte(l)}});var tre,DOe=w(()=>{ro();mo();dr();ha();Na();tre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(Hyt).de(pbt).build(){}});var rre,LOe=w(()=>{ro();mo();dr();ha();Na();rre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(Vyt).de(mbt).build(){}});var nre,FOe=w(()=>{ro();mo();dr();ha();Na();nre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(Wyt).de(hbt).build(){}});var ore,kOe=w(()=>{ro();mo();dr();ha();Na();ore=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(Kyt).de(gbt).build(){}});var ire,$Oe=w(()=>{ro();mo();dr();ha();Na();ire=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(Gyt).de(ybt).build(){}});var Uz,zOe=w(()=>{ro();mo();dr();ha();Na();Uz=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(Jyt).de(bbt).build(){}});var qz,BOe=w(()=>{ro();mo();dr();ha();Na();qz=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(Zyt).de(_bt).build(){}});var are,UOe=w(()=>{ro();mo();dr();ha();Na();are=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(Yyt).de(vbt).build(){}});var sre,qOe=w(()=>{ro();mo();dr();ha();Na();sre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(Xyt).de(wbt).build(){}});var ure,HOe=w(()=>{ro();mo();dr();ha();Na();ure=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(Qyt).de(xbt).build(){}});var lre,VOe=w(()=>{ro();mo();dr();ha();Na();lre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(ebt).de(Sbt).build(){}});var cre,WOe=w(()=>{ro();mo();dr();ha();Na();cre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(tbt).de(Cbt).build(){}});var Hz,dre=w(()=>{ro();mo();dr();ha();Na();Hz=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(rbt).de(Obt).build(){}});var fre,KOe=w(()=>{ro();mo();dr();ha();Na();fre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(nbt).de(Pbt).build(){}});var pre,GOe=w(()=>{ro();mo();dr();ha();Na();pre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(obt).de(Ebt).build(){}});var mre,JOe=w(()=>{ro();mo();dr();ha();Na();mre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(ibt).de(Tbt).build(){}});var hre,ZOe=w(()=>{ro();mo();dr();ha();Na();hre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(abt).de(Abt).build(){}});var gre,YOe=w(()=>{ro();mo();dr();ha();Na();gre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(sbt).de(Ibt).build(){}});var yre,XOe=w(()=>{ro();mo();dr();ha();Na();yre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(ubt).de(Mbt).build(){}});var bre,QOe=w(()=>{ro();mo();dr();ha();Na();bre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(lbt).de(Rbt).build(){}});var _re,ePe=w(()=>{ro();mo();dr();ha();Na();_re=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(cbt).de(Nbt).build(){}});var vre,tPe=w(()=>{ro();mo();dr();ha();Na();vre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(dbt).de(jbt).build(){}});var wre,rPe=w(()=>{ro();mo();dr();ha();Na();wre=class extends Et.classBuilder().ep({...jr}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(fbt).de(Dbt).build(){}});var MOr,nPe,Fbt=w(()=>{dr();qte();DOe();LOe();FOe();kOe();$Oe();zOe();BOe();UOe();qOe();HOe();VOe();WOe();dre();KOe();GOe();JOe();ZOe();YOe();XOe();QOe();ePe();tPe();rPe();MOr={CreateIdentityPoolCommand:tre,DeleteIdentitiesCommand:rre,DeleteIdentityPoolCommand:nre,DescribeIdentityCommand:ore,DescribeIdentityPoolCommand:ire,GetCredentialsForIdentityCommand:Uz,GetIdCommand:qz,GetIdentityPoolRolesCommand:are,GetOpenIdTokenCommand:sre,GetOpenIdTokenForDeveloperIdentityCommand:ure,GetPrincipalTagAttributeMapCommand:lre,ListIdentitiesCommand:cre,ListIdentityPoolsCommand:Hz,ListTagsForResourceCommand:fre,LookupDeveloperIdentityCommand:pre,MergeDeveloperIdentitiesCommand:mre,SetIdentityPoolRolesCommand:hre,SetPrincipalTagAttributeMapCommand:gre,TagResourceCommand:yre,UnlinkDeveloperIdentityCommand:bre,UnlinkIdentityCommand:_re,UntagResourceCommand:vre,UpdateIdentityPoolCommand:wre},nPe=class extends aI{};lte(MOr,nPe)});var kbt=w(()=>{DOe();LOe();FOe();kOe();$Oe();zOe();BOe();UOe();qOe();HOe();VOe();WOe();dre();KOe();GOe();JOe();ZOe();YOe();XOe();QOe();ePe();tPe();rPe()});var $bt=w(()=>{});var bOo,zbt=w(()=>{rI();qte();dre();bOo=LCe(aI,Hz,"NextToken","NextToken","MaxResults")});var Bbt=w(()=>{$bt();zbt()});var Ubt=w(()=>{jOe()});var qbt=w(()=>{qte();Fbt();kbt();Bbt();Ubt()});var oPe={};Qd(oPe,{CognitoIdentityClient:()=>aI,GetCredentialsForIdentityCommand:()=>Uz,GetIdCommand:()=>qz});var iPe=w(()=>{qbt()});function xre(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(iPe(),oPe)),{Credentials:{AccessKeyId:n=ROr(t.logger),Expiration:o,SecretKey:i=jOr(t.logger),SessionToken:a}=NOr(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 wee(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function ROr(t){throw new Wl("Response from Amazon Cognito contained no access key ID",{logger:t})}function NOr(t){throw new Wl("Response from Amazon Cognito contained no credentials",{logger:t})}function jOr(t){throw new Wl("Response from Amazon Cognito contained no secret key",{logger:t})}var aPe=w(()=>{cP();OSe()});var sPe,Sre,Hbt=w(()=>{sPe="IdentityIds",Sre=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(sPe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(sPe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(sPe)))}).catch(i=>{throw n.close(),i})})}}});var Cre,Vbt=w(()=>{Cre=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 Wbt(){return typeof self=="object"&&self.indexedDB?new Sre:typeof window=="object"&&window.localStorage?window.localStorage:DOr}var DOr,Kbt=w(()=>{Hbt();Vbt();DOr=new Cre});function Gbt({accountId:t,cache:e=Wbt(),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(()=>(iPe(),oPe)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:b=LOr(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await wee(a):void 0}));h=b,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=xre({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function LOr(t){throw new Wl("Response from Amazon Cognito contained no identity ID",{logger:t})}var Jbt=w(()=>{cP();aPe();Kbt();OSe()});var uPe=w(()=>{lut();cut();dut();aPe();Jbt()});var FOr,Zbt=w(()=>{uPe();FOr=t=>xre({...t})});var kOr,Ybt=w(()=>{uPe();kOr=t=>Gbt({...t})});var $Or,zOr,BOr,Xbt,Qbt=w(()=>{cP();$Or="169.254.170.2",zOr="169.254.170.23",BOr="[fd00:ec2::23]",Xbt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===$Or||t.hostname===zOr||t.hostname===BOr)){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 Wl(`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 e_t=w(()=>{});var t_t=w(()=>{e_t()});var r_t=w(()=>{su()});var n_t=w(()=>{});var o_t=w(()=>{});function UOr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Ore,i_t=w(()=>{Ore=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=UOr(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 a_t=w(()=>{});var s_t=w(()=>{});var u_t=w(()=>{});var l_t=w(()=>{t_t();r_t();n_t();o_t();i_t();a_t();s_t();u_t()});function c_t(t){return new Ore({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 d_t(t,e){let n=await Tpt(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 Wl("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:Vpt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Wl(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Wl(`Server responded with status: ${t.statusCode}`,{logger:e})}var f_t=w(()=>{cP();l_t();dr();CCe()});var p_t,m_t=w(()=>{p_t=(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 lPe,h_t=w(()=>{G8();cP();Qbt();f_t();m_t();lPe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Wl("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);Xbt(n,t.logger);let o=new eI;return p_t(async()=>{let i=c_t(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return d_t(a.response)},t.maxRetries??3,t.timeout??1e3)}});var g_t=w(()=>{h_t()});function qOr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function y_t(t){return{schemeId:"smithy.api#noAuth"}}var b_t,__t,HOr,v_t,cPe=w(()=>{xj();yb();dV();b_t=async(t,e,r)=>({operation:wv(e).operation,region:await hf(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});__t=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(y_t(t));break}case"AssumeRoleWithWebIdentity":{e.push(y_t(t));break}default:e.push(qOr(t))}return e},HOr=t=>({...t,stsClientCtor:Rg}),v_t=t=>{let e=HOr(t);return{...Ite(e)}}});var w_t,yf,Tv=w(()=>{w_t=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),yf={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 S_t,x_t=w(()=>{S_t={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 dPe,fPe=w(()=>{dPe=t=>new TextEncoder().encode(t)});var C_t=w(()=>{fPe()});var O_t,P_t=w(()=>{O_t=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 E_t=w(()=>{fPe();C_t();P_t()});var k_t,mn,Ro,No,uI,sI,ud,$_t,z_t,B_t,ja,T_t,Av,Vz,mPe,A_t,pPe,U_t,I_t,ld,M_t,q_t,H_t,bf,sh,R_t,V_t,W_t,N_t,K_t,j_t,D_t,L_t,F_t,WOr,G_t,J_t=w(()=>{k_t="required",mn="type",Ro="fn",No="argv",uI="ref",sI="booleanEquals",ud="stringEquals",$_t="sigv4",z_t="sts",B_t="us-east-1",ja="endpoint",T_t="https://sts.{Region}.{PartitionResult#dnsSuffix}",Av="tree",Vz="error",mPe="getAttr",A_t={[k_t]:!1,[mn]:"String"},pPe={[k_t]:!0,default:!1,[mn]:"Boolean"},U_t={[uI]:"Endpoint"},I_t={[Ro]:"isSet",[No]:[{[uI]:"Region"}]},ld={[uI]:"Region"},M_t={[Ro]:"aws.partition",[No]:[ld],assign:"PartitionResult"},q_t={[uI]:"UseFIPS"},H_t={[uI]:"UseDualStack"},bf={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:$_t,signingName:z_t,signingRegion:B_t}]},headers:{}},sh={},R_t={conditions:[{[Ro]:ud,[No]:[ld,"aws-global"]}],[ja]:bf,[mn]:ja},V_t={[Ro]:sI,[No]:[q_t,!0]},W_t={[Ro]:sI,[No]:[H_t,!0]},N_t={[Ro]:mPe,[No]:[{[uI]:"PartitionResult"},"supportsFIPS"]},K_t={[uI]:"PartitionResult"},j_t={[Ro]:sI,[No]:[!0,{[Ro]:mPe,[No]:[K_t,"supportsDualStack"]}]},D_t=[{[Ro]:"isSet",[No]:[U_t]}],L_t=[V_t],F_t=[W_t],WOr={version:"1.0",parameters:{Region:A_t,UseDualStack:pPe,UseFIPS:pPe,Endpoint:A_t,UseGlobalEndpoint:pPe},rules:[{conditions:[{[Ro]:sI,[No]:[{[uI]:"UseGlobalEndpoint"},!0]},{[Ro]:"not",[No]:D_t},I_t,M_t,{[Ro]:sI,[No]:[q_t,!1]},{[Ro]:sI,[No]:[H_t,!1]}],rules:[{conditions:[{[Ro]:ud,[No]:[ld,"ap-northeast-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"ap-south-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"ap-southeast-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"ap-southeast-2"]}],endpoint:bf,[mn]:ja},R_t,{conditions:[{[Ro]:ud,[No]:[ld,"ca-central-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"eu-central-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"eu-north-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"eu-west-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"eu-west-2"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"eu-west-3"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"sa-east-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,B_t]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"us-east-2"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"us-west-1"]}],endpoint:bf,[mn]:ja},{conditions:[{[Ro]:ud,[No]:[ld,"us-west-2"]}],endpoint:bf,[mn]:ja},{endpoint:{url:T_t,properties:{authSchemes:[{name:$_t,signingName:z_t,signingRegion:"{Region}"}]},headers:sh},[mn]:ja}],[mn]:Av},{conditions:D_t,rules:[{conditions:L_t,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[mn]:Vz},{conditions:F_t,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[mn]:Vz},{endpoint:{url:U_t,properties:sh,headers:sh},[mn]:ja}],[mn]:Av},{conditions:[I_t],rules:[{conditions:[M_t],rules:[{conditions:[V_t,W_t],rules:[{conditions:[{[Ro]:sI,[No]:[!0,N_t]},j_t],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:sh,headers:sh},[mn]:ja}],[mn]:Av},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[mn]:Vz}],[mn]:Av},{conditions:L_t,rules:[{conditions:[{[Ro]:sI,[No]:[N_t,!0]}],rules:[{conditions:[{[Ro]:ud,[No]:[{[Ro]:mPe,[No]:[K_t,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:sh,headers:sh},[mn]:ja},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:sh,headers:sh},[mn]:ja}],[mn]:Av},{error:"FIPS is enabled but this partition does not support FIPS",[mn]:Vz}],[mn]:Av},{conditions:F_t,rules:[{conditions:[j_t],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:sh,headers:sh},[mn]:ja}],[mn]:Av},{error:"DualStack is enabled but this partition does not support DualStack",[mn]:Vz}],[mn]:Av},R_t,{endpoint:{url:T_t,properties:sh,headers:sh},[mn]:ja}],[mn]:Av}],[mn]:Av},{error:"Invalid Configuration: Missing Region",[mn]:Vz}]},G_t=WOr});var Z_t,Y_t=w(()=>{Dee();KA();J_t();Z_t=(t,e={})=>k8(G_t,{endpointParams:t,logger:e.logger});dP.aws=$8});var X_t,Q_t=w(()=>{xj();rI();dr();Wee();Mz();E_t();cPe();Y_t();X_t=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??XA,base64Encoder:t?.base64Encoder??QA,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Z_t,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??__t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new _j},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Lz}],logger:t?.logger??new JA,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??GA,utf8Decoder:t?.utf8Decoder??dPe,utf8Encoder:t?.utf8Encoder??O_t})});var evt,tvt=w(()=>{x_t();vOe();SOe();z8();G8();COe();OOe();Sv();Q_t();dr();AOe();evt=t=>{let e=kte(t),r=()=>e().then(fte),n=X_t(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Fte,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Dte({serviceId:n.serviceId,clientVersion:S_t.version}),maxAttempts:t?.maxAttempts??xv,region:t?.region??Lte("Region is missing"),requestHandler:eI.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||q8),sha256:t?.sha256??jte,streamCollector:t?.streamCollector??Rz,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Bee)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Uee))}}});var rvt,nvt,ovt=w(()=>{rvt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},nvt=t=>({httpHandler:t.httpHandler()})});var ivt=w(()=>{ovt()});var avt=w(()=>{su()});var svt=w(()=>{});var uvt=w(()=>{});function KOr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Pre,lvt=w(()=>{Pre=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=KOr(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 cvt=w(()=>{});var dvt=w(()=>{});var fvt=w(()=>{});var hPe=w(()=>{ivt();avt();svt();uvt();lvt();cvt();dvt();fvt()});var pvt,mvt,hvt=w(()=>{pvt=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}}},mvt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Ere,gvt,yvt=w(()=>{MOe();hPe();dr();hvt();Ere=t=>t,gvt=(t,e)=>{let r={...Ere($te(t)),...Ere(pte(t)),...Ere(rvt(t)),...Ere(pvt(t))};return e.forEach(n=>n.configure(r)),{...t,...zte(r),...mte(r),...nvt(r),...mvt(r)}}});var Rg,dV=w(()=>{TSe();ASe();ISe();KSe();z8();rI();FCe();ro();yte();dr();cPe();Tv();tvt();yvt();Rg=class extends mj{constructor(...[e]){let r=evt(e||{}),n=w_t(r),o=Eee(n),i=ite(o),a=Hee(i),s=a,u=Jee(s),l=v_t(u),c=gvt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use($ee(this.config)),this.middlewareStack.use(gte(this.config)),this.middlewareStack.use(vte(this.config)),this.middlewareStack.use(See(this.config)),this.middlewareStack.use(Cee(this.config)),this.middlewareStack.use(Pee(this.config)),this.middlewareStack.use(Zee(this.config,{httpAuthSchemeParametersProvider:b_t,identityProviderConfigProvider:async d=>new Dz({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(bte(this.config))}destroy(){super.destroy()}}});var dp,Tre=w(()=>{dr();dp=class t extends jz{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var fV,pV,mV,hV,gV,yV,bV,_V,Wz,gPe,yPe,bPe,_Pe,vPe,wPe,xPe,lI=w(()=>{dr();Tre();fV=class t extends dp{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pV=class t extends dp{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mV=class t extends dp{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hV=class t extends dp{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gV=class t extends dp{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yV=class t extends dp{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bV=class t extends dp{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_V=class t extends dp{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Wz=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:ute}}),gPe=t=>({...t,...t.Credentials&&{Credentials:Wz(t.Credentials)}}),yPe=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:ute}}),bPe=t=>({...t,...t.Credentials&&{Credentials:Wz(t.Credentials)}}),_Pe=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:ute}}),vPe=t=>({...t,...t.Credentials&&{Credentials:Wz(t.Credentials)}}),wPe=t=>({...t,...t.Credentials&&{Credentials:Wz(t.Credentials)}}),xPe=t=>({...t,...t.Credentials&&{Credentials:Wz(t.Credentials)}})});var bvt,_vt,vvt,wvt,xvt,Svt,Cvt,Ovt,Pvt,Evt,Tvt,Avt,Ivt,Mvt,Rvt,Nvt,cI,GOr,JOr,ZOr,YOr,XOr,QOr,ePr,tPr,rPr,nPr,oPr,iPr,aPr,sPr,uPr,lPr,Are,cPr,dPr,fPr,pPr,mPr,jvt,YPe,hPr,gPr,yPr,vV,bPr,_Pr,vPr,wPr,xPr,SPr,CPr,OPr,PPr,EPr,TPr,APr,IPr,MPr,_f,RPr,dI,fI,pI,mI,Kz,NPr,SPe,yP,jPr,DPr,Gz,bP,Jz,fp,CPe,LPr,OPe,pp,PPe,EPe,TPe,APe,IPe,FPr,kPr,$Pr,zPr,MPe,RPe,NPe,jPe,Ng,jg,DPe,LPe,FPe,kPe,Dg,$Pe,_P,Zz,zPe,BPe,UPe,qPe,Lg,Yz,HPe,VPe,Xz,Qz,WPe,KPe,hI,GPe,JPe,ZPe,Da,gI,BPr,vP=w(()=>{xj();hPe();dr();lI();Tre();bvt=async(t,e)=>{let r=fI,n;return n=gI({...rPr(t,e),[mI]:NPr,[hI]:pI}),dI(e,r,"/",void 0,n)},_vt=async(t,e)=>{let r=fI,n;return n=gI({...nPr(t,e),[mI]:jPr,[hI]:pI}),dI(e,r,"/",void 0,n)},vvt=async(t,e)=>{let r=fI,n;return n=gI({...oPr(t,e),[mI]:DPr,[hI]:pI}),dI(e,r,"/",void 0,n)},wvt=async(t,e)=>{let r=fI,n;return n=gI({...iPr(t,e),[mI]:LPr,[hI]:pI}),dI(e,r,"/",void 0,n)},xvt=async(t,e)=>{let r=fI,n;return n=gI({...aPr(t,e),[mI]:FPr,[hI]:pI}),dI(e,r,"/",void 0,n)},Svt=async(t,e)=>{let r=fI,n;return n=gI({...sPr(t,e),[mI]:kPr,[hI]:pI}),dI(e,r,"/",void 0,n)},Cvt=async(t,e)=>{let r=fI,n;return n=gI({...uPr(t,e),[mI]:$Pr,[hI]:pI}),dI(e,r,"/",void 0,n)},Ovt=async(t,e)=>{let r=fI,n;return n=gI({...lPr(t,e),[mI]:zPr,[hI]:pI}),dI(e,r,"/",void 0,n)},Pvt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=hPr(r.AssumeRoleResult,e),{$metadata:_f(t),...n}},Evt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=gPr(r.AssumeRoleWithSAMLResult,e),{$metadata:_f(t),...n}},Tvt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=yPr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:_f(t),...n}},Avt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=bPr(r.DecodeAuthorizationMessageResult,e),{$metadata:_f(t),...n}},Ivt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=wPr(r.GetAccessKeyInfoResult,e),{$metadata:_f(t),...n}},Mvt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=xPr(r.GetCallerIdentityResult,e),{$metadata:_f(t),...n}},Rvt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=SPr(r.GetFederationTokenResult,e),{$metadata:_f(t),...n}},Nvt=async(t,e)=>{if(t.statusCode>=300)return cI(t,e);let r=await Cv(t.body,e),n={};return n=CPr(r.GetSessionTokenResult,e),{$metadata:_f(t),...n}},cI=async(t,e)=>{let r={...t,body:await Egt(t.body,e)},n=BPr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await GOr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await QOr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await ePr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await tPr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await ZOr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await XOr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await JOr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await YOr(r,e);default:let o=r.body;return RPr({output:t,parsedBody:o.Error,errorCode:n})}},GOr=async(t,e)=>{let r=t.body,n=_Pr(r.Error,e),o=new fV({$metadata:_f(t),...n});return Qa(o,r)},JOr=async(t,e)=>{let r=t.body,n=OPr(r.Error,e),o=new bV({$metadata:_f(t),...n});return Qa(o,r)},ZOr=async(t,e)=>{let r=t.body,n=PPr(r.Error,e),o=new gV({$metadata:_f(t),...n});return Qa(o,r)},YOr=async(t,e)=>{let r=t.body,n=EPr(r.Error,e),o=new _V({$metadata:_f(t),...n});return Qa(o,r)},XOr=async(t,e)=>{let r=t.body,n=TPr(r.Error,e),o=new yV({$metadata:_f(t),...n});return Qa(o,r)},QOr=async(t,e)=>{let r=t.body,n=APr(r.Error,e),o=new pV({$metadata:_f(t),...n});return Qa(o,r)},ePr=async(t,e)=>{let r=t.body,n=IPr(r.Error,e),o=new mV({$metadata:_f(t),...n});return Qa(o,r)},tPr=async(t,e)=>{let r=t.body,n=MPr(r.Error,e),o=new hV({$metadata:_f(t),...n});return Qa(o,r)},rPr=(t,e)=>{let r={};if(t[_P]!=null&&(r[_P]=t[_P]),t[Zz]!=null&&(r[Zz]=t[Zz]),t[jg]!=null){let n=Are(t[jg],e);t[jg]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Ng]!=null&&(r[Ng]=t[Ng]),t[pp]!=null&&(r[pp]=t[pp]),t[Xz]!=null){let n=jvt(t[Xz],e);t[Xz]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[WPe]!=null){let n=mPr(t[WPe],e);t[WPe]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[EPe]!=null&&(r[EPe]=t[EPe]),t[Yz]!=null&&(r[Yz]=t[Yz]),t[Qz]!=null&&(r[Qz]=t[Qz]),t[Lg]!=null&&(r[Lg]=t[Lg]),t[FPe]!=null){let n=fPr(t[FPe],e);t[FPe]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},nPr=(t,e)=>{let r={};if(t[_P]!=null&&(r[_P]=t[_P]),t[DPe]!=null&&(r[DPe]=t[DPe]),t[UPe]!=null&&(r[UPe]=t[UPe]),t[jg]!=null){let n=Are(t[jg],e);t[jg]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Ng]!=null&&(r[Ng]=t[Ng]),t[pp]!=null&&(r[pp]=t[pp]),r},oPr=(t,e)=>{let r={};if(t[_P]!=null&&(r[_P]=t[_P]),t[Zz]!=null&&(r[Zz]=t[Zz]),t[JPe]!=null&&(r[JPe]=t[JPe]),t[kPe]!=null&&(r[kPe]=t[kPe]),t[jg]!=null){let n=Are(t[jg],e);t[jg]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Ng]!=null&&(r[Ng]=t[Ng]),t[pp]!=null&&(r[pp]=t[pp]),r},iPr=(t,e)=>{let r={};return t[TPe]!=null&&(r[TPe]=t[TPe]),r},aPr=(t,e)=>{let r={};return t[Kz]!=null&&(r[Kz]=t[Kz]),r},sPr=(t,e)=>({}),uPr=(t,e)=>{let r={};if(t[NPe]!=null&&(r[NPe]=t[NPe]),t[Ng]!=null&&(r[Ng]=t[Ng]),t[jg]!=null){let n=Are(t[jg],e);t[jg]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[pp]!=null&&(r[pp]=t[pp]),t[Xz]!=null){let n=jvt(t[Xz],e);t[Xz]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},lPr=(t,e)=>{let r={};return t[pp]!=null&&(r[pp]=t[pp]),t[Yz]!=null&&(r[Yz]=t[Yz]),t[Qz]!=null&&(r[Qz]=t[Qz]),r},Are=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=cPr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},cPr=(t,e)=>{let r={};return t[ZPe]!=null&&(r[ZPe]=t[ZPe]),r},dPr=(t,e)=>{let r={};return t[LPe]!=null&&(r[LPe]=t[LPe]),t[CPe]!=null&&(r[CPe]=t[CPe]),r},fPr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=dPr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},pPr=(t,e)=>{let r={};return t[RPe]!=null&&(r[RPe]=t[RPe]),t[GPe]!=null&&(r[GPe]=t[GPe]),r},mPr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},jvt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=pPr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},YPe=(t,e)=>{let r={};return t[SPe]!=null&&(r[SPe]=vn(t[SPe])),t[bP]!=null&&(r[bP]=vn(t[bP])),r},hPr=(t,e)=>{let r={};return t[fp]!=null&&(r[fp]=vV(t[fp],e)),t[yP]!=null&&(r[yP]=YPe(t[yP],e)),t[Dg]!=null&&(r[Dg]=Z8(t[Dg])),t[Lg]!=null&&(r[Lg]=vn(t[Lg])),r},gPr=(t,e)=>{let r={};return t[fp]!=null&&(r[fp]=vV(t[fp],e)),t[yP]!=null&&(r[yP]=YPe(t[yP],e)),t[Dg]!=null&&(r[Dg]=Z8(t[Dg])),t[zPe]!=null&&(r[zPe]=vn(t[zPe])),t[HPe]!=null&&(r[HPe]=vn(t[HPe])),t[MPe]!=null&&(r[MPe]=vn(t[MPe])),t[Jz]!=null&&(r[Jz]=vn(t[Jz])),t[jPe]!=null&&(r[jPe]=vn(t[jPe])),t[Lg]!=null&&(r[Lg]=vn(t[Lg])),r},yPr=(t,e)=>{let r={};return t[fp]!=null&&(r[fp]=vV(t[fp],e)),t[qPe]!=null&&(r[qPe]=vn(t[qPe])),t[yP]!=null&&(r[yP]=YPe(t[yP],e)),t[Dg]!=null&&(r[Dg]=Z8(t[Dg])),t[$Pe]!=null&&(r[$Pe]=vn(t[$Pe])),t[Jz]!=null&&(r[Jz]=vn(t[Jz])),t[Lg]!=null&&(r[Lg]=vn(t[Lg])),r},vV=(t,e)=>{let r={};return t[Kz]!=null&&(r[Kz]=vn(t[Kz])),t[BPe]!=null&&(r[BPe]=vn(t[BPe])),t[VPe]!=null&&(r[VPe]=vn(t[VPe])),t[PPe]!=null&&(r[PPe]=Nz(Wpt(t[PPe]))),r},bPr=(t,e)=>{let r={};return t[OPe]!=null&&(r[OPe]=vn(t[OPe])),r},_Pr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},vPr=(t,e)=>{let r={};return t[IPe]!=null&&(r[IPe]=vn(t[IPe])),t[bP]!=null&&(r[bP]=vn(t[bP])),r},wPr=(t,e)=>{let r={};return t[Gz]!=null&&(r[Gz]=vn(t[Gz])),r},xPr=(t,e)=>{let r={};return t[KPe]!=null&&(r[KPe]=vn(t[KPe])),t[Gz]!=null&&(r[Gz]=vn(t[Gz])),t[bP]!=null&&(r[bP]=vn(t[bP])),r},SPr=(t,e)=>{let r={};return t[fp]!=null&&(r[fp]=vV(t[fp],e)),t[APe]!=null&&(r[APe]=vPr(t[APe],e)),t[Dg]!=null&&(r[Dg]=Z8(t[Dg])),r},CPr=(t,e)=>{let r={};return t[fp]!=null&&(r[fp]=vV(t[fp],e)),r},OPr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},PPr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},EPr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},TPr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},APr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},IPr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},MPr=(t,e)=>{let r={};return t[Da]!=null&&(r[Da]=vn(t[Da])),r},_f=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"]}),RPr=dte(dp),dI=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 Pre(l)},fI={"content-type":"application/x-www-form-urlencoded"},pI="2011-06-15",mI="Action",Kz="AccessKeyId",NPr="AssumeRole",SPe="AssumedRoleId",yP="AssumedRoleUser",jPr="AssumeRoleWithSAML",DPr="AssumeRoleWithWebIdentity",Gz="Account",bP="Arn",Jz="Audience",fp="Credentials",CPe="ContextAssertion",LPr="DecodeAuthorizationMessage",OPe="DecodedMessage",pp="DurationSeconds",PPe="Expiration",EPe="ExternalId",TPe="EncodedMessage",APe="FederatedUser",IPe="FederatedUserId",FPr="GetAccessKeyInfo",kPr="GetCallerIdentity",$Pr="GetFederationToken",zPr="GetSessionToken",MPe="Issuer",RPe="Key",NPe="Name",jPe="NameQualifier",Ng="Policy",jg="PolicyArns",DPe="PrincipalArn",LPe="ProviderArn",FPe="ProvidedContexts",kPe="ProviderId",Dg="PackedPolicySize",$Pe="Provider",_P="RoleArn",Zz="RoleSessionName",zPe="Subject",BPe="SecretAccessKey",UPe="SAMLAssertion",qPe="SubjectFromWebIdentityToken",Lg="SourceIdentity",Yz="SerialNumber",HPe="SubjectType",VPe="SessionToken",Xz="Tags",Qz="TokenCode",WPe="TransitiveTagKeys",KPe="UserId",hI="Version",GPe="Value",JPe="WebIdentityToken",ZPe="arn",Da="message",gI=t=>Object.entries(t).map(([e,r])=>hte(e)+"="+hte(r)).join("&"),BPr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var wP,Ire=w(()=>{ro();mo();dr();Tv();lI();vP();wP=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,gPe).ser(bvt).de(Pvt).build(){}});var wV,XPe=w(()=>{ro();mo();dr();Tv();lI();vP();wV=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(yPe,bPe).ser(_vt).de(Evt).build(){}});var Sj,Mre=w(()=>{ro();mo();dr();Tv();lI();vP();Sj=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(_Pe,vPe).ser(vvt).de(Tvt).build(){}});var xV,QPe=w(()=>{ro();mo();dr();Tv();vP();xV=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(wvt).de(Avt).build(){}});var SV,eEe=w(()=>{ro();mo();dr();Tv();vP();SV=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(xvt).de(Ivt).build(){}});var CV,tEe=w(()=>{ro();mo();dr();Tv();vP();CV=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(Svt).de(Mvt).build(){}});var OV,rEe=w(()=>{ro();mo();dr();Tv();lI();vP();OV=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,wPe).ser(Cvt).de(Rvt).build(){}});var PV,nEe=w(()=>{ro();mo();dr();Tv();lI();vP();PV=class extends Et.classBuilder().ep({...yf}).m(function(e,r,n,o){return[kt(n,this.serialize,this.deserialize),$t(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,xPe).ser(Ovt).de(Nvt).build(){}});var UPr,Rre,Dvt=w(()=>{dr();Ire();XPe();Mre();QPe();eEe();tEe();rEe();nEe();dV();UPr={AssumeRoleCommand:wP,AssumeRoleWithSAMLCommand:wV,AssumeRoleWithWebIdentityCommand:Sj,DecodeAuthorizationMessageCommand:xV,GetAccessKeyInfoCommand:SV,GetCallerIdentityCommand:CV,GetFederationTokenCommand:OV,GetSessionTokenCommand:PV},Rre=class extends Rg{};lte(UPr,Rre)});var Lvt=w(()=>{Ire();XPe();Mre();QPe();eEe();tEe();rEe();nEe()});var Fvt=w(()=>{lI()});var kvt,$vt,zvt,Bvt,Uvt,qvt,Hvt=w(()=>{Ire();Mre();kvt="us-east-1",$vt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},zvt=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)`,`${kvt} (STS default)`),n??o??kvt},Bvt=(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 zvt(c,t?.parentClientConfig?.region,f),m=!qvt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new wP(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=$vt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},Uvt=(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 zvt(u,t?.parentClientConfig?.region,c),f=!qvt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new Sj(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=$vt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},qvt=t=>t?.metadata?.handlerProtocol==="h2"});var Vvt,Wvt,Kvt,qPr,Gvt=w(()=>{Hvt();dV();Vvt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,Wvt=(t={},e)=>Bvt(t,Vvt(Rg,e)),Kvt=(t={},e)=>Uvt(t,Vvt(Rg,e)),qPr=t=>e=>t({roleAssumer:Wvt(e),roleAssumerWithWebIdentity:Kvt(e),...e})});var Jvt={};Qd(Jvt,{$Command:()=>Et,AssumeRoleCommand:()=>wP,AssumeRoleResponseFilterSensitiveLog:()=>gPe,AssumeRoleWithSAMLCommand:()=>wV,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>yPe,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>bPe,AssumeRoleWithWebIdentityCommand:()=>Sj,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>_Pe,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>vPe,CredentialsFilterSensitiveLog:()=>Wz,DecodeAuthorizationMessageCommand:()=>xV,ExpiredTokenException:()=>fV,GetAccessKeyInfoCommand:()=>SV,GetCallerIdentityCommand:()=>CV,GetFederationTokenCommand:()=>OV,GetFederationTokenResponseFilterSensitiveLog:()=>wPe,GetSessionTokenCommand:()=>PV,GetSessionTokenResponseFilterSensitiveLog:()=>xPe,IDPCommunicationErrorException:()=>bV,IDPRejectedClaimException:()=>gV,InvalidAuthorizationMessageException:()=>_V,InvalidIdentityTokenException:()=>yV,MalformedPolicyDocumentException:()=>pV,PackedPolicyTooLargeException:()=>mV,RegionDisabledException:()=>hV,STS:()=>Rre,STSClient:()=>Rg,STSServiceException:()=>dp,__Client:()=>mj,decorateDefaultCredentialProvider:()=>qPr,getDefaultRoleAssumer:()=>Wvt,getDefaultRoleAssumerWithWebIdentity:()=>Kvt});var oEe=w(()=>{dV();Dvt();Lvt();Fvt();Gvt();Tre()});var Zvt={};Qd(Zvt,{AssumeRoleCommand:()=>wP,STSClient:()=>Rg});var Yvt=w(()=>{oEe()});var HPr,Xvt=w(()=>{cP();HPr=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 Wl("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(()=>(Yvt(),Zvt));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 Wl(`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 Qvt=w(()=>{});var ewt,twt=w(()=>{ewt=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(()=>(oEe(),Jvt));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 rwt=w(()=>{Qvt();twt()});var VPr,nwt=w(()=>{rwt();VPr=t=>ewt({...t})});var owt={};Qd(owt,{fromCognitoIdentity:()=>FOr,fromCognitoIdentityPool:()=>kOr,fromHttp:()=>lPe,fromTemporaryCredentials:()=>HPr,fromWebToken:()=>VPr});var iwt=w(()=>{Zbt();Ybt();g_t();Xvt();nwt()});var Cj={};Qd(Cj,{__addDisposableResource:()=>Pwt,__assign:()=>Nre,__asyncDelegator:()=>bwt,__asyncGenerator:()=>ywt,__asyncValues:()=>_wt,__await:()=>eB,__awaiter:()=>dwt,__classPrivateFieldGet:()=>Swt,__classPrivateFieldIn:()=>Owt,__classPrivateFieldSet:()=>Cwt,__createBinding:()=>Dre,__decorate:()=>uwt,__disposeResources:()=>Ewt,__esDecorate:()=>WPr,__exportStar:()=>pwt,__extends:()=>awt,__generator:()=>fwt,__importDefault:()=>xwt,__importStar:()=>wwt,__makeTemplateObject:()=>vwt,__metadata:()=>cwt,__param:()=>lwt,__propKey:()=>GPr,__read:()=>aEe,__rest:()=>swt,__runInitializers:()=>KPr,__setFunctionName:()=>JPr,__spread:()=>mwt,__spreadArray:()=>gwt,__spreadArrays:()=>hwt,__values:()=>jre,default:()=>XPr});function awt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");iEe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function swt(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 uwt(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 lwt(t,e){return function(r,n){e(r,n,t)}}function WPr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function KPr(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 GPr(t){return typeof t=="symbol"?t:"".concat(t)}function JPr(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 cwt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function dwt(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 fwt(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 pwt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Dre(e,t,r)}function jre(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 aEe(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 mwt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(aEe(arguments[e]));return t}function hwt(){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 gwt(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 eB(t){return this instanceof eB?(this.v=t,this):new eB(t)}function ywt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(b,g){i.push([p,h,b,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof eB?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function bwt(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:eB(t[o](a)),done:!1}:i?i(a):a}:i}}function _wt(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 jre=="function"?jre(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 vwt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function wwt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dre(e,t,r);return ZPr(e,t),e}function xwt(t){return t&&t.__esModule?t:{default:t}}function Swt(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 Cwt(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 Owt(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 Pwt(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 Ewt(t){function e(i){t.error=t.hasError?new YPr(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 iEe,Nre,Dre,ZPr,YPr,XPr,Oj=w(()=>{iEe=function(t,e){return iEe=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])},iEe(t,e)};Nre=function(){return Nre=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},Nre.apply(this,arguments)};Dre=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};ZPr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};YPr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};XPr={__extends:awt,__assign:Nre,__rest:swt,__decorate:uwt,__param:lwt,__metadata:cwt,__awaiter:dwt,__generator:fwt,__createBinding:Dre,__exportStar:pwt,__values:jre,__read:aEe,__spread:mwt,__spreadArrays:hwt,__spreadArray:gwt,__await:eB,__asyncGenerator:ywt,__asyncDelegator:bwt,__asyncValues:_wt,__makeTemplateObject:vwt,__importStar:wwt,__importDefault:xwt,__classPrivateFieldGet:Swt,__classPrivateFieldSet:Cwt,__classPrivateFieldIn:Owt,__addDisposableResource:Pwt,__disposeResources:Ewt}});var Awt=v(Twt=>{"use strict";Object.defineProperty(Twt,"__esModule",{value:!0})});var Iwt=v(EV=>{"use strict";Object.defineProperty(EV,"__esModule",{value:!0});EV.HttpAuthLocation=void 0;var QPr;(function(t){t.HEADER="header",t.QUERY="query"})(QPr=EV.HttpAuthLocation||(EV.HttpAuthLocation={}))});var Rwt=v(Mwt=>{"use strict";Object.defineProperty(Mwt,"__esModule",{value:!0})});var jwt=v(Nwt=>{"use strict";Object.defineProperty(Nwt,"__esModule",{value:!0})});var Lwt=v(Dwt=>{"use strict";Object.defineProperty(Dwt,"__esModule",{value:!0})});var kwt=v(Fwt=>{"use strict";Object.defineProperty(Fwt,"__esModule",{value:!0})});var zwt=v($wt=>{"use strict";Object.defineProperty($wt,"__esModule",{value:!0})});var Uwt=v(Bwt=>{"use strict";Object.defineProperty(Bwt,"__esModule",{value:!0})});var Hwt=v(qwt=>{"use strict";Object.defineProperty(qwt,"__esModule",{value:!0})});var Vwt=v(TV=>{"use strict";Object.defineProperty(TV,"__esModule",{value:!0});var sEe=(Oj(),dc(Cj));sEe.__exportStar(zwt(),TV);sEe.__exportStar(Uwt(),TV);sEe.__exportStar(Hwt(),TV)});var Kwt=v(Wwt=>{"use strict";Object.defineProperty(Wwt,"__esModule",{value:!0})});var Jwt=v(Gwt=>{"use strict";Object.defineProperty(Gwt,"__esModule",{value:!0})});var Zwt=v(AV=>{"use strict";Object.defineProperty(AV,"__esModule",{value:!0});AV.EndpointURLScheme=void 0;var eEr;(function(t){t.HTTP="http",t.HTTPS="https"})(eEr=AV.EndpointURLScheme||(AV.EndpointURLScheme={}))});var Xwt=v(Ywt=>{"use strict";Object.defineProperty(Ywt,"__esModule",{value:!0})});var e0t=v(Qwt=>{"use strict";Object.defineProperty(Qwt,"__esModule",{value:!0})});var r0t=v(t0t=>{"use strict";Object.defineProperty(t0t,"__esModule",{value:!0})});var o0t=v(n0t=>{"use strict";Object.defineProperty(n0t,"__esModule",{value:!0})});var a0t=v(i0t=>{"use strict";Object.defineProperty(i0t,"__esModule",{value:!0})});var s0t=v(Pj=>{"use strict";Object.defineProperty(Pj,"__esModule",{value:!0});var IV=(Oj(),dc(Cj));IV.__exportStar(Xwt(),Pj);IV.__exportStar(e0t(),Pj);IV.__exportStar(r0t(),Pj);IV.__exportStar(o0t(),Pj);IV.__exportStar(a0t(),Pj)});var l0t=v(u0t=>{"use strict";Object.defineProperty(u0t,"__esModule",{value:!0})});var c0t=v(MV=>{"use strict";Object.defineProperty(MV,"__esModule",{value:!0});MV.FieldPosition=void 0;var tEr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(tEr=MV.FieldPosition||(MV.FieldPosition={}))});var f0t=v(d0t=>{"use strict";Object.defineProperty(d0t,"__esModule",{value:!0})});var m0t=v(p0t=>{"use strict";Object.defineProperty(p0t,"__esModule",{value:!0})});var g0t=v(Lre=>{"use strict";Object.defineProperty(Lre,"__esModule",{value:!0});var h0t=(Oj(),dc(Cj));h0t.__exportStar(f0t(),Lre);h0t.__exportStar(m0t(),Lre)});var b0t=v(y0t=>{"use strict";Object.defineProperty(y0t,"__esModule",{value:!0})});var v0t=v(_0t=>{"use strict";Object.defineProperty(_0t,"__esModule",{value:!0})});var x0t=v(w0t=>{"use strict";Object.defineProperty(w0t,"__esModule",{value:!0})});var C0t=v(S0t=>{"use strict";Object.defineProperty(S0t,"__esModule",{value:!0})});var P0t=v(O0t=>{"use strict";Object.defineProperty(O0t,"__esModule",{value:!0})});var T0t=v(E0t=>{"use strict";Object.defineProperty(E0t,"__esModule",{value:!0})});var I0t=v(A0t=>{"use strict";Object.defineProperty(A0t,"__esModule",{value:!0})});var R0t=v(M0t=>{"use strict";Object.defineProperty(M0t,"__esModule",{value:!0})});var j0t=v(N0t=>{"use strict";Object.defineProperty(N0t,"__esModule",{value:!0})});var L0t=v(D0t=>{"use strict";Object.defineProperty(D0t,"__esModule",{value:!0})});var k0t=v(F0t=>{"use strict";Object.defineProperty(F0t,"__esModule",{value:!0})});var z0t=v($0t=>{"use strict";Object.defineProperty($0t,"__esModule",{value:!0})});var U0t=v(B0t=>{"use strict";Object.defineProperty(B0t,"__esModule",{value:!0})});var q0t=v(RV=>{"use strict";Object.defineProperty(RV,"__esModule",{value:!0});RV.RequestHandlerProtocol=void 0;var rEr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(rEr=RV.RequestHandlerProtocol||(RV.RequestHandlerProtocol={}))});var V0t=v(H0t=>{"use strict";Object.defineProperty(H0t,"__esModule",{value:!0})});var K0t=v(W0t=>{"use strict";Object.defineProperty(W0t,"__esModule",{value:!0})});var J0t=v(G0t=>{"use strict";Object.defineProperty(G0t,"__esModule",{value:!0})});var Y0t=v(Z0t=>{"use strict";Object.defineProperty(Z0t,"__esModule",{value:!0})});var Q0t=v(X0t=>{"use strict";Object.defineProperty(X0t,"__esModule",{value:!0})});var ext=v(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});var Ao=(Oj(),dc(Cj));Ao.__exportStar(Awt(),no);Ao.__exportStar(Iwt(),no);Ao.__exportStar(Rwt(),no);Ao.__exportStar(jwt(),no);Ao.__exportStar(Lwt(),no);Ao.__exportStar(kwt(),no);Ao.__exportStar(Vwt(),no);Ao.__exportStar(Kwt(),no);Ao.__exportStar(Jwt(),no);Ao.__exportStar(Zwt(),no);Ao.__exportStar(s0t(),no);Ao.__exportStar(l0t(),no);Ao.__exportStar(c0t(),no);Ao.__exportStar(g0t(),no);Ao.__exportStar(b0t(),no);Ao.__exportStar(v0t(),no);Ao.__exportStar(x0t(),no);Ao.__exportStar(C0t(),no);Ao.__exportStar(P0t(),no);Ao.__exportStar(T0t(),no);Ao.__exportStar(I0t(),no);Ao.__exportStar(R0t(),no);Ao.__exportStar(j0t(),no);Ao.__exportStar(L0t(),no);Ao.__exportStar(k0t(),no);Ao.__exportStar(z0t(),no);Ao.__exportStar(U0t(),no);Ao.__exportStar(q0t(),no);Ao.__exportStar(V0t(),no);Ao.__exportStar(K0t(),no);Ao.__exportStar(J0t(),no);Ao.__exportStar(Y0t(),no);Ao.__exportStar(Q0t(),no)});var txt=v(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.Field=void 0;var nEr=ext(),uEe=class{constructor({name:e,kind:r=nEr.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}};Fre.Field=uEe});var rxt=v(kre=>{"use strict";Object.defineProperty(kre,"__esModule",{value:!0});kre.Fields=void 0;var lEe=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)}};kre.Fields=lEe});var oxt=v(nxt=>{"use strict";Object.defineProperty(nxt,"__esModule",{value:!0})});var ixt=v($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.HttpRequest=void 0;var cEe=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=oEr(e.query)),e}};$re.HttpRequest=cEe;function oEr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var axt=v(zre=>{"use strict";Object.defineProperty(zre,"__esModule",{value:!0});zre.HttpResponse=void 0;var dEe=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"}};zre.HttpResponse=dEe});var sxt=v(Bre=>{"use strict";Object.defineProperty(Bre,"__esModule",{value:!0});Bre.isValidHostname=void 0;function iEr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}Bre.isValidHostname=iEr});var lxt=v(uxt=>{"use strict";Object.defineProperty(uxt,"__esModule",{value:!0})});var cxt=v(xP=>{"use strict";Object.defineProperty(xP,"__esModule",{value:!0});var Ej=(Oj(),dc(Cj));Ej.__exportStar(txt(),xP);Ej.__exportStar(rxt(),xP);Ej.__exportStar(oxt(),xP);Ej.__exportStar(ixt(),xP);Ej.__exportStar(axt(),xP);Ej.__exportStar(sxt(),xP);Ej.__exportStar(lxt(),xP)});var dxt=v(fEe=>{"use strict";Object.defineProperty(fEe,"__esModule",{value:!0});var aEr=(Oj(),dc(Cj));aEr.__exportStar(cxt(),fEe)});var Tj={};Qd(Tj,{__addDisposableResource:()=>Rxt,__assign:()=>Ure,__asyncDelegator:()=>Cxt,__asyncGenerator:()=>Sxt,__asyncValues:()=>Oxt,__await:()=>tB,__awaiter:()=>yxt,__classPrivateFieldGet:()=>Axt,__classPrivateFieldIn:()=>Mxt,__classPrivateFieldSet:()=>Ixt,__createBinding:()=>Hre,__decorate:()=>mxt,__disposeResources:()=>Nxt,__esDecorate:()=>sEr,__exportStar:()=>_xt,__extends:()=>fxt,__generator:()=>bxt,__importDefault:()=>Txt,__importStar:()=>Ext,__makeTemplateObject:()=>Pxt,__metadata:()=>gxt,__param:()=>hxt,__propKey:()=>lEr,__read:()=>mEe,__rest:()=>pxt,__runInitializers:()=>uEr,__setFunctionName:()=>cEr,__spread:()=>vxt,__spreadArray:()=>xxt,__spreadArrays:()=>wxt,__values:()=>qre,default:()=>pEr});function fxt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pEe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function pxt(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 mxt(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 hxt(t,e){return function(r,n){e(r,n,t)}}function sEr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function uEr(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 lEr(t){return typeof t=="symbol"?t:"".concat(t)}function cEr(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 gxt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function yxt(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 bxt(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 _xt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hre(e,t,r)}function qre(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 mEe(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 vxt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(mEe(arguments[e]));return t}function wxt(){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 xxt(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 tB(t){return this instanceof tB?(this.v=t,this):new tB(t)}function Sxt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(b,g){i.push([p,h,b,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof tB?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Cxt(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:tB(t[o](a)),done:!1}:i?i(a):a}:i}}function Oxt(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 qre=="function"?qre(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 Pxt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ext(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hre(e,t,r);return dEr(e,t),e}function Txt(t){return t&&t.__esModule?t:{default:t}}function Axt(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 Ixt(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 Mxt(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 Rxt(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 Nxt(t){function e(i){t.error=t.hasError?new fEr(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 pEe,Ure,Hre,dEr,fEr,pEr,Aj=w(()=>{pEe=function(t,e){return pEe=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])},pEe(t,e)};Ure=function(){return Ure=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},Ure.apply(this,arguments)};Hre=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};dEr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};fEr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};pEr={__extends:fxt,__assign:Ure,__rest:pxt,__decorate:mxt,__param:hxt,__metadata:gxt,__awaiter:yxt,__generator:bxt,__createBinding:Hre,__exportStar:_xt,__values:qre,__read:mEe,__spread:vxt,__spreadArrays:wxt,__spreadArray:xxt,__await:tB,__asyncGenerator:Sxt,__asyncDelegator:Cxt,__asyncValues:Oxt,__makeTemplateObject:Pxt,__importStar:Ext,__importDefault:Txt,__classPrivateFieldGet:Axt,__classPrivateFieldSet:Ixt,__classPrivateFieldIn:Mxt,__addDisposableResource:Rxt,__disposeResources:Nxt}});var bEe={};Qd(bEe,{__assign:()=>gEe,__asyncDelegator:()=>PEr,__asyncGenerator:()=>OEr,__asyncValues:()=>EEr,__await:()=>NV,__awaiter:()=>_Er,__classPrivateFieldGet:()=>MEr,__classPrivateFieldSet:()=>REr,__createBinding:()=>wEr,__decorate:()=>gEr,__exportStar:()=>xEr,__extends:()=>mEr,__generator:()=>vEr,__importDefault:()=>IEr,__importStar:()=>AEr,__makeTemplateObject:()=>TEr,__metadata:()=>bEr,__param:()=>yEr,__read:()=>jxt,__rest:()=>hEr,__spread:()=>SEr,__spreadArrays:()=>CEr,__values:()=>yEe});function mEr(t,e){hEe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function hEr(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 gEr(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 yEr(t,e){return function(r,n){e(r,n,t)}}function bEr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function _Er(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 vEr(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 wEr(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function xEr(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function yEe(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 jxt(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 SEr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(jxt(arguments[e]));return t}function CEr(){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 NV(t){return this instanceof NV?(this.v=t,this):new NV(t)}function OEr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof NV?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 PEr(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:NV(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function EEr(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 yEe=="function"?yEe(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 TEr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function AEr(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 IEr(t){return t&&t.__esModule?t:{default:t}}function MEr(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function REr(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 hEe,gEe,_Ee=w(()=>{hEe=function(t,e){return hEe=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])},hEe(t,e)};gEe=function(){return gEe=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},gEe.apply(this,arguments)}});var Dxt=v(rB=>{"use strict";Object.defineProperty(rB,"__esModule",{value:!0});rB.toUtf8=rB.fromUtf8=void 0;var NEr=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)};rB.fromUtf8=NEr;var jEr=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};rB.toUtf8=jEr});var Lxt=v(nB=>{"use strict";Object.defineProperty(nB,"__esModule",{value:!0});nB.toUtf8=nB.fromUtf8=void 0;function DEr(t){return new TextEncoder().encode(t)}nB.fromUtf8=DEr;function LEr(t){return new TextDecoder("utf-8").decode(t)}nB.toUtf8=LEr});var $xt=v(oB=>{"use strict";Object.defineProperty(oB,"__esModule",{value:!0});oB.toUtf8=oB.fromUtf8=void 0;var Fxt=Dxt(),kxt=Lxt(),FEr=t=>typeof TextEncoder=="function"?(0,kxt.fromUtf8)(t):(0,Fxt.fromUtf8)(t);oB.fromUtf8=FEr;var kEr=t=>typeof TextDecoder=="function"?(0,kxt.toUtf8)(t):(0,Fxt.toUtf8)(t);oB.toUtf8=kEr});var zxt=v(Vre=>{"use strict";Object.defineProperty(Vre,"__esModule",{value:!0});Vre.convertToBuffer=void 0;var $Er=$xt(),zEr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:$Er.fromUtf8;function BEr(t){return t instanceof Uint8Array?t:typeof t=="string"?zEr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Vre.convertToBuffer=BEr});var Bxt=v(Wre=>{"use strict";Object.defineProperty(Wre,"__esModule",{value:!0});Wre.isEmptyData=void 0;function UEr(t){return typeof t=="string"?t.length===0:t.byteLength===0}Wre.isEmptyData=UEr});var Uxt=v(Kre=>{"use strict";Object.defineProperty(Kre,"__esModule",{value:!0});Kre.numToUint8=void 0;function qEr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}Kre.numToUint8=qEr});var qxt=v(Gre=>{"use strict";Object.defineProperty(Gre,"__esModule",{value:!0});Gre.uint32ArrayFrom=void 0;function HEr(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)}Gre.uint32ArrayFrom=HEr});var vEe=v(Iv=>{"use strict";Object.defineProperty(Iv,"__esModule",{value:!0});Iv.uint32ArrayFrom=Iv.numToUint8=Iv.isEmptyData=Iv.convertToBuffer=void 0;var VEr=zxt();Object.defineProperty(Iv,"convertToBuffer",{enumerable:!0,get:function(){return VEr.convertToBuffer}});var WEr=Bxt();Object.defineProperty(Iv,"isEmptyData",{enumerable:!0,get:function(){return WEr.isEmptyData}});var KEr=Uxt();Object.defineProperty(Iv,"numToUint8",{enumerable:!0,get:function(){return KEr.numToUint8}});var GEr=qxt();Object.defineProperty(Iv,"uint32ArrayFrom",{enumerable:!0,get:function(){return GEr.uint32ArrayFrom}})});var Wxt=v(Jre=>{"use strict";Object.defineProperty(Jre,"__esModule",{value:!0});Jre.AwsCrc32=void 0;var Hxt=(_Ee(),dc(bEe)),wEe=vEe(),Vxt=Zre(),JEr=function(){function t(){this.crc32=new Vxt.Crc32}return t.prototype.update=function(e){(0,wEe.isEmptyData)(e)||this.crc32.update((0,wEe.convertToBuffer)(e))},t.prototype.digest=function(){return Hxt.__awaiter(this,void 0,void 0,function(){return Hxt.__generator(this,function(e){return[2,(0,wEe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new Vxt.Crc32},t}();Jre.AwsCrc32=JEr});var Zre=v(yI=>{"use strict";Object.defineProperty(yI,"__esModule",{value:!0});yI.AwsCrc32=yI.Crc32=yI.crc32=void 0;var ZEr=(_Ee(),dc(bEe)),YEr=vEe();function XEr(t){return new Kxt().update(t).digest()}yI.crc32=XEr;var Kxt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=ZEr.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^eTr[(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}();yI.Crc32=Kxt;var QEr=[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],eTr=(0,YEr.uint32ArrayFrom)(QEr),tTr=Wxt();Object.defineProperty(yI,"AwsCrc32",{enumerable:!0,get:function(){return tTr.AwsCrc32}})});var aB=v(iB=>{"use strict";Object.defineProperty(iB,"__esModule",{value:!0});iB.toHex=iB.fromHex=void 0;var Gxt={},xEe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Gxt[t]=e,xEe[e]=t}function rTr(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 xEe)e[r/2]=xEe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}iB.fromHex=rTr;function nTr(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Gxt[t[r]];return e}iB.toHex=nTr});var CEe=v(Yre=>{"use strict";Object.defineProperty(Yre,"__esModule",{value:!0});Yre.Int64=void 0;var oTr=aB(),SEe=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&&Jxt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Jxt(e),parseInt((0,oTr.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};Yre.Int64=SEe;function Jxt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var EEe=v(Xre=>{"use strict";Object.defineProperty(Xre,"__esModule",{value:!0});Xre.HeaderMarshaller=void 0;var sB=aB(),OEe=CEe(),PEe=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(OEe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!pTr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,sB.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:Yxt,value:!0};break;case 1:r[i]={type:Yxt,value:!1};break;case 2:r[i]={type:iTr,value:e.getInt8(n++)};break;case 3:r[i]={type:aTr,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:sTr,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:uTr,value:new OEe.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:lTr,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:cTr,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:dTr,value:new Date(new OEe.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:fTr,value:`${(0,sB.toHex)(u.subarray(0,4))}-${(0,sB.toHex)(u.subarray(4,6))}-${(0,sB.toHex)(u.subarray(6,8))}-${(0,sB.toHex)(u.subarray(8,10))}-${(0,sB.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};Xre.HeaderMarshaller=PEe;var Zxt;(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"})(Zxt||(Zxt={}));var Yxt="boolean",iTr="byte",aTr="short",sTr="integer",uTr="long",lTr="binary",cTr="string",dTr="timestamp",fTr="uuid",pTr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var Qxt=v(Qre=>{"use strict";Object.defineProperty(Qre,"__esModule",{value:!0});Qre.splitMessage=void 0;var mTr=Zre(),Xxt=4,bI=Xxt*2,Ij=4,hTr=bI+Ij*2;function gTr({byteLength:t,byteOffset:e,buffer:r}){if(t<hTr)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(Xxt,!1),a=n.getUint32(bI,!1),s=n.getUint32(t-Ij,!1),u=new mTr.Crc32().update(new Uint8Array(r,e,bI));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+bI,t-(bI+Ij))),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+bI+Ij,i),body:new Uint8Array(r,e+bI+Ij+i,o-i-(bI+Ij+Ij))}}Qre.splitMessage=gTr});var eSt=v(ene=>{"use strict";Object.defineProperty(ene,"__esModule",{value:!0});ene.EventStreamCodec=void 0;var yTr=Zre(),bTr=EEe(),_Tr=Qxt(),TEe=class{constructor(e,r){this.headerMarshaller=new bTr.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 yTr.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,_Tr.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};ene.EventStreamCodec=TEe});var rSt=v(tSt=>{"use strict";Object.defineProperty(tSt,"__esModule",{value:!0})});var nSt=v(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.MessageDecoderStream=void 0;var AEe=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)}};tne.MessageDecoderStream=AEe});var oSt=v(rne=>{"use strict";Object.defineProperty(rne,"__esModule",{value:!0});rne.MessageEncoderStream=void 0;var IEe=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))}};rne.MessageEncoderStream=IEe});var iSt=v(nne=>{"use strict";Object.defineProperty(nne,"__esModule",{value:!0});nne.SmithyMessageDecoderStream=void 0;var MEe=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)}}};nne.SmithyMessageDecoderStream=MEe});var aSt=v(one=>{"use strict";Object.defineProperty(one,"__esModule",{value:!0});one.SmithyMessageEncoderStream=void 0;var REe=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)}};one.SmithyMessageEncoderStream=REe});var sSt=v(Mv=>{"use strict";Object.defineProperty(Mv,"__esModule",{value:!0});var _I=(Aj(),dc(Tj));_I.__exportStar(eSt(),Mv);_I.__exportStar(EEe(),Mv);_I.__exportStar(CEe(),Mv);_I.__exportStar(rSt(),Mv);_I.__exportStar(nSt(),Mv);_I.__exportStar(oSt(),Mv);_I.__exportStar(iSt(),Mv);_I.__exportStar(aSt(),Mv)});var uSt=v(ine=>{"use strict";Object.defineProperty(ine,"__esModule",{value:!0});ine.normalizeProvider=void 0;var vTr=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};ine.normalizeProvider=vTr});var lSt=v(NEe=>{"use strict";Object.defineProperty(NEe,"__esModule",{value:!0});var wTr=(Aj(),dc(Tj));wTr.__exportStar(uSt(),NEe)});var jEe=v(ane=>{"use strict";Object.defineProperty(ane,"__esModule",{value:!0});ane.isArrayBuffer=void 0;var xTr=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";ane.isArrayBuffer=xTr});var LEe=v(uB=>{"use strict";Object.defineProperty(uB,"__esModule",{value:!0});uB.fromString=uB.fromArrayBuffer=void 0;var STr=jEe(),DEe=Yp(),CTr=(t,e=0,r=t.byteLength-e)=>{if(!(0,STr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return DEe.Buffer.from(t,e,r)};uB.fromArrayBuffer=CTr;var OTr=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?DEe.Buffer.from(t,e):DEe.Buffer.from(t)};uB.fromString=OTr});var FEe=v(sne=>{"use strict";Object.defineProperty(sne,"__esModule",{value:!0});sne.fromUtf8=void 0;var PTr=LEe(),ETr=t=>{let e=(0,PTr.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};sne.fromUtf8=ETr});var cSt=v(une=>{"use strict";Object.defineProperty(une,"__esModule",{value:!0});une.toUint8Array=void 0;var TTr=FEe(),ATr=t=>typeof t=="string"?(0,TTr.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);une.toUint8Array=ATr});var dSt=v(lne=>{"use strict";Object.defineProperty(lne,"__esModule",{value:!0});lne.toUtf8=void 0;var ITr=LEe(),MTr=t=>(0,ITr.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");lne.toUtf8=MTr});var cne=v(jV=>{"use strict";Object.defineProperty(jV,"__esModule",{value:!0});var kEe=(Aj(),dc(Tj));kEe.__exportStar(FEe(),jV);kEe.__exportStar(cSt(),jV);kEe.__exportStar(dSt(),jV)});var Mj=v(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.MAX_PRESIGNED_TTL=zt.KEY_TYPE_IDENTIFIER=zt.MAX_CACHE_SIZE=zt.UNSIGNED_PAYLOAD=zt.EVENT_ALGORITHM_IDENTIFIER=zt.ALGORITHM_IDENTIFIER_V4A=zt.ALGORITHM_IDENTIFIER=zt.UNSIGNABLE_PATTERNS=zt.SEC_HEADER_PATTERN=zt.PROXY_HEADER_PATTERN=zt.ALWAYS_UNSIGNABLE_HEADERS=zt.HOST_HEADER=zt.TOKEN_HEADER=zt.SHA256_HEADER=zt.SIGNATURE_HEADER=zt.GENERATED_HEADERS=zt.DATE_HEADER=zt.AMZ_DATE_HEADER=zt.AUTH_HEADER=zt.REGION_SET_PARAM=zt.TOKEN_QUERY_PARAM=zt.SIGNATURE_QUERY_PARAM=zt.EXPIRES_QUERY_PARAM=zt.SIGNED_HEADERS_QUERY_PARAM=zt.AMZ_DATE_QUERY_PARAM=zt.CREDENTIAL_QUERY_PARAM=zt.ALGORITHM_QUERY_PARAM=void 0;zt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";zt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";zt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";zt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";zt.EXPIRES_QUERY_PARAM="X-Amz-Expires";zt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";zt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";zt.REGION_SET_PARAM="X-Amz-Region-Set";zt.AUTH_HEADER="authorization";zt.AMZ_DATE_HEADER=zt.AMZ_DATE_QUERY_PARAM.toLowerCase();zt.DATE_HEADER="date";zt.GENERATED_HEADERS=[zt.AUTH_HEADER,zt.AMZ_DATE_HEADER,zt.DATE_HEADER];zt.SIGNATURE_HEADER=zt.SIGNATURE_QUERY_PARAM.toLowerCase();zt.SHA256_HEADER="x-amz-content-sha256";zt.TOKEN_HEADER=zt.TOKEN_QUERY_PARAM.toLowerCase();zt.HOST_HEADER="host";zt.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};zt.PROXY_HEADER_PATTERN=/^proxy-/;zt.SEC_HEADER_PATTERN=/^sec-/;zt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];zt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";zt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";zt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";zt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";zt.MAX_CACHE_SIZE=50;zt.KEY_TYPE_IDENTIFIER="aws4_request";zt.MAX_PRESIGNED_TTL=60*60*24*7});var zEe=v(vI=>{"use strict";Object.defineProperty(vI,"__esModule",{value:!0});vI.clearCredentialCache=vI.getSigningKey=vI.createScope=void 0;var RTr=aB(),NTr=cne(),$Ee=Mj(),lB={},dne=[],jTr=(t,e,r)=>`${t}/${e}/${r}/${$Ee.KEY_TYPE_IDENTIFIER}`;vI.createScope=jTr;var DTr=async(t,e,r,n,o)=>{let i=await fSt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,RTr.toHex)(i)}:${e.sessionToken}`;if(a in lB)return lB[a];for(dne.push(a);dne.length>$Ee.MAX_CACHE_SIZE;)delete lB[dne.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,$Ee.KEY_TYPE_IDENTIFIER])s=await fSt(t,s,u);return lB[a]=s};vI.getSigningKey=DTr;var LTr=()=>{dne.length=0,Object.keys(lB).forEach(t=>{delete lB[t]})};vI.clearCredentialCache=LTr;var fSt=(t,e,r)=>{let n=new t(e);return n.update((0,NTr.toUint8Array)(r)),n.digest()}});var UEe=v(fne=>{"use strict";Object.defineProperty(fne,"__esModule",{value:!0});fne.getCanonicalHeaders=void 0;var BEe=Mj(),FTr=({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 BEe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||BEe.PROXY_HEADER_PATTERN.test(i)||BEe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};fne.getCanonicalHeaders=FTr});var qEe=v(pne=>{"use strict";Object.defineProperty(pne,"__esModule",{value:!0});pne.escapeUri=void 0;var kTr=t=>encodeURIComponent(t).replace(/[!'()*]/g,$Tr);pne.escapeUri=kTr;var $Tr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var pSt=v(mne=>{"use strict";Object.defineProperty(mne,"__esModule",{value:!0});mne.escapeUriPath=void 0;var zTr=qEe(),BTr=t=>t.split("/").map(zTr.escapeUri).join("/");mne.escapeUriPath=BTr});var hSt=v(hne=>{"use strict";Object.defineProperty(hne,"__esModule",{value:!0});var mSt=(Aj(),dc(Tj));mSt.__exportStar(qEe(),hne);mSt.__exportStar(pSt(),hne)});var HEe=v(yne=>{"use strict";Object.defineProperty(yne,"__esModule",{value:!0});yne.getCanonicalQuery=void 0;var gne=hSt(),UTr=Mj(),qTr=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===UTr.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,gne.escapeUri)(n)}=${(0,gne.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,gne.escapeUri)(n)}=${(0,gne.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};yne.getCanonicalQuery=qTr});var VEe=v(bne=>{"use strict";Object.defineProperty(bne,"__esModule",{value:!0});bne.getPayloadHash=void 0;var HTr=jEe(),VTr=aB(),WTr=cne(),gSt=Mj(),KTr=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===gSt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,HTr.isArrayBuffer)(e)){let n=new r;return n.update((0,WTr.toUint8Array)(e)),(0,VTr.toHex)(await n.digest())}return gSt.UNSIGNED_PAYLOAD};bne.getPayloadHash=KTr});var ySt=v(wI=>{"use strict";Object.defineProperty(wI,"__esModule",{value:!0});wI.deleteHeader=wI.getHeaderValue=wI.hasHeader=void 0;var GTr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};wI.hasHeader=GTr;var JTr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};wI.getHeaderValue=JTr;var ZTr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};wI.deleteHeader=ZTr});var WEe=v(Rj=>{"use strict";Object.defineProperty(Rj,"__esModule",{value:!0});Rj.cloneQuery=Rj.cloneRequest=void 0;var YTr=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,Rj.cloneQuery)(e):void 0});Rj.cloneRequest=YTr;var XTr=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});Rj.cloneQuery=XTr});var KEe=v(_ne=>{"use strict";Object.defineProperty(_ne,"__esModule",{value:!0});_ne.moveHeadersToQuery=void 0;var QTr=WEe(),eAr=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,QTr.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}};_ne.moveHeadersToQuery=eAr});var GEe=v(vne=>{"use strict";Object.defineProperty(vne,"__esModule",{value:!0});vne.prepareRequest=void 0;var tAr=WEe(),rAr=Mj(),nAr=t=>{t=typeof t.clone=="function"?t.clone():(0,tAr.cloneRequest)(t);for(let e of Object.keys(t.headers))rAr.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};vne.prepareRequest=nAr});var bSt=v(Nj=>{"use strict";Object.defineProperty(Nj,"__esModule",{value:!0});Nj.toDate=Nj.iso8601=void 0;var oAr=t=>(0,Nj.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");Nj.iso8601=oAr;var iAr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;Nj.toDate=iAr});var SSt=v(Cne=>{"use strict";Object.defineProperty(Cne,"__esModule",{value:!0});Cne.SignatureV4=void 0;var aAr=sSt(),wne=aB(),_St=lSt(),DV=cne(),cd=Mj(),xne=zEe(),vSt=UEe(),sAr=HEe(),JEe=VEe(),uAr=ySt(),lAr=KEe(),wSt=GEe(),cAr=bSt(),ZEe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new aAr.HeaderMarshaller(DV.toUtf8,DV.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,_St.normalizeProvider)(n),this.credentialProvider=(0,_St.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}=Sne(n);if(o>cd.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=(0,xne.createScope)(p,d,l??this.service),h=(0,lAr.moveHeadersToQuery)((0,wSt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[cd.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[cd.ALGORITHM_QUERY_PARAM]=cd.ALGORITHM_IDENTIFIER,h.query[cd.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[cd.AMZ_DATE_QUERY_PARAM]=f,h.query[cd.EXPIRES_QUERY_PARAM]=o.toString(10);let b=(0,vSt.getCanonicalHeaders)(h,i,s);return h.query[cd.SIGNED_HEADERS_QUERY_PARAM]=xSt(b),h.query[cd.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await(0,JEe.getPayloadHash)(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=Sne(n),c=(0,xne.createScope)(u,s,a??this.service),d=await(0,JEe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,wne.toHex)(await f.digest()),m=[cd.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
|
||
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=Sne(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,DV.toUint8Array)(e)),(0,wne.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,wSt.prepareRequest)(e),{longDate:c,shortDate:d}=Sne(r),f=(0,xne.createScope)(d,u,a??this.service);l.headers[cd.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[cd.TOKEN_HEADER]=s.sessionToken);let p=await(0,JEe.getPayloadHash)(l,this.sha256);!(0,uAr.hasHeader)(cd.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[cd.SHA256_HEADER]=p);let m=(0,vSt.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[cd.AUTH_HEADER]=`${cd.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${xSt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${(0,sAr.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,DV.toUint8Array)(n));let i=await o.digest();return`${cd.ALGORITHM_IDENTIFIER}
|
||
${e}
|
||
${r}
|
||
${(0,wne.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,DV.toUint8Array)(i)),(0,wne.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,xne.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")}};Cne.SignatureV4=ZEe;var Sne=t=>{let e=(0,cAr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},xSt=t=>Object.keys(t).sort().join(";")});var OSt=v(om=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});om.prepareRequest=om.moveHeadersToQuery=om.getPayloadHash=om.getCanonicalQuery=om.getCanonicalHeaders=void 0;var CSt=(Aj(),dc(Tj));CSt.__exportStar(SSt(),om);var dAr=UEe();Object.defineProperty(om,"getCanonicalHeaders",{enumerable:!0,get:function(){return dAr.getCanonicalHeaders}});var fAr=HEe();Object.defineProperty(om,"getCanonicalQuery",{enumerable:!0,get:function(){return fAr.getCanonicalQuery}});var pAr=VEe();Object.defineProperty(om,"getPayloadHash",{enumerable:!0,get:function(){return pAr.getPayloadHash}});var mAr=KEe();Object.defineProperty(om,"moveHeadersToQuery",{enumerable:!0,get:function(){return mAr.moveHeadersToQuery}});var hAr=GEe();Object.defineProperty(om,"prepareRequest",{enumerable:!0,get:function(){return hAr.prepareRequest}});CSt.__exportStar(zEe(),om)});var PSt=v(YEe=>{"use strict";Object.defineProperty(YEe,"__esModule",{value:!0});var gAr=(Aj(),dc(Tj));gAr.__exportStar(OSt(),YEe)});var ns=v((tRo,ESt)=>{"use strict";ESt.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 cB=v((rRo,One)=>{"use strict";var{AbortController:TSt,AbortSignal:yAr}=typeof self<"u"?self:typeof window<"u"?window:void 0;One.exports=TSt;One.exports.AbortSignal=yAr;One.exports.default=TSt});var LV=v((nRo,XEe)=>{"use strict";var dB=typeof Reflect=="object"?Reflect:null,ASt=dB&&typeof dB.apply=="function"?dB.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Pne;dB&&typeof dB.ownKeys=="function"?Pne=dB.ownKeys:Object.getOwnPropertySymbols?Pne=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Pne=function(e){return Object.getOwnPropertyNames(e)};function bAr(t){console&&console.warn&&console.warn(t)}var MSt=Number.isNaN||function(e){return e!==e};function Li(){Li.init.call(this)}XEe.exports=Li;XEe.exports.once=xAr;Li.EventEmitter=Li;Li.prototype._events=void 0;Li.prototype._eventsCount=0;Li.prototype._maxListeners=void 0;var ISt=10;function Ene(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Li,"defaultMaxListeners",{enumerable:!0,get:function(){return ISt},set:function(t){if(typeof t!="number"||t<0||MSt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ISt=t}});Li.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};Li.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||MSt(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 RSt(t){return t._maxListeners===void 0?Li.defaultMaxListeners:t._maxListeners}Li.prototype.getMaxListeners=function(){return RSt(this)};Li.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")ASt(u,this,r);else for(var l=u.length,c=FSt(u,l),n=0;n<l;++n)ASt(c[n],this,r);return!0};function NSt(t,e,r,n){var o,i,a;if(Ene(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=RSt(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,bAr(s)}return t}Li.prototype.addListener=function(e,r){return NSt(this,e,r,!1)};Li.prototype.on=Li.prototype.addListener;Li.prototype.prependListener=function(e,r){return NSt(this,e,r,!0)};function _Ar(){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 jSt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=_Ar.bind(n);return o.listener=r,n.wrapFn=o,o}Li.prototype.once=function(e,r){return Ene(r),this.on(e,jSt(this,e,r)),this};Li.prototype.prependOnceListener=function(e,r){return Ene(r),this.prependListener(e,jSt(this,e,r)),this};Li.prototype.removeListener=function(e,r){var n,o,i,a,s;if(Ene(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():vAr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Li.prototype.off=Li.prototype.removeListener;Li.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 DSt(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?wAr(o):FSt(o,o.length)}Li.prototype.listeners=function(e){return DSt(this,e,!0)};Li.prototype.rawListeners=function(e){return DSt(this,e,!1)};Li.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):LSt.call(t,e)};Li.prototype.listenerCount=LSt;function LSt(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}Li.prototype.eventNames=function(){return this._eventsCount>0?Pne(this._events):[]};function FSt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function vAr(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function wAr(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function xAr(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))}kSt(t,e,i,{once:!0}),e!=="error"&&SAr(t,o,{once:!0})})}function SAr(t,e,r){typeof t.on=="function"&&kSt(t,"error",e,r)}function kSt(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=v((oRo,eTe)=>{"use strict";var CAr=Yp(),{kResistStopPropagation:OAr,SymbolDispose:PAr}=ns(),EAr=globalThis.AbortSignal||cB().AbortSignal,TAr=globalThis.AbortController||cB().AbortController,AAr=Object.getPrototypeOf(async function(){}).constructor,$St=globalThis.Blob||CAr.Blob,IAr=typeof $St<"u"?function(e){return e instanceof $St}:function(e){return!1},zSt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},MAr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},QEe=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}};eTe.exports={AggregateError:QEe,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 AAr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:IAr,deprecate(t,e){return t},addAbortListener:LV().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);zSt(e,"signal"),MAr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[OAr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[PAr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:EAr.any||function(e){if(e.length===1)return e[0];let r=new TAr,n=()=>r.abort();return e.forEach(o=>{zSt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};eTe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var mp=v((iRo,qSt)=>{"use strict";var{format:RAr,inspect:Tne,AggregateError:NAr}=vf(),jAr=globalThis.AggregateError||NAr,DAr=Symbol("kIsNodeError"),LAr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],FAr=/^([A-Z][a-z0-9]*)+$/,kAr="__node_internal_",Ane={};function jj(t,e){if(!t)throw new Ane.ERR_INTERNAL_ASSERTION(e)}function BSt(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 $Ar(t,e,r){if(typeof e=="function")return jj(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 jj(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:RAr(e,...r)}function dd(t,e,r){r||(r=Error);class n extends r{constructor(...i){super($Ar(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[DAr]=!0,Ane[t]=n}function USt(t){let e=kAr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function zAr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new jAr([e,t],e.message);return r.code=e.code,r}return t||e}var tTe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Ane.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};dd("ERR_ASSERTION","%s",Error);dd("ERR_INVALID_ARG_TYPE",(t,e,r)=>{jj(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)jj(typeof u=="string","All expected entries have to be of type string"),LAr.includes(u)?o.push(u.toLowerCase()):FAr.test(u)?i.push(u):(jj(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=Tne(r,{depth:-1});n+=`. Received ${u}`}}else{let u=Tne(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);dd("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=Tne(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);dd("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);dd("ERR_MISSING_ARGS",(...t)=>{jj(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);dd("ERR_OUT_OF_RANGE",(t,e,r)=>{jj(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=BSt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=BSt(n)),n+="n"):n=Tne(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);dd("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);dd("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);dd("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);dd("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);dd("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);dd("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);dd("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);dd("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);dd("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);dd("ERR_STREAM_WRITE_AFTER_END","write after end",Error);dd("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);qSt.exports={AbortError:tTe,aggregateTwoErrors:USt(zAr),hideStackFrames:USt,codes:Ane}});var pB=v((aRo,QSt)=>{"use strict";var{ArrayIsArray:nTe,ArrayPrototypeIncludes:KSt,ArrayPrototypeJoin:GSt,ArrayPrototypeMap:BAr,NumberIsInteger:oTe,NumberIsNaN:UAr,NumberMAX_SAFE_INTEGER:qAr,NumberMIN_SAFE_INTEGER:HAr,NumberParseInt:VAr,ObjectPrototypeHasOwnProperty:WAr,RegExpPrototypeExec:JSt,String:KAr,StringPrototypeToUpperCase:GAr,StringPrototypeTrim:JAr}=ns(),{hideStackFrames:Fg,codes:{ERR_SOCKET_BAD_PORT:ZAr,ERR_INVALID_ARG_TYPE:wf,ERR_INVALID_ARG_VALUE:fB,ERR_OUT_OF_RANGE:Dj,ERR_UNKNOWN_SIGNAL:HSt}}=mp(),{normalizeEncoding:YAr}=vf(),{isAsyncFunction:XAr,isArrayBufferView:QAr}=vf().types,VSt={};function eIr(t){return t===(t|0)}function tIr(t){return t===t>>>0}var rIr=/^[0-7]+$/,nIr="must be a 32-bit unsigned integer or an octal string";function oIr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(JSt(rIr,t)===null)throw new fB(e,t,nIr);t=VAr(t,8)}return ZSt(t,e),t}var iIr=Fg((t,e,r=HAr,n=qAr)=>{if(typeof t!="number")throw new wf(e,"number",t);if(!oTe(t))throw new Dj(e,"an integer",t);if(t<r||t>n)throw new Dj(e,`>= ${r} && <= ${n}`,t)}),aIr=Fg((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new wf(e,"number",t);if(!oTe(t))throw new Dj(e,"an integer",t);if(t<r||t>n)throw new Dj(e,`>= ${r} && <= ${n}`,t)}),ZSt=Fg((t,e,r=!1)=>{if(typeof t!="number")throw new wf(e,"number",t);if(!oTe(t))throw new Dj(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new Dj(e,`>= ${n} && <= ${o}`,t)});function iTe(t,e){if(typeof t!="string")throw new wf(e,"string",t)}function sIr(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)&&UAr(t))throw new Dj(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var uIr=Fg((t,e,r)=>{if(!KSt(r,t)){let o="must be one of: "+GSt(BAr(r,i=>typeof i=="string"?`'${i}'`:KAr(i)),", ");throw new fB(e,t,o)}});function YSt(t,e){if(typeof t!="boolean")throw new wf(e,"boolean",t)}function rTe(t,e,r){return t==null||!WAr(t,e)?r:t[e]}var lIr=Fg((t,e,r=null)=>{let n=rTe(r,"allowArray",!1),o=rTe(r,"allowFunction",!1);if(!rTe(r,"nullable",!1)&&t===null||!n&&nTe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new wf(e,"Object",t)}),cIr=Fg((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new wf(e,"a dictionary",t)}),Ine=Fg((t,e,r=0)=>{if(!nTe(t))throw new wf(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new fB(e,t,n)}});function dIr(t,e){Ine(t,e);for(let r=0;r<t.length;r++)iTe(t[r],`${e}[${r}]`)}function fIr(t,e){Ine(t,e);for(let r=0;r<t.length;r++)YSt(t[r],`${e}[${r}]`)}function pIr(t,e){Ine(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);XSt(n,o)}}function mIr(t,e="signal"){if(iTe(t,e),VSt[t]===void 0)throw VSt[GAr(t)]!==void 0?new HSt(t+" (signals must use all capital letters)"):new HSt(t)}var hIr=Fg((t,e="buffer")=>{if(!QAr(t))throw new wf(e,["Buffer","TypedArray","DataView"],t)});function gIr(t,e){let r=YAr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new fB("encoding",e,`is invalid for data of length ${n}`)}function yIr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&JAr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new ZAr(e,t,r);return t|0}var XSt=Fg((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new wf(e,"AbortSignal",t)}),bIr=Fg((t,e)=>{if(typeof t!="function")throw new wf(e,"Function",t)}),_Ir=Fg((t,e)=>{if(typeof t!="function"||XAr(t))throw new wf(e,"Function",t)}),vIr=Fg((t,e)=>{if(t!==void 0)throw new wf(e,"undefined",t)});function wIr(t,e,r){if(!KSt(r,t))throw new wf(e,`('${GSt(r,"|")}')`,t)}var xIr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function WSt(t,e){if(typeof t>"u"||!JSt(xIr,t))throw new fB(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function SIr(t){if(typeof t=="string")return WSt(t,"hints"),t;if(nTe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];WSt(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new fB("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}QSt.exports={isInt32:eIr,isUint32:tIr,parseFileMode:oIr,validateArray:Ine,validateStringArray:dIr,validateBooleanArray:fIr,validateAbortSignalArray:pIr,validateBoolean:YSt,validateBuffer:hIr,validateDictionary:cIr,validateEncoding:gIr,validateFunction:bIr,validateInt32:aIr,validateInteger:iIr,validateNumber:sIr,validateObject:lIr,validateOneOf:uIr,validatePlainFunction:_Ir,validatePort:yIr,validateSignalName:mIr,validateString:iTe,validateUint32:ZSt,validateUndefined:vIr,validateUnion:wIr,validateAbortSignal:XSt,validateLinkHeaderValue:SIr}});var xI=v((sRo,nCt)=>{var Ks=nCt.exports={},Rv,Nv;function aTe(){throw new Error("setTimeout has not been defined")}function sTe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Rv=setTimeout:Rv=aTe}catch{Rv=aTe}try{typeof clearTimeout=="function"?Nv=clearTimeout:Nv=sTe}catch{Nv=sTe}})();function eCt(t){if(Rv===setTimeout)return setTimeout(t,0);if((Rv===aTe||!Rv)&&setTimeout)return Rv=setTimeout,setTimeout(t,0);try{return Rv(t,0)}catch{try{return Rv.call(null,t,0)}catch{return Rv.call(this,t,0)}}}function CIr(t){if(Nv===clearTimeout)return clearTimeout(t);if((Nv===sTe||!Nv)&&clearTimeout)return Nv=clearTimeout,clearTimeout(t);try{return Nv(t)}catch{try{return Nv.call(null,t)}catch{return Nv.call(this,t)}}}var SP=[],mB=!1,Lj,Mne=-1;function OIr(){!mB||!Lj||(mB=!1,Lj.length?SP=Lj.concat(SP):Mne=-1,SP.length&&tCt())}function tCt(){if(!mB){var t=eCt(OIr);mB=!0;for(var e=SP.length;e;){for(Lj=SP,SP=[];++Mne<e;)Lj&&Lj[Mne].run();Mne=-1,e=SP.length}Lj=null,mB=!1,CIr(t)}}Ks.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 rCt(t,e)),SP.length===1&&!mB&&eCt(tCt)};function rCt(t,e){this.fun=t,this.array=e}rCt.prototype.run=function(){this.fun.apply(null,this.array)};Ks.title="browser";Ks.browser=!0;Ks.env={};Ks.argv=[];Ks.version="";Ks.versions={};function CP(){}Ks.on=CP;Ks.addListener=CP;Ks.once=CP;Ks.off=CP;Ks.removeListener=CP;Ks.removeAllListeners=CP;Ks.emit=CP;Ks.prependListener=CP;Ks.prependOnceListener=CP;Ks.listeners=function(t){return[]};Ks.binding=function(t){throw new Error("process.binding is not supported")};Ks.cwd=function(){return"/"};Ks.chdir=function(t){throw new Error("process.chdir is not supported")};Ks.umask=function(){return 0}});var Dv=v((uRo,bCt)=>{"use strict";var{SymbolAsyncIterator:oCt,SymbolIterator:iCt,SymbolFor:Fj}=ns(),aCt=Fj("nodejs.stream.destroyed"),sCt=Fj("nodejs.stream.errored"),uTe=Fj("nodejs.stream.readable"),lTe=Fj("nodejs.stream.writable"),uCt=Fj("nodejs.stream.disturbed"),PIr=Fj("nodejs.webstream.isClosedPromise"),EIr=Fj("nodejs.webstream.controllerErrorFunction");function Rne(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 Nne(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 TIr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function jv(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function lCt(t){return!!(t&&!jv(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function cCt(t){return!!(t&&!jv(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function dCt(t){return!!(t&&!jv(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function AIr(t){return lCt(t)||cCt(t)||dCt(t)}function IIr(t,e){return t==null?!1:e===!0?typeof t[oCt]=="function":e===!1?typeof t[iCt]=="function":typeof t[oCt]=="function"||typeof t[iCt]=="function"}function jne(t){if(!jv(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[aCt]||n!=null&&n.destroyed)}function fCt(t){if(!Nne(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 MIr(t,e){if(!Nne(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 RIr(t){if(!Rne(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 pCt(t,e){if(!Rne(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 mCt(t){return t&&t[uTe]!=null?t[uTe]:typeof t?.readable!="boolean"?null:jne(t)?!1:Rne(t)&&t.readable&&!pCt(t)}function hCt(t){return t&&t[lTe]!=null?t[lTe]:typeof t?.writable!="boolean"?null:jne(t)?!1:Nne(t)&&t.writable&&!fCt(t)}function NIr(t,e){return jv(t)?jne(t)?!0:!(e?.readable!==!1&&mCt(t)||e?.writable!==!1&&hCt(t)):null}function jIr(t){var e,r;return jv(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 DIr(t){var e,r;return jv(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 LIr(t){if(!jv(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"&&gCt(t)?t._closed:null}function gCt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function yCt(t){return typeof t._sent100=="boolean"&&gCt(t)}function FIr(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 kIr(t){if(!jv(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&yCt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function $Ir(t){var e;return!!(t&&((e=t[uCt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function zIr(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[sCt])!==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))}bCt.exports={isDestroyed:jne,kIsDestroyed:aCt,isDisturbed:$Ir,kIsDisturbed:uCt,isErrored:zIr,kIsErrored:sCt,isReadable:mCt,kIsReadable:uTe,kIsClosedPromise:PIr,kControllerErrorFunction:EIr,kIsWritable:lTe,isClosed:LIr,isDuplexNodeStream:TIr,isFinished:NIr,isIterable:IIr,isReadableNodeStream:Rne,isReadableStream:lCt,isReadableEnded:RIr,isReadableFinished:pCt,isReadableErrored:DIr,isNodeStream:jv,isWebStream:AIr,isWritable:hCt,isWritableNodeStream:Nne,isWritableStream:cCt,isWritableEnded:fCt,isWritableFinished:MIr,isWritableErrored:jIr,isServerRequest:FIr,isServerResponse:yCt,willEmitClose:kIr,isTransformStream:dCt}});var OP=v((lRo,mTe)=>{var SI=xI(),{AbortError:ECt,codes:BIr}=mp(),{ERR_INVALID_ARG_TYPE:UIr,ERR_STREAM_PREMATURE_CLOSE:_Ct}=BIr,{kEmptyObject:dTe,once:fTe}=vf(),{validateAbortSignal:qIr,validateFunction:HIr,validateObject:VIr,validateBoolean:WIr}=pB(),{Promise:KIr,PromisePrototypeThen:GIr,SymbolDispose:TCt}=ns(),{isClosed:JIr,isReadable:vCt,isReadableNodeStream:cTe,isReadableStream:ZIr,isReadableFinished:wCt,isReadableErrored:xCt,isWritable:SCt,isWritableNodeStream:CCt,isWritableStream:YIr,isWritableFinished:OCt,isWritableErrored:PCt,isNodeStream:XIr,willEmitClose:QIr,kIsClosedPromise:eMr}=Dv(),hB;function tMr(t){return t.setHeader&&typeof t.abort=="function"}var pTe=()=>{};function ACt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=dTe):e==null?e=dTe:VIr(e,"options"),HIr(r,"callback"),qIr(e.signal,"options.signal"),r=fTe(r),ZIr(t)||YIr(t))return rMr(t,e,r);if(!XIr(t))throw new UIr("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:cTe(t),a=(o=e.writable)!==null&&o!==void 0?o:CCt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=QIr(t)&&cTe(t)===i&&CCt(t)===a,d=OCt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=wCt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=O=>{r.call(t,O)},b=JIr(t),g=()=>{b=!0;let O=PCt(t)||xCt(t);if(O&&typeof O!="boolean")return r.call(t,O);if(i&&!p&&cTe(t,!0)&&!wCt(t,!1))return r.call(t,new _Ct);if(a&&!d&&!OCt(t,!1))return r.call(t,new _Ct);r.call(t)},y=()=>{b=!0;let O=PCt(t)||xCt(t);if(O&&typeof O!="boolean")return r.call(t,O);r.call(t)},x=()=>{t.req.on("finish",f)};tMr(t)?(t.on("complete",f),c||t.on("abort",g),t.req?x():t.on("request",x)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),b?SI.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||SI.nextTick(y):(!i&&(!c||vCt(t))&&(d||SCt(t)===!1)||!a&&(!c||SCt(t))&&(p||vCt(t)===!1)||u&&t.req&&t.aborted)&&SI.nextTick(y);let S=()=>{r=pTe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",x),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!b){let O=()=>{let E=r;S(),E.call(t,new ECt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)SI.nextTick(O);else{hB=hB||vf().addAbortListener;let E=hB(e.signal,O),P=r;r=fTe((...A)=>{E[TCt](),P.apply(t,A)})}}return S}function rMr(t,e,r){let n=!1,o=pTe;if(e.signal)if(o=()=>{n=!0,r.call(t,new ECt(void 0,{cause:e.signal.reason}))},e.signal.aborted)SI.nextTick(o);else{hB=hB||vf().addAbortListener;let a=hB(e.signal,o),s=r;r=fTe((...u)=>{a[TCt](),s.apply(t,u)})}let i=(...a)=>{n||SI.nextTick(()=>r.apply(t,a))};return GIr(t[eMr].promise,i,i),pTe}function nMr(t,e){var r;let n=!1;return e===null&&(e=dTe),(r=e)!==null&&r!==void 0&&r.cleanup&&(WIr(e.cleanup,"cleanup"),n=e.cleanup),new KIr((o,i)=>{let a=ACt(t,e,s=>{n&&a(),s?i(s):o()})})}mTe.exports=ACt;mTe.exports.finished=nMr});var kj=v((cRo,FCt)=>{"use strict";var Lv=xI(),{aggregateTwoErrors:oMr,codes:{ERR_MULTIPLE_CALLBACK:iMr},AbortError:aMr}=mp(),{Symbol:RCt}=ns(),{kIsDestroyed:sMr,isDestroyed:uMr,isFinished:lMr,isServerRequest:cMr}=Dv(),NCt=RCt("kDestroy"),hTe=RCt("kConstruct");function jCt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function dMr(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):(jCt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?ICt(this,t,e):this.once(NCt,function(i){ICt(this,oMr(i,t),e)}),this)}function ICt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;jCt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?Lv.nextTick(fMr,t,i):Lv.nextTick(DCt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function fMr(t,e){gTe(t,e),DCt(t)}function DCt(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 gTe(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 pMr(){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 yTe(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?Lv.nextTick(gTe,t,e):gTe(t,e))}function mMr(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(hTe,e),!(t.listenerCount(hTe)>1)&&Lv.nextTick(hMr,t)}function hMr(t){let e=!1;function r(n){if(e){yTe(t,n??new iMr);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(NCt,n):n?yTe(t,n,!0):Lv.nextTick(gMr,t)}try{t._construct(n=>{Lv.nextTick(r,n)})}catch(n){Lv.nextTick(r,n)}}function gMr(t){t.emit(hTe)}function MCt(t){return t?.setHeader&&typeof t.abort=="function"}function LCt(t){t.emit("close")}function yMr(t,e){t.emit("error",e),Lv.nextTick(LCt,t)}function bMr(t,e){!t||uMr(t)||(!e&&!lMr(t)&&(e=new aMr),cMr(t)?(t.socket=null,t.destroy(e)):MCt(t)?t.abort():MCt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Lv.nextTick(yMr,t,e):Lv.nextTick(LCt,t),t.destroyed||(t[sMr]=!0))}FCt.exports={construct:mMr,destroyer:bMr,destroy:dMr,undestroy:pMr,errorOrDestroy:yTe}});var Fne=v((dRo,$Ct)=>{"use strict";var{ArrayIsArray:_Mr,ObjectSetPrototypeOf:kCt}=ns(),{EventEmitter:Dne}=LV();function Lne(t){Dne.call(this,t)}kCt(Lne.prototype,Dne.prototype);kCt(Lne,Dne);Lne.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(),Dne.listenerCount(this,"error")===0&&this.emit("error",c)}bTe(r,"error",u),bTe(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 bTe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):_Mr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}$Ct.exports={Stream:Lne,prependListener:bTe}});var FV=v((fRo,kne)=>{"use strict";var{SymbolDispose:vMr}=ns(),{AbortError:zCt,codes:wMr}=mp(),{isNodeStream:BCt,isWebStream:xMr,kControllerErrorFunction:SMr}=Dv(),CMr=OP(),{ERR_INVALID_ARG_TYPE:UCt}=wMr,_Te,OMr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new UCt(e,"AbortSignal",t)};kne.exports.addAbortSignal=function(e,r){if(OMr(e,"signal"),!BCt(r)&&!xMr(r))throw new UCt("stream",["ReadableStream","WritableStream","Stream"],r);return kne.exports.addAbortSignalNoValidate(e,r)};kne.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=BCt(e)?()=>{e.destroy(new zCt(void 0,{cause:t.reason}))}:()=>{e[SMr](new zCt(void 0,{cause:t.reason}))};if(t.aborted)r();else{_Te=_Te||vf().addAbortListener;let n=_Te(t,r);CMr(e,n[vMr])}return e}});var VCt=v((mRo,HCt)=>{"use strict";var{StringPrototypeSlice:qCt,SymbolIterator:PMr,TypedArrayPrototypeSet:$ne,Uint8Array:EMr}=ns(),{Buffer:vTe}=Yp(),{inspect:TMr}=vf();HCt.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 vTe.alloc(0);let r=vTe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)$ne(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}*[PMr](){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+=qCt(i,0,e),this.head=n,n.data=qCt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=vTe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)$ne(r,a,n-e),e-=a.length;else{e===a.length?($ne(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):($ne(r,new EMr(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 TMr(this,{...r,depth:0,customInspect:!1})}}});var kV=v((hRo,JCt)=>{"use strict";var{MathFloor:AMr,NumberIsInteger:IMr}=ns(),{validateInteger:MMr}=pB(),{ERR_INVALID_ARG_VALUE:RMr}=mp().codes,WCt=16*1024,KCt=16;function NMr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function GCt(t){return t?KCt:WCt}function jMr(t,e){MMr(e,"value",0),t?KCt=e:WCt=e}function DMr(t,e,r,n){let o=NMr(e,n,r);if(o!=null){if(!IMr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new RMr(i,o)}return AMr(o)}return GCt(t.objectMode)}JCt.exports={getHighWaterMark:DMr,getDefaultHighWaterMark:GCt,setDefaultHighWaterMark:jMr}});var XCt=v((wTe,YCt)=>{var zne=Yp(),Fv=zne.Buffer;function ZCt(t,e){for(var r in t)e[r]=t[r]}Fv.from&&Fv.alloc&&Fv.allocUnsafe&&Fv.allocUnsafeSlow?YCt.exports=zne:(ZCt(zne,wTe),wTe.Buffer=$j);function $j(t,e,r){return Fv(t,e,r)}$j.prototype=Object.create(Fv.prototype);ZCt(Fv,$j);$j.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Fv(t,e,r)};$j.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Fv(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};$j.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Fv(t)};$j.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return zne.SlowBuffer(t)}});var tOt=v(eOt=>{"use strict";var STe=XCt().Buffer,QCt=STe.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 LMr(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 FMr(t){var e=LMr(t);if(typeof e!="string"&&(STe.isEncoding===QCt||!QCt(t)))throw new Error("Unknown encoding: "+t);return e||t}eOt.StringDecoder=$V;function $V(t){this.encoding=FMr(t);var e;switch(this.encoding){case"utf16le":this.text=qMr,this.end=HMr,e=4;break;case"utf8":this.fillLast=zMr,e=4;break;case"base64":this.text=VMr,this.end=WMr,e=3;break;default:this.write=KMr,this.end=GMr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=STe.allocUnsafe(e)}$V.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||""};$V.prototype.end=UMr;$V.prototype.text=BMr;$V.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 xTe(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function kMr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=xTe(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=xTe(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=xTe(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function $Mr(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 zMr(t){var e=this.lastTotal-this.lastNeed,r=$Mr(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 BMr(t,e){var r=kMr(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 UMr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function qMr(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 HMr(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 VMr(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 WMr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function KMr(t){return t.toString(this.encoding)}function GMr(t){return t&&t.length?this.write(t):""}});var CTe=v((yRo,iOt)=>{"use strict";var rOt=xI(),{PromisePrototypeThen:JMr,SymbolAsyncIterator:nOt,SymbolIterator:oOt}=ns(),{Buffer:ZMr}=Yp(),{ERR_INVALID_ARG_TYPE:YMr,ERR_STREAM_NULL_VALUES:XMr}=mp().codes;function QMr(t,e,r){let n;if(typeof e=="string"||e instanceof ZMr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[nOt])o=!0,n=e[nOt]();else if(e&&e[oOt])o=!1,n=e[oOt]();else throw new YMr("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){JMr(s(l),()=>rOt.nextTick(c,l),d=>rOt.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 XMr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}iOt.exports=QMr});var BV=v((bRo,SOt)=>{var vb=xI(),{ArrayPrototypeIndexOf:eRr,NumberIsInteger:tRr,NumberIsNaN:rRr,NumberParseInt:nRr,ObjectDefineProperties:RTe,ObjectKeys:oRr,ObjectSetPrototypeOf:uOt,Promise:lOt,SafeSet:iRr,SymbolAsyncDispose:aRr,SymbolAsyncIterator:sRr,Symbol:uRr}=ns();SOt.exports=wn;wn.ReadableState=Hne;var{EventEmitter:lRr}=LV(),{Stream:CI,prependListener:cRr}=Fne(),{Buffer:OTe}=Yp(),{addAbortSignal:dRr}=FV(),cOt=OP(),Vn=vf().debuglog("stream",t=>{Vn=t}),fRr=VCt(),bB=kj(),{getHighWaterMark:pRr,getDefaultHighWaterMark:mRr}=kV(),{aggregateTwoErrors:aOt,codes:{ERR_INVALID_ARG_TYPE:hRr,ERR_METHOD_NOT_IMPLEMENTED:gRr,ERR_OUT_OF_RANGE:yRr,ERR_STREAM_PUSH_AFTER_EOF:bRr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:_Rr},AbortError:vRr}=mp(),{validateObject:wRr}=pB(),zj=uRr("kPaused"),{StringDecoder:dOt}=tOt(),xRr=CTe();uOt(wn.prototype,CI.prototype);uOt(wn,CI);var PTe=()=>{},{errorOrDestroy:gB}=bB,yB=1,SRr=2,fOt=4,zV=8,pOt=16,Bne=32,Une=64,mOt=128,CRr=256,ORr=512,PRr=1024,ITe=2048,MTe=4096,ERr=8192,TRr=16384,ARr=32768,hOt=65536,IRr=1<<17,MRr=1<<18;function Kl(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}RTe(Hne.prototype,{objectMode:Kl(yB),ended:Kl(SRr),endEmitted:Kl(fOt),reading:Kl(zV),constructed:Kl(pOt),sync:Kl(Bne),needReadable:Kl(Une),emittedReadable:Kl(mOt),readableListening:Kl(CRr),resumeScheduled:Kl(ORr),errorEmitted:Kl(PRr),emitClose:Kl(ITe),autoDestroy:Kl(MTe),destroyed:Kl(ERr),closed:Kl(TRr),closeEmitted:Kl(ARr),multiAwaitDrain:Kl(hOt),readingMore:Kl(IRr),dataEmitted:Kl(MRr)});function Hne(t,e,r){typeof r!="boolean"&&(r=e instanceof kv()),this.state=ITe|MTe|pOt|Bne,t&&t.objectMode&&(this.state|=yB),r&&t&&t.readableObjectMode&&(this.state|=yB),this.highWaterMark=t?pRr(this,t,"readableHighWaterMark",r):mRr(!1),this.buffer=new fRr,this.length=0,this.pipes=[],this.flowing=null,this[zj]=null,t&&t.emitClose===!1&&(this.state&=~ITe),t&&t.autoDestroy===!1&&(this.state&=~MTe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new dOt(t.encoding),this.encoding=t.encoding)}function wn(t){if(!(this instanceof wn))return new wn(t);let e=this instanceof kv();this._readableState=new Hne(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&&dRr(t.signal,this)),CI.call(this,t),bB.construct(this,()=>{this._readableState.needReadable&&qne(this,this._readableState)})}wn.prototype.destroy=bB.destroy;wn.prototype._undestroy=bB.undestroy;wn.prototype._destroy=function(t,e){e(t)};wn.prototype[lRr.captureRejectionSymbol]=function(t){this.destroy(t)};wn.prototype[aRr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new vRr,this.destroy(t)),new lOt((e,r)=>cOt(this,n=>n&&n!==t?r(n):e(null)))};wn.prototype.push=function(t,e){return gOt(this,t,e,!1)};wn.prototype.unshift=function(t,e){return gOt(this,t,e,!0)};function gOt(t,e,r,n){Vn("readableAddChunk",e);let o=t._readableState,i;if((o.state&yB)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=OTe.from(e,r).toString(o.encoding):(e=OTe.from(e,r),r=""))):e instanceof OTe?r="":CI._isUint8Array(e)?(e=CI._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new hRr("chunk",["string","Buffer","Uint8Array"],e))),i)gB(t,i);else if(e===null)o.state&=~zV,jRr(t,o);else if((o.state&yB)!==0||e&&e.length>0)if(n)if((o.state&fOt)!==0)gB(t,new _Rr);else{if(o.destroyed||o.errored)return!1;ETe(t,o,e,!0)}else if(o.ended)gB(t,new bRr);else{if(o.destroyed||o.errored)return!1;o.state&=~zV,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?ETe(t,o,e,!1):qne(t,o)):ETe(t,o,e,!1)}else n||(o.state&=~zV,qne(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function ETe(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&hOt)!==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&Une)!==0&&Vne(t)),qne(t,e)}wn.prototype.isPaused=function(){let t=this._readableState;return t[zj]===!0||t.flowing===!1};wn.prototype.setEncoding=function(t){let e=new dOt(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 RRr=1073741824;function NRr(t){if(t>RRr)throw new yRr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function sOt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&yB)!==0?1:rRr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}wn.prototype.read=function(t){Vn("read",t),t===void 0?t=NaN:tRr(t)||(t=nRr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=NRr(t)),t!==0&&(e.state&=~mOt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Vn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?TTe(this):Vne(this),null;if(t=sOt(t,e),t===0&&e.ended)return e.length===0&&TTe(this),null;let n=(e.state&Une)!==0;if(Vn("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Vn("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Vn("reading, ended or constructing",n);else if(n){Vn("do read"),e.state|=zV|Bne,e.length===0&&(e.state|=Une);try{this._read(e.highWaterMark)}catch(i){gB(this,i)}e.state&=~Bne,e.reading||(t=sOt(r,e))}let o;return t>0?o=wOt(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&&TTe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function jRr(t,e){if(Vn("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?Vne(t):(e.needReadable=!1,e.emittedReadable=!0,yOt(t))}}function Vne(t){let e=t._readableState;Vn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Vn("emitReadable",e.flowing),e.emittedReadable=!0,vb.nextTick(yOt,t))}function yOt(t){let e=t._readableState;Vn("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,_Ot(t)}function qne(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,vb.nextTick(DRr,t,e))}function DRr(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Vn("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}wn.prototype._read=function(t){throw new gRr("_read()")};wn.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new iRr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Vn("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==vb.stdout&&t!==vb.stderr?s:b;n.endEmitted?vb.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,y){Vn("onunpipe"),g===r&&y&&y.hasUnpiped===!1&&(y.hasUnpiped=!0,c())}function s(){Vn("onend"),t.end()}let u,l=!1;function c(){Vn("cleanup"),t.removeListener("close",m),t.removeListener("finish",h),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",b),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?(Vn("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Vn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=LRr(r,t),t.on("drain",u))}r.on("data",f);function f(g){Vn("ondata");let y=t.write(g);Vn("dest.write",y),y===!1&&d()}function p(g){if(Vn("onerror",g),b(),t.removeListener("error",p),t.listenerCount("error")===0){let y=t._writableState||t._readableState;y&&!y.errorEmitted?gB(t,g):t.emit("error",g)}}cRr(t,"error",p);function m(){t.removeListener("finish",h),b()}t.once("close",m);function h(){Vn("onfinish"),t.removeListener("close",m),b()}t.once("finish",h);function b(){Vn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(Vn("pipe resume"),r.resume()),t};function LRr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Vn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Vn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}wn.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=eRr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};wn.prototype.on=function(t,e){let r=CI.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,Vn("on readable",n.length,n.reading),n.length?Vne(this):n.reading||vb.nextTick(FRr,this)),r};wn.prototype.addListener=wn.prototype.on;wn.prototype.removeListener=function(t,e){let r=CI.prototype.removeListener.call(this,t,e);return t==="readable"&&vb.nextTick(bOt,this),r};wn.prototype.off=wn.prototype.removeListener;wn.prototype.removeAllListeners=function(t){let e=CI.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&vb.nextTick(bOt,this),e};function bOt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[zj]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function FRr(t){Vn("readable nexttick read 0"),t.read(0)}wn.prototype.resume=function(){let t=this._readableState;return t.flowing||(Vn("resume"),t.flowing=!t.readableListening,kRr(this,t)),t[zj]=!1,this};function kRr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,vb.nextTick($Rr,t,e))}function $Rr(t,e){Vn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),_Ot(t),e.flowing&&!e.reading&&t.read(0)}wn.prototype.pause=function(){return Vn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Vn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[zj]=!0,this};function _Ot(t){let e=t._readableState;for(Vn("flow",e.flowing);e.flowing&&t.read()!==null;);}wn.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=>{gB(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=oRr(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};wn.prototype[sRr]=function(){return vOt(this)};wn.prototype.iterator=function(t){return t!==void 0&&wRr(t,"options"),vOt(this,t)};function vOt(t,e){typeof t.read!="function"&&(t=wn.wrap(t,{objectMode:!0}));let r=zRr(t,e);return r.stream=t,r}async function*zRr(t,e){let r=PTe;function n(a){this===t?(r(),r=PTe):r=a}t.on("readable",n);let o,i=cOt(t,{writable:!1},a=>{o=a?aOt(o,a):null,r(),r=PTe});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 lOt(n)}}}catch(a){throw o=aOt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?bB.destroyer(t,null):(t.off("readable",n),i())}}RTe(wn.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}}});RTe(Hne.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[zj]!==!1},set(t){this[zj]=!!t}}});wn._fromList=wOt;function wOt(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 TTe(t){let e=t._readableState;Vn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,vb.nextTick(BRr,e,t))}function BRr(t,e){if(Vn("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)vb.nextTick(URr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function URr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}wn.from=function(t,e){return xRr(wn,t,e)};var ATe;function xOt(){return ATe===void 0&&(ATe={}),ATe}wn.fromWeb=function(t,e){return xOt().newStreamReadableFromReadableStream(t,e)};wn.toWeb=function(t,e){return xOt().newReadableStreamFromStreamReadable(t,e)};wn.wrap=function(t,e){var r,n;return new wn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){bB.destroyer(t,o),i(o)}}).wrap(t)}});var Zne=v((_Ro,DOt)=>{var Bj=xI(),{ArrayPrototypeSlice:POt,Error:qRr,FunctionPrototypeSymbolHasInstance:EOt,ObjectDefineProperty:TOt,ObjectDefineProperties:HRr,ObjectSetPrototypeOf:AOt,StringPrototypeToLowerCase:VRr,Symbol:WRr,SymbolHasInstance:KRr}=ns();DOt.exports=os;os.WritableState=HV;var{EventEmitter:GRr}=LV(),UV=Fne().Stream,{Buffer:Wne}=Yp(),Jne=kj(),{addAbortSignal:JRr}=FV(),{getHighWaterMark:ZRr,getDefaultHighWaterMark:YRr}=kV(),{ERR_INVALID_ARG_TYPE:XRr,ERR_METHOD_NOT_IMPLEMENTED:QRr,ERR_MULTIPLE_CALLBACK:IOt,ERR_STREAM_CANNOT_PIPE:e1r,ERR_STREAM_DESTROYED:qV,ERR_STREAM_ALREADY_FINISHED:t1r,ERR_STREAM_NULL_VALUES:r1r,ERR_STREAM_WRITE_AFTER_END:n1r,ERR_UNKNOWN_ENCODING:MOt}=mp().codes,{errorOrDestroy:_B}=Jne;AOt(os.prototype,UV.prototype);AOt(os,UV);function DTe(){}var vB=WRr("kOnFinished");function HV(t,e,r){typeof r!="boolean"&&(r=e instanceof kv()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?ZRr(this,t,"writableHighWaterMark",r):YRr(!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=i1r.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Gne(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[vB]=[]}function Gne(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}HV.prototype.getBuffer=function(){return POt(this.buffered,this.bufferedIndex)};TOt(HV.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function os(t){let e=this instanceof kv();if(!e&&!EOt(os,this))return new os(t);this._writableState=new HV(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&&JRr(t.signal,this)),UV.call(this,t),Jne.construct(this,()=>{let r=this._writableState;r.writing||FTe(this,r),kTe(this,r)})}TOt(os,KRr,{__proto__:null,value:function(t){return EOt(this,t)?!0:this!==os?!1:t&&t._writableState instanceof HV}});os.prototype.pipe=function(){_B(this,new e1r)};function ROt(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"&&!Wne.isEncoding(r))throw new MOt(r);typeof n!="function"&&(n=DTe)}if(e===null)throw new r1r;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=Wne.from(e,r),r="buffer");else if(e instanceof Wne)r="buffer";else if(UV._isUint8Array(e))e=UV._uint8ArrayToBuffer(e),r="buffer";else throw new XRr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new n1r:o.destroyed&&(i=new qV("write")),i?(Bj.nextTick(n,i),_B(t,i,!0),i):(o.pendingcb++,o1r(t,o,e,r,n))}os.prototype.write=function(t,e,r){return ROt(this,t,e,r)===!0};os.prototype.cork=function(){this._writableState.corked++};os.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||FTe(this,t))};os.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=VRr(e)),!Wne.isEncoding(e))throw new MOt(e);return this._writableState.defaultEncoding=e,this};function o1r(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!==DTe&&(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 COt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new qV("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function OOt(t,e,r,n){--e.pendingcb,n(r),LTe(e),_B(t,r)}function i1r(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){_B(t,new IOt);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?Bj.nextTick(OOt,t,r,e,o):OOt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&FTe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},Bj.nextTick(a1r,r.afterWriteTickInfo)):NOt(t,r,1,o))}function a1r({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,NOt(t,e,r,n)}function NOt(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&<e(e),kTe(t,e)}function LTe(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 qV("write"))}let r=t[vB].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new qV("end"))}Gne(t)}function FTe(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?DTe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:POt(r,a);u.allBuffers=e.allBuffers,COt(t,e,!0,e.length,u,"",s),Gne(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;COt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?Gne(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}os.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new QRr("_write()")};os.prototype._writev=null;os.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=ROt(this,t,e);i instanceof qRr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,kTe(this,n,!0),n.ended=!0):n.finished?o=new t1r("end"):n.destroyed&&(o=new qV("end"))),typeof r=="function"&&(o||n.finished?Bj.nextTick(r,o):n[vB].push(r)),this};function Kne(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 s1r(t,e){let r=!1;function n(o){if(r){_B(t,o??IOt());return}if(r=!0,e.pendingcb--,o){let i=e[vB].splice(0);for(let a=0;a<i.length;a++)i[a](o);_B(t,o,e.sync)}else Kne(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,Bj.nextTick(jTe,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function u1r(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,s1r(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function kTe(t,e,r){Kne(e)&&(u1r(t,e),e.pendingcb===0&&(r?(e.pendingcb++,Bj.nextTick((n,o)=>{Kne(o)?jTe(n,o):o.pendingcb--},t,e)):Kne(e)&&(e.pendingcb++,jTe(t,e))))}function jTe(t,e){e.pendingcb--,e.finished=!0;let r=e[vB].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()}}HRr(os.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 l1r=Jne.destroy;os.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[vB].length)&&Bj.nextTick(LTe,r),l1r.call(this,t,e),this};os.prototype._undestroy=Jne.undestroy;os.prototype._destroy=function(t,e){e(t)};os.prototype[GRr.captureRejectionSymbol]=function(t){this.destroy(t)};var NTe;function jOt(){return NTe===void 0&&(NTe={}),NTe}os.fromWeb=function(t,e){return jOt().newStreamWritableFromWritableStream(t,e)};os.toWeb=function(t){return jOt().newWritableStreamFromStreamWritable(t)}});var ZOt=v((vRo,JOt)=>{var $Te=xI(),c1r=Yp(),{isReadable:d1r,isWritable:f1r,isIterable:LOt,isNodeStream:p1r,isReadableNodeStream:FOt,isWritableNodeStream:kOt,isDuplexNodeStream:m1r,isReadableStream:$Ot,isWritableStream:zOt}=Dv(),BOt=OP(),{AbortError:KOt,codes:{ERR_INVALID_ARG_TYPE:h1r,ERR_INVALID_RETURN_VALUE:UOt}}=mp(),{destroyer:xB}=kj(),g1r=kv(),GOt=BV(),y1r=Zne(),{createDeferredPromise:qOt}=vf(),HOt=CTe(),VOt=globalThis.Blob||c1r.Blob,b1r=typeof VOt<"u"?function(e){return e instanceof VOt}:function(e){return!1},_1r=globalThis.AbortController||cB().AbortController,{FunctionPrototypeCall:WOt}=ns(),OI=class extends g1r{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)}};JOt.exports=function t(e,r){if(m1r(e))return e;if(FOt(e))return wB({readable:e});if(kOt(e))return wB({writable:e});if(p1r(e))return wB({writable:!1,readable:!1});if($Ot(e))return wB({readable:GOt.fromWeb(e)});if(zOt(e))return wB({writable:y1r.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=v1r(e);if(LOt(o))return HOt(OI,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=WOt(u,o,d=>{if(d!=null)throw new UOt("nully","body",d)},d=>{xB(l,d)});return l=new OI({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,$Te.nextTick(d,null)}catch(f){$Te.nextTick(d,f)}})},destroy:s})}throw new UOt("Iterable, AsyncIterable or AsyncFunction",r,o)}if(b1r(e))return t(e.arrayBuffer());if(LOt(e))return HOt(OI,e,{objectMode:!0,writable:!1});if($Ot(e?.readable)&&zOt(e?.writable))return OI.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?FOt(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?kOt(e?.writable)?e?.writable:t(e.writable):void 0;return wB({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return WOt(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{xB(o,i)}),o=new OI({objectMode:!0,writable:!1,read(){}})}throw new h1r(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function v1r(t){let{promise:e,resolve:r}=qOt(),n=new _1r,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if($Te.nextTick(l),u)return;if(o.aborted)throw new KOt(void 0,{cause:o.reason});({promise:e,resolve:r}=qOt()),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 wB(t){let e=t.readable&&typeof t.readable.read!="function"?GOt.wrap(t.readable):t.readable,r=t.writable,n=!!d1r(e),o=!!f1r(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new OI({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(BOt(r,d=>{o=!1,d&&xB(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&&(BOt(e,d=>{n=!1,d&&xB(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 KOt),s=null,i=null,a=null,u===null?f(d):(u=f,xB(r,d),xB(e,d))},l}});var kv=v((wRo,QOt)=>{"use strict";var{ObjectDefineProperties:w1r,ObjectGetOwnPropertyDescriptor:PP,ObjectKeys:x1r,ObjectSetPrototypeOf:YOt}=ns();QOt.exports=wb;var UTe=BV(),kg=Zne();YOt(wb.prototype,UTe.prototype);YOt(wb,UTe);{let t=x1r(kg.prototype);for(let e=0;e<t.length;e++){let r=t[e];wb.prototype[r]||(wb.prototype[r]=kg.prototype[r])}}function wb(t){if(!(this instanceof wb))return new wb(t);UTe.call(this,t),kg.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}w1r(wb.prototype,{writable:{__proto__:null,...PP(kg.prototype,"writable")},writableHighWaterMark:{__proto__:null,...PP(kg.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...PP(kg.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...PP(kg.prototype,"writableBuffer")},writableLength:{__proto__:null,...PP(kg.prototype,"writableLength")},writableFinished:{__proto__:null,...PP(kg.prototype,"writableFinished")},writableCorked:{__proto__:null,...PP(kg.prototype,"writableCorked")},writableEnded:{__proto__:null,...PP(kg.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...PP(kg.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 zTe;function XOt(){return zTe===void 0&&(zTe={}),zTe}wb.fromWeb=function(t,e){return XOt().newStreamDuplexFromReadableWritablePair(t,e)};wb.toWeb=function(t){return XOt().newReadableWritablePairFromDuplex(t)};var BTe;wb.from=function(t){return BTe||(BTe=ZOt()),BTe(t,"body")}});var VTe=v((xRo,tPt)=>{"use strict";var{ObjectSetPrototypeOf:ePt,Symbol:S1r}=ns();tPt.exports=EP;var{ERR_METHOD_NOT_IMPLEMENTED:C1r}=mp().codes,HTe=kv(),{getHighWaterMark:O1r}=kV();ePt(EP.prototype,HTe.prototype);ePt(EP,HTe);var VV=S1r("kCallback");function EP(t){if(!(this instanceof EP))return new EP(t);let e=t?O1r(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),HTe.call(this,t),this._readableState.sync=!1,this[VV]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",P1r)}function qTe(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 P1r(){this._final!==qTe&&qTe.call(this)}EP.prototype._final=qTe;EP.prototype._transform=function(t,e,r){throw new C1r("_transform()")};EP.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[VV]=r})};EP.prototype._read=function(){if(this[VV]){let t=this[VV];this[VV]=null,t()}}});var KTe=v((SRo,nPt)=>{"use strict";var{ObjectSetPrototypeOf:rPt}=ns();nPt.exports=SB;var WTe=VTe();rPt(SB.prototype,WTe.prototype);rPt(SB,WTe);function SB(t){if(!(this instanceof SB))return new SB(t);WTe.call(this,t)}SB.prototype._transform=function(t,e,r){r(null,t)}});var eoe=v((CRo,uPt)=>{var WV=xI(),{ArrayIsArray:E1r,Promise:T1r,SymbolAsyncIterator:A1r,SymbolDispose:I1r}=ns(),Qne=OP(),{once:M1r}=vf(),R1r=kj(),oPt=kv(),{aggregateTwoErrors:N1r,codes:{ERR_INVALID_ARG_TYPE:rAe,ERR_INVALID_RETURN_VALUE:GTe,ERR_MISSING_ARGS:j1r,ERR_STREAM_DESTROYED:D1r,ERR_STREAM_PREMATURE_CLOSE:L1r},AbortError:F1r}=mp(),{validateFunction:k1r,validateAbortSignal:$1r}=pB(),{isIterable:Uj,isReadable:JTe,isReadableNodeStream:Xne,isNodeStream:iPt,isTransformStream:CB,isWebStream:z1r,isReadableStream:ZTe,isReadableFinished:B1r}=Dv(),U1r=globalThis.AbortController||cB().AbortController,YTe,XTe,QTe;function aPt(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=Qne(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,R1r.destroyer(t,i||new D1r("pipe")))},cleanup:o}}function q1r(t){return k1r(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function eAe(t){if(Uj(t))return t;if(Xne(t))return H1r(t);throw new rAe("val",["Readable","Iterable","AsyncIterable"],t)}async function*H1r(t){XTe||(XTe=BV()),yield*XTe.prototype[A1r].call(t)}async function Yne(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new T1r((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=Qne(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?N1r(o,l):l)}finally{u(),e.off("drain",a)}}async function tAe(t,e,r,{end:n}){CB(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 V1r(...t){return sPt(t,M1r(q1r(t)))}function sPt(t,e,r){if(t.length===1&&E1r(t[0])&&(t=t[0]),t.length<2)throw new j1r("streams");let n=new U1r,o=n.signal,i=r?.signal,a=[];$1r(i,"options.signal");function s(){m(new F1r)}QTe=QTe||vf().addAbortListener;let u;i&&(u=QTe(i,s));let l,c,d=[],f=0;function p(x){m(x,--f===0)}function m(x,S){var O;if(x&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=x),!(!l&&!S)){for(;d.length;)d.shift()(l);(O=u)===null||O===void 0||O[I1r](),n.abort(),S&&(l||a.forEach(E=>E()),WV.nextTick(e,l,c))}}let h;for(let x=0;x<t.length;x++){let S=t[x],O=x<t.length-1,E=x>0,P=O||r?.end!==!1,A=x===t.length-1;if(iPt(S)){let I=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var y=I;if(P){let{destroy:R,cleanup:N}=aPt(S,O,E);d.push(R),JTe(S)&&A&&a.push(N)}S.on("error",I),JTe(S)&&A&&a.push(()=>{S.removeListener("error",I)})}if(x===0)if(typeof S=="function"){if(h=S({signal:o}),!Uj(h))throw new GTe("Iterable, AsyncIterable or Stream","source",h)}else Uj(S)||Xne(S)||CB(S)?h=S:h=oPt.from(S);else if(typeof S=="function"){if(CB(h)){var b;h=eAe((b=h)===null||b===void 0?void 0:b.readable)}else h=eAe(h);if(h=S(h,{signal:o}),O){if(!Uj(h,!0))throw new GTe("AsyncIterable",`transform[${x-1}]`,h)}else{var g;YTe||(YTe=KTe());let I=new YTe({objectMode:!0}),R=(g=h)===null||g===void 0?void 0:g.then;if(typeof R=="function")f++,R.call(h,$=>{c=$,$!=null&&I.write($),P&&I.end(),WV.nextTick(p)},$=>{I.destroy($),WV.nextTick(p,$)});else if(Uj(h,!0))f++,Yne(h,I,p,{end:P});else if(ZTe(h)||CB(h)){let $=h.readable||h;f++,Yne($,I,p,{end:P})}else throw new GTe("AsyncIterable or Promise","destination",h);h=I;let{destroy:N,cleanup:j}=aPt(h,!1,!0);d.push(N),A&&a.push(j)}}else if(iPt(S)){if(Xne(h)){f+=2;let I=W1r(h,S,p,{end:P});JTe(S)&&A&&a.push(I)}else if(CB(h)||ZTe(h)){let I=h.readable||h;f++,Yne(I,S,p,{end:P})}else if(Uj(h))f++,Yne(h,S,p,{end:P});else throw new rAe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=S}else if(z1r(S)){if(Xne(h))f++,tAe(eAe(h),S,p,{end:P});else if(ZTe(h)||Uj(h))f++,tAe(h,S,p,{end:P});else if(CB(h))f++,tAe(h.readable,S,p,{end:P});else throw new rAe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=S}else h=oPt.from(S)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&WV.nextTick(s),h}function W1r(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new L1r)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;B1r(t)?WV.nextTick(a):t.once("end",a)}else r();return Qne(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)}),Qne(e,{readable:!1,writable:!0},r)}uPt.exports={pipelineImpl:sPt,pipeline:V1r}});var oAe=v((ORo,mPt)=>{"use strict";var{pipeline:K1r}=eoe(),toe=kv(),{destroyer:G1r}=kj(),{isNodeStream:roe,isReadable:lPt,isWritable:cPt,isWebStream:nAe,isTransformStream:qj,isWritableStream:dPt,isReadableStream:fPt}=Dv(),{AbortError:J1r,codes:{ERR_INVALID_ARG_VALUE:pPt,ERR_MISSING_ARGS:Z1r}}=mp(),Y1r=OP();mPt.exports=function(...e){if(e.length===0)throw new Z1r("streams");if(e.length===1)return toe.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=toe.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=toe.from(e[p])}for(let p=0;p<e.length;++p)if(!(!roe(e[p])&&!nAe(e[p]))){if(p<e.length-1&&!(lPt(e[p])||fPt(e[p])||qj(e[p])))throw new pPt(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(cPt(e[p])||dPt(e[p])||qj(e[p])))throw new pPt(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let m=a;a=null,m?m(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=K1r(e,u),d=!!(cPt(l)||dPt(l)||qj(l)),f=!!(lPt(c)||fPt(c)||qj(c));if(s=new toe({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(roe(l))s._write=function(m,h,b){l.write(m,h)?b():n=b},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(nAe(l)){let h=(qj(l)?l.writable:l).getWriter();s._write=async function(b,g,y){try{await h.ready,h.write(b).catch(()=>{}),y()}catch(x){y(x)}},s._final=async function(b){try{await h.ready,h.close().catch(()=>{}),o=b}catch(g){b(g)}}}let p=qj(c)?c.readable:c;Y1r(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(roe(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(nAe(c)){let m=(qj(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:b}=await m.read();if(!s.push(h))return;if(b){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new J1r),i=null,n=null,o=null,a===null?m(p):(a=m,roe(c)&&G1r(c,p))},s}});var CPt=v((PRo,sAe)=>{"use strict";var X1r=globalThis.AbortController||cB().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Q1r,ERR_INVALID_ARG_TYPE:KV,ERR_MISSING_ARGS:eNr,ERR_OUT_OF_RANGE:tNr},AbortError:$v}=mp(),{validateAbortSignal:Hj,validateInteger:hPt,validateObject:Vj}=pB(),rNr=ns().Symbol("kWeak"),nNr=ns().Symbol("kResistStopPropagation"),{finished:oNr}=OP(),iNr=oAe(),{addAbortSignalNoValidate:aNr}=FV(),{isWritable:sNr,isNodeStream:uNr}=Dv(),{deprecate:lNr}=vf(),{ArrayPrototypePush:cNr,Boolean:dNr,MathFloor:gPt,Number:fNr,NumberIsNaN:pNr,Promise:yPt,PromiseReject:bPt,PromiseResolve:mNr,PromisePrototypeThen:_Pt,Symbol:wPt}=ns(),noe=wPt("kEmpty"),vPt=wPt("kEof");function hNr(t,e){if(e!=null&&Vj(e,"options"),e?.signal!=null&&Hj(e.signal,"options.signal"),uNr(t)&&!sNr(t))throw new Q1r("stream",t,"must be writable");let r=iNr(this,t);return e!=null&&e.signal&&aNr(e.signal,r),r}function ooe(t,e){if(typeof t!="function")throw new KV("fn",["Function","AsyncFunction"],t);e!=null&&Vj(e,"options"),e?.signal!=null&&Hj(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=gPt(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=gPt(e.highWaterMark)),hPt(r,"options.concurrency",1),hPt(n,"options.highWaterMark",0),n+=r,async function*(){let i=vf().AbortSignalAny([e?.signal].filter(dNr)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function b(){try{for await(let g of a){if(d)return;if(i.aborted)throw new $v;try{if(g=t(g,u),g===noe)continue;g=mNr(g)}catch(y){g=bPt(y)}f+=1,_Pt(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new yPt(y=>{c=y})}s.push(vPt)}catch(g){let y=bPt(g);_Pt(y,m,p),s.push(y)}finally{d=!0,l&&(l(),l=null)}}b();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===vPt)return;if(i.aborted)throw new $v;g!==noe&&(yield g),s.shift(),h()}await new yPt(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function gNr(t=void 0){return t!=null&&Vj(t,"options"),t?.signal!=null&&Hj(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 $v({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function xPt(t,e=void 0){for await(let r of aAe.call(this,t,e))return!0;return!1}async function yNr(t,e=void 0){if(typeof t!="function")throw new KV("fn",["Function","AsyncFunction"],t);return!await xPt.call(this,async(...r)=>!await t(...r),e)}async function bNr(t,e){for await(let r of aAe.call(this,t,e))return r}async function _Nr(t,e){if(typeof t!="function")throw new KV("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),noe}for await(let n of ooe.call(this,r,e));}function aAe(t,e){if(typeof t!="function")throw new KV("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:noe}return ooe.call(this,r,e)}var iAe=class extends eNr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function vNr(t,e,r){var n;if(typeof t!="function")throw new KV("reducer",["Function","AsyncFunction"],t);r!=null&&Vj(r,"options"),r?.signal!=null&&Hj(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new $v(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await oNr(this.destroy(l)),l}let i=new X1r,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[rNr]:this,[nNr]:!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 $v;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new iAe}finally{i.abort()}return e}async function wNr(t){t!=null&&Vj(t,"options"),t?.signal!=null&&Hj(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 $v(void 0,{cause:t.signal.reason});cNr(e,n)}return e}function xNr(t,e){let r=ooe.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function SPt(t){if(t=fNr(t),pNr(t))return 0;if(t<0)throw new tNr("number",">= 0",t);return t}function SNr(t,e=void 0){return e!=null&&Vj(e,"options"),e?.signal!=null&&Hj(e.signal,"options.signal"),t=SPt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new $v;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new $v;t--<=0&&(yield i)}}.call(this)}function CNr(t,e=void 0){return e!=null&&Vj(e,"options"),e?.signal!=null&&Hj(e.signal,"options.signal"),t=SPt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new $v;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new $v;if(t-- >0&&(yield i),t<=0)return}}.call(this)}sAe.exports.streamReturningOperators={asIndexedPairs:lNr(gNr,"readable.asIndexedPairs will be removed in a future version."),drop:SNr,filter:aAe,flatMap:xNr,map:ooe,take:CNr,compose:hNr};sAe.exports.promiseReturningOperators={every:yNr,forEach:_Nr,reduce:vNr,toArray:wNr,some:xPt,find:bNr}});var uAe=v((ERo,OPt)=>{"use strict";var{ArrayPrototypePop:ONr,Promise:PNr}=ns(),{isIterable:ENr,isNodeStream:TNr,isWebStream:ANr}=Dv(),{pipelineImpl:INr}=eoe(),{finished:MNr}=OP();lAe();function RNr(...t){return new PNr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!TNr(i)&&!ENr(i)&&!ANr(i)){let a=ONr(t);n=a.signal,o=a.end}INr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}OPt.exports={finished:MNr,pipeline:RNr}});var lAe=v((TRo,jPt)=>{var{Buffer:NNr}=Yp(),{ObjectDefineProperty:TP,ObjectKeys:TPt,ReflectApply:APt}=ns(),{promisify:{custom:IPt}}=vf(),{streamReturningOperators:PPt,promiseReturningOperators:EPt}=CPt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:MPt}}=mp(),jNr=oAe(),{setDefaultHighWaterMark:DNr,getDefaultHighWaterMark:LNr}=kV(),{pipeline:RPt}=eoe(),{destroyer:FNr}=kj(),NPt=OP(),cAe=uAe(),GV=Dv(),ga=jPt.exports=Fne().Stream;ga.isDestroyed=GV.isDestroyed;ga.isDisturbed=GV.isDisturbed;ga.isErrored=GV.isErrored;ga.isReadable=GV.isReadable;ga.isWritable=GV.isWritable;ga.Readable=BV();for(let t of TPt(PPt)){let r=function(...n){if(new.target)throw MPt();return ga.Readable.from(APt(e,this,n))};dAe=r;let e=PPt[t];TP(r,"name",{__proto__:null,value:e.name}),TP(r,"length",{__proto__:null,value:e.length}),TP(ga.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var dAe;for(let t of TPt(EPt)){let r=function(...o){if(new.target)throw MPt();return APt(e,this,o)};dAe=r;let e=EPt[t];TP(r,"name",{__proto__:null,value:e.name}),TP(r,"length",{__proto__:null,value:e.length}),TP(ga.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var dAe;ga.Writable=Zne();ga.Duplex=kv();ga.Transform=VTe();ga.PassThrough=KTe();ga.pipeline=RPt;var{addAbortSignal:kNr}=FV();ga.addAbortSignal=kNr;ga.finished=NPt;ga.destroy=FNr;ga.compose=jNr;ga.setDefaultHighWaterMark=DNr;ga.getDefaultHighWaterMark=LNr;TP(ga,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return cAe}});TP(RPt,IPt,{__proto__:null,enumerable:!0,get(){return cAe.pipeline}});TP(NPt,IPt,{__proto__:null,enumerable:!0,get(){return cAe.finished}});ga.Stream=ga;ga._isUint8Array=function(e){return e instanceof Uint8Array};ga._uint8ArrayToBuffer=function(e){return NNr.from(e.buffer,e.byteOffset,e.byteLength)}});var JV=v((ARo,Gs)=>{"use strict";var Gl=lAe(),$Nr=uAe(),zNr=Gl.Readable.destroy;Gs.exports=Gl.Readable;Gs.exports._uint8ArrayToBuffer=Gl._uint8ArrayToBuffer;Gs.exports._isUint8Array=Gl._isUint8Array;Gs.exports.isDisturbed=Gl.isDisturbed;Gs.exports.isErrored=Gl.isErrored;Gs.exports.isReadable=Gl.isReadable;Gs.exports.Readable=Gl.Readable;Gs.exports.Writable=Gl.Writable;Gs.exports.Duplex=Gl.Duplex;Gs.exports.Transform=Gl.Transform;Gs.exports.PassThrough=Gl.PassThrough;Gs.exports.addAbortSignal=Gl.addAbortSignal;Gs.exports.finished=Gl.finished;Gs.exports.destroy=Gl.destroy;Gs.exports.destroy=zNr;Gs.exports.pipeline=Gl.pipeline;Gs.exports.compose=Gl.compose;Object.defineProperty(Gl,"promises",{configurable:!0,enumerable:!0,get(){return $Nr}});Gs.exports.Stream=Gl.Stream;Gs.exports.default=Gs.exports});var Wj=v((IRo,DPt)=>{"use strict";DPt.exports=TypeError});var LPt=v(()=>{});var QV=v((NRo,rEt)=>{var wAe=typeof Map=="function"&&Map.prototype,fAe=Object.getOwnPropertyDescriptor&&wAe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,aoe=wAe&&fAe&&typeof fAe.get=="function"?fAe.get:null,FPt=wAe&&Map.prototype.forEach,xAe=typeof Set=="function"&&Set.prototype,pAe=Object.getOwnPropertyDescriptor&&xAe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,soe=xAe&&pAe&&typeof pAe.get=="function"?pAe.get:null,kPt=xAe&&Set.prototype.forEach,BNr=typeof WeakMap=="function"&&WeakMap.prototype,YV=BNr?WeakMap.prototype.has:null,UNr=typeof WeakSet=="function"&&WeakSet.prototype,XV=UNr?WeakSet.prototype.has:null,qNr=typeof WeakRef=="function"&&WeakRef.prototype,$Pt=qNr?WeakRef.prototype.deref:null,HNr=Boolean.prototype.valueOf,VNr=Object.prototype.toString,WNr=Function.prototype.toString,KNr=String.prototype.match,SAe=String.prototype.slice,PI=String.prototype.replace,GNr=String.prototype.toUpperCase,zPt=String.prototype.toLowerCase,JPt=RegExp.prototype.test,BPt=Array.prototype.concat,zv=Array.prototype.join,JNr=Array.prototype.slice,UPt=Math.floor,gAe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,mAe=Object.getOwnPropertySymbols,yAe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,OB=typeof Symbol=="function"&&typeof Symbol.iterator=="object",xf=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===OB||!0)?Symbol.toStringTag:null,ZPt=Object.prototype.propertyIsEnumerable,qPt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function HPt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||JPt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-UPt(-t):UPt(t);if(n!==t){var o=String(n),i=SAe.call(e,o.length+1);return PI.call(o,r,"$&_")+"."+PI.call(PI.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return PI.call(e,r,"$&_")}var bAe=LPt(),VPt=bAe.custom,WPt=QPt(VPt)?VPt:null,YPt={__proto__:null,double:'"',single:"'"},ZNr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};rEt.exports=function t(e,r,n,o){var i=r||{};if(AP(i,"quoteStyle")&&!AP(YPt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(AP(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=AP(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(AP(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(AP(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 tEt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?HPt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?HPt(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 _Ae(e)?"[Array]":"[Object]";var d=mjr(i,n);if(typeof o>"u")o=[];else if(eEt(o,e)>=0)return"[Circular]";function f($,k,H){if(k&&(o=JNr.call(o),o.push(k)),H){var V={depth:i.depth};return AP(i,"quoteStyle")&&(V.quoteStyle=i.quoteStyle),t($,V,n+1,o)}return t($,i,n+1,o)}if(typeof e=="function"&&!KPt(e)){var p=ijr(e),m=ioe(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+zv.call(m,", ")+" }":"")}if(QPt(e)){var h=OB?PI.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):yAe.call(e);return typeof e=="object"&&!OB?ZV(h):h}if(djr(e)){for(var b="<"+zPt.call(String(e.nodeName)),g=e.attributes||[],y=0;y<g.length;y++)b+=" "+g[y].name+"="+XPt(YNr(g[y].value),"double",i);return b+=">",e.childNodes&&e.childNodes.length&&(b+="..."),b+="</"+zPt.call(String(e.nodeName))+">",b}if(_Ae(e)){if(e.length===0)return"[]";var x=ioe(e,f);return d&&!pjr(x)?"["+vAe(x,d)+"]":"[ "+zv.call(x,", ")+" ]"}if(QNr(e)){var S=ioe(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!ZPt.call(e,"cause")?"{ ["+String(e)+"] "+zv.call(BPt.call("[cause]: "+f(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+zv.call(S,", ")+" }"}if(typeof e=="object"&&a){if(WPt&&typeof e[WPt]=="function"&&bAe)return bAe(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ajr(e)){var O=[];return FPt&&FPt.call(e,function($,k){O.push(f(k,e,!0)+" => "+f($,e))}),GPt("Map",aoe.call(e),O,d)}if(ljr(e)){var E=[];return kPt&&kPt.call(e,function($){E.push(f($,e))}),GPt("Set",soe.call(e),E,d)}if(sjr(e))return hAe("WeakMap");if(cjr(e))return hAe("WeakSet");if(ujr(e))return hAe("WeakRef");if(tjr(e))return ZV(f(Number(e)));if(njr(e))return ZV(f(gAe.call(e)));if(rjr(e))return ZV(HNr.call(e));if(ejr(e))return ZV(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(!XNr(e)&&!KPt(e)){var P=ioe(e,f),A=qPt?qPt(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",R=!A&&xf&&Object(e)===e&&xf in e?SAe.call(EI(e),8,-1):I?"Object":"",N=A||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=N+(R||I?"["+zv.call(BPt.call([],R||[],I||[]),": ")+"] ":"");return P.length===0?j+"{}":d?j+"{"+vAe(P,d)+"}":j+"{ "+zv.call(P,", ")+" }"}return String(e)};function XPt(t,e,r){var n=r.quoteStyle||e,o=YPt[n];return o+t+o}function YNr(t){return PI.call(String(t),/"/g,""")}function _Ae(t){return EI(t)==="[object Array]"&&(!xf||!(typeof t=="object"&&xf in t))}function XNr(t){return EI(t)==="[object Date]"&&(!xf||!(typeof t=="object"&&xf in t))}function KPt(t){return EI(t)==="[object RegExp]"&&(!xf||!(typeof t=="object"&&xf in t))}function QNr(t){return EI(t)==="[object Error]"&&(!xf||!(typeof t=="object"&&xf in t))}function ejr(t){return EI(t)==="[object String]"&&(!xf||!(typeof t=="object"&&xf in t))}function tjr(t){return EI(t)==="[object Number]"&&(!xf||!(typeof t=="object"&&xf in t))}function rjr(t){return EI(t)==="[object Boolean]"&&(!xf||!(typeof t=="object"&&xf in t))}function QPt(t){if(OB)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!yAe)return!1;try{return yAe.call(t),!0}catch{}return!1}function njr(t){if(!t||typeof t!="object"||!gAe)return!1;try{return gAe.call(t),!0}catch{}return!1}var ojr=Object.prototype.hasOwnProperty||function(t){return t in this};function AP(t,e){return ojr.call(t,e)}function EI(t){return VNr.call(t)}function ijr(t){if(t.name)return t.name;var e=KNr.call(WNr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function eEt(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 ajr(t){if(!aoe||!t||typeof t!="object")return!1;try{aoe.call(t);try{soe.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function sjr(t){if(!YV||!t||typeof t!="object")return!1;try{YV.call(t,YV);try{XV.call(t,XV)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function ujr(t){if(!$Pt||!t||typeof t!="object")return!1;try{return $Pt.call(t),!0}catch{}return!1}function ljr(t){if(!soe||!t||typeof t!="object")return!1;try{soe.call(t);try{aoe.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function cjr(t){if(!XV||!t||typeof t!="object")return!1;try{XV.call(t,XV);try{YV.call(t,YV)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function djr(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function tEt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return tEt(SAe.call(t,0,e.maxStringLength),e)+n}var o=ZNr[e.quoteStyle||"single"];o.lastIndex=0;var i=PI.call(PI.call(t,o,"\\$1"),/[\x00-\x1f]/g,fjr);return XPt(i,"single",e)}function fjr(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":"")+GNr.call(e.toString(16))}function ZV(t){return"Object("+t+")"}function hAe(t){return t+" { ? }"}function GPt(t,e,r,n){var o=n?vAe(r,n):zv.call(r,", ");return t+" ("+e+") {"+o+"}"}function pjr(t){for(var e=0;e<t.length;e++)if(eEt(t[e],`
|
||
`)>=0)return!1;return!0}function mjr(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=zv.call(Array(t.indent+1)," ");else return null;return{base:r,prev:zv.call(Array(e+1),r)}}function vAe(t,e){if(t.length===0)return"";var r=`
|
||
`+e.prev+e.base;return r+zv.call(t,","+r)+`
|
||
`+e.prev}function ioe(t,e){var r=_Ae(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=AP(t,o)?e(t[o],t):""}var i=typeof mAe=="function"?mAe(t):[],a;if(OB){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)AP(t,u)&&(r&&String(Number(u))===u&&u<t.length||OB&&a["$"+u]instanceof Symbol||(JPt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof mAe=="function")for(var l=0;l<i.length;l++)ZPt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var oEt=v((jRo,nEt)=>{"use strict";var hjr=QV(),gjr=Wj(),uoe=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},yjr=function(t,e){if(t){var r=uoe(t,e);return r&&r.value}},bjr=function(t,e,r){var n=uoe(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},_jr=function(t,e){return t?!!uoe(t,e):!1},vjr=function(t,e){if(t)return uoe(t,e,!0)};nEt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new gjr("Side channel does not contain "+hjr(n))},delete:function(n){var o=e&&e.next,i=vjr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return yjr(e,n)},has:function(n){return _jr(e,n)},set:function(n,o){e||(e={next:void 0}),bjr(e,n,o)}};return r}});var CAe=v((DRo,iEt)=>{"use strict";iEt.exports=Object});var sEt=v((LRo,aEt)=>{"use strict";aEt.exports=Error});var lEt=v((FRo,uEt)=>{"use strict";uEt.exports=EvalError});var dEt=v((kRo,cEt)=>{"use strict";cEt.exports=RangeError});var pEt=v(($Ro,fEt)=>{"use strict";fEt.exports=ReferenceError});var hEt=v((zRo,mEt)=>{"use strict";mEt.exports=SyntaxError});var yEt=v((BRo,gEt)=>{"use strict";gEt.exports=URIError});var _Et=v((URo,bEt)=>{"use strict";bEt.exports=Math.abs});var wEt=v((qRo,vEt)=>{"use strict";vEt.exports=Math.floor});var SEt=v((HRo,xEt)=>{"use strict";xEt.exports=Math.max});var OEt=v((VRo,CEt)=>{"use strict";CEt.exports=Math.min});var EEt=v((WRo,PEt)=>{"use strict";PEt.exports=Math.pow});var AEt=v((KRo,TEt)=>{"use strict";TEt.exports=Math.round});var MEt=v((GRo,IEt)=>{"use strict";IEt.exports=Number.isNaN||function(e){return e!==e}});var NEt=v((JRo,REt)=>{"use strict";var wjr=MEt();REt.exports=function(e){return wjr(e)||e===0?e:e<0?-1:1}});var DEt=v((ZRo,jEt)=>{"use strict";jEt.exports=Object.getOwnPropertyDescriptor});var OAe=v((YRo,LEt)=>{"use strict";var loe=DEt();if(loe)try{loe([],"length")}catch{loe=null}LEt.exports=loe});var kEt=v((XRo,FEt)=>{"use strict";var coe=Object.defineProperty||!1;if(coe)try{coe({},"a",{value:1})}catch{coe=!1}FEt.exports=coe});var zEt=v((QRo,$Et)=>{"use strict";$Et.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 qEt=v((e1o,UEt)=>{"use strict";var BEt=typeof Symbol<"u"&&Symbol,xjr=zEt();UEt.exports=function(){return typeof BEt!="function"||typeof Symbol!="function"||typeof BEt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:xjr()}});var PAe=v((t1o,HEt)=>{"use strict";HEt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var EAe=v((r1o,VEt)=>{"use strict";var Sjr=CAe();VEt.exports=Sjr.getPrototypeOf||null});var GEt=v((n1o,KEt)=>{"use strict";var Cjr="Function.prototype.bind called on incompatible ",Ojr=Object.prototype.toString,Pjr=Math.max,Ejr="[object Function]",WEt=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},Tjr=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},Ajr=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};KEt.exports=function(e){var r=this;if(typeof r!="function"||Ojr.apply(r)!==Ejr)throw new TypeError(Cjr+r);for(var n=Tjr(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,WEt(n,arguments));return Object(c)===c?c:this}return r.apply(e,WEt(n,arguments))},a=Pjr(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+Ajr(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 e5=v((o1o,JEt)=>{"use strict";var Ijr=GEt();JEt.exports=Function.prototype.bind||Ijr});var doe=v((i1o,ZEt)=>{"use strict";ZEt.exports=Function.prototype.call});var TAe=v((a1o,YEt)=>{"use strict";YEt.exports=Function.prototype.apply});var QEt=v((s1o,XEt)=>{"use strict";XEt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var tTt=v((u1o,eTt)=>{"use strict";var Mjr=e5(),Rjr=TAe(),Njr=doe(),jjr=QEt();eTt.exports=jjr||Mjr.call(Njr,Rjr)});var AAe=v((l1o,rTt)=>{"use strict";var Djr=e5(),Ljr=Wj(),Fjr=doe(),kjr=tTt();rTt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Ljr("a function is required");return kjr(Djr,Fjr,e)}});var uTt=v((c1o,sTt)=>{"use strict";var $jr=AAe(),nTt=OAe(),iTt;try{iTt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var IAe=!!iTt&&nTt&&nTt(Object.prototype,"__proto__"),aTt=Object,oTt=aTt.getPrototypeOf;sTt.exports=IAe&&typeof IAe.get=="function"?$jr([IAe.get]):typeof oTt=="function"?function(e){return oTt(e==null?e:aTt(e))}:!1});var pTt=v((d1o,fTt)=>{"use strict";var lTt=PAe(),cTt=EAe(),dTt=uTt();fTt.exports=lTt?function(e){return lTt(e)}:cTt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return cTt(e)}:dTt?function(e){return dTt(e)}:null});var hTt=v((f1o,mTt)=>{"use strict";var zjr=Function.prototype.call,Bjr=Object.prototype.hasOwnProperty,Ujr=e5();mTt.exports=Ujr.call(zjr,Bjr)});var moe=v((p1o,wTt)=>{"use strict";var Wn,qjr=CAe(),Hjr=sEt(),Vjr=lEt(),Wjr=dEt(),Kjr=pEt(),AB=hEt(),TB=Wj(),Gjr=yEt(),Jjr=_Et(),Zjr=wEt(),Yjr=SEt(),Xjr=OEt(),Qjr=EEt(),eDr=AEt(),tDr=NEt(),_Tt=Function,MAe=function(t){try{return _Tt('"use strict"; return ('+t+").constructor;")()}catch{}},t5=OAe(),rDr=kEt(),RAe=function(){throw new TB},nDr=t5?function(){try{return arguments.callee,RAe}catch{try{return t5(arguments,"callee").get}catch{return RAe}}}():RAe,PB=qEt()(),bc=pTt(),oDr=EAe(),iDr=PAe(),vTt=TAe(),r5=doe(),EB={},aDr=typeof Uint8Array>"u"||!bc?Wn:bc(Uint8Array),Kj={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Wn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Wn:ArrayBuffer,"%ArrayIteratorPrototype%":PB&&bc?bc([][Symbol.iterator]()):Wn,"%AsyncFromSyncIteratorPrototype%":Wn,"%AsyncFunction%":EB,"%AsyncGenerator%":EB,"%AsyncGeneratorFunction%":EB,"%AsyncIteratorPrototype%":EB,"%Atomics%":typeof Atomics>"u"?Wn:Atomics,"%BigInt%":typeof BigInt>"u"?Wn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Wn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Wn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Wn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Hjr,"%eval%":eval,"%EvalError%":Vjr,"%Float32Array%":typeof Float32Array>"u"?Wn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Wn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Wn:FinalizationRegistry,"%Function%":_Tt,"%GeneratorFunction%":EB,"%Int8Array%":typeof Int8Array>"u"?Wn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Wn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Wn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":PB&&bc?bc(bc([][Symbol.iterator]())):Wn,"%JSON%":typeof JSON=="object"?JSON:Wn,"%Map%":typeof Map>"u"?Wn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!PB||!bc?Wn:bc(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":qjr,"%Object.getOwnPropertyDescriptor%":t5,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Wn:Promise,"%Proxy%":typeof Proxy>"u"?Wn:Proxy,"%RangeError%":Wjr,"%ReferenceError%":Kjr,"%Reflect%":typeof Reflect>"u"?Wn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Wn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!PB||!bc?Wn:bc(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Wn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":PB&&bc?bc(""[Symbol.iterator]()):Wn,"%Symbol%":PB?Symbol:Wn,"%SyntaxError%":AB,"%ThrowTypeError%":nDr,"%TypedArray%":aDr,"%TypeError%":TB,"%Uint8Array%":typeof Uint8Array>"u"?Wn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Wn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Wn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Wn:Uint32Array,"%URIError%":Gjr,"%WeakMap%":typeof WeakMap>"u"?Wn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Wn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Wn:WeakSet,"%Function.prototype.call%":r5,"%Function.prototype.apply%":vTt,"%Object.defineProperty%":rDr,"%Object.getPrototypeOf%":oDr,"%Math.abs%":Jjr,"%Math.floor%":Zjr,"%Math.max%":Yjr,"%Math.min%":Xjr,"%Math.pow%":Qjr,"%Math.round%":eDr,"%Math.sign%":tDr,"%Reflect.getPrototypeOf%":iDr};if(bc)try{null.error}catch(t){gTt=bc(bc(t)),Kj["%Error.prototype%"]=gTt}var gTt,sDr=function t(e){var r;if(e==="%AsyncFunction%")r=MAe("async function () {}");else if(e==="%GeneratorFunction%")r=MAe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=MAe("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 Kj[e]=r,r},yTt={__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"]},n5=e5(),foe=hTt(),uDr=n5.call(r5,Array.prototype.concat),lDr=n5.call(vTt,Array.prototype.splice),bTt=n5.call(r5,String.prototype.replace),poe=n5.call(r5,String.prototype.slice),cDr=n5.call(r5,RegExp.prototype.exec),dDr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,fDr=/\\(\\)?/g,pDr=function(e){var r=poe(e,0,1),n=poe(e,-1);if(r==="%"&&n!=="%")throw new AB("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new AB("invalid intrinsic syntax, expected opening `%`");var o=[];return bTt(e,dDr,function(i,a,s,u){o[o.length]=s?bTt(u,fDr,"$1"):a||i}),o},mDr=function(e,r){var n=e,o;if(foe(yTt,n)&&(o=yTt[n],n="%"+o[0]+"%"),foe(Kj,n)){var i=Kj[n];if(i===EB&&(i=sDr(n)),typeof i>"u"&&!r)throw new TB("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new AB("intrinsic "+e+" does not exist!")};wTt.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new TB("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new TB('"allowMissing" argument must be a boolean');if(cDr(/^%?[^%]*%?$/,e)===null)throw new AB("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=pDr(e),o=n.length>0?n[0]:"",i=mDr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],lDr(n,uDr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=poe(f,0,1),m=poe(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new AB("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",foe(Kj,a))s=Kj[a];else if(s!=null){if(!(f in s)){if(!r)throw new TB("base intrinsic for "+e+" exists, but the property is not available.");return}if(t5&&c+1>=n.length){var h=t5(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=foe(s,f),s=s[f];d&&!u&&(Kj[a]=s)}}return s}});var NAe=v((m1o,CTt)=>{"use strict";var xTt=moe(),STt=AAe(),hDr=STt([xTt("%String.prototype.indexOf%")]);CTt.exports=function(e,r){var n=xTt(e,!!r);return typeof n=="function"&&hDr(e,".prototype.")>-1?STt([n]):n}});var jAe=v((h1o,PTt)=>{"use strict";var gDr=moe(),o5=NAe(),yDr=QV(),bDr=Wj(),OTt=gDr("%Map%",!0),_Dr=o5("Map.prototype.get",!0),vDr=o5("Map.prototype.set",!0),wDr=o5("Map.prototype.has",!0),xDr=o5("Map.prototype.delete",!0),SDr=o5("Map.prototype.size",!0);PTt.exports=!!OTt&&function(){var e,r={assert:function(n){if(!r.has(n))throw new bDr("Side channel does not contain "+yDr(n))},delete:function(n){if(e){var o=xDr(e,n);return SDr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return _Dr(e,n)},has:function(n){return e?wDr(e,n):!1},set:function(n,o){e||(e=new OTt),vDr(e,n,o)}};return r}});var TTt=v((g1o,ETt)=>{"use strict";var CDr=moe(),goe=NAe(),ODr=QV(),hoe=jAe(),PDr=Wj(),IB=CDr("%WeakMap%",!0),EDr=goe("WeakMap.prototype.get",!0),TDr=goe("WeakMap.prototype.set",!0),ADr=goe("WeakMap.prototype.has",!0),IDr=goe("WeakMap.prototype.delete",!0);ETt.exports=IB?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new PDr("Side channel does not contain "+ODr(o))},delete:function(o){if(IB&&o&&(typeof o=="object"||typeof o=="function")){if(e)return IDr(e,o)}else if(hoe&&r)return r.delete(o);return!1},get:function(o){return IB&&o&&(typeof o=="object"||typeof o=="function")&&e?EDr(e,o):r&&r.get(o)},has:function(o){return IB&&o&&(typeof o=="object"||typeof o=="function")&&e?ADr(e,o):!!r&&r.has(o)},set:function(o,i){IB&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new IB),TDr(e,o,i)):hoe&&(r||(r=hoe()),r.set(o,i))}};return n}:hoe});var ITt=v((y1o,ATt)=>{"use strict";var MDr=Wj(),RDr=QV(),NDr=oEt(),jDr=jAe(),DDr=TTt(),LDr=DDr||jDr||NDr;ATt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new MDr("Side channel does not contain "+RDr(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=LDr()),e.set(n,o)}};return r}});var yoe=v((b1o,MTt)=>{"use strict";var FDr=String.prototype.replace,kDr=/%20/g,DAe={RFC1738:"RFC1738",RFC3986:"RFC3986"};MTt.exports={default:DAe.RFC3986,formatters:{RFC1738:function(t){return FDr.call(t,kDr,"+")},RFC3986:function(t){return String(t)}},RFC1738:DAe.RFC1738,RFC3986:DAe.RFC3986}});var FAe=v((_1o,NTt)=>{"use strict";var $Dr=yoe(),LAe=Object.prototype.hasOwnProperty,Gj=Array.isArray,Bv=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),zDr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Gj(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},RTt=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},BDr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(Gj(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!LAe.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 Gj(e)&&!Gj(r)&&(o=RTt(e,n)),Gj(e)&&Gj(r)?(r.forEach(function(i,a){if(LAe.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 LAe.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},UDr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},qDr=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}},HDr=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===$Dr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+Bv[l];continue}if(l<2048){s=s+(Bv[192|l>>6]+Bv[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Bv[224|l>>12]+Bv[128|l>>6&63]+Bv[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=Bv[240|l>>18]+Bv[128|l>>12&63]+Bv[128|l>>6&63]+Bv[128|l&63]}return s},VDr=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 zDr(r),e},WDr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},KDr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},GDr=function(e,r){return[].concat(e,r)},JDr=function(e,r){if(Gj(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};NTt.exports={arrayToObject:RTt,assign:UDr,combine:GDr,compact:VDr,decode:qDr,encode:HDr,isBuffer:KDr,isRegExp:WDr,maybeMap:JDr,merge:BDr}});var $Tt=v((v1o,kTt)=>{"use strict";var LTt=ITt(),boe=FAe(),i5=yoe(),ZDr=Object.prototype.hasOwnProperty,jTt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},IP=Array.isArray,YDr=Array.prototype.push,FTt=function(t,e){YDr.apply(t,IP(e)?e:[e])},XDr=Date.prototype.toISOString,DTt=i5.default,Sf={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:boe.encode,encodeValuesOnly:!1,format:DTt,formatter:i5.formatters[DTt],indices:!1,serializeDate:function(e){return XDr.call(e)},skipNulls:!1,strictNullHandling:!1},QDr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},kAe={},eLr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b){for(var g=e,y=b,x=0,S=!1;(y=y.get(kAe))!==void 0&&!S;){var O=y.get(e);if(x+=1,typeof O<"u"){if(O===x)throw new RangeError("Cyclic object value");S=!0}typeof y.get(kAe)>"u"&&(x=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&IP(g)&&(g=boe.maybeMap(g,function(V){return V instanceof Date?d(V):V})),g===null){if(i)return s&&!m?s(r,Sf.encoder,h,"key",f):r;g=""}if(QDr(g)||boe.isBuffer(g)){if(s){var E=m?r:s(r,Sf.encoder,h,"key",f);return[p(E)+"="+p(s(g,Sf.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var P=[];if(typeof g>"u")return P;var A;if(n==="comma"&&IP(g))m&&s&&(g=boe.maybeMap(g,s)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(IP(u))A=u;else{var I=Object.keys(g);A=l?I.sort(l):I}for(var R=o&&IP(g)&&g.length===1?r+"[]":r,N=0;N<A.length;++N){var j=A[N],$=typeof j=="object"&&typeof j.value<"u"?j.value:g[j];if(!(a&&$===null)){var k=IP(g)?typeof n=="function"?n(R,j):R:R+(c?"."+j:"["+j+"]");b.set(e,x);var H=LTt();H.set(kAe,b),FTt(P,t($,k,n,o,i,a,n==="comma"&&m&&IP(g)?null:s,u,l,c,d,f,p,m,h,H))}}return P},tLr=function(e){if(!e)return Sf;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||Sf.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=i5.default;if(typeof e.format<"u"){if(!ZDr.call(i5.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=i5.formatters[n],i=Sf.filter;return(typeof e.filter=="function"||IP(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Sf.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Sf.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Sf.charsetSentinel,delimiter:typeof e.delimiter>"u"?Sf.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Sf.encode,encoder:typeof e.encoder=="function"?e.encoder:Sf.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Sf.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Sf.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Sf.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Sf.strictNullHandling}};kTt.exports=function(t,e){var r=t,n=tLr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):IP(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in jTt?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=jTt[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=LTt(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||FTt(a,eLr(r[f],f,u,l,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var p=a.join(n.delimiter),m=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""}});var UTt=v((w1o,BTt)=>{"use strict";var MB=FAe(),$Ae=Object.prototype.hasOwnProperty,rLr=Array.isArray,_c={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:MB.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},nLr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},zTt=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},oLr="utf8=%26%2310003%3B",iLr="utf8=%E2%9C%93",aLr=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]===iLr?l="utf-8":a[u]===oLr&&(l="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var c=a[u],d=c.indexOf("]="),f=d===-1?c.indexOf("="):d+1,p,m;f===-1?(p=r.decoder(c,_c.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),_c.decoder,l,"key"),m=MB.maybeMap(zTt(c.slice(f+1),r),function(h){return r.decoder(h,_c.decoder,l,"value")})),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=nLr(m)),c.indexOf("[]=")>-1&&(m=rLr(m)?[m]:m),$Ae.call(n,p)?n[p]=MB.combine(n[p],m):n[p]=m}return n},sLr=function(t,e,r,n){for(var o=n?e:zTt(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},uLr=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&&$Ae.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&&$Ae.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),sLr(c,r,n,o)}},lLr=function(e){if(!e)return _c;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"?_c.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?_c.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:_c.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:_c.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:_c.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:_c.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:_c.comma,decoder:typeof e.decoder=="function"?e.decoder:_c.decoder,delimiter:typeof e.delimiter=="string"||MB.isRegExp(e.delimiter)?e.delimiter:_c.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:_c.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:_c.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:_c.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:_c.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:_c.strictNullHandling}};BTt.exports=function(t,e){var r=lLr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?aLr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=uLr(s,n[s],r,typeof t=="string");o=MB.merge(o,u,r)}return r.allowSparse===!0?o:MB.compact(o)}});var HTt=v((x1o,qTt)=>{"use strict";var cLr=$Tt(),dLr=UTt(),fLr=yoe();qTt.exports={formats:fLr,parse:dLr,stringify:cLr}});var VTt=v(RB=>{"use strict";var pLr=RB&&RB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(RB,"__esModule",{value:!0});RB.createRequestUrl=void 0;var mLr=pLr(HTt());function hLr(t,e){return Object.keys(e??{}).length>0?`${t}?${mLr.default.stringify(e,{arrayFormat:"repeat"})}`:t}RB.createRequestUrl=hLr});var GTt=v(_oe=>{"use strict";var zAe,BAe,UAe,qAe,HAe;Object.defineProperty(_oe,"__esModule",{value:!0});_oe.RUNTIME=void 0;var gLr=typeof window<"u"&&typeof window.document<"u",yLr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((zAe=self.constructor)===null||zAe===void 0?void 0:zAe.name)==="DedicatedWorkerGlobalScope"||((BAe=self.constructor)===null||BAe===void 0?void 0:BAe.name)==="ServiceWorkerGlobalScope"||((UAe=self.constructor)===null||UAe===void 0?void 0:UAe.name)==="SharedWorkerGlobalScope"),WTt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",KTt=typeof Bun<"u"&&typeof Bun.version<"u",bLr=typeof process<"u"&&!!process.version&&!!(!((qAe=process.versions)===null||qAe===void 0)&&qAe.node)&&!WTt&&!KTt,_Lr=typeof navigator<"u"&&navigator?.product==="ReactNative",vLr=typeof globalThis<"u"&&((HAe=globalThis?.navigator)===null||HAe===void 0?void 0:HAe.userAgent)==="Cloudflare-Workers";_oe.RUNTIME=wLr();function wLr(){return gLr?{type:"browser",version:window.navigator.userAgent}:vLr?{type:"workerd"}:yLr?{type:"web-worker"}:WTt?{type:"deno",version:Deno.version.deno}:KTt?{type:"bun",version:Bun.version}:bLr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:_Lr?{type:"react-native"}:{type:"unknown"}}});var NB=v(voe=>{"use strict";Object.defineProperty(voe,"__esModule",{value:!0});voe.RUNTIME=void 0;var xLr=GTt();Object.defineProperty(voe,"RUNTIME",{enumerable:!0,get:function(){return xLr.RUNTIME}})});var VAe=v((jB,JTt)=>{"use strict";var SLr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},Jj=SLr();JTt.exports=jB=Jj.fetch;Jj.fetch&&(jB.default=Jj.fetch.bind(Jj));jB.Headers=Jj.Headers;jB.Request=Jj.Request;jB.Response=Jj.Response});var YTt=v($g=>{"use strict";var CLr=$g&&$g.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OLr=$g&&$g.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZTt=$g&&$g.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CLr(e,t,r);return OLr(e,t),e},PLr=$g&&$g.__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($g,"__esModule",{value:!0});$g.getFetchFn=void 0;var woe=NB();function ELr(){return PLr(this,void 0,void 0,function*(){return woe.RUNTIME.type==="node"&&woe.RUNTIME.parsedVersion!=null&&woe.RUNTIME.parsedVersion>=18?fetch:woe.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>ZTt(VAe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>ZTt(VAe()))).default})}$g.getFetchFn=ELr});var XTt=v(DB=>{"use strict";var TLr=DB&&DB.__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(DB,"__esModule",{value:!0});DB.getRequestBody=void 0;function ALr({body:t,type:e}){return TLr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}DB.getRequestBody=ALr});var QTt=v(LB=>{"use strict";var xb=LB&&LB.__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(LB,"__esModule",{value:!0});LB.Node18UniversalStreamWrapper=void 0;var WAe=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=>xb(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",()=>xb(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>xb(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=>xb(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",()=>xb(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>xb(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 xb(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 xb(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 xb(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 xb(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:()=>xb(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}}}};LB.Node18UniversalStreamWrapper=WAe});var eAt=v(FB=>{"use strict";var a5=FB&&FB.__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(FB,"__esModule",{value:!0});FB.UndiciStreamWrapper=void 0;var KAe=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 a5(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 a5(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 a5(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 a5(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:()=>a5(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}}}};FB.UndiciStreamWrapper=KAe});var tAt=v(TI=>{"use strict";var xoe=TI&&TI.__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())})},ILr=TI&&TI.__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(TI,"__esModule",{value:!0});TI.NodePre18StreamWrapper=void 0;var GAe=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 xoe(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 xoe(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=ILr(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 xoe(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 xoe(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};TI.NodePre18StreamWrapper=GAe});var rAt=v(zg=>{"use strict";var MLr=zg&&zg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RLr=zg&&zg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAe=zg&&zg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MLr(e,t,r);return RLr(e,t),e},NLr=zg&&zg.__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(zg,"__esModule",{value:!0});zg.chooseStreamWrapper=void 0;var Soe=NB();function jLr(t){return NLr(this,void 0,void 0,function*(){return Soe.RUNTIME.type==="node"&&Soe.RUNTIME.parsedVersion!=null&&Soe.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>JAe(QTt()))).Node18UniversalStreamWrapper(t):Soe.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>JAe(eAt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>JAe(tAt()))).NodePre18StreamWrapper(t)})}zg.chooseStreamWrapper=jLr});var nAt=v(kB=>{"use strict";var DLr=kB&&kB.__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(kB,"__esModule",{value:!0});kB.getResponseBody=void 0;var LLr=rAt();function FLr(t,e){return DLr(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,LLr.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}})}kB.getResponseBody=FLr});var oAt=v($B=>{"use strict";Object.defineProperty($B,"__esModule",{value:!0});$B.anySignal=$B.getTimeoutSignal=void 0;var kLr="timeout";function $Lr(t){let e=new AbortController,r=setTimeout(()=>e.abort(kLr),t);return{signal:e.signal,abortId:r}}$B.getTimeoutSignal=$Lr;function zLr(...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}$B.anySignal=zLr});var aAt=v(zB=>{"use strict";var BLr=zB&&zB.__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(zB,"__esModule",{value:!0});zB.makeRequest=void 0;var iAt=oAt(),ULr=(t,e,r,n,o,i,a,s,u)=>BLr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,iAt.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,iAt.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});zB.makeRequest=ULr});var sAt=v(BB=>{"use strict";var qLr=BB&&BB.__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(BB,"__esModule",{value:!0});BB.requestWithRetries=void 0;var HLr=1,VLr=60,WLr=2;function KLr(t,e=WLr){return qLr(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(HLr*Math.pow(2,n),VLr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}BB.requestWithRetries=KLr});var cAt=v(AI=>{"use strict";var uAt=AI&&AI.__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(AI,"__esModule",{value:!0});AI.fetcher=AI.fetcherImpl=void 0;var GLr=VTt(),JLr=YTt(),ZLr=XTt(),YLr=nAt(),XLr=aAt(),QLr=sAt();function lAt(t){return uAt(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,GLr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,ZLr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,JLr.getFetchFn)();try{let i=yield(0,QLr.requestWithRetries)(()=>uAt(this,void 0,void 0,function*(){return(0,XLr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,YLr.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)}}}})}AI.fetcherImpl=lAt;AI.fetcher=lAt});var dAt=v(Coe=>{"use strict";Object.defineProperty(Coe,"__esModule",{value:!0});Coe.getHeader=void 0;function eFr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}Coe.getHeader=eFr});var fAt=v(UB=>{"use strict";var tFr=UB&&UB.__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(UB,"__esModule",{value:!0});UB.Supplier=void 0;UB.Supplier={get:t=>tFr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var pAt=v(II=>{"use strict";Object.defineProperty(II,"__esModule",{value:!0});II.Supplier=II.getHeader=II.fetcher=void 0;var rFr=cAt();Object.defineProperty(II,"fetcher",{enumerable:!0,get:function(){return rFr.fetcher}});var nFr=dAt();Object.defineProperty(II,"getHeader",{enumerable:!0,get:function(){return nFr.getHeader}});var oFr=fAt();Object.defineProperty(II,"Supplier",{enumerable:!0,get:function(){return oFr.Supplier}})});var mAt=v((ZAe,YAe)=>{(function(t,e){typeof ZAe=="object"&&typeof YAe<"u"?YAe.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:ZAe,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(U){var W={};return U.forEach(function(Y,se){return W[Y]=se}),W}(u),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(U,W){return W===void 0&&(W=function(Y){return Y}),new Uint8Array(Array.prototype.slice.call(U,0).map(W))},p=function(U){return U.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},m=function(U){return U.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(U){for(var W,Y,se,Te,de="",Ue=U.length%3,Ke=0;Ke<U.length;){if((Y=U.charCodeAt(Ke++))>255||(se=U.charCodeAt(Ke++))>255||(Te=U.charCodeAt(Ke++))>255)throw new TypeError("invalid character found");W=Y<<16|se<<8|Te,de+=u[W>>18&63]+u[W>>12&63]+u[W>>6&63]+u[W&63]}return Ue?de.slice(0,Ue-3)+"===".substring(Ue):de},b=n?function(U){return btoa(U)}:o?function(U){return Buffer.from(U,"binary").toString("base64")}:h,g=o?function(U){return Buffer.from(U).toString("base64")}:function(U){for(var W=4096,Y=[],se=0,Te=U.length;se<Te;se+=W)Y.push(d.apply(null,U.subarray(se,se+W)));return b(Y.join(""))},y=function(U,W){return W===void 0&&(W=!1),W?p(g(U)):g(U)},x=function(U){if(U.length<2){var W=U.charCodeAt(0);return W<128?U:W<2048?d(192|W>>>6)+d(128|W&63):d(224|W>>>12&15)+d(128|W>>>6&63)+d(128|W&63)}else{var W=65536+(U.charCodeAt(0)-55296)*1024+(U.charCodeAt(1)-56320);return d(240|W>>>18&7)+d(128|W>>>12&63)+d(128|W>>>6&63)+d(128|W&63)}},S=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(U){return U.replace(S,x)},E=o?function(U){return Buffer.from(U,"utf8").toString("base64")}:a?function(U){return g(a.encode(U))}:function(U){return b(O(U))},P=function(U,W){return W===void 0&&(W=!1),W?p(E(U)):E(U)},A=function(U){return P(U,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(U){switch(U.length){case 4:var W=(7&U.charCodeAt(0))<<18|(63&U.charCodeAt(1))<<12|(63&U.charCodeAt(2))<<6|63&U.charCodeAt(3),Y=W-65536;return d((Y>>>10)+55296)+d((Y&1023)+56320);case 3:return d((15&U.charCodeAt(0))<<12|(63&U.charCodeAt(1))<<6|63&U.charCodeAt(2));default:return d((31&U.charCodeAt(0))<<6|63&U.charCodeAt(1))}},N=function(U){return U.replace(I,R)},j=function(U){if(U=U.replace(/\s+/g,""),!c.test(U))throw new TypeError("malformed base64.");U+="==".slice(2-(U.length&3));for(var W,Y="",se,Te,de=0;de<U.length;)W=l[U.charAt(de++)]<<18|l[U.charAt(de++)]<<12|(se=l[U.charAt(de++)])<<6|(Te=l[U.charAt(de++)]),Y+=se===64?d(W>>16&255):Te===64?d(W>>16&255,W>>8&255):d(W>>16&255,W>>8&255,W&255);return Y},$=r?function(U){return atob(m(U))}:o?function(U){return Buffer.from(U,"base64").toString("binary")}:j,k=o?function(U){return f(Buffer.from(U,"base64"))}:function(U){return f($(U),function(W){return W.charCodeAt(0)})},H=function(U){return k(Q(U))},V=o?function(U){return Buffer.from(U,"base64").toString("utf8")}:i?function(U){return i.decode(k(U))}:function(U){return N($(U))},Q=function(U){return m(U.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},Z=function(U){return V(Q(U))},D=function(U){if(typeof U!="string")return!1;var W=U.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},z=function(U){return{value:U,enumerable:!1,writable:!0,configurable:!0}},B=function(){var U=function(W,Y){return Object.defineProperty(String.prototype,W,z(Y))};U("fromBase64",function(){return Z(this)}),U("toBase64",function(W){return P(this,W)}),U("toBase64URI",function(){return P(this,!0)}),U("toBase64URL",function(){return P(this,!0)}),U("toUint8Array",function(){return H(this)})},K=function(){var U=function(W,Y){return Object.defineProperty(Uint8Array.prototype,W,z(Y))};U("toBase64",function(W){return y(this,W)}),U("toBase64URI",function(){return y(this,!0)}),U("toBase64URL",function(){return y(this,!0)})},q=function(){B(),K()},te={version:t,VERSION:e,atob:$,atobPolyfill:j,btoa:b,btoaPolyfill:h,fromBase64:Z,toBase64:P,encode:P,encodeURI:A,encodeURL:A,utob:O,btou:N,decode:Z,isValid:D,fromUint8Array:y,toUint8Array:H,extendString:B,extendUint8Array:K,extendBuiltins:q};return te.Base64={},Object.keys(te).forEach(function(U){return te.Base64[U]=te[U]}),te})});var gAt=v(Ooe=>{"use strict";Object.defineProperty(Ooe,"__esModule",{value:!0});Ooe.BasicAuth=void 0;var hAt=mAt(),iFr=/^Basic /i;Ooe.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${hAt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(iFr,""),r=hAt.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 yAt=v(Poe=>{"use strict";Object.defineProperty(Poe,"__esModule",{value:!0});Poe.BearerToken=void 0;var aFr=/^Bearer /i;Poe.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(aFr,"").trim()}});var bAt=v(qB=>{"use strict";Object.defineProperty(qB,"__esModule",{value:!0});qB.BearerToken=qB.BasicAuth=void 0;var sFr=gAt();Object.defineProperty(qB,"BasicAuth",{enumerable:!0,get:function(){return sFr.BasicAuth}});var uFr=yAt();Object.defineProperty(qB,"BearerToken",{enumerable:!0,get:function(){return uFr.BearerToken}})});var QAe=v(im=>{"use strict";var _At=im&&im.__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())})},vAt=im&&im.__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)}},Sb=im&&im.__await||function(t){return this instanceof Sb?(this.v=t,this):new Sb(t)},wAt=im&&im.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Sb?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(im,"__esModule",{value:!0});im.readableStreamAsyncIterable=im.Stream=void 0;var lFr=NB(),cFr="data:",XAe=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=cFr,this.messageTerminator=`
|
||
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return wAt(this,arguments,function*(){var r,n;this.controller.signal;let o=xAt(this.stream),i="",a=!1;try{for(var s=vAt(o),u;u=yield Sb(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 Sb(void 0);let f=yield Sb(this.parse(JSON.parse(d)));yield yield Sb(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield Sb(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return wAt(this,arguments,function*(){var r,n;try{for(var o=vAt(this.iterMessages()),i;i=yield Sb(o.next()),!i.done;){let a=i.value;yield yield Sb(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield Sb(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 lFr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};im.Stream=XAe;function xAt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return _At(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 _At(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}im.readableStreamAsyncIterable=xAt});var SAt=v(Eoe=>{"use strict";Object.defineProperty(Eoe,"__esModule",{value:!0});Eoe.Stream=void 0;var dFr=QAe();Object.defineProperty(Eoe,"Stream",{enumerable:!0,get:function(){return dFr.Stream}})});var PAt=v((V1o,OAt)=>{"use strict";var eIe=Object.defineProperty,fFr=Object.getOwnPropertyDescriptor,pFr=Object.getOwnPropertyNames,mFr=Object.prototype.hasOwnProperty,hFr=(t,e)=>{for(var r in e)eIe(t,r,{get:e[r],enumerable:!0})},gFr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pFr(e))!mFr.call(t,o)&&o!==r&&eIe(t,o,{get:()=>e[o],enumerable:!(n=fFr(e,o))||n.enumerable});return t},yFr=t=>gFr(eIe({},"__esModule",{value:!0}),t),CAt={};hFr(CAt,{Blob:()=>vFr,File:()=>wFr,FormData:()=>_Fr});OAt.exports=yFr(CAt);var bFr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:_Fr,Blob:vFr,File:wFr}=bFr});var $At=v((W1o,kAt)=>{"use strict";var nIe=Object.defineProperty,xFr=Object.getOwnPropertyDescriptor,SFr=Object.getOwnPropertyNames,CFr=Object.prototype.hasOwnProperty,OFr=(t,e)=>{for(var r in e)nIe(t,r,{get:e[r],enumerable:!0})},PFr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of SFr(e))!CFr.call(t,o)&&o!==r&&nIe(t,o,{get:()=>e[o],enumerable:!(n=xFr(e,o))||n.enumerable});return t},EFr=t=>PFr(nIe({},"__esModule",{value:!0}),t),oIe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Os=(t,e,r)=>(oIe(t,e,"read from private field"),r?r.call(t):e.get(t)),Uv=(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)},s5=(t,e,r,n)=>(oIe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),tIe=(t,e,r)=>(oIe(t,e,"access private method"),r),NAt={};OFr(NAt,{FormDataEncoder:()=>DFr,isFile:()=>Yj,isFormData:()=>LAt});kAt.exports=EFr(NAt);var MP=t=>typeof t=="function",TFr=t=>MP(t[Symbol.asyncIterator]),EAt=65536;function*jAt(t){if(t.byteLength<=EAt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,EAt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*AFr(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*TAt(t){for await(let e of t)yield*jAt(e)}var IFr=t=>{if(TFr(t))return TAt(t);if(MP(t.getReader))return TAt(AFr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},AAt="abcdefghijklmnopqrstuvwxyz0123456789";function MFr(){let t=16,e="";for(;t--;)e+=AAt[Math.random()*AAt.length<<0];return e}var DAt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
|
||
`||e===`
|
||
`&&n[r-1]!=="\r"?`\r
|
||
`:e),RFr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function IAt(t){if(RFr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function MAt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var NFr=t=>new Proxy(t,{get:(e,r)=>MAt(e,r),has:(e,r)=>MAt(e,r)!==void 0}),LAt=t=>!!(t&&MP(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&MP(t.append)&&MP(t.getAll)&&MP(t.entries)&&MP(t[Symbol.iterator])),RAt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),Yj=t=>!!(t&&typeof t=="object"&&MP(t.constructor)&&t[Symbol.toStringTag]==="File"&&MP(t.stream)&&t.name!=null),jFr={enableAdditionalHeaders:!1},Toe={writable:!1,configurable:!1},MI,u5,Aoe,l5,Zj,c5,d5,Ioe,Moe,iIe,rIe,FAt,DFr=class{constructor(t,e,r){if(Uv(this,Moe),Uv(this,rIe),Uv(this,MI,`\r
|
||
`),Uv(this,u5,void 0),Uv(this,Aoe,void 0),Uv(this,l5,"-".repeat(2)),Uv(this,Zj,new TextEncoder),Uv(this,c5,void 0),Uv(this,d5,void 0),Uv(this,Ioe,void 0),!LAt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(IAt(e)?r=e:n=e,n||(n=MFr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!IAt(r))throw new TypeError("Expected options argument to be an object.");s5(this,d5,Array.from(t.entries())),s5(this,Ioe,{...jFr,...r}),s5(this,u5,Os(this,Zj).encode(Os(this,MI))),s5(this,Aoe,Os(this,u5).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,s5(this,c5,Os(this,Zj).encode(`${Os(this,l5)}${this.boundary}${Os(this,l5)}${Os(this,MI).repeat(2)}`));let o={"Content-Type":this.contentType},i=tIe(this,rIe,FAt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=NFr(Object.freeze(o)),Object.defineProperties(this,{boundary:Toe,contentType:Toe,contentLength:Toe,headers:Toe})}*values(){for(let[t,e]of Os(this,d5)){let r=Yj(e)?e:Os(this,Zj).encode(DAt(e));yield tIe(this,Moe,iIe).call(this,t,r),yield r,yield Os(this,u5)}yield Os(this,c5)}async*encode(){for(let t of this.values())Yj(t)?yield*IFr(t.stream()):yield*jAt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};MI=new WeakMap;u5=new WeakMap;Aoe=new WeakMap;l5=new WeakMap;Zj=new WeakMap;c5=new WeakMap;d5=new WeakMap;Ioe=new WeakMap;Moe=new WeakSet;iIe=function(t,e){let r="";if(r+=`${Os(this,l5)}${this.boundary}${Os(this,MI)}`,r+=`Content-Disposition: form-data; name="${RAt(t)}"`,Yj(e)&&(r+=`; filename="${RAt(e.name)}"${Os(this,MI)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Os(this,Ioe).enableAdditionalHeaders===!0){let n=Yj(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Os(this,MI)}Content-Length: ${n}`)}return Os(this,Zj).encode(`${r}${Os(this,MI).repeat(2)}`)};rIe=new WeakSet;FAt=function(){let t=0;for(let[e,r]of Os(this,d5)){let n=Yj(r)?r:Os(this,Zj).encode(DAt(r)),o=Yj(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=tIe(this,Moe,iIe).call(this,e,n).byteLength,t+=o,t+=Os(this,Aoe)}return String(t+Os(this,c5).byteLength)}});var BAt=v((G1o,zAt)=>{zAt.exports=typeof self=="object"?self.FormData:window.FormData});var UAt=v(vc=>{"use strict";var LFr=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]}),FFr=vc&&vc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HB=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)&&LFr(e,t,r);return FFr(e,t),e},RI=vc&&vc.__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(vc,"__esModule",{value:!0});vc.WebFormData=vc.Node16FormData=vc.Node18FormData=vc.newFormData=void 0;var Roe=NB();function aIe(t){return typeof t=="object"&&t!=null&&"name"in t}function kFr(){return RI(this,void 0,void 0,function*(){let t;return Roe.RUNTIME.type==="node"&&Roe.RUNTIME.parsedVersion!=null&&Roe.RUNTIME.parsedVersion>=18?t=new Noe:Roe.RUNTIME.type==="node"?t=new joe:t=new Doe,yield t.setup(),t})}vc.newFormData=kFr;var Noe=class{setup(){return RI(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>HB(PAt()))).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 RI(this,void 0,void 0,function*(){n==null&&aIe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>HB(JV()))).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 RI(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>HB($At()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>HB(JV()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};vc.Node18FormData=Noe;var joe=class{setup(){return RI(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>HB(BAt()))).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 RI(this,void 0,void 0,function*(){n==null&&aIe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>HB(JV()))).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():{}}}};vc.Node16FormData=joe;var Doe=class{setup(){return RI(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 RI(this,void 0,void 0,function*(){n==null&&aIe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};vc.WebFormData=Doe});var qAt=v(Xj=>{"use strict";var $Fr=Xj&&Xj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zFr=Xj&&Xj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Fr(e,t,r)};Object.defineProperty(Xj,"__esModule",{value:!0});zFr(UAt(),Xj)});var fd=v(Loe=>{"use strict";Object.defineProperty(Loe,"__esModule",{value:!0});Loe.SchemaType=void 0;Loe.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 am=v(Foe=>{"use strict";Object.defineProperty(Foe,"__esModule",{value:!0});Foe.getErrorMessageForIncorrectType=void 0;function BFr(t,e){return`Expected ${e}. Received ${UFr(t)}.`}Foe.getErrorMessageForIncorrectType=BFr;function UFr(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 RP=v(koe=>{"use strict";Object.defineProperty(koe,"__esModule",{value:!0});koe.maybeSkipValidation=void 0;function qFr(t){return Object.assign(Object.assign({},t),{json:HAt(t.json),parse:HAt(t.parse)})}koe.maybeSkipValidation=qFr;function HAt(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 sIe=v($oe=>{"use strict";Object.defineProperty($oe,"__esModule",{value:!0});$oe.stringifyValidationError=void 0;function HFr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}$oe.stringifyValidationError=HFr});var lIe=v(zoe=>{"use strict";Object.defineProperty(zoe,"__esModule",{value:!0});zoe.JsonError=void 0;var VFr=sIe(),uIe=class t extends Error{constructor(e){super(e.map(VFr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};zoe.JsonError=uIe});var dIe=v(Boe=>{"use strict";Object.defineProperty(Boe,"__esModule",{value:!0});Boe.ParseError=void 0;var WFr=sIe(),cIe=class t extends Error{constructor(e){super(e.map(WFr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};Boe.ParseError=cIe});var KAt=v(NI=>{"use strict";Object.defineProperty(NI,"__esModule",{value:!0});NI.transform=NI.optional=NI.getSchemaUtils=void 0;var KFr=fd(),GFr=lIe(),JFr=dIe();function fIe(t){return{optional:()=>VAt(t),transform:e=>WAt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new JFr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new GFr.JsonError(n.errors)}}}NI.getSchemaUtils=fIe;function VAt(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:()=>KFr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),fIe(e))}NI.optional=VAt;function WAt(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),fIe(r))}NI.transform=WAt});var uh=v(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});Bg.ParseError=Bg.JsonError=Bg.transform=Bg.optional=Bg.getSchemaUtils=void 0;var pIe=KAt();Object.defineProperty(Bg,"getSchemaUtils",{enumerable:!0,get:function(){return pIe.getSchemaUtils}});Object.defineProperty(Bg,"optional",{enumerable:!0,get:function(){return pIe.optional}});Object.defineProperty(Bg,"transform",{enumerable:!0,get:function(){return pIe.transform}});var ZFr=lIe();Object.defineProperty(Bg,"JsonError",{enumerable:!0,get:function(){return ZFr.JsonError}});var YFr=dIe();Object.defineProperty(Bg,"ParseError",{enumerable:!0,get:function(){return YFr.ParseError}})});var GAt=v(Uoe=>{"use strict";Object.defineProperty(Uoe,"__esModule",{value:!0});Uoe.date=void 0;var XFr=fd(),mIe=am(),QFr=RP(),ekr=uh(),tkr=/^([+-]?\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 rkr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,mIe.getErrorMessageForIncorrectType)(e,"string")}]}:tkr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,mIe.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,mIe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>XFr.SchemaType.DATE};return Object.assign(Object.assign({},(0,QFr.maybeSkipValidation)(t)),(0,ekr.getSchemaUtils)(t))}Uoe.date=rkr});var JAt=v(qoe=>{"use strict";Object.defineProperty(qoe,"__esModule",{value:!0});qoe.date=void 0;var nkr=GAt();Object.defineProperty(qoe,"date",{enumerable:!0,get:function(){return nkr.date}})});var NP=v(Hoe=>{"use strict";Object.defineProperty(Hoe,"__esModule",{value:!0});Hoe.createIdentitySchemaCreator=void 0;var okr=uh(),ikr=RP();function akr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,ikr.maybeSkipValidation)(r)),(0,okr.getSchemaUtils)(r))}}Hoe.createIdentitySchemaCreator=akr});var YAt=v(Voe=>{"use strict";Object.defineProperty(Voe,"__esModule",{value:!0});Voe.enum_=void 0;var skr=fd(),ukr=NP(),ZAt=am();function lkr(t){let e=new Set(t);return(0,ukr.createIdentitySchemaCreator)(skr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,ZAt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,ZAt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}Voe.enum_=lkr});var hIe=v(Woe=>{"use strict";Object.defineProperty(Woe,"__esModule",{value:!0});Woe.enum_=void 0;var ckr=YAt();Object.defineProperty(Woe,"enum_",{enumerable:!0,get:function(){return ckr.enum_}})});var gIe=v(jI=>{"use strict";Object.defineProperty(jI,"__esModule",{value:!0});jI.getMemoizedSchema=jI.constructLazyBaseSchema=jI.lazy=void 0;var dkr=uh();function fkr(t){let e=XAt(t);return Object.assign(Object.assign({},e),(0,dkr.getSchemaUtils)(e))}jI.lazy=fkr;function XAt(t){return{parse:(e,r)=>Koe(t).parse(e,r),json:(e,r)=>Koe(t).json(e,r),getType:()=>Koe(t).getType()}}jI.constructLazyBaseSchema=XAt;function Koe(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}jI.getMemoizedSchema=Koe});var yIe=v(Goe=>{"use strict";Object.defineProperty(Goe,"__esModule",{value:!0});Goe.entries=void 0;function pkr(t){return Object.entries(t)}Goe.entries=pkr});var bIe=v(Joe=>{"use strict";Object.defineProperty(Joe,"__esModule",{value:!0});Joe.filterObject=void 0;function mkr(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}Joe.filterObject=mkr});var f5=v(Zoe=>{"use strict";Object.defineProperty(Zoe,"__esModule",{value:!0});Zoe.isPlainObject=void 0;function hkr(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}Zoe.isPlainObject=hkr});var _Ie=v(Yoe=>{"use strict";Object.defineProperty(Yoe,"__esModule",{value:!0});Yoe.keys=void 0;function gkr(t){return Object.keys(t)}Yoe.keys=gkr});var QAt=v(Xoe=>{"use strict";Object.defineProperty(Xoe,"__esModule",{value:!0});Xoe.partition=void 0;function ykr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}Xoe.partition=ykr});var rIt=v(VB=>{"use strict";Object.defineProperty(VB,"__esModule",{value:!0});VB.withParsedProperties=VB.getObjectLikeUtils=void 0;var bkr=bIe(),_kr=am(),vkr=f5(),wkr=uh();function eIt(t){return{withParsedProperties:e=>tIt(t,e)}}VB.getObjectLikeUtils=eIt;function tIt(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,vkr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,_kr.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,bkr.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,wkr.getSchemaUtils)(r)),eIt(r))}VB.withParsedProperties=tIt});var p5=v(WB=>{"use strict";Object.defineProperty(WB,"__esModule",{value:!0});WB.withParsedProperties=WB.getObjectLikeUtils=void 0;var nIt=rIt();Object.defineProperty(WB,"getObjectLikeUtils",{enumerable:!0,get:function(){return nIt.getObjectLikeUtils}});Object.defineProperty(WB,"withParsedProperties",{enumerable:!0,get:function(){return nIt.withParsedProperties}})});var vIe=v(KB=>{"use strict";Object.defineProperty(KB,"__esModule",{value:!0});KB.isProperty=KB.property=void 0;function xkr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}KB.property=xkr;function Skr(t){return t.isProperty}KB.isProperty=Skr});var xIe=v(GB=>{"use strict";Object.defineProperty(GB,"__esModule",{value:!0});GB.getObjectUtils=GB.object=void 0;var h5=fd(),oIt=yIe(),iIt=bIe(),Ckr=am(),Okr=f5(),lIt=_Ie(),Pkr=RP(),Ekr=QAt(),cIt=p5(),dIt=uh(),m5=vIe();function Tkr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,m5.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,lIt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,oIt.entries)(t)){let u=(0,m5.isProperty)(s)?s.rawKey:a,l=(0,m5.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,uIt(l)&&i.push(u)}return aIt({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,oIt.entries)(t)){let s=(0,m5.isProperty)(a)?a.valueSchema:a;uIt(s)&&o.push(i)}return aIt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,m5.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:()=>h5.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,Pkr.maybeSkipValidation)(e)),(0,dIt.getSchemaUtils)(e)),(0,cIt.getObjectLikeUtils)(e)),wIe(e))}GB.object=Tkr;function aIt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,Okr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,Ckr.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 wIe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>sIt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>sIt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>h5.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,dIt.getSchemaUtils)(r)),(0,cIt.getObjectLikeUtils)(r)),wIe(r))}}}GB.getObjectUtils=wIe;function sIt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,Ekr.partition)((0,lIt.keys)(e),l=>o.has(l)),s=r((0,iIt.filterObject)(e,a)),u=n((0,iIt.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 uIt(t){return!Akr(t)}function Akr(t){switch(t.getType()){case h5.SchemaType.ANY:case h5.SchemaType.UNKNOWN:case h5.SchemaType.OPTIONAL:return!0;default:return!1}}});var fIt=v(Qoe=>{"use strict";Object.defineProperty(Qoe,"__esModule",{value:!0});Qoe.objectWithoutOptionalProperties=void 0;var Ikr=xIe();function Mkr(t){return(0,Ikr.object)(t)}Qoe.objectWithoutOptionalProperties=Mkr});var SIe=v(Ug=>{"use strict";Object.defineProperty(Ug,"__esModule",{value:!0});Ug.property=Ug.isProperty=Ug.objectWithoutOptionalProperties=Ug.object=Ug.getObjectUtils=void 0;var pIt=xIe();Object.defineProperty(Ug,"getObjectUtils",{enumerable:!0,get:function(){return pIt.getObjectUtils}});Object.defineProperty(Ug,"object",{enumerable:!0,get:function(){return pIt.object}});var Rkr=fIt();Object.defineProperty(Ug,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return Rkr.objectWithoutOptionalProperties}});var mIt=vIe();Object.defineProperty(Ug,"isProperty",{enumerable:!0,get:function(){return mIt.isProperty}});Object.defineProperty(Ug,"property",{enumerable:!0,get:function(){return mIt.property}})});var hIt=v(eie=>{"use strict";Object.defineProperty(eie,"__esModule",{value:!0});eie.lazyObject=void 0;var Nkr=SIe(),jkr=p5(),Dkr=uh(),CIe=gIe();function Lkr(t){let e=Object.assign(Object.assign({},(0,CIe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,CIe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,CIe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,Dkr.getSchemaUtils)(e)),(0,jkr.getObjectLikeUtils)(e)),(0,Nkr.getObjectUtils)(e))}eie.lazyObject=Lkr});var gIt=v(JB=>{"use strict";Object.defineProperty(JB,"__esModule",{value:!0});JB.lazyObject=JB.lazy=void 0;var Fkr=gIe();Object.defineProperty(JB,"lazy",{enumerable:!0,get:function(){return Fkr.lazy}});var kkr=hIt();Object.defineProperty(JB,"lazyObject",{enumerable:!0,get:function(){return kkr.lazyObject}})});var bIt=v(tie=>{"use strict";Object.defineProperty(tie,"__esModule",{value:!0});tie.list=void 0;var $kr=fd(),zkr=am(),Bkr=RP(),Ukr=uh();function qkr(t){let e={parse:(r,n)=>yIt(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)=>yIt(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:()=>$kr.SchemaType.LIST};return Object.assign(Object.assign({},(0,Bkr.maybeSkipValidation)(e)),(0,Ukr.getSchemaUtils)(e))}tie.list=qkr;function yIt(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,zkr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var OIe=v(rie=>{"use strict";Object.defineProperty(rie,"__esModule",{value:!0});rie.list=void 0;var Hkr=bIt();Object.defineProperty(rie,"list",{enumerable:!0,get:function(){return Hkr.list}})});var _It=v(nie=>{"use strict";Object.defineProperty(nie,"__esModule",{value:!0});nie.stringLiteral=void 0;var Vkr=fd(),Wkr=NP(),Kkr=am();function Gkr(t){return(0,Wkr.createIdentitySchemaCreator)(Vkr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,Kkr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}nie.stringLiteral=Gkr});var vIt=v(oie=>{"use strict";Object.defineProperty(oie,"__esModule",{value:!0});oie.booleanLiteral=void 0;var Jkr=fd(),Zkr=NP(),Ykr=am();function Xkr(t){return(0,Zkr.createIdentitySchemaCreator)(Jkr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,Ykr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}oie.booleanLiteral=Xkr});var wIt=v(ZB=>{"use strict";Object.defineProperty(ZB,"__esModule",{value:!0});ZB.booleanLiteral=ZB.stringLiteral=void 0;var Qkr=_It();Object.defineProperty(ZB,"stringLiteral",{enumerable:!0,get:function(){return Qkr.stringLiteral}});var e$r=vIt();Object.defineProperty(ZB,"booleanLiteral",{enumerable:!0,get:function(){return e$r.booleanLiteral}})});var xIt=v(iie=>{"use strict";Object.defineProperty(iie,"__esModule",{value:!0});iie.any=void 0;var t$r=fd(),r$r=NP();iie.any=(0,r$r.createIdentitySchemaCreator)(t$r.SchemaType.ANY,t=>({ok:!0,value:t}))});var SIt=v(aie=>{"use strict";Object.defineProperty(aie,"__esModule",{value:!0});aie.boolean=void 0;var n$r=fd(),o$r=NP(),i$r=am();aie.boolean=(0,o$r.createIdentitySchemaCreator)(n$r.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,i$r.getErrorMessageForIncorrectType)(t,"boolean")}]})});var CIt=v(sie=>{"use strict";Object.defineProperty(sie,"__esModule",{value:!0});sie.number=void 0;var a$r=fd(),s$r=NP(),u$r=am();sie.number=(0,s$r.createIdentitySchemaCreator)(a$r.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,u$r.getErrorMessageForIncorrectType)(t,"number")}]})});var OIt=v(uie=>{"use strict";Object.defineProperty(uie,"__esModule",{value:!0});uie.string=void 0;var l$r=fd(),c$r=NP(),d$r=am();uie.string=(0,c$r.createIdentitySchemaCreator)(l$r.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,d$r.getErrorMessageForIncorrectType)(t,"string")}]})});var PIt=v(lie=>{"use strict";Object.defineProperty(lie,"__esModule",{value:!0});lie.unknown=void 0;var f$r=fd(),p$r=NP();lie.unknown=(0,p$r.createIdentitySchemaCreator)(f$r.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var EIt=v(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});qg.unknown=qg.string=qg.number=qg.boolean=qg.any=void 0;var m$r=xIt();Object.defineProperty(qg,"any",{enumerable:!0,get:function(){return m$r.any}});var h$r=SIt();Object.defineProperty(qg,"boolean",{enumerable:!0,get:function(){return h$r.boolean}});var g$r=CIt();Object.defineProperty(qg,"number",{enumerable:!0,get:function(){return g$r.number}});var y$r=OIt();Object.defineProperty(qg,"string",{enumerable:!0,get:function(){return y$r.string}});var b$r=PIt();Object.defineProperty(qg,"unknown",{enumerable:!0,get:function(){return b$r.unknown}})});var AIt=v(cie=>{"use strict";Object.defineProperty(cie,"__esModule",{value:!0});cie.record=void 0;var PIe=fd(),_$r=yIe(),v$r=am(),w$r=f5(),x$r=RP(),S$r=uh();function C$r(t,e){let r={parse:(n,o)=>TIt({value:n,isKeyNumeric:t.getType()===PIe.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)=>TIt({value:n,isKeyNumeric:t.getType()===PIe.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:()=>PIe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,x$r.maybeSkipValidation)(r)),(0,S$r.getSchemaUtils)(r))}cie.record=C$r;function TIt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,w$r.isPlainObject)(t)?(0,_$r.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,v$r.getErrorMessageForIncorrectType)(t,"object")}]}}});var IIt=v(die=>{"use strict";Object.defineProperty(die,"__esModule",{value:!0});die.record=void 0;var O$r=AIt();Object.defineProperty(die,"record",{enumerable:!0,get:function(){return O$r.record}})});var MIt=v(fie=>{"use strict";Object.defineProperty(fie,"__esModule",{value:!0});fie.set=void 0;var P$r=fd(),E$r=am(),T$r=RP(),A$r=OIe(),I$r=uh();function M$r(t){let e=(0,A$r.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,E$r.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>P$r.SchemaType.SET};return Object.assign(Object.assign({},(0,T$r.maybeSkipValidation)(r)),(0,I$r.getSchemaUtils)(r))}fie.set=M$r});var RIt=v(pie=>{"use strict";Object.defineProperty(pie,"__esModule",{value:!0});pie.set=void 0;var R$r=MIt();Object.defineProperty(pie,"set",{enumerable:!0,get:function(){return R$r.set}})});var jIt=v(mie=>{"use strict";Object.defineProperty(mie,"__esModule",{value:!0});mie.undiscriminatedUnion=void 0;var N$r=fd(),j$r=RP(),D$r=uh();function L$r(t){let e={parse:(r,n)=>NIt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>NIt((o,i)=>o.json(r,i),t,n),getType:()=>N$r.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,j$r.maybeSkipValidation)(e)),(0,D$r.getSchemaUtils)(e))}mie.undiscriminatedUnion=L$r;function NIt(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 DIt=v(hie=>{"use strict";Object.defineProperty(hie,"__esModule",{value:!0});hie.undiscriminatedUnion=void 0;var F$r=jIt();Object.defineProperty(hie,"undiscriminatedUnion",{enumerable:!0,get:function(){return F$r.undiscriminatedUnion}})});var LIt=v(gie=>{"use strict";Object.defineProperty(gie,"__esModule",{value:!0});gie.discriminant=void 0;function k$r(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}gie.discriminant=k$r});var kIt=v(YB=>{"use strict";var $$r=YB&&YB.__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(YB,"__esModule",{value:!0});YB.union=void 0;var z$r=fd(),B$r=am(),U$r=f5(),q$r=_Ie(),H$r=RP(),V$r=hIe(),W$r=p5(),K$r=uh();function G$r(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,V$r.enum_)((0,q$r.keys)(e)),i={parse:(a,s)=>FIt({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)=>FIt({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:()=>z$r.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,H$r.maybeSkipValidation)(i)),(0,K$r.getSchemaUtils)(i)),(0,W$r.getObjectLikeUtils)(i))}YB.union=G$r;function FIt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,U$r.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,B$r.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=$$r(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let m=a(d,p);return m.ok?{ok:!0,value:Object.assign({[r]:c},m.value)}:m}});var $It=v(XB=>{"use strict";Object.defineProperty(XB,"__esModule",{value:!0});XB.union=XB.discriminant=void 0;var J$r=LIt();Object.defineProperty(XB,"discriminant",{enumerable:!0,get:function(){return J$r.discriminant}});var Z$r=kIt();Object.defineProperty(XB,"union",{enumerable:!0,get:function(){return Z$r.union}})});var zIt=v(Jl=>{"use strict";var Y$r=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]}),lh=Jl&&Jl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Y$r(e,t,r)};Object.defineProperty(Jl,"__esModule",{value:!0});lh(JAt(),Jl);lh(hIe(),Jl);lh(gIt(),Jl);lh(OIe(),Jl);lh(wIt(),Jl);lh(SIe(),Jl);lh(p5(),Jl);lh(EIt(),Jl);lh(IIt(),Jl);lh(uh(),Jl);lh(RIt(),Jl);lh(DIt(),Jl);lh($It(),Jl)});var BIt=v(Qj=>{"use strict";var X$r=Qj&&Qj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q$r=Qj&&Qj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X$r(e,t,r)};Object.defineProperty(Qj,"__esModule",{value:!0});Q$r(zIt(),Qj)});var G=v(pd=>{"use strict";var UIt=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]}),ezr=pd&&pd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g5=pd&&pd.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UIt(e,t,r)},tzr=pd&&pd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UIt(e,t,r);return ezr(e,t),e};Object.defineProperty(pd,"__esModule",{value:!0});pd.serialization=void 0;g5(pAt(),pd);g5(bAt(),pd);g5(SAt(),pd);g5(NB(),pd);g5(qAt(),pd);pd.serialization=tzr(BIt())});var HIt=v(uu=>{"use strict";var y5=uu&&uu.__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())})},b5=uu&&uu.__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)}},La=uu&&uu.__await||function(t){return this instanceof La?(this.v=t,this):new La(t)},_5=uu&&uu.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof La?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(uu,"__esModule",{value:!0});uu.readableStreamAsyncIterable=uu._decodeChunks=uu.LineDecoder=uu._iterSSEMessages=uu.StreamUtils=void 0;var QB=Hs(),EIe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return _5(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=b5(qIt(e,r)),c;c=yield La(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 QB.CohereError({message:`Error: ${f.error}`});yield yield La(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 QB.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield La({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield La(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield La(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return _5(this,arguments,function*(){var s,u;let l=new DI,c=AIe(e);try{for(var d=b5(c),f;f=yield La(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield La(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield La(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield La(p)})}function i(){return _5(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=b5(o()),d;d=yield La(c.next()),!d.done;){let f=d.value;l||f&&(yield yield La(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield La(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield La(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 y5(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return y5(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 y5(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};uu.StreamUtils=EIe;function qIt(t,e){return _5(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new QB.CohereError({message:"Attempted to iterate over a response with no body"});let i=new TIe,a=new DI,s=AIe(t.body);try{for(var u=b5(rzr(s)),l;l=yield La(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield La(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield La(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield La(d))}})}uu._iterSSEMessages=qIt;function rzr(t){return _5(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=b5(t),a;a=yield La(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=nzr(o))!==-1;)yield yield La(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield La(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield La(o))})}function nzr(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 TIe=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]=izr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},DI=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 QB.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 QB.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new QB.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}};uu.LineDecoder=DI;DI.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);DI.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function ozr(t){let e=new DI,r=[];for(let n of t)r.push(...e.decode(n));return r}uu._decodeChunks=ozr;function izr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function AIe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return y5(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 y5(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}uu.readableStreamAsyncIterable=AIe});var IIe=v(qv=>{"use strict";var azr=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]}),szr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uzr=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)&&azr(e,t,r);return szr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.V2ChatStreamRequestCitationMode=void 0;var lzr=uzr(G());qv.V2ChatStreamRequestCitationMode=lzr.serialization.enum_(["FAST","ACCURATE","OFF"])});var MIe=v(Hv=>{"use strict";var czr=Hv&&Hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fzr=Hv&&Hv.__importStar||function(t){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(Hv,"__esModule",{value:!0});Hv.V2ChatRequestCitationMode=void 0;var pzr=fzr(G());Hv.V2ChatRequestCitationMode=pzr.serialization.enum_(["FAST","ACCURATE","OFF"])});var eU=v(Vv=>{"use strict";var mzr=Vv&&Vv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hzr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gzr=Vv&&Vv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mzr(e,t,r);return hzr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.TextContent=void 0;var VIt=gzr(G());Vv.TextContent=VIt.serialization.object({text:VIt.serialization.string()})});var RIe=v(Wv=>{"use strict";var yzr=Wv&&Wv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bzr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_zr=Wv&&Wv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yzr(e,t,r);return bzr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.Content=void 0;var vzr=_zr(G()),wzr=eU();Wv.Content=vzr.serialization.union("type",{text:wzr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var jIe=v(Kv=>{"use strict";var xzr=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]}),Szr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Czr=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)&&xzr(e,t,r);return Szr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.UserMessageContent=void 0;var NIe=Czr(G()),Ozr=RIe();Kv.UserMessageContent=NIe.serialization.undiscriminatedUnion([NIe.serialization.string(),NIe.serialization.list(Ozr.Content)])});var eD=v(Gv=>{"use strict";var Pzr=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]}),Ezr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tzr=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)&&Pzr(e,t,r);return Ezr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.ChatDocument=void 0;var DIe=Tzr(G());Gv.ChatDocument=DIe.serialization.record(DIe.serialization.string(),DIe.serialization.string())});var LIe=v(Jv=>{"use strict";var Azr=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]}),Izr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mzr=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)&&Azr(e,t,r);return Izr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.UserMessage=void 0;var WIt=Mzr(G()),Rzr=jIe(),Nzr=eD();Jv.UserMessage=WIt.serialization.object({content:Rzr.UserMessageContent,documents:WIt.serialization.list(Nzr.ChatDocument).optional()})});var kIe=v(Zv=>{"use strict";var jzr=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]}),Dzr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lzr=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)&&jzr(e,t,r);return Dzr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.ToolCall2Function=void 0;var FIe=Lzr(G());Zv.ToolCall2Function=FIe.serialization.object({name:FIe.serialization.string().optional(),arguments:FIe.serialization.string().optional()})});var yie=v(Yv=>{"use strict";var Fzr=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]}),kzr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$zr=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)&&Fzr(e,t,r);return kzr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ToolCall2=void 0;var $Ie=$zr(G()),zzr=kIe();Yv.ToolCall2=$Ie.serialization.object({id:$Ie.serialization.string().optional(),type:$Ie.serialization.stringLiteral("function").optional(),function:zzr.ToolCall2Function.optional()})});var zIe=v(Xv=>{"use strict";var Bzr=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]}),Uzr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qzr=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)&&Bzr(e,t,r);return Uzr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ToolSource=void 0;var tU=qzr(G());Xv.ToolSource=tU.serialization.object({id:tU.serialization.string().optional(),toolOutput:tU.serialization.property("tool_output",tU.serialization.record(tU.serialization.string(),tU.serialization.unknown()).optional())})});var BIe=v(Qv=>{"use strict";var Hzr=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]}),Vzr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wzr=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)&&Hzr(e,t,r);return Vzr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.DocumentSource=void 0;var v5=Wzr(G());Qv.DocumentSource=v5.serialization.object({id:v5.serialization.string().optional(),document:v5.serialization.record(v5.serialization.string(),v5.serialization.unknown()).optional()})});var UIe=v(ew=>{"use strict";var Kzr=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]}),Gzr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jzr=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)&&Kzr(e,t,r);return Gzr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.Source=void 0;var Zzr=Jzr(G()),Yzr=zIe(),Xzr=BIe();ew.Source=Zzr.serialization.union("type",{tool:Yzr.ToolSource,document:Xzr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var x5=v(tw=>{"use strict";var Qzr=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]}),eBr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tBr=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)&&Qzr(e,t,r);return eBr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.Citation=void 0;var w5=tBr(G()),rBr=UIe();tw.Citation=w5.serialization.object({start:w5.serialization.number().optional(),end:w5.serialization.number().optional(),text:w5.serialization.string().optional(),sources:w5.serialization.list(rBr.Source).optional()})});var qIe=v(rw=>{"use strict";var nBr=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]}),oBr=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iBr=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)&&nBr(e,t,r);return oBr(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.AssistantMessageContentItem=void 0;var aBr=iBr(G()),sBr=eU();rw.AssistantMessageContentItem=aBr.serialization.union("type",{text:sBr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var VIe=v(nw=>{"use strict";var uBr=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]}),lBr=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cBr=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)&&uBr(e,t,r);return lBr(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.AssistantMessageContent=void 0;var HIe=cBr(G()),dBr=qIe();nw.AssistantMessageContent=HIe.serialization.undiscriminatedUnion([HIe.serialization.string(),HIe.serialization.list(dBr.AssistantMessageContentItem)])});var WIe=v(ow=>{"use strict";var fBr=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]}),pBr=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mBr=ow&&ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fBr(e,t,r);return pBr(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.AssistantMessage=void 0;var rU=mBr(G()),hBr=yie(),gBr=VIe(),yBr=x5();ow.AssistantMessage=rU.serialization.object({toolCalls:rU.serialization.property("tool_calls",rU.serialization.list(hBr.ToolCall2).optional()),toolPlan:rU.serialization.property("tool_plan",rU.serialization.string().optional()),content:gBr.AssistantMessageContent.optional(),citations:rU.serialization.list(yBr.Citation).optional()})});var KIe=v(iw=>{"use strict";var bBr=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]}),_Br=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vBr=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)&&bBr(e,t,r);return _Br(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.SystemMessageContentItem=void 0;var wBr=vBr(G()),xBr=eU();iw.SystemMessageContentItem=wBr.serialization.union("type",{text:xBr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var JIe=v(aw=>{"use strict";var SBr=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]}),CBr=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OBr=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)&&SBr(e,t,r);return CBr(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.SystemMessageContent=void 0;var GIe=OBr(G()),PBr=KIe();aw.SystemMessageContent=GIe.serialization.undiscriminatedUnion([GIe.serialization.string(),GIe.serialization.list(PBr.SystemMessageContentItem)])});var ZIe=v(sw=>{"use strict";var EBr=sw&&sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TBr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ABr=sw&&sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EBr(e,t,r);return TBr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.SystemMessage=void 0;var IBr=ABr(G()),MBr=JIe();sw.SystemMessage=IBr.serialization.object({content:MBr.SystemMessageContent})});var YIe=v(uw=>{"use strict";var RBr=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]}),NBr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jBr=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)&&RBr(e,t,r);return NBr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.ToolContent=void 0;var bie=jBr(G());uw.ToolContent=bie.serialization.object({output:bie.serialization.record(bie.serialization.string(),bie.serialization.unknown())})});var XIe=v(lw=>{"use strict";var DBr=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]}),LBr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FBr=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)&&DBr(e,t,r);return LBr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.ToolMessage2ToolContentItem=void 0;var kBr=FBr(G()),$Br=YIe();lw.ToolMessage2ToolContentItem=kBr.serialization.union("type",{tool_result_object:$Br.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var QIe=v(cw=>{"use strict";var zBr=cw&&cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BBr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UBr=cw&&cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zBr(e,t,r);return BBr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.ToolMessage2=void 0;var S5=UBr(G()),qBr=XIe();cw.ToolMessage2=S5.serialization.object({toolCallId:S5.serialization.property("tool_call_id",S5.serialization.string()),toolContent:S5.serialization.property("tool_content",S5.serialization.list(qBr.ToolMessage2ToolContentItem))})});var eMe=v(dw=>{"use strict";var HBr=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]}),VBr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WBr=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)&&HBr(e,t,r);return VBr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.ChatMessage2=void 0;var KBr=WBr(G()),GBr=LIe(),JBr=WIe(),ZBr=ZIe(),YBr=QIe();dw.ChatMessage2=KBr.serialization.union("role",{user:GBr.UserMessage,assistant:JBr.AssistantMessage,system:ZBr.SystemMessage,tool:YBr.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var _ie=v(fw=>{"use strict";var XBr=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]}),QBr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eUr=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)&&XBr(e,t,r);return QBr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.ChatMessages=void 0;var tUr=eUr(G()),rUr=eMe();fw.ChatMessages=tUr.serialization.list(rUr.ChatMessage2)});var tMe=v(pw=>{"use strict";var nUr=pw&&pw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oUr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iUr=pw&&pw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nUr(e,t,r);return oUr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.Tool2Function=void 0;var nU=iUr(G());pw.Tool2Function=nU.serialization.object({name:nU.serialization.string().optional(),description:nU.serialization.string().optional(),parameters:nU.serialization.record(nU.serialization.string(),nU.serialization.unknown()).optional()})});var vie=v(mw=>{"use strict";var aUr=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]}),sUr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uUr=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)&&aUr(e,t,r);return sUr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.Tool2=void 0;var KIt=uUr(G()),lUr=tMe();mw.Tool2=KIt.serialization.object({type:KIt.serialization.stringLiteral("function").optional(),function:lUr.Tool2Function.optional()})});var wie=v(hw=>{"use strict";var cUr=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]}),dUr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fUr=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)&&cUr(e,t,r);return dUr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.ChatFinishReason=void 0;var pUr=fUr(G());hw.ChatFinishReason=pUr.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var rMe=v(gw=>{"use strict";var mUr=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]}),hUr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gUr=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)&&mUr(e,t,r);return hUr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.AssistantMessageResponseContentItem=void 0;var yUr=gUr(G()),bUr=eU();gw.AssistantMessageResponseContentItem=yUr.serialization.union("type",{text:bUr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var nMe=v(yw=>{"use strict";var _Ur=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]}),vUr=yw&&yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wUr=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)&&_Ur(e,t,r);return vUr(e,t),e};Object.defineProperty(yw,"__esModule",{value:!0});yw.AssistantMessageResponse=void 0;var LI=wUr(G()),xUr=yie(),SUr=rMe(),CUr=x5();yw.AssistantMessageResponse=LI.serialization.object({role:LI.serialization.stringLiteral("assistant"),toolCalls:LI.serialization.property("tool_calls",LI.serialization.list(xUr.ToolCall2).optional()),toolPlan:LI.serialization.property("tool_plan",LI.serialization.string().optional()),content:LI.serialization.list(SUr.AssistantMessageResponseContentItem).optional(),citations:LI.serialization.list(CUr.Citation).optional()})});var oMe=v(bw=>{"use strict";var OUr=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]}),PUr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EUr=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)&&OUr(e,t,r);return PUr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.UsageBilledUnits=void 0;var FI=EUr(G());bw.UsageBilledUnits=FI.serialization.object({inputTokens:FI.serialization.property("input_tokens",FI.serialization.number().optional()),outputTokens:FI.serialization.property("output_tokens",FI.serialization.number().optional()),searchUnits:FI.serialization.property("search_units",FI.serialization.number().optional()),classifications:FI.serialization.number().optional()})});var iMe=v(_w=>{"use strict";var TUr=_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]}),AUr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IUr=_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)&&TUr(e,t,r);return AUr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.UsageTokens=void 0;var C5=IUr(G());_w.UsageTokens=C5.serialization.object({inputTokens:C5.serialization.property("input_tokens",C5.serialization.number().optional()),outputTokens:C5.serialization.property("output_tokens",C5.serialization.number().optional())})});var xie=v(vw=>{"use strict";var MUr=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]}),RUr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NUr=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)&&MUr(e,t,r);return RUr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.Usage=void 0;var GIt=NUr(G()),jUr=oMe(),DUr=iMe();vw.Usage=GIt.serialization.object({billedUnits:GIt.serialization.property("billed_units",jUr.UsageBilledUnits.optional()),tokens:DUr.UsageTokens.optional()})});var JIt=v(ww=>{"use strict";var LUr=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]}),FUr=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kUr=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)&&LUr(e,t,r);return FUr(e,t),e};Object.defineProperty(ww,"__esModule",{value:!0});ww.NonStreamedChatResponse2=void 0;var Sie=kUr(G()),$Ur=wie(),zUr=nMe(),BUr=xie();ww.NonStreamedChatResponse2=Sie.serialization.object({id:Sie.serialization.string(),finishReason:Sie.serialization.property("finish_reason",$Ur.ChatFinishReason),prompt:Sie.serialization.string().optional(),message:zUr.AssistantMessageResponse.optional(),usage:BUr.Usage.optional()})});var ch=v(xw=>{"use strict";var UUr=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]}),qUr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HUr=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)&&UUr(e,t,r);return qUr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.ChatStreamEventType=void 0;var VUr=HUr(G());xw.ChatStreamEventType=VUr.serialization.object({})});var aMe=v(Sw=>{"use strict";var WUr=Sw&&Sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KUr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GUr=Sw&&Sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WUr(e,t,r);return KUr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.ChatMessageStartEventDeltaMessage=void 0;var ZIt=GUr(G());Sw.ChatMessageStartEventDeltaMessage=ZIt.serialization.object({role:ZIt.serialization.stringLiteral("assistant").optional()})});var sMe=v(Cw=>{"use strict";var JUr=Cw&&Cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZUr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YUr=Cw&&Cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JUr(e,t,r);return ZUr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.ChatMessageStartEventDelta=void 0;var XUr=YUr(G()),QUr=aMe();Cw.ChatMessageStartEventDelta=XUr.serialization.object({message:QUr.ChatMessageStartEventDeltaMessage.optional()})});var uMe=v(Ow=>{"use strict";var eqr=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]}),tqr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rqr=Ow&&Ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eqr(e,t,r);return tqr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.ChatMessageStartEvent=void 0;var YIt=rqr(G()),nqr=sMe(),oqr=ch();Ow.ChatMessageStartEvent=YIt.serialization.object({id:YIt.serialization.string().optional(),delta:nqr.ChatMessageStartEventDelta.optional()}).extend(oqr.ChatStreamEventType)});var cMe=v(Pw=>{"use strict";var iqr=Pw&&Pw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aqr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sqr=Pw&&Pw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iqr(e,t,r);return aqr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.ChatContentStartEventDeltaMessageContent=void 0;var lMe=sqr(G());Pw.ChatContentStartEventDeltaMessageContent=lMe.serialization.object({text:lMe.serialization.string().optional(),type:lMe.serialization.stringLiteral("text").optional()})});var dMe=v(Ew=>{"use strict";var uqr=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]}),lqr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cqr=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)&&uqr(e,t,r);return lqr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.ChatContentStartEventDeltaMessage=void 0;var dqr=cqr(G()),fqr=cMe();Ew.ChatContentStartEventDeltaMessage=dqr.serialization.object({content:fqr.ChatContentStartEventDeltaMessageContent.optional()})});var fMe=v(Tw=>{"use strict";var pqr=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]}),mqr=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hqr=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)&&pqr(e,t,r);return mqr(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.ChatContentStartEventDelta=void 0;var gqr=hqr(G()),yqr=dMe();Tw.ChatContentStartEventDelta=gqr.serialization.object({message:yqr.ChatContentStartEventDeltaMessage.optional()})});var pMe=v(Aw=>{"use strict";var bqr=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]}),_qr=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vqr=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)&&bqr(e,t,r);return _qr(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.ChatContentStartEvent=void 0;var XIt=vqr(G()),wqr=fMe(),xqr=ch();Aw.ChatContentStartEvent=XIt.serialization.object({index:XIt.serialization.number().optional(),delta:wqr.ChatContentStartEventDelta.optional()}).extend(xqr.ChatStreamEventType)});var mMe=v(Iw=>{"use strict";var Sqr=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]}),Cqr=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oqr=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)&&Sqr(e,t,r);return Cqr(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.ChatContentDeltaEventDeltaMessageContent=void 0;var QIt=Oqr(G());Iw.ChatContentDeltaEventDeltaMessageContent=QIt.serialization.object({text:QIt.serialization.string().optional()})});var hMe=v(Mw=>{"use strict";var Pqr=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]}),Eqr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tqr=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)&&Pqr(e,t,r);return Eqr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.ChatContentDeltaEventDeltaMessage=void 0;var Aqr=Tqr(G()),Iqr=mMe();Mw.ChatContentDeltaEventDeltaMessage=Aqr.serialization.object({content:Iqr.ChatContentDeltaEventDeltaMessageContent.optional()})});var gMe=v(Rw=>{"use strict";var Mqr=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]}),Rqr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nqr=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)&&Mqr(e,t,r);return Rqr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.ChatContentDeltaEventDelta=void 0;var jqr=Nqr(G()),Dqr=hMe();Rw.ChatContentDeltaEventDelta=jqr.serialization.object({message:Dqr.ChatContentDeltaEventDeltaMessage.optional()})});var yMe=v(Nw=>{"use strict";var Lqr=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]}),Fqr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kqr=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)&&Lqr(e,t,r);return Fqr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.ChatContentDeltaEvent=void 0;var eMt=kqr(G()),$qr=gMe(),zqr=ch();Nw.ChatContentDeltaEvent=eMt.serialization.object({index:eMt.serialization.number().optional(),delta:$qr.ChatContentDeltaEventDelta.optional()}).extend(zqr.ChatStreamEventType)});var bMe=v(jw=>{"use strict";var Bqr=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]}),Uqr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qqr=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)&&Bqr(e,t,r);return Uqr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.ChatContentEndEvent=void 0;var tMt=qqr(G()),Hqr=ch();jw.ChatContentEndEvent=tMt.serialization.object({index:tMt.serialization.number().optional()}).extend(Hqr.ChatStreamEventType)});var vMe=v(Dw=>{"use strict";var Vqr=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]}),Wqr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kqr=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)&&Vqr(e,t,r);return Wqr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.ChatToolPlanDeltaEventDelta=void 0;var _Me=Kqr(G());Dw.ChatToolPlanDeltaEventDelta=_Me.serialization.object({toolPlan:_Me.serialization.property("tool_plan",_Me.serialization.string().optional())})});var wMe=v(Lw=>{"use strict";var Gqr=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]}),Jqr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zqr=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)&&Gqr(e,t,r);return Jqr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.ChatToolPlanDeltaEvent=void 0;var Yqr=Zqr(G()),Xqr=vMe(),Qqr=ch();Lw.ChatToolPlanDeltaEvent=Yqr.serialization.object({delta:Xqr.ChatToolPlanDeltaEventDelta.optional()}).extend(Qqr.ChatStreamEventType)});var SMe=v(Fw=>{"use strict";var e2r=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]}),t2r=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r2r=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)&&e2r(e,t,r);return t2r(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.ChatToolCallStartEventDeltaToolCallFunction=void 0;var xMe=r2r(G());Fw.ChatToolCallStartEventDeltaToolCallFunction=xMe.serialization.object({name:xMe.serialization.string().optional(),arguments:xMe.serialization.string().optional()})});var OMe=v(kw=>{"use strict";var n2r=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]}),o2r=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i2r=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)&&n2r(e,t,r);return o2r(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.ChatToolCallStartEventDeltaToolCall=void 0;var CMe=i2r(G()),a2r=SMe();kw.ChatToolCallStartEventDeltaToolCall=CMe.serialization.object({id:CMe.serialization.string().optional(),type:CMe.serialization.stringLiteral("function").optional(),function:a2r.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var PMe=v($w=>{"use strict";var s2r=$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]}),u2r=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l2r=$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)&&s2r(e,t,r);return u2r(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.ChatToolCallStartEventDelta=void 0;var rMt=l2r(G()),c2r=OMe();$w.ChatToolCallStartEventDelta=rMt.serialization.object({toolCall:rMt.serialization.property("tool_call",c2r.ChatToolCallStartEventDeltaToolCall.optional())})});var EMe=v(zw=>{"use strict";var d2r=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]}),f2r=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p2r=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)&&d2r(e,t,r);return f2r(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.ChatToolCallStartEvent=void 0;var nMt=p2r(G()),m2r=PMe(),h2r=ch();zw.ChatToolCallStartEvent=nMt.serialization.object({index:nMt.serialization.number().optional(),delta:m2r.ChatToolCallStartEventDelta.optional()}).extend(h2r.ChatStreamEventType)});var TMe=v(Bw=>{"use strict";var g2r=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]}),y2r=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b2r=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)&&g2r(e,t,r);return y2r(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var oMt=b2r(G());Bw.ChatToolCallDeltaEventDeltaToolCallFunction=oMt.serialization.object({arguments:oMt.serialization.string().optional()})});var AMe=v(Uw=>{"use strict";var _2r=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]}),v2r=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w2r=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)&&_2r(e,t,r);return v2r(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.ChatToolCallDeltaEventDeltaToolCall=void 0;var x2r=w2r(G()),S2r=TMe();Uw.ChatToolCallDeltaEventDeltaToolCall=x2r.serialization.object({function:S2r.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var IMe=v(qw=>{"use strict";var C2r=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]}),O2r=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P2r=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)&&C2r(e,t,r);return O2r(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.ChatToolCallDeltaEventDelta=void 0;var iMt=P2r(G()),E2r=AMe();qw.ChatToolCallDeltaEventDelta=iMt.serialization.object({toolCall:iMt.serialization.property("tool_call",E2r.ChatToolCallDeltaEventDeltaToolCall.optional())})});var MMe=v(Hw=>{"use strict";var T2r=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]}),A2r=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I2r=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)&&T2r(e,t,r);return A2r(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.ChatToolCallDeltaEvent=void 0;var aMt=I2r(G()),M2r=IMe(),R2r=ch();Hw.ChatToolCallDeltaEvent=aMt.serialization.object({index:aMt.serialization.number().optional(),delta:M2r.ChatToolCallDeltaEventDelta.optional()}).extend(R2r.ChatStreamEventType)});var RMe=v(Vw=>{"use strict";var N2r=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]}),j2r=Vw&&Vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D2r=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)&&N2r(e,t,r);return j2r(e,t),e};Object.defineProperty(Vw,"__esModule",{value:!0});Vw.ChatToolCallEndEvent=void 0;var sMt=D2r(G()),L2r=ch();Vw.ChatToolCallEndEvent=sMt.serialization.object({index:sMt.serialization.number().optional()}).extend(L2r.ChatStreamEventType)});var NMe=v(Ww=>{"use strict";var F2r=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]}),k2r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$2r=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)&&F2r(e,t,r);return k2r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.ChatMessageEndEventDelta=void 0;var uMt=$2r(G()),z2r=wie(),B2r=xie();Ww.ChatMessageEndEventDelta=uMt.serialization.object({finishReason:uMt.serialization.property("finish_reason",z2r.ChatFinishReason.optional()),usage:B2r.Usage.optional()})});var jMe=v(Kw=>{"use strict";var U2r=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]}),q2r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H2r=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)&&U2r(e,t,r);return q2r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.ChatMessageEndEvent=void 0;var lMt=H2r(G()),V2r=NMe(),W2r=ch();Kw.ChatMessageEndEvent=lMt.serialization.object({id:lMt.serialization.string().optional(),delta:V2r.ChatMessageEndEventDelta.optional()}).extend(W2r.ChatStreamEventType)});var DMe=v(Gw=>{"use strict";var K2r=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]}),G2r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J2r=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)&&K2r(e,t,r);return G2r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.CitationStartEventDeltaMessage=void 0;var Z2r=J2r(G()),Y2r=x5();Gw.CitationStartEventDeltaMessage=Z2r.serialization.object({citations:Y2r.Citation.optional()})});var LMe=v(Jw=>{"use strict";var X2r=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]}),Q2r=Jw&&Jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e4r=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)&&X2r(e,t,r);return Q2r(e,t),e};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.CitationStartEventDelta=void 0;var t4r=e4r(G()),r4r=DMe();Jw.CitationStartEventDelta=t4r.serialization.object({message:r4r.CitationStartEventDeltaMessage.optional()})});var FMe=v(Zw=>{"use strict";var n4r=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]}),o4r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i4r=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)&&n4r(e,t,r);return o4r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.CitationStartEvent=void 0;var cMt=i4r(G()),a4r=LMe(),s4r=ch();Zw.CitationStartEvent=cMt.serialization.object({index:cMt.serialization.number().optional(),delta:a4r.CitationStartEventDelta.optional()}).extend(s4r.ChatStreamEventType)});var kMe=v(Yw=>{"use strict";var u4r=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]}),l4r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c4r=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)&&u4r(e,t,r);return l4r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.CitationEndEvent=void 0;var dMt=c4r(G()),d4r=ch();Yw.CitationEndEvent=dMt.serialization.object({index:dMt.serialization.number().optional()}).extend(d4r.ChatStreamEventType)});var fMt=v(Xw=>{"use strict";var f4r=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]}),p4r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4r=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)&&f4r(e,t,r);return p4r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.StreamedChatResponse2=void 0;var h4r=m4r(G()),g4r=uMe(),y4r=pMe(),b4r=yMe(),_4r=bMe(),v4r=wMe(),w4r=EMe(),x4r=MMe(),S4r=RMe(),C4r=FMe(),O4r=kMe(),P4r=jMe();Xw.StreamedChatResponse2=h4r.serialization.union("type",{"message-start":g4r.ChatMessageStartEvent,"content-start":y4r.ChatContentStartEvent,"content-delta":b4r.ChatContentDeltaEvent,"content-end":_4r.ChatContentEndEvent,"tool-plan-delta":v4r.ChatToolPlanDeltaEvent,"tool-call-start":w4r.ChatToolCallStartEvent,"tool-call-delta":x4r.ChatToolCallDeltaEvent,"tool-call-end":S4r.ChatToolCallEndEvent,"citation-start":C4r.CitationStartEvent,"citation-end":O4r.CitationEndEvent,"message-end":P4r.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var $Me=v(Rt=>{"use strict";var E4r=Rt&&Rt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kt=Rt&&Rt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&E4r(e,t,r)};Object.defineProperty(Rt,"__esModule",{value:!0});Kt(IIe(),Rt);Kt(MIe(),Rt);Kt(eU(),Rt);Kt(RIe(),Rt);Kt(jIe(),Rt);Kt(LIe(),Rt);Kt(kIe(),Rt);Kt(yie(),Rt);Kt(zIe(),Rt);Kt(BIe(),Rt);Kt(UIe(),Rt);Kt(x5(),Rt);Kt(qIe(),Rt);Kt(VIe(),Rt);Kt(WIe(),Rt);Kt(KIe(),Rt);Kt(JIe(),Rt);Kt(ZIe(),Rt);Kt(YIe(),Rt);Kt(XIe(),Rt);Kt(QIe(),Rt);Kt(eMe(),Rt);Kt(_ie(),Rt);Kt(tMe(),Rt);Kt(vie(),Rt);Kt(wie(),Rt);Kt(rMe(),Rt);Kt(nMe(),Rt);Kt(oMe(),Rt);Kt(iMe(),Rt);Kt(xie(),Rt);Kt(JIt(),Rt);Kt(ch(),Rt);Kt(aMe(),Rt);Kt(sMe(),Rt);Kt(uMe(),Rt);Kt(cMe(),Rt);Kt(dMe(),Rt);Kt(fMe(),Rt);Kt(pMe(),Rt);Kt(mMe(),Rt);Kt(hMe(),Rt);Kt(gMe(),Rt);Kt(yMe(),Rt);Kt(bMe(),Rt);Kt(vMe(),Rt);Kt(wMe(),Rt);Kt(SMe(),Rt);Kt(OMe(),Rt);Kt(PMe(),Rt);Kt(EMe(),Rt);Kt(TMe(),Rt);Kt(AMe(),Rt);Kt(IMe(),Rt);Kt(MMe(),Rt);Kt(RMe(),Rt);Kt(NMe(),Rt);Kt(jMe(),Rt);Kt(fMt(),Rt)});var Cie=v(Qw=>{"use strict";var T4r=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]}),A4r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4r=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)&&T4r(e,t,r);return A4r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.TextResponseFormat=void 0;var M4r=I4r(G());Qw.TextResponseFormat=M4r.serialization.object({})});var zMe=v(e0=>{"use strict";var R4r=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]}),N4r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j4r=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)&&R4r(e,t,r);return N4r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.JsonResponseFormat2=void 0;var O5=j4r(G());e0.JsonResponseFormat2=O5.serialization.object({jsonSchema:O5.serialization.property("json_schema",O5.serialization.record(O5.serialization.string(),O5.serialization.unknown()).optional())})});var Oie=v(t0=>{"use strict";var D4r=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]}),L4r=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F4r=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)&&D4r(e,t,r);return L4r(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.ResponseFormat2=void 0;var k4r=F4r(G()),$4r=Cie(),z4r=zMe();t0.ResponseFormat2=k4r.serialization.union("type",{text:$4r.TextResponseFormat,json_object:z4r.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var pMt=v(r0=>{"use strict";var B4r=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]}),U4r=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q4r=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)&&B4r(e,t,r);return U4r(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.V2ChatStreamRequest=void 0;var lu=q4r(G()),H4r=_ie(),V4r=vie(),W4r=IIe(),K4r=Oie();r0.V2ChatStreamRequest=lu.serialization.object({model:lu.serialization.string(),messages:H4r.ChatMessages,tools:lu.serialization.list(V4r.Tool2).optional(),citationMode:lu.serialization.property("citation_mode",W4r.V2ChatStreamRequestCitationMode.optional()),responseFormat:lu.serialization.property("response_format",K4r.ResponseFormat2.optional()),maxTokens:lu.serialization.property("max_tokens",lu.serialization.number().optional()),stopSequences:lu.serialization.property("stop_sequences",lu.serialization.list(lu.serialization.string()).optional()),temperature:lu.serialization.number().optional(),seed:lu.serialization.number().optional(),frequencyPenalty:lu.serialization.property("frequency_penalty",lu.serialization.number().optional()),presencePenalty:lu.serialization.property("presence_penalty",lu.serialization.number().optional()),k:lu.serialization.number().optional(),p:lu.serialization.number().optional(),returnPrompt:lu.serialization.property("return_prompt",lu.serialization.boolean().optional())})});var mMt=v(n0=>{"use strict";var G4r=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]}),J4r=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z4r=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)&&G4r(e,t,r);return J4r(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.V2ChatRequest=void 0;var cu=Z4r(G()),Y4r=_ie(),X4r=vie(),Q4r=MIe(),e3r=Oie();n0.V2ChatRequest=cu.serialization.object({model:cu.serialization.string(),messages:Y4r.ChatMessages,tools:cu.serialization.list(X4r.Tool2).optional(),citationMode:cu.serialization.property("citation_mode",Q4r.V2ChatRequestCitationMode.optional()),responseFormat:cu.serialization.property("response_format",e3r.ResponseFormat2.optional()),maxTokens:cu.serialization.property("max_tokens",cu.serialization.number().optional()),stopSequences:cu.serialization.property("stop_sequences",cu.serialization.list(cu.serialization.string()).optional()),temperature:cu.serialization.number().optional(),seed:cu.serialization.number().optional(),frequencyPenalty:cu.serialization.property("frequency_penalty",cu.serialization.number().optional()),presencePenalty:cu.serialization.property("presence_penalty",cu.serialization.number().optional()),k:cu.serialization.number().optional(),p:cu.serialization.number().optional(),returnPrompt:cu.serialization.property("return_prompt",cu.serialization.boolean().optional())})});var BMe=v(oU=>{"use strict";Object.defineProperty(oU,"__esModule",{value:!0});oU.V2ChatRequest=oU.V2ChatStreamRequest=void 0;var t3r=pMt();Object.defineProperty(oU,"V2ChatStreamRequest",{enumerable:!0,get:function(){return t3r.V2ChatStreamRequest}});var r3r=mMt();Object.defineProperty(oU,"V2ChatRequest",{enumerable:!0,get:function(){return r3r.V2ChatRequest}})});var hMt=v(tD=>{"use strict";var n3r=tD&&tD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o3r=tD&&tD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&n3r(e,t,r)};Object.defineProperty(tD,"__esModule",{value:!0});o3r(BMe(),tD)});var yMt=v(kI=>{"use strict";var i3r=kI&&kI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gMt=kI&&kI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&i3r(e,t,r)};Object.defineProperty(kI,"__esModule",{value:!0});gMt($Me(),kI);gMt(hMt(),kI)});var UMe=v(o0=>{"use strict";var a3r=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]}),s3r=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u3r=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)&&a3r(e,t,r);return s3r(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.CreateEmbedJobRequestTruncate=void 0;var l3r=u3r(G());o0.CreateEmbedJobRequestTruncate=l3r.serialization.enum_(["START","END"])});var qMe=v(rD=>{"use strict";var c3r=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]}),d3r=rD&&rD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&c3r(e,t,r)};Object.defineProperty(rD,"__esModule",{value:!0});d3r(UMe(),rD)});var Pie=v(i0=>{"use strict";var f3r=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]}),p3r=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m3r=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)&&f3r(e,t,r);return p3r(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.EmbedInputType=void 0;var h3r=m3r(G());i0.EmbedInputType=h3r.serialization.enum_(["search_document","search_query","classification","clustering"])});var Eie=v(a0=>{"use strict";var g3r=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]}),y3r=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b3r=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)&&g3r(e,t,r);return y3r(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.EmbeddingType=void 0;var _3r=b3r(G());a0.EmbeddingType=_3r.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var bMt=v(s0=>{"use strict";var v3r=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]}),w3r=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x3r=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)&&v3r(e,t,r);return w3r(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.CreateEmbedJobRequest=void 0;var $I=x3r(G()),S3r=Pie(),C3r=Eie(),O3r=UMe();s0.CreateEmbedJobRequest=$I.serialization.object({model:$I.serialization.string(),datasetId:$I.serialization.property("dataset_id",$I.serialization.string()),inputType:$I.serialization.property("input_type",S3r.EmbedInputType),name:$I.serialization.string().optional(),embeddingTypes:$I.serialization.property("embedding_types",$I.serialization.list(C3r.EmbeddingType).optional()),truncate:O3r.CreateEmbedJobRequestTruncate.optional()})});var HMe=v(Tie=>{"use strict";Object.defineProperty(Tie,"__esModule",{value:!0});Tie.CreateEmbedJobRequest=void 0;var P3r=bMt();Object.defineProperty(Tie,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return P3r.CreateEmbedJobRequest}})});var _Mt=v(nD=>{"use strict";var E3r=nD&&nD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T3r=nD&&nD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&E3r(e,t,r)};Object.defineProperty(nD,"__esModule",{value:!0});T3r(HMe(),nD)});var wMt=v(zI=>{"use strict";var A3r=zI&&zI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vMt=zI&&zI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A3r(e,t,r)};Object.defineProperty(zI,"__esModule",{value:!0});vMt(qMe(),zI);vMt(_Mt(),zI)});var VMe=v(u0=>{"use strict";var I3r=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]}),M3r=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R3r=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)&&I3r(e,t,r);return M3r(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.DatasetType=void 0;var N3r=R3r(G());u0.DatasetType=N3r.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 WMe=v(l0=>{"use strict";var j3r=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]}),D3r=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L3r=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)&&j3r(e,t,r);return D3r(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.DatasetValidationStatus=void 0;var F3r=L3r(G());l0.DatasetValidationStatus=F3r.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var KMe=v(c0=>{"use strict";var k3r=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]}),$3r=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z3r=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)&&k3r(e,t,r);return $3r(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.DatasetPart=void 0;var dh=z3r(G());c0.DatasetPart=dh.serialization.object({id:dh.serialization.string(),name:dh.serialization.string(),url:dh.serialization.string().optional(),index:dh.serialization.number().optional(),sizeBytes:dh.serialization.property("size_bytes",dh.serialization.number().optional()),numRows:dh.serialization.property("num_rows",dh.serialization.number().optional()),originalUrl:dh.serialization.property("original_url",dh.serialization.string().optional()),samples:dh.serialization.list(dh.serialization.string()).optional()})});var Aie=v(d0=>{"use strict";var B3r=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]}),U3r=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q3r=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)&&B3r(e,t,r);return U3r(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.Dataset=void 0;var is=q3r(G()),H3r=VMe(),V3r=WMe(),W3r=KMe();d0.Dataset=is.serialization.object({id:is.serialization.string(),name:is.serialization.string(),createdAt:is.serialization.property("created_at",is.serialization.date()),updatedAt:is.serialization.property("updated_at",is.serialization.date()),datasetType:is.serialization.property("dataset_type",H3r.DatasetType),validationStatus:is.serialization.property("validation_status",V3r.DatasetValidationStatus),validationError:is.serialization.property("validation_error",is.serialization.string().optional()),schema:is.serialization.string().optional(),requiredFields:is.serialization.property("required_fields",is.serialization.list(is.serialization.string()).optional()),preserveFields:is.serialization.property("preserve_fields",is.serialization.list(is.serialization.string()).optional()),datasetParts:is.serialization.property("dataset_parts",is.serialization.list(W3r.DatasetPart).optional()),validationWarnings:is.serialization.property("validation_warnings",is.serialization.list(is.serialization.string()).optional())})});var SMt=v(f0=>{"use strict";var K3r=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]}),G3r=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J3r=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)&&K3r(e,t,r);return G3r(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.DatasetsListResponse=void 0;var xMt=J3r(G()),Z3r=Aie();f0.DatasetsListResponse=xMt.serialization.object({datasets:xMt.serialization.list(Z3r.Dataset).optional()})});var CMt=v(p0=>{"use strict";var Y3r=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]}),X3r=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q3r=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)&&Y3r(e,t,r);return X3r(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.DatasetsCreateResponseDatasetPartsItem=void 0;var BI=Q3r(G());p0.DatasetsCreateResponseDatasetPartsItem=BI.serialization.object({name:BI.serialization.string().optional(),numRows:BI.serialization.property("num_rows",BI.serialization.number().optional()),samples:BI.serialization.list(BI.serialization.string()).optional(),partKind:BI.serialization.property("part_kind",BI.serialization.string().optional())})});var PMt=v(m0=>{"use strict";var eHr=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]}),tHr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rHr=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)&&eHr(e,t,r);return tHr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.DatasetsCreateResponse=void 0;var OMt=rHr(G());m0.DatasetsCreateResponse=OMt.serialization.object({id:OMt.serialization.string().optional()})});var EMt=v(h0=>{"use strict";var nHr=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]}),oHr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iHr=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)&&nHr(e,t,r);return oHr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.DatasetsGetUsageResponse=void 0;var GMe=iHr(G());h0.DatasetsGetUsageResponse=GMe.serialization.object({organizationUsage:GMe.serialization.property("organization_usage",GMe.serialization.number().optional())})});var TMt=v(g0=>{"use strict";var aHr=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]}),sHr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uHr=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)&&aHr(e,t,r);return sHr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.DatasetsGetResponse=void 0;var lHr=uHr(G()),cHr=Aie();g0.DatasetsGetResponse=lHr.serialization.object({dataset:cHr.Dataset})});var JMe=v(Cb=>{"use strict";var dHr=Cb&&Cb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),P5=Cb&&Cb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dHr(e,t,r)};Object.defineProperty(Cb,"__esModule",{value:!0});P5(SMt(),Cb);P5(CMt(),Cb);P5(PMt(),Cb);P5(EMt(),Cb);P5(TMt(),Cb)});var AMt=v(y0=>{"use strict";var fHr=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]}),pHr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mHr=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)&&fHr(e,t,r);return pHr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.Response=void 0;var ZMe=mHr(G());y0.Response=ZMe.serialization.record(ZMe.serialization.string(),ZMe.serialization.unknown())});var IMt=v(b0=>{"use strict";var hHr=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]}),gHr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yHr=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)&&hHr(e,t,r);return gHr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.delete=void 0;b0.delete=yHr(AMt())});var RMt=v(UI=>{"use strict";var bHr=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]}),MMt=UI&&UI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bHr(e,t,r)};Object.defineProperty(UI,"__esModule",{value:!0});MMt(JMe(),UI);MMt(IMt(),UI)});var YMe=v(_0=>{"use strict";var _Hr=_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]}),vHr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wHr=_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)&&_Hr(e,t,r);return vHr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.BaseType=void 0;var xHr=wHr(G());_0.BaseType=xHr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var XMe=v(v0=>{"use strict";var SHr=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]}),CHr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OHr=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)&&SHr(e,t,r);return CHr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.Strategy=void 0;var PHr=OHr(G());v0.Strategy=PHr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var QMe=v(w0=>{"use strict";var EHr=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]}),THr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AHr=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)&&EHr(e,t,r);return THr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.BaseModel=void 0;var Iie=AHr(G()),IHr=YMe(),MHr=XMe();w0.BaseModel=Iie.serialization.object({name:Iie.serialization.string().optional(),version:Iie.serialization.string().optional(),baseType:Iie.serialization.property("base_type",IHr.BaseType),strategy:MHr.Strategy.optional()})});var eRe=v(x0=>{"use strict";var RHr=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]}),NHr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHr=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)&&RHr(e,t,r);return NHr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.Hyperparameters=void 0;var Ob=jHr(G());x0.Hyperparameters=Ob.serialization.object({earlyStoppingPatience:Ob.serialization.property("early_stopping_patience",Ob.serialization.number().optional()),earlyStoppingThreshold:Ob.serialization.property("early_stopping_threshold",Ob.serialization.number().optional()),trainBatchSize:Ob.serialization.property("train_batch_size",Ob.serialization.number().optional()),trainEpochs:Ob.serialization.property("train_epochs",Ob.serialization.number().optional()),learningRate:Ob.serialization.property("learning_rate",Ob.serialization.number().optional())})});var tRe=v(S0=>{"use strict";var DHr=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]}),LHr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FHr=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)&&DHr(e,t,r);return LHr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.WandbConfig=void 0;var E5=FHr(G());S0.WandbConfig=E5.serialization.object({project:E5.serialization.string(),apiKey:E5.serialization.property("api_key",E5.serialization.string()),entity:E5.serialization.string().optional()})});var Mie=v(C0=>{"use strict";var kHr=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]}),$Hr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zHr=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)&&kHr(e,t,r);return $Hr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.Settings=void 0;var iU=zHr(G()),BHr=QMe(),UHr=eRe(),qHr=tRe();C0.Settings=iU.serialization.object({baseModel:iU.serialization.property("base_model",BHr.BaseModel),datasetId:iU.serialization.property("dataset_id",iU.serialization.string()),hyperparameters:UHr.Hyperparameters.optional(),multiLabel:iU.serialization.property("multi_label",iU.serialization.boolean().optional()),wandb:qHr.WandbConfig.optional()})});var T5=v(O0=>{"use strict";var HHr=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]}),VHr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WHr=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)&&HHr(e,t,r);return VHr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.Status=void 0;var KHr=WHr(G());O0.Status=KHr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var aU=v(P0=>{"use strict";var GHr=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]}),JHr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZHr=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)&&GHr(e,t,r);return JHr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.FinetunedModel=void 0;var hp=ZHr(G()),YHr=Mie(),XHr=T5();P0.FinetunedModel=hp.serialization.object({id:hp.serialization.string().optional(),name:hp.serialization.string(),creatorId:hp.serialization.property("creator_id",hp.serialization.string().optional()),organizationId:hp.serialization.property("organization_id",hp.serialization.string().optional()),settings:YHr.Settings,status:XHr.Status.optional(),createdAt:hp.serialization.property("created_at",hp.serialization.date().optional()),updatedAt:hp.serialization.property("updated_at",hp.serialization.date().optional()),completedAt:hp.serialization.property("completed_at",hp.serialization.date().optional()),lastUsed:hp.serialization.property("last_used",hp.serialization.date().optional())})});var NMt=v(E0=>{"use strict";var QHr=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]}),e6r=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t6r=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)&&QHr(e,t,r);return e6r(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.ListFinetunedModelsResponse=void 0;var oD=t6r(G()),r6r=aU();E0.ListFinetunedModelsResponse=oD.serialization.object({finetunedModels:oD.serialization.property("finetuned_models",oD.serialization.list(r6r.FinetunedModel).optional()),nextPageToken:oD.serialization.property("next_page_token",oD.serialization.string().optional()),totalSize:oD.serialization.property("total_size",oD.serialization.number().optional())})});var DMt=v(T0=>{"use strict";var n6r=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]}),o6r=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i6r=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)&&n6r(e,t,r);return o6r(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.CreateFinetunedModelResponse=void 0;var jMt=i6r(G()),a6r=aU();T0.CreateFinetunedModelResponse=jMt.serialization.object({finetunedModel:jMt.serialization.property("finetuned_model",a6r.FinetunedModel.optional())})});var FMt=v(A0=>{"use strict";var s6r=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]}),u6r=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l6r=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)&&s6r(e,t,r);return u6r(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.GetFinetunedModelResponse=void 0;var LMt=l6r(G()),c6r=aU();A0.GetFinetunedModelResponse=LMt.serialization.object({finetunedModel:LMt.serialization.property("finetuned_model",c6r.FinetunedModel.optional())})});var kMt=v(I0=>{"use strict";var d6r=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]}),f6r=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p6r=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)&&d6r(e,t,r);return f6r(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.DeleteFinetunedModelResponse=void 0;var rRe=p6r(G());I0.DeleteFinetunedModelResponse=rRe.serialization.record(rRe.serialization.string(),rRe.serialization.unknown())});var zMt=v(M0=>{"use strict";var m6r=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]}),h6r=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g6r=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)&&m6r(e,t,r);return h6r(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.UpdateFinetunedModelResponse=void 0;var $Mt=g6r(G()),y6r=aU();M0.UpdateFinetunedModelResponse=$Mt.serialization.object({finetunedModel:$Mt.serialization.property("finetuned_model",y6r.FinetunedModel.optional())})});var nRe=v(R0=>{"use strict";var b6r=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]}),_6r=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v6r=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)&&b6r(e,t,r);return _6r(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.Event=void 0;var A5=v6r(G()),w6r=T5();R0.Event=A5.serialization.object({userId:A5.serialization.property("user_id",A5.serialization.string().optional()),status:w6r.Status.optional(),createdAt:A5.serialization.property("created_at",A5.serialization.date().optional())})});var BMt=v(N0=>{"use strict";var x6r=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]}),S6r=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C6r=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)&&x6r(e,t,r);return S6r(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.ListEventsResponse=void 0;var sU=C6r(G()),O6r=nRe();N0.ListEventsResponse=sU.serialization.object({events:sU.serialization.list(O6r.Event).optional(),nextPageToken:sU.serialization.property("next_page_token",sU.serialization.string().optional()),totalSize:sU.serialization.property("total_size",sU.serialization.number().optional())})});var oRe=v(j0=>{"use strict";var P6r=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]}),E6r=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T6r=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)&&P6r(e,t,r);return E6r(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.TrainingStepMetrics=void 0;var qI=T6r(G());j0.TrainingStepMetrics=qI.serialization.object({createdAt:qI.serialization.property("created_at",qI.serialization.date().optional()),stepNumber:qI.serialization.property("step_number",qI.serialization.number().optional()),metrics:qI.serialization.record(qI.serialization.string(),qI.serialization.number()).optional()})});var UMt=v(D0=>{"use strict";var A6r=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]}),I6r=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M6r=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)&&A6r(e,t,r);return I6r(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.ListTrainingStepMetricsResponse=void 0;var I5=M6r(G()),R6r=oRe();D0.ListTrainingStepMetricsResponse=I5.serialization.object({stepMetrics:I5.serialization.property("step_metrics",I5.serialization.list(R6r.TrainingStepMetrics).optional()),nextPageToken:I5.serialization.property("next_page_token",I5.serialization.string().optional())})});var iRe=v(as=>{"use strict";var N6r=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]}),md=as&&as.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N6r(e,t,r)};Object.defineProperty(as,"__esModule",{value:!0});md(YMe(),as);md(XMe(),as);md(QMe(),as);md(eRe(),as);md(tRe(),as);md(Mie(),as);md(T5(),as);md(aU(),as);md(NMt(),as);md(DMt(),as);md(FMt(),as);md(kMt(),as);md(zMt(),as);md(nRe(),as);md(BMt(),as);md(oRe(),as);md(UMt(),as)});var qMt=v(iD=>{"use strict";var j6r=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]}),D6r=iD&&iD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j6r(e,t,r)};Object.defineProperty(iD,"__esModule",{value:!0});D6r(iRe(),iD)});var VMt=v(fh=>{"use strict";var HMt=fh&&fh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L6r=fh&&fh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F6r=fh&&fh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HMt(e,t,r);return L6r(e,t),e},k6r=fh&&fh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&HMt(e,t,r)};Object.defineProperty(fh,"__esModule",{value:!0});fh.finetuning=void 0;fh.finetuning=F6r(qMt());k6r(iRe(),fh)});var WMt=v(L0=>{"use strict";var $6r=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]}),z6r=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B6r=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)&&$6r(e,t,r);return z6r(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.FinetuningUpdateFinetunedModelRequest=void 0;var sm=B6r(G()),U6r=Mie(),q6r=T5();L0.FinetuningUpdateFinetunedModelRequest=sm.serialization.object({name:sm.serialization.string(),creatorId:sm.serialization.property("creator_id",sm.serialization.string().optional()),organizationId:sm.serialization.property("organization_id",sm.serialization.string().optional()),settings:U6r.Settings,status:q6r.Status.optional(),createdAt:sm.serialization.property("created_at",sm.serialization.date().optional()),updatedAt:sm.serialization.property("updated_at",sm.serialization.date().optional()),completedAt:sm.serialization.property("completed_at",sm.serialization.date().optional()),lastUsed:sm.serialization.property("last_used",sm.serialization.date().optional())})});var aRe=v(Rie=>{"use strict";Object.defineProperty(Rie,"__esModule",{value:!0});Rie.FinetuningUpdateFinetunedModelRequest=void 0;var H6r=WMt();Object.defineProperty(Rie,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return H6r.FinetuningUpdateFinetunedModelRequest}})});var KMt=v(aD=>{"use strict";var V6r=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]}),W6r=aD&&aD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&V6r(e,t,r)};Object.defineProperty(aD,"__esModule",{value:!0});W6r(aRe(),aD)});var JMt=v(HI=>{"use strict";var K6r=HI&&HI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GMt=HI&&HI.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K6r(e,t,r)};Object.defineProperty(HI,"__esModule",{value:!0});GMt(VMt(),HI);GMt(KMt(),HI)});var Nie=v(k0=>{"use strict";var G6r=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]}),J6r=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z6r=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)&&G6r(e,t,r);return J6r(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.CreateConnectorOAuth=void 0;var F0=Z6r(G());k0.CreateConnectorOAuth=F0.serialization.object({clientId:F0.serialization.property("client_id",F0.serialization.string().optional()),clientSecret:F0.serialization.property("client_secret",F0.serialization.string().optional()),authorizeUrl:F0.serialization.property("authorize_url",F0.serialization.string().optional()),tokenUrl:F0.serialization.property("token_url",F0.serialization.string().optional()),scope:F0.serialization.string().optional()})});var sRe=v($0=>{"use strict";var Y6r=$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]}),X6r=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q6r=$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)&&Y6r(e,t,r);return X6r(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.AuthTokenType=void 0;var e8r=Q6r(G());$0.AuthTokenType=e8r.serialization.enum_(["bearer","basic","noscheme"])});var jie=v(z0=>{"use strict";var t8r=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]}),r8r=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n8r=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)&&t8r(e,t,r);return r8r(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.CreateConnectorServiceAuth=void 0;var ZMt=n8r(G()),o8r=sRe();z0.CreateConnectorServiceAuth=ZMt.serialization.object({type:o8r.AuthTokenType,token:ZMt.serialization.string()})});var YMt=v(U0=>{"use strict";var i8r=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]}),a8r=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s8r=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)&&i8r(e,t,r);return a8r(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.CreateConnectorRequest=void 0;var B0=s8r(G()),u8r=Nie(),l8r=jie();U0.CreateConnectorRequest=B0.serialization.object({name:B0.serialization.string(),description:B0.serialization.string().optional(),url:B0.serialization.string(),excludes:B0.serialization.list(B0.serialization.string()).optional(),oauth:u8r.CreateConnectorOAuth.optional(),active:B0.serialization.boolean().optional(),continueOnFailure:B0.serialization.property("continue_on_failure",B0.serialization.boolean().optional()),serviceAuth:B0.serialization.property("service_auth",l8r.CreateConnectorServiceAuth.optional())})});var XMt=v(q0=>{"use strict";var c8r=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]}),d8r=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f8r=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)&&c8r(e,t,r);return d8r(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.UpdateConnectorRequest=void 0;var jP=f8r(G()),p8r=Nie(),m8r=jie();q0.UpdateConnectorRequest=jP.serialization.object({name:jP.serialization.string().optional(),url:jP.serialization.string().optional(),excludes:jP.serialization.list(jP.serialization.string()).optional(),oauth:p8r.CreateConnectorOAuth.optional(),active:jP.serialization.boolean().optional(),continueOnFailure:jP.serialization.property("continue_on_failure",jP.serialization.boolean().optional()),serviceAuth:jP.serialization.property("service_auth",m8r.CreateConnectorServiceAuth.optional())})});var uRe=v(uU=>{"use strict";Object.defineProperty(uU,"__esModule",{value:!0});uU.UpdateConnectorRequest=uU.CreateConnectorRequest=void 0;var h8r=YMt();Object.defineProperty(uU,"CreateConnectorRequest",{enumerable:!0,get:function(){return h8r.CreateConnectorRequest}});var g8r=XMt();Object.defineProperty(uU,"UpdateConnectorRequest",{enumerable:!0,get:function(){return g8r.UpdateConnectorRequest}})});var QMt=v(sD=>{"use strict";var y8r=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]}),b8r=sD&&sD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y8r(e,t,r)};Object.defineProperty(sD,"__esModule",{value:!0});b8r(uRe(),sD)});var eRt=v(uD=>{"use strict";var _8r=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]}),v8r=uD&&uD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_8r(e,t,r)};Object.defineProperty(uD,"__esModule",{value:!0});v8r(QMt(),uD)});var rRt=v(Hi=>{"use strict";var tRt=Hi&&Hi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w8r=Hi&&Hi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M5=Hi&&Hi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tRt(e,t,r);return w8r(e,t),e},lD=Hi&&Hi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tRt(e,t,r)};Object.defineProperty(Hi,"__esModule",{value:!0});Hi.connectors=Hi.finetuning=Hi.datasets=Hi.embedJobs=Hi.v2=void 0;Hi.v2=M5(yMt());lD($Me(),Hi);Hi.embedJobs=M5(wMt());lD(qMe(),Hi);Hi.datasets=M5(RMt());lD(JMe(),Hi);Hi.finetuning=M5(JMt());lD(BMe(),Hi);lD(HMe(),Hi);Hi.connectors=M5(eRt());lD(uRe(),Hi);lD(aRe(),Hi)});var lRe=v(H0=>{"use strict";var x8r=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]}),S8r=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C8r=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)&&x8r(e,t,r);return S8r(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ChatStreamRequestPromptTruncation=void 0;var O8r=C8r(G());H0.ChatStreamRequestPromptTruncation=O8r.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var cRe=v(V0=>{"use strict";var P8r=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]}),E8r=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T8r=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)&&P8r(e,t,r);return E8r(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.ChatStreamRequestCitationQuality=void 0;var A8r=T8r(G());V0.ChatStreamRequestCitationQuality=A8r.serialization.enum_(["fast","accurate","off"])});var oRt=v(W0=>{"use strict";var I8r=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]}),M8r=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R8r=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)&&I8r(e,t,r);return M8r(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.ChatStreamRequestConnectorsSearchOptions=void 0;var nRt=R8r(G());W0.ChatStreamRequestConnectorsSearchOptions=nRt.serialization.object({seed:nRt.serialization.number().optional()})});var dRe=v(K0=>{"use strict";var N8r=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]}),j8r=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D8r=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)&&N8r(e,t,r);return j8r(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.ChatStreamRequestSafetyMode=void 0;var L8r=D8r(G());K0.ChatStreamRequestSafetyMode=L8r.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var aRt=v(G0=>{"use strict";var F8r=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]}),k8r=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$8r=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)&&F8r(e,t,r);return k8r(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.UnprocessableEntityErrorBody=void 0;var iRt=$8r(G());G0.UnprocessableEntityErrorBody=iRt.serialization.object({data:iRt.serialization.string().optional()})});var uRt=v(J0=>{"use strict";var z8r=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]}),B8r=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U8r=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)&&z8r(e,t,r);return B8r(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.TooManyRequestsErrorBody=void 0;var sRt=U8r(G());J0.TooManyRequestsErrorBody=sRt.serialization.object({data:sRt.serialization.string().optional()})});var cRt=v(Z0=>{"use strict";var q8r=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]}),H8r=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V8r=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)&&q8r(e,t,r);return H8r(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.ClientClosedRequestErrorBody=void 0;var lRt=V8r(G());Z0.ClientClosedRequestErrorBody=lRt.serialization.object({data:lRt.serialization.string().optional()})});var fRt=v(Y0=>{"use strict";var W8r=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]}),K8r=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G8r=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)&&W8r(e,t,r);return K8r(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.NotImplementedErrorBody=void 0;var dRt=G8r(G());Y0.NotImplementedErrorBody=dRt.serialization.object({data:dRt.serialization.string().optional()})});var mRt=v(X0=>{"use strict";var J8r=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]}),Z8r=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y8r=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)&&J8r(e,t,r);return Z8r(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.GatewayTimeoutErrorBody=void 0;var pRt=Y8r(G());X0.GatewayTimeoutErrorBody=pRt.serialization.object({data:pRt.serialization.string().optional()})});var fRe=v(Q0=>{"use strict";var X8r=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]}),Q8r=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eVr=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)&&X8r(e,t,r);return Q8r(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.ChatRequestPromptTruncation=void 0;var tVr=eVr(G());Q0.ChatRequestPromptTruncation=tVr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var pRe=v(ex=>{"use strict";var rVr=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]}),nVr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oVr=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)&&rVr(e,t,r);return nVr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.ChatRequestCitationQuality=void 0;var iVr=oVr(G());ex.ChatRequestCitationQuality=iVr.serialization.enum_(["fast","accurate","off"])});var gRt=v(tx=>{"use strict";var aVr=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]}),sVr=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uVr=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)&&aVr(e,t,r);return sVr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.ChatRequestConnectorsSearchOptions=void 0;var hRt=uVr(G());tx.ChatRequestConnectorsSearchOptions=hRt.serialization.object({seed:hRt.serialization.number().optional()})});var mRe=v(rx=>{"use strict";var lVr=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]}),cVr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dVr=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)&&lVr(e,t,r);return cVr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.ChatRequestSafetyMode=void 0;var fVr=dVr(G());rx.ChatRequestSafetyMode=fVr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var hRe=v(nx=>{"use strict";var pVr=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]}),mVr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hVr=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)&&pVr(e,t,r);return mVr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.GenerateStreamRequestTruncate=void 0;var gVr=hVr(G());nx.GenerateStreamRequestTruncate=gVr.serialization.enum_(["NONE","START","END"])});var gRe=v(ox=>{"use strict";var yVr=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]}),bVr=ox&&ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Vr=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)&&yVr(e,t,r);return bVr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.GenerateStreamRequestReturnLikelihoods=void 0;var vVr=_Vr(G());ox.GenerateStreamRequestReturnLikelihoods=vVr.serialization.enum_(["GENERATION","ALL","NONE"])});var yRe=v(ix=>{"use strict";var wVr=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]}),xVr=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SVr=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)&&wVr(e,t,r);return xVr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.GenerateRequestTruncate=void 0;var CVr=SVr(G());ix.GenerateRequestTruncate=CVr.serialization.enum_(["NONE","START","END"])});var bRe=v(ax=>{"use strict";var OVr=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]}),PVr=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EVr=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)&&OVr(e,t,r);return PVr(e,t),e};Object.defineProperty(ax,"__esModule",{value:!0});ax.GenerateRequestReturnLikelihoods=void 0;var TVr=EVr(G());ax.GenerateRequestReturnLikelihoods=TVr.serialization.enum_(["GENERATION","ALL","NONE"])});var _Re=v(sx=>{"use strict";var AVr=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]}),IVr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MVr=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)&&AVr(e,t,r);return IVr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.EmbedRequestTruncate=void 0;var RVr=MVr(G());sx.EmbedRequestTruncate=RVr.serialization.enum_(["NONE","START","END"])});var vRe=v(ux=>{"use strict";var NVr=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]}),jVr=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DVr=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)&&NVr(e,t,r);return jVr(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.ApiMetaApiVersion=void 0;var lU=DVr(G());ux.ApiMetaApiVersion=lU.serialization.object({version:lU.serialization.string(),isDeprecated:lU.serialization.property("is_deprecated",lU.serialization.boolean().optional()),isExperimental:lU.serialization.property("is_experimental",lU.serialization.boolean().optional())})});var wRe=v(lx=>{"use strict";var LVr=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]}),FVr=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kVr=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)&&LVr(e,t,r);return FVr(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.ApiMetaBilledUnits=void 0;var VI=kVr(G());lx.ApiMetaBilledUnits=VI.serialization.object({inputTokens:VI.serialization.property("input_tokens",VI.serialization.number().optional()),outputTokens:VI.serialization.property("output_tokens",VI.serialization.number().optional()),searchUnits:VI.serialization.property("search_units",VI.serialization.number().optional()),classifications:VI.serialization.number().optional()})});var xRe=v(cx=>{"use strict";var $Vr=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]}),zVr=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BVr=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)&&$Vr(e,t,r);return zVr(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.ApiMetaTokens=void 0;var R5=BVr(G());cx.ApiMetaTokens=R5.serialization.object({inputTokens:R5.serialization.property("input_tokens",R5.serialization.number().optional()),outputTokens:R5.serialization.property("output_tokens",R5.serialization.number().optional())})});var ph=v(dx=>{"use strict";var UVr=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]}),qVr=dx&&dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HVr=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)&&UVr(e,t,r);return qVr(e,t),e};Object.defineProperty(dx,"__esModule",{value:!0});dx.ApiMeta=void 0;var N5=HVr(G()),VVr=vRe(),WVr=wRe(),KVr=xRe();dx.ApiMeta=N5.serialization.object({apiVersion:N5.serialization.property("api_version",VVr.ApiMetaApiVersion.optional()),billedUnits:N5.serialization.property("billed_units",WVr.ApiMetaBilledUnits.optional()),tokens:KVr.ApiMetaTokens.optional(),warnings:N5.serialization.list(N5.serialization.string()).optional()})});var SRe=v(fx=>{"use strict";var GVr=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]}),JVr=fx&&fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZVr=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)&&GVr(e,t,r);return JVr(e,t),e};Object.defineProperty(fx,"__esModule",{value:!0});fx.EmbedFloatsResponse=void 0;var cD=ZVr(G()),YVr=ph();fx.EmbedFloatsResponse=cD.serialization.object({id:cD.serialization.string(),embeddings:cD.serialization.list(cD.serialization.list(cD.serialization.number())),texts:cD.serialization.list(cD.serialization.string()),meta:YVr.ApiMeta.optional()})});var CRe=v(px=>{"use strict";var XVr=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]}),QVr=px&&px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e5r=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)&&XVr(e,t,r);return QVr(e,t),e};Object.defineProperty(px,"__esModule",{value:!0});px.EmbedByTypeResponseEmbeddings=void 0;var Cf=e5r(G());px.EmbedByTypeResponseEmbeddings=Cf.serialization.object({float:Cf.serialization.list(Cf.serialization.list(Cf.serialization.number())).optional(),int8:Cf.serialization.list(Cf.serialization.list(Cf.serialization.number())).optional(),uint8:Cf.serialization.list(Cf.serialization.list(Cf.serialization.number())).optional(),binary:Cf.serialization.list(Cf.serialization.list(Cf.serialization.number())).optional(),ubinary:Cf.serialization.list(Cf.serialization.list(Cf.serialization.number())).optional()})});var ORe=v(mx=>{"use strict";var t5r=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]}),r5r=mx&&mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n5r=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)&&t5r(e,t,r);return r5r(e,t),e};Object.defineProperty(mx,"__esModule",{value:!0});mx.EmbedByTypeResponse=void 0;var Die=n5r(G()),o5r=CRe(),i5r=ph();mx.EmbedByTypeResponse=Die.serialization.object({id:Die.serialization.string(),embeddings:o5r.EmbedByTypeResponseEmbeddings,texts:Die.serialization.list(Die.serialization.string()),meta:i5r.ApiMeta.optional()})});var bRt=v(hx=>{"use strict";var a5r=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]}),s5r=hx&&hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u5r=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)&&a5r(e,t,r);return s5r(e,t),e};Object.defineProperty(hx,"__esModule",{value:!0});hx.EmbedResponse=void 0;var yRt=u5r(G()),l5r=SRe(),c5r=ORe();hx.EmbedResponse=yRt.serialization.union(yRt.serialization.discriminant("responseType","response_type"),{embeddings_floats:l5r.EmbedFloatsResponse,embeddings_by_type:c5r.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var ERe=v(gx=>{"use strict";var d5r=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]}),f5r=gx&&gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p5r=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)&&d5r(e,t,r);return f5r(e,t),e};Object.defineProperty(gx,"__esModule",{value:!0});gx.RerankDocument=void 0;var PRe=p5r(G());gx.RerankDocument=PRe.serialization.record(PRe.serialization.string(),PRe.serialization.string())});var TRe=v(yx=>{"use strict";var m5r=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]}),h5r=yx&&yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g5r=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)&&m5r(e,t,r);return h5r(e,t),e};Object.defineProperty(yx,"__esModule",{value:!0});yx.RerankRequestDocumentsItem=void 0;var _Rt=g5r(G()),y5r=ERe();yx.RerankRequestDocumentsItem=_Rt.serialization.undiscriminatedUnion([_Rt.serialization.string(),y5r.RerankDocument])});var ARe=v(bx=>{"use strict";var b5r=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]}),_5r=bx&&bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v5r=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)&&b5r(e,t,r);return _5r(e,t),e};Object.defineProperty(bx,"__esModule",{value:!0});bx.RerankResponseResultsItemDocument=void 0;var vRt=v5r(G());bx.RerankResponseResultsItemDocument=vRt.serialization.object({text:vRt.serialization.string()})});var IRe=v(_x=>{"use strict";var w5r=_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]}),x5r=_x&&_x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S5r=_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)&&w5r(e,t,r);return x5r(e,t),e};Object.defineProperty(_x,"__esModule",{value:!0});_x.RerankResponseResultsItem=void 0;var Lie=S5r(G()),C5r=ARe();_x.RerankResponseResultsItem=Lie.serialization.object({document:C5r.RerankResponseResultsItemDocument.optional(),index:Lie.serialization.number(),relevanceScore:Lie.serialization.property("relevance_score",Lie.serialization.number())})});var wRt=v(vx=>{"use strict";var O5r=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]}),P5r=vx&&vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E5r=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)&&O5r(e,t,r);return P5r(e,t),e};Object.defineProperty(vx,"__esModule",{value:!0});vx.RerankResponse=void 0;var MRe=E5r(G()),T5r=IRe(),A5r=ph();vx.RerankResponse=MRe.serialization.object({id:MRe.serialization.string().optional(),results:MRe.serialization.list(T5r.RerankResponseResultsItem),meta:A5r.ApiMeta.optional()})});var RRe=v(wx=>{"use strict";var I5r=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]}),M5r=wx&&wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R5r=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)&&I5r(e,t,r);return M5r(e,t),e};Object.defineProperty(wx,"__esModule",{value:!0});wx.ClassifyRequestTruncate=void 0;var N5r=R5r(G());wx.ClassifyRequestTruncate=N5r.serialization.enum_(["NONE","START","END"])});var NRe=v(xx=>{"use strict";var j5r=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]}),D5r=xx&&xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L5r=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)&&j5r(e,t,r);return D5r(e,t),e};Object.defineProperty(xx,"__esModule",{value:!0});xx.ClassifyResponseClassificationsItemLabelsValue=void 0;var xRt=L5r(G());xx.ClassifyResponseClassificationsItemLabelsValue=xRt.serialization.object({confidence:xRt.serialization.number().optional()})});var jRe=v(Sx=>{"use strict";var F5r=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]}),k5r=Sx&&Sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5r=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)&&F5r(e,t,r);return k5r(e,t),e};Object.defineProperty(Sx,"__esModule",{value:!0});Sx.ClassifyResponseClassificationsItemClassificationType=void 0;var z5r=$5r(G());Sx.ClassifyResponseClassificationsItemClassificationType=z5r.serialization.enum_(["single-label","multi-label"])});var DRe=v(Cx=>{"use strict";var B5r=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]}),U5r=Cx&&Cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q5r=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)&&B5r(e,t,r);return U5r(e,t),e};Object.defineProperty(Cx,"__esModule",{value:!0});Cx.ClassifyResponseClassificationsItem=void 0;var Hg=q5r(G()),H5r=NRe(),V5r=jRe();Cx.ClassifyResponseClassificationsItem=Hg.serialization.object({id:Hg.serialization.string(),input:Hg.serialization.string().optional(),prediction:Hg.serialization.string().optional(),predictions:Hg.serialization.list(Hg.serialization.string()),confidence:Hg.serialization.number().optional(),confidences:Hg.serialization.list(Hg.serialization.number()),labels:Hg.serialization.record(Hg.serialization.string(),H5r.ClassifyResponseClassificationsItemLabelsValue),classificationType:Hg.serialization.property("classification_type",V5r.ClassifyResponseClassificationsItemClassificationType)})});var SRt=v(Ox=>{"use strict";var W5r=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]}),K5r=Ox&&Ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G5r=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)&&W5r(e,t,r);return K5r(e,t),e};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.ClassifyResponse=void 0;var LRe=G5r(G()),J5r=DRe(),Z5r=ph();Ox.ClassifyResponse=LRe.serialization.object({id:LRe.serialization.string(),classifications:LRe.serialization.list(J5r.ClassifyResponseClassificationsItem),meta:Z5r.ApiMeta.optional()})});var FRe=v(Px=>{"use strict";var Y5r=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]}),X5r=Px&&Px.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q5r=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)&&Y5r(e,t,r);return X5r(e,t),e};Object.defineProperty(Px,"__esModule",{value:!0});Px.SummarizeRequestLength=void 0;var e9r=Q5r(G());Px.SummarizeRequestLength=e9r.serialization.enum_(["short","medium","long"])});var kRe=v(Ex=>{"use strict";var t9r=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]}),r9r=Ex&&Ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n9r=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)&&t9r(e,t,r);return r9r(e,t),e};Object.defineProperty(Ex,"__esModule",{value:!0});Ex.SummarizeRequestFormat=void 0;var o9r=n9r(G());Ex.SummarizeRequestFormat=o9r.serialization.enum_(["paragraph","bullets"])});var $Re=v(Tx=>{"use strict";var i9r=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]}),a9r=Tx&&Tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s9r=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)&&i9r(e,t,r);return a9r(e,t),e};Object.defineProperty(Tx,"__esModule",{value:!0});Tx.SummarizeRequestExtractiveness=void 0;var u9r=s9r(G());Tx.SummarizeRequestExtractiveness=u9r.serialization.enum_(["low","medium","high"])});var CRt=v(Ax=>{"use strict";var l9r=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]}),c9r=Ax&&Ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d9r=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)&&l9r(e,t,r);return c9r(e,t),e};Object.defineProperty(Ax,"__esModule",{value:!0});Ax.SummarizeResponse=void 0;var zRe=d9r(G()),f9r=ph();Ax.SummarizeResponse=zRe.serialization.object({id:zRe.serialization.string().optional(),summary:zRe.serialization.string().optional(),meta:f9r.ApiMeta.optional()})});var ORt=v(Ix=>{"use strict";var p9r=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]}),m9r=Ix&&Ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h9r=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)&&p9r(e,t,r);return m9r(e,t),e};Object.defineProperty(Ix,"__esModule",{value:!0});Ix.TokenizeResponse=void 0;var cU=h9r(G()),g9r=ph();Ix.TokenizeResponse=cU.serialization.object({tokens:cU.serialization.list(cU.serialization.number()),tokenStrings:cU.serialization.property("token_strings",cU.serialization.list(cU.serialization.string())),meta:g9r.ApiMeta.optional()})});var ERt=v(Mx=>{"use strict";var y9r=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]}),b9r=Mx&&Mx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_9r=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)&&y9r(e,t,r);return b9r(e,t),e};Object.defineProperty(Mx,"__esModule",{value:!0});Mx.DetokenizeResponse=void 0;var PRt=_9r(G()),v9r=ph();Mx.DetokenizeResponse=PRt.serialization.object({text:PRt.serialization.string(),meta:v9r.ApiMeta.optional()})});var TRt=v(Rx=>{"use strict";var w9r=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]}),x9r=Rx&&Rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S9r=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)&&w9r(e,t,r);return x9r(e,t),e};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.CheckApiKeyResponse=void 0;var dU=S9r(G());Rx.CheckApiKeyResponse=dU.serialization.object({valid:dU.serialization.boolean(),organizationId:dU.serialization.property("organization_id",dU.serialization.string().optional()),ownerId:dU.serialization.property("owner_id",dU.serialization.string().optional())})});var fU=v(Nx=>{"use strict";var C9r=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]}),O9r=Nx&&Nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P9r=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)&&C9r(e,t,r);return O9r(e,t),e};Object.defineProperty(Nx,"__esModule",{value:!0});Nx.ToolCall=void 0;var j5=P9r(G());Nx.ToolCall=j5.serialization.object({name:j5.serialization.string(),parameters:j5.serialization.record(j5.serialization.string(),j5.serialization.unknown())})});var BRe=v(jx=>{"use strict";var E9r=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]}),T9r=jx&&jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A9r=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)&&E9r(e,t,r);return T9r(e,t),e};Object.defineProperty(jx,"__esModule",{value:!0});jx.ChatMessage=void 0;var Fie=A9r(G()),I9r=fU();jx.ChatMessage=Fie.serialization.object({message:Fie.serialization.string(),toolCalls:Fie.serialization.property("tool_calls",Fie.serialization.list(I9r.ToolCall).optional())})});var L5=v(Dx=>{"use strict";var M9r=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]}),R9r=Dx&&Dx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N9r=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)&&M9r(e,t,r);return R9r(e,t),e};Object.defineProperty(Dx,"__esModule",{value:!0});Dx.ToolResult=void 0;var D5=N9r(G()),j9r=fU();Dx.ToolResult=D5.serialization.object({call:j9r.ToolCall,outputs:D5.serialization.list(D5.serialization.record(D5.serialization.string(),D5.serialization.unknown()))})});var qRe=v(Lx=>{"use strict";var D9r=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]}),L9r=Lx&&Lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F9r=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)&&D9r(e,t,r);return L9r(e,t),e};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.ToolMessage=void 0;var URe=F9r(G()),k9r=L5();Lx.ToolMessage=URe.serialization.object({toolResults:URe.serialization.property("tool_results",URe.serialization.list(k9r.ToolResult).optional())})});var F5=v(Fx=>{"use strict";var $9r=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]}),z9r=Fx&&Fx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B9r=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)&&$9r(e,t,r);return z9r(e,t),e};Object.defineProperty(Fx,"__esModule",{value:!0});Fx.Message=void 0;var U9r=B9r(G()),HRe=BRe(),q9r=qRe();Fx.Message=U9r.serialization.union("role",{CHATBOT:HRe.ChatMessage,SYSTEM:HRe.ChatMessage,USER:HRe.ChatMessage,TOOL:q9r.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var kie=v(kx=>{"use strict";var H9r=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]}),V9r=kx&&kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W9r=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)&&H9r(e,t,r);return V9r(e,t),e};Object.defineProperty(kx,"__esModule",{value:!0});kx.ChatConnector=void 0;var DP=W9r(G());kx.ChatConnector=DP.serialization.object({id:DP.serialization.string(),userAccessToken:DP.serialization.property("user_access_token",DP.serialization.string().optional()),continueOnFailure:DP.serialization.property("continue_on_failure",DP.serialization.boolean().optional()),options:DP.serialization.record(DP.serialization.string(),DP.serialization.unknown()).optional()})});var VRe=v($x=>{"use strict";var K9r=$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]}),G9r=$x&&$x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J9r=$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)&&K9r(e,t,r);return G9r(e,t),e};Object.defineProperty($x,"__esModule",{value:!0});$x.ToolParameterDefinitionsValue=void 0;var $ie=J9r(G());$x.ToolParameterDefinitionsValue=$ie.serialization.object({description:$ie.serialization.string().optional(),type:$ie.serialization.string(),required:$ie.serialization.boolean().optional()})});var zie=v(zx=>{"use strict";var Z9r=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]}),Y9r=zx&&zx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X9r=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)&&Z9r(e,t,r);return Y9r(e,t),e};Object.defineProperty(zx,"__esModule",{value:!0});zx.Tool=void 0;var pU=X9r(G()),Q9r=VRe();zx.Tool=pU.serialization.object({name:pU.serialization.string(),description:pU.serialization.string(),parameterDefinitions:pU.serialization.property("parameter_definitions",pU.serialization.record(pU.serialization.string(),Q9r.ToolParameterDefinitionsValue).optional())})});var WRe=v(Bx=>{"use strict";var eWr=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]}),tWr=Bx&&Bx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rWr=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)&&eWr(e,t,r);return tWr(e,t),e};Object.defineProperty(Bx,"__esModule",{value:!0});Bx.JsonResponseFormat=void 0;var Bie=rWr(G());Bx.JsonResponseFormat=Bie.serialization.object({schema:Bie.serialization.record(Bie.serialization.string(),Bie.serialization.unknown()).optional()})});var Uie=v(Ux=>{"use strict";var nWr=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]}),oWr=Ux&&Ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iWr=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)&&nWr(e,t,r);return oWr(e,t),e};Object.defineProperty(Ux,"__esModule",{value:!0});Ux.ResponseFormat=void 0;var aWr=iWr(G()),sWr=Cie(),uWr=WRe();Ux.ResponseFormat=aWr.serialization.union("type",{text:sWr.TextResponseFormat,json_object:uWr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var qie=v(qx=>{"use strict";var lWr=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]}),cWr=qx&&qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dWr=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)&&lWr(e,t,r);return cWr(e,t),e};Object.defineProperty(qx,"__esModule",{value:!0});qx.ChatCitation=void 0;var dD=dWr(G());qx.ChatCitation=dD.serialization.object({start:dD.serialization.number(),end:dD.serialization.number(),text:dD.serialization.string(),documentIds:dD.serialization.property("document_ids",dD.serialization.list(dD.serialization.string()))})});var k5=v(Hx=>{"use strict";var fWr=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]}),pWr=Hx&&Hx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mWr=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)&&fWr(e,t,r);return pWr(e,t),e};Object.defineProperty(Hx,"__esModule",{value:!0});Hx.ChatSearchQuery=void 0;var Hie=mWr(G());Hx.ChatSearchQuery=Hie.serialization.object({text:Hie.serialization.string(),generationId:Hie.serialization.property("generation_id",Hie.serialization.string())})});var KRe=v(Vx=>{"use strict";var hWr=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]}),gWr=Vx&&Vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yWr=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)&&hWr(e,t,r);return gWr(e,t),e};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.ChatSearchResultConnector=void 0;var ARt=yWr(G());Vx.ChatSearchResultConnector=ARt.serialization.object({id:ARt.serialization.string()})});var Vie=v(Wx=>{"use strict";var bWr=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]}),_Wr=Wx&&Wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vWr=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)&&bWr(e,t,r);return _Wr(e,t),e};Object.defineProperty(Wx,"__esModule",{value:!0});Wx.ChatSearchResult=void 0;var LP=vWr(G()),wWr=k5(),xWr=KRe();Wx.ChatSearchResult=LP.serialization.object({searchQuery:LP.serialization.property("search_query",wWr.ChatSearchQuery.optional()),connector:xWr.ChatSearchResultConnector,documentIds:LP.serialization.property("document_ids",LP.serialization.list(LP.serialization.string())),errorMessage:LP.serialization.property("error_message",LP.serialization.string().optional()),continueOnFailure:LP.serialization.property("continue_on_failure",LP.serialization.boolean().optional())})});var mU=v(Kx=>{"use strict";var SWr=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]}),CWr=Kx&&Kx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OWr=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)&&SWr(e,t,r);return CWr(e,t),e};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.FinishReason=void 0;var PWr=OWr(G());Kx.FinishReason=PWr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var GRe=v(Gx=>{"use strict";var EWr=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]}),TWr=Gx&&Gx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AWr=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)&&EWr(e,t,r);return TWr(e,t),e};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.NonStreamedChatResponse=void 0;var wc=AWr(G()),IWr=qie(),MWr=eD(),RWr=k5(),NWr=Vie(),jWr=mU(),DWr=fU(),LWr=F5(),FWr=ph();Gx.NonStreamedChatResponse=wc.serialization.object({text:wc.serialization.string(),generationId:wc.serialization.property("generation_id",wc.serialization.string().optional()),citations:wc.serialization.list(IWr.ChatCitation).optional(),documents:wc.serialization.list(MWr.ChatDocument).optional(),isSearchRequired:wc.serialization.property("is_search_required",wc.serialization.boolean().optional()),searchQueries:wc.serialization.property("search_queries",wc.serialization.list(RWr.ChatSearchQuery).optional()),searchResults:wc.serialization.property("search_results",wc.serialization.list(NWr.ChatSearchResult).optional()),finishReason:wc.serialization.property("finish_reason",jWr.FinishReason.optional()),toolCalls:wc.serialization.property("tool_calls",wc.serialization.list(DWr.ToolCall).optional()),chatHistory:wc.serialization.property("chat_history",wc.serialization.list(LWr.Message).optional()),prompt:wc.serialization.string().optional(),meta:FWr.ApiMeta.optional()})});var Zx=v(Jx=>{"use strict";var kWr=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]}),$Wr=Jx&&Jx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zWr=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)&&kWr(e,t,r);return $Wr(e,t),e};Object.defineProperty(Jx,"__esModule",{value:!0});Jx.ChatStreamEvent=void 0;var BWr=zWr(G());Jx.ChatStreamEvent=BWr.serialization.object({})});var ZRe=v(Yx=>{"use strict";var UWr=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]}),qWr=Yx&&Yx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HWr=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)&&UWr(e,t,r);return qWr(e,t),e};Object.defineProperty(Yx,"__esModule",{value:!0});Yx.ChatStreamStartEvent=void 0;var JRe=HWr(G()),VWr=Zx();Yx.ChatStreamStartEvent=JRe.serialization.object({generationId:JRe.serialization.property("generation_id",JRe.serialization.string())}).extend(VWr.ChatStreamEvent)});var XRe=v(Xx=>{"use strict";var WWr=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]}),KWr=Xx&&Xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GWr=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)&&WWr(e,t,r);return KWr(e,t),e};Object.defineProperty(Xx,"__esModule",{value:!0});Xx.ChatSearchQueriesGenerationEvent=void 0;var YRe=GWr(G()),JWr=k5(),ZWr=Zx();Xx.ChatSearchQueriesGenerationEvent=YRe.serialization.object({searchQueries:YRe.serialization.property("search_queries",YRe.serialization.list(JWr.ChatSearchQuery))}).extend(ZWr.ChatStreamEvent)});var QRe=v(Qx=>{"use strict";var YWr=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]}),XWr=Qx&&Qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QWr=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)&&YWr(e,t,r);return XWr(e,t),e};Object.defineProperty(Qx,"__esModule",{value:!0});Qx.ChatSearchResultsEvent=void 0;var Wie=QWr(G()),eKr=Vie(),tKr=eD(),rKr=Zx();Qx.ChatSearchResultsEvent=Wie.serialization.object({searchResults:Wie.serialization.property("search_results",Wie.serialization.list(eKr.ChatSearchResult).optional()),documents:Wie.serialization.list(tKr.ChatDocument).optional()}).extend(rKr.ChatStreamEvent)});var e1e=v(eS=>{"use strict";var nKr=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]}),oKr=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iKr=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)&&nKr(e,t,r);return oKr(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.ChatTextGenerationEvent=void 0;var IRt=iKr(G()),aKr=Zx();eS.ChatTextGenerationEvent=IRt.serialization.object({text:IRt.serialization.string()}).extend(aKr.ChatStreamEvent)});var t1e=v(tS=>{"use strict";var sKr=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]}),uKr=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lKr=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)&&sKr(e,t,r);return uKr(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.ChatCitationGenerationEvent=void 0;var MRt=lKr(G()),cKr=qie(),dKr=Zx();tS.ChatCitationGenerationEvent=MRt.serialization.object({citations:MRt.serialization.list(cKr.ChatCitation)}).extend(dKr.ChatStreamEvent)});var r1e=v(rS=>{"use strict";var fKr=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]}),pKr=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mKr=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)&&fKr(e,t,r);return pKr(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.ChatToolCallsGenerationEvent=void 0;var Kie=mKr(G()),hKr=fU(),gKr=Zx();rS.ChatToolCallsGenerationEvent=Kie.serialization.object({text:Kie.serialization.string().optional(),toolCalls:Kie.serialization.property("tool_calls",Kie.serialization.list(hKr.ToolCall))}).extend(gKr.ChatStreamEvent)});var n1e=v(nS=>{"use strict";var yKr=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]}),bKr=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Kr=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)&&yKr(e,t,r);return bKr(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.ChatStreamEndEventFinishReason=void 0;var vKr=_Kr(G());nS.ChatStreamEndEventFinishReason=vKr.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var o1e=v(oS=>{"use strict";var wKr=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]}),xKr=oS&&oS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SKr=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)&&wKr(e,t,r);return xKr(e,t),e};Object.defineProperty(oS,"__esModule",{value:!0});oS.ChatStreamEndEvent=void 0;var RRt=SKr(G()),CKr=n1e(),OKr=GRe(),PKr=Zx();oS.ChatStreamEndEvent=RRt.serialization.object({finishReason:RRt.serialization.property("finish_reason",CKr.ChatStreamEndEventFinishReason),response:OKr.NonStreamedChatResponse}).extend(PKr.ChatStreamEvent)});var i1e=v(iS=>{"use strict";var EKr=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]}),TKr=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AKr=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)&&EKr(e,t,r);return TKr(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.ToolCallDelta=void 0;var $5=AKr(G());iS.ToolCallDelta=$5.serialization.object({name:$5.serialization.string().optional(),index:$5.serialization.number().optional(),parameters:$5.serialization.string().optional(),text:$5.serialization.string().optional()})});var a1e=v(aS=>{"use strict";var IKr=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]}),MKr=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RKr=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)&&IKr(e,t,r);return MKr(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.ChatToolCallsChunkEvent=void 0;var NRt=RKr(G()),NKr=i1e(),jKr=Zx();aS.ChatToolCallsChunkEvent=NRt.serialization.object({toolCallDelta:NRt.serialization.property("tool_call_delta",NKr.ToolCallDelta)}).extend(jKr.ChatStreamEvent)});var DRt=v(sS=>{"use strict";var DKr=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]}),LKr=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FKr=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)&&DKr(e,t,r);return LKr(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.StreamedChatResponse=void 0;var jRt=FKr(G()),kKr=ZRe(),$Kr=XRe(),zKr=QRe(),BKr=e1e(),UKr=t1e(),qKr=r1e(),HKr=o1e(),VKr=a1e();sS.StreamedChatResponse=jRt.serialization.union(jRt.serialization.discriminant("eventType","event_type"),{"stream-start":kKr.ChatStreamStartEvent,"search-queries-generation":$Kr.ChatSearchQueriesGenerationEvent,"search-results":zKr.ChatSearchResultsEvent,"text-generation":BKr.ChatTextGenerationEvent,"citation-generation":UKr.ChatCitationGenerationEvent,"tool-calls-generation":qKr.ChatToolCallsGenerationEvent,"stream-end":HKr.ChatStreamEndEvent,"tool-calls-chunk":VKr.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var u1e=v(uS=>{"use strict";var WKr=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]}),KKr=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GKr=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)&&WKr(e,t,r);return KKr(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.SingleGenerationTokenLikelihoodsItem=void 0;var s1e=GKr(G());uS.SingleGenerationTokenLikelihoodsItem=s1e.serialization.object({token:s1e.serialization.string(),likelihood:s1e.serialization.number()})});var l1e=v(lS=>{"use strict";var JKr=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]}),ZKr=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YKr=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)&&JKr(e,t,r);return ZKr(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.SingleGeneration=void 0;var fD=YKr(G()),XKr=u1e();lS.SingleGeneration=fD.serialization.object({id:fD.serialization.string(),text:fD.serialization.string(),index:fD.serialization.number().optional(),likelihood:fD.serialization.number().optional(),tokenLikelihoods:fD.serialization.property("token_likelihoods",fD.serialization.list(XKr.SingleGenerationTokenLikelihoodsItem).optional())})});var LRt=v(cS=>{"use strict";var QKr=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]}),eGr=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tGr=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)&&QKr(e,t,r);return eGr(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.Generation=void 0;var Gie=tGr(G()),rGr=l1e(),nGr=ph();cS.Generation=Gie.serialization.object({id:Gie.serialization.string(),prompt:Gie.serialization.string().optional(),generations:Gie.serialization.list(rGr.SingleGeneration),meta:nGr.ApiMeta.optional()})});var z5=v(dS=>{"use strict";var oGr=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]}),iGr=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aGr=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)&&oGr(e,t,r);return iGr(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.GenerateStreamEvent=void 0;var sGr=aGr(G());dS.GenerateStreamEvent=sGr.serialization.object({})});var c1e=v(fS=>{"use strict";var uGr=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]}),lGr=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cGr=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)&&uGr(e,t,r);return lGr(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.GenerateStreamText=void 0;var B5=cGr(G()),dGr=z5();fS.GenerateStreamText=B5.serialization.object({text:B5.serialization.string(),index:B5.serialization.number().optional(),isFinished:B5.serialization.property("is_finished",B5.serialization.boolean())}).extend(dGr.GenerateStreamEvent)});var d1e=v(pS=>{"use strict";var fGr=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]}),pGr=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mGr=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)&&fGr(e,t,r);return pGr(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.SingleGenerationInStream=void 0;var U5=mGr(G()),hGr=mU();pS.SingleGenerationInStream=U5.serialization.object({id:U5.serialization.string(),text:U5.serialization.string(),index:U5.serialization.number().optional(),finishReason:U5.serialization.property("finish_reason",hGr.FinishReason)})});var f1e=v(mS=>{"use strict";var gGr=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]}),yGr=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bGr=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)&&gGr(e,t,r);return yGr(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.GenerateStreamEndResponse=void 0;var Jie=bGr(G()),_Gr=d1e();mS.GenerateStreamEndResponse=Jie.serialization.object({id:Jie.serialization.string(),prompt:Jie.serialization.string().optional(),generations:Jie.serialization.list(_Gr.SingleGenerationInStream).optional()})});var p1e=v(hS=>{"use strict";var vGr=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]}),wGr=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xGr=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)&&vGr(e,t,r);return wGr(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.GenerateStreamEnd=void 0;var Zie=xGr(G()),SGr=mU(),CGr=f1e(),OGr=z5();hS.GenerateStreamEnd=Zie.serialization.object({isFinished:Zie.serialization.property("is_finished",Zie.serialization.boolean()),finishReason:Zie.serialization.property("finish_reason",SGr.FinishReason.optional()),response:CGr.GenerateStreamEndResponse}).extend(OGr.GenerateStreamEvent)});var m1e=v(gS=>{"use strict";var PGr=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]}),EGr=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TGr=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)&&PGr(e,t,r);return EGr(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.GenerateStreamError=void 0;var hU=TGr(G()),AGr=mU(),IGr=z5();gS.GenerateStreamError=hU.serialization.object({index:hU.serialization.number().optional(),isFinished:hU.serialization.property("is_finished",hU.serialization.boolean()),finishReason:hU.serialization.property("finish_reason",AGr.FinishReason),err:hU.serialization.string()}).extend(IGr.GenerateStreamEvent)});var kRt=v(yS=>{"use strict";var MGr=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]}),RGr=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NGr=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)&&MGr(e,t,r);return RGr(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.GenerateStreamedResponse=void 0;var FRt=NGr(G()),jGr=c1e(),DGr=p1e(),LGr=m1e();yS.GenerateStreamedResponse=FRt.serialization.union(FRt.serialization.discriminant("eventType","event_type"),{"text-generation":jGr.GenerateStreamText,"stream-end":DGr.GenerateStreamEnd,"stream-error":LGr.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var h1e=v(bS=>{"use strict";var FGr=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]}),kGr=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Gr=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)&&FGr(e,t,r);return kGr(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.EmbedJobStatus=void 0;var zGr=$Gr(G());bS.EmbedJobStatus=zGr.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var g1e=v(_S=>{"use strict";var BGr=_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]}),UGr=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qGr=_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)&&BGr(e,t,r);return UGr(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.EmbedJobTruncate=void 0;var HGr=qGr(G());_S.EmbedJobTruncate=HGr.serialization.enum_(["START","END"])});var y1e=v(vS=>{"use strict";var VGr=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]}),WGr=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KGr=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)&&VGr(e,t,r);return WGr(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.EmbedJob=void 0;var Pb=KGr(G()),GGr=h1e(),JGr=g1e(),ZGr=ph();vS.EmbedJob=Pb.serialization.object({jobId:Pb.serialization.property("job_id",Pb.serialization.string()),name:Pb.serialization.string().optional(),status:GGr.EmbedJobStatus,createdAt:Pb.serialization.property("created_at",Pb.serialization.date()),inputDatasetId:Pb.serialization.property("input_dataset_id",Pb.serialization.string()),outputDatasetId:Pb.serialization.property("output_dataset_id",Pb.serialization.string().optional()),model:Pb.serialization.string(),truncate:JGr.EmbedJobTruncate,meta:ZGr.ApiMeta.optional()})});var $Rt=v(wS=>{"use strict";var YGr=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]}),XGr=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QGr=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)&&YGr(e,t,r);return XGr(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.ListEmbedJobResponse=void 0;var b1e=QGr(G()),eJr=y1e();wS.ListEmbedJobResponse=b1e.serialization.object({embedJobs:b1e.serialization.property("embed_jobs",b1e.serialization.list(eJr.EmbedJob).optional())})});var zRt=v(xS=>{"use strict";var tJr=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]}),rJr=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nJr=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)&&tJr(e,t,r);return rJr(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.CreateEmbedJobResponse=void 0;var _1e=nJr(G()),oJr=ph();xS.CreateEmbedJobResponse=_1e.serialization.object({jobId:_1e.serialization.property("job_id",_1e.serialization.string()),meta:oJr.ApiMeta.optional()})});var w1e=v(SS=>{"use strict";var iJr=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]}),aJr=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sJr=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)&&iJr(e,t,r);return aJr(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.ClassifyExample=void 0;var v1e=sJr(G());SS.ClassifyExample=v1e.serialization.object({text:v1e.serialization.string().optional(),label:v1e.serialization.string().optional()})});var BRt=v(CS=>{"use strict";var uJr=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]}),lJr=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cJr=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)&&uJr(e,t,r);return lJr(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.ParseInfo=void 0;var x1e=cJr(G());CS.ParseInfo=x1e.serialization.object({separator:x1e.serialization.string().optional(),delimiter:x1e.serialization.string().optional()})});var URt=v(OS=>{"use strict";var dJr=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]}),fJr=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pJr=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)&&dJr(e,t,r);return fJr(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.RerankerDataMetrics=void 0;var mh=pJr(G());OS.RerankerDataMetrics=mh.serialization.object({numTrainQueries:mh.serialization.property("num_train_queries",mh.serialization.number().optional()),numTrainRelevantPassages:mh.serialization.property("num_train_relevant_passages",mh.serialization.number().optional()),numTrainHardNegatives:mh.serialization.property("num_train_hard_negatives",mh.serialization.number().optional()),numEvalQueries:mh.serialization.property("num_eval_queries",mh.serialization.number().optional()),numEvalRelevantPassages:mh.serialization.property("num_eval_relevant_passages",mh.serialization.number().optional()),numEvalHardNegatives:mh.serialization.property("num_eval_hard_negatives",mh.serialization.number().optional())})});var qRt=v(PS=>{"use strict";var mJr=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]}),hJr=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gJr=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)&&mJr(e,t,r);return hJr(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.ChatDataMetrics=void 0;var gU=gJr(G());PS.ChatDataMetrics=gU.serialization.object({numTrainTurns:gU.serialization.property("num_train_turns",gU.serialization.number().optional()),numEvalTurns:gU.serialization.property("num_eval_turns",gU.serialization.number().optional()),preamble:gU.serialization.string().optional()})});var S1e=v(ES=>{"use strict";var yJr=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]}),bJr=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Jr=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)&&yJr(e,t,r);return bJr(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.LabelMetric=void 0;var yU=_Jr(G());ES.LabelMetric=yU.serialization.object({totalExamples:yU.serialization.property("total_examples",yU.serialization.number().optional()),label:yU.serialization.string().optional(),samples:yU.serialization.list(yU.serialization.string()).optional()})});var HRt=v(TS=>{"use strict";var vJr=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]}),wJr=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xJr=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)&&vJr(e,t,r);return wJr(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.ClassifyDataMetrics=void 0;var C1e=xJr(G()),SJr=S1e();TS.ClassifyDataMetrics=C1e.serialization.object({labelMetrics:C1e.serialization.property("label_metrics",C1e.serialization.list(SJr.LabelMetric).optional())})});var O1e=v(AS=>{"use strict";var CJr=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]}),OJr=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PJr=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)&&CJr(e,t,r);return OJr(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.FinetuneDatasetMetrics=void 0;var hh=PJr(G());AS.FinetuneDatasetMetrics=hh.serialization.object({trainableTokenCount:hh.serialization.property("trainable_token_count",hh.serialization.number().optional()),totalExamples:hh.serialization.property("total_examples",hh.serialization.number().optional()),trainExamples:hh.serialization.property("train_examples",hh.serialization.number().optional()),trainSizeBytes:hh.serialization.property("train_size_bytes",hh.serialization.number().optional()),evalExamples:hh.serialization.property("eval_examples",hh.serialization.number().optional()),evalSizeBytes:hh.serialization.property("eval_size_bytes",hh.serialization.number().optional())})});var E1e=v(IS=>{"use strict";var EJr=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]}),TJr=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AJr=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)&&EJr(e,t,r);return TJr(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.MetricsEmbedDataFieldsItem=void 0;var P1e=AJr(G());IS.MetricsEmbedDataFieldsItem=P1e.serialization.object({name:P1e.serialization.string().optional(),count:P1e.serialization.number().optional()})});var T1e=v(MS=>{"use strict";var IJr=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]}),MJr=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RJr=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)&&IJr(e,t,r);return MJr(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.MetricsEmbedData=void 0;var VRt=RJr(G()),NJr=E1e();MS.MetricsEmbedData=VRt.serialization.object({fields:VRt.serialization.list(NJr.MetricsEmbedDataFieldsItem).optional()})});var WRt=v(RS=>{"use strict";var jJr=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]}),DJr=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LJr=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)&&jJr(e,t,r);return DJr(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.Metrics=void 0;var A1e=LJr(G()),FJr=O1e(),kJr=T1e();RS.Metrics=A1e.serialization.object({finetuneDatasetMetrics:A1e.serialization.property("finetune_dataset_metrics",FJr.FinetuneDatasetMetrics.optional()),embedData:A1e.serialization.property("embed_data",kJr.MetricsEmbedData.optional())})});var I1e=v(jS=>{"use strict";var $Jr=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]}),zJr=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BJr=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)&&$Jr(e,t,r);return zJr(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.ConnectorOAuth=void 0;var NS=BJr(G());jS.ConnectorOAuth=NS.serialization.object({clientId:NS.serialization.property("client_id",NS.serialization.string().optional()),clientSecret:NS.serialization.property("client_secret",NS.serialization.string().optional()),authorizeUrl:NS.serialization.property("authorize_url",NS.serialization.string()),tokenUrl:NS.serialization.property("token_url",NS.serialization.string()),scope:NS.serialization.string().optional()})});var M1e=v(DS=>{"use strict";var UJr=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]}),qJr=DS&&DS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HJr=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)&&UJr(e,t,r);return qJr(e,t),e};Object.defineProperty(DS,"__esModule",{value:!0});DS.ConnectorAuthStatus=void 0;var VJr=HJr(G());DS.ConnectorAuthStatus=VJr.serialization.enum_(["valid","expired"])});var bU=v(LS=>{"use strict";var WJr=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]}),KJr=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GJr=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)&&WJr(e,t,r);return KJr(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.Connector=void 0;var Zl=GJr(G()),JJr=I1e(),ZJr=M1e();LS.Connector=Zl.serialization.object({id:Zl.serialization.string(),organizationId:Zl.serialization.property("organization_id",Zl.serialization.string().optional()),name:Zl.serialization.string(),description:Zl.serialization.string().optional(),url:Zl.serialization.string().optional(),createdAt:Zl.serialization.property("created_at",Zl.serialization.date()),updatedAt:Zl.serialization.property("updated_at",Zl.serialization.date()),excludes:Zl.serialization.list(Zl.serialization.string()).optional(),authType:Zl.serialization.property("auth_type",Zl.serialization.string().optional()),oauth:JJr.ConnectorOAuth.optional(),authStatus:Zl.serialization.property("auth_status",ZJr.ConnectorAuthStatus.optional()),active:Zl.serialization.boolean().optional(),continueOnFailure:Zl.serialization.property("continue_on_failure",Zl.serialization.boolean().optional())})});var KRt=v(FS=>{"use strict";var YJr=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]}),XJr=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QJr=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)&&YJr(e,t,r);return XJr(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.ListConnectorsResponse=void 0;var Yie=QJr(G()),e7r=bU();FS.ListConnectorsResponse=Yie.serialization.object({connectors:Yie.serialization.list(e7r.Connector),totalCount:Yie.serialization.property("total_count",Yie.serialization.number().optional())})});var GRt=v(kS=>{"use strict";var t7r=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]}),r7r=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n7r=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)&&t7r(e,t,r);return r7r(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.CreateConnectorResponse=void 0;var o7r=n7r(G()),i7r=bU();kS.CreateConnectorResponse=o7r.serialization.object({connector:i7r.Connector})});var JRt=v($S=>{"use strict";var a7r=$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]}),s7r=$S&&$S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u7r=$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)&&a7r(e,t,r);return s7r(e,t),e};Object.defineProperty($S,"__esModule",{value:!0});$S.GetConnectorResponse=void 0;var l7r=u7r(G()),c7r=bU();$S.GetConnectorResponse=l7r.serialization.object({connector:c7r.Connector})});var ZRt=v(zS=>{"use strict";var d7r=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]}),f7r=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p7r=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)&&d7r(e,t,r);return f7r(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.DeleteConnectorResponse=void 0;var R1e=p7r(G());zS.DeleteConnectorResponse=R1e.serialization.record(R1e.serialization.string(),R1e.serialization.unknown())});var YRt=v(BS=>{"use strict";var m7r=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]}),h7r=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g7r=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)&&m7r(e,t,r);return h7r(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.UpdateConnectorResponse=void 0;var y7r=g7r(G()),b7r=bU();BS.UpdateConnectorResponse=y7r.serialization.object({connector:b7r.Connector})});var XRt=v(US=>{"use strict";var _7r=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]}),v7r=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w7r=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)&&_7r(e,t,r);return v7r(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.OAuthAuthorizeResponse=void 0;var N1e=w7r(G());US.OAuthAuthorizeResponse=N1e.serialization.object({redirectUrl:N1e.serialization.property("redirect_url",N1e.serialization.string().optional())})});var j1e=v(qS=>{"use strict";var x7r=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]}),S7r=qS&&qS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C7r=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)&&x7r(e,t,r);return S7r(e,t),e};Object.defineProperty(qS,"__esModule",{value:!0});qS.CompatibleEndpoint=void 0;var O7r=C7r(G());qS.CompatibleEndpoint=O7r.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var D1e=v(VS=>{"use strict";var P7r=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]}),E7r=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T7r=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)&&P7r(e,t,r);return E7r(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.GetModelResponse=void 0;var HS=T7r(G()),QRt=j1e();VS.GetModelResponse=HS.serialization.object({name:HS.serialization.string().optional(),endpoints:HS.serialization.list(QRt.CompatibleEndpoint).optional(),finetuned:HS.serialization.boolean().optional(),contextLength:HS.serialization.property("context_length",HS.serialization.number().optional()),tokenizerUrl:HS.serialization.property("tokenizer_url",HS.serialization.string().optional()),defaultEndpoints:HS.serialization.property("default_endpoints",HS.serialization.list(QRt.CompatibleEndpoint).optional())})});var e1t=v(WS=>{"use strict";var A7r=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]}),I7r=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M7r=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)&&A7r(e,t,r);return I7r(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.ListModelsResponse=void 0;var Xie=M7r(G()),R7r=D1e();WS.ListModelsResponse=Xie.serialization.object({models:Xie.serialization.list(R7r.GetModelResponse),nextPageToken:Xie.serialization.property("next_page_token",Xie.serialization.string().optional())})});var t1t=v(he=>{"use strict";var N7r=he&&he.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ce=he&&he.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N7r(e,t,r)};Object.defineProperty(he,"__esModule",{value:!0});Ce(lRe(),he);Ce(cRe(),he);Ce(oRt(),he);Ce(dRe(),he);Ce(aRt(),he);Ce(uRt(),he);Ce(cRt(),he);Ce(fRt(),he);Ce(mRt(),he);Ce(fRe(),he);Ce(pRe(),he);Ce(gRt(),he);Ce(mRe(),he);Ce(hRe(),he);Ce(gRe(),he);Ce(yRe(),he);Ce(bRe(),he);Ce(_Re(),he);Ce(bRt(),he);Ce(TRe(),he);Ce(ARe(),he);Ce(IRe(),he);Ce(wRt(),he);Ce(RRe(),he);Ce(NRe(),he);Ce(jRe(),he);Ce(DRe(),he);Ce(SRt(),he);Ce(FRe(),he);Ce(kRe(),he);Ce($Re(),he);Ce(CRt(),he);Ce(ORt(),he);Ce(ERt(),he);Ce(TRt(),he);Ce(fU(),he);Ce(BRe(),he);Ce(L5(),he);Ce(qRe(),he);Ce(F5(),he);Ce(kie(),he);Ce(eD(),he);Ce(VRe(),he);Ce(zie(),he);Ce(Cie(),he);Ce(WRe(),he);Ce(Uie(),he);Ce(qie(),he);Ce(k5(),he);Ce(KRe(),he);Ce(Vie(),he);Ce(mU(),he);Ce(vRe(),he);Ce(wRe(),he);Ce(xRe(),he);Ce(ph(),he);Ce(GRe(),he);Ce(Zx(),he);Ce(ZRe(),he);Ce(XRe(),he);Ce(QRe(),he);Ce(e1e(),he);Ce(t1e(),he);Ce(r1e(),he);Ce(n1e(),he);Ce(o1e(),he);Ce(i1e(),he);Ce(a1e(),he);Ce(DRt(),he);Ce(zMe(),he);Ce(Oie(),he);Ce(DMe(),he);Ce(LMe(),he);Ce(FMe(),he);Ce(kMe(),he);Ce(u1e(),he);Ce(l1e(),he);Ce(LRt(),he);Ce(z5(),he);Ce(c1e(),he);Ce(d1e(),he);Ce(f1e(),he);Ce(p1e(),he);Ce(m1e(),he);Ce(kRt(),he);Ce(Pie(),he);Ce(Eie(),he);Ce(SRe(),he);Ce(CRe(),he);Ce(ORe(),he);Ce(h1e(),he);Ce(g1e(),he);Ce(y1e(),he);Ce($Rt(),he);Ce(zRt(),he);Ce(ERe(),he);Ce(w1e(),he);Ce(WMe(),he);Ce(VMe(),he);Ce(KMe(),he);Ce(BRt(),he);Ce(URt(),he);Ce(qRt(),he);Ce(S1e(),he);Ce(HRt(),he);Ce(O1e(),he);Ce(E1e(),he);Ce(T1e(),he);Ce(WRt(),he);Ce(Aie(),he);Ce(I1e(),he);Ce(M1e(),he);Ce(bU(),he);Ce(KRt(),he);Ce(Nie(),he);Ce(sRe(),he);Ce(jie(),he);Ce(GRt(),he);Ce(JRt(),he);Ce(ZRt(),he);Ce(YRt(),he);Ce(XRt(),he);Ce(j1e(),he);Ce(D1e(),he);Ce(e1t(),he)});var r1t=v(KS=>{"use strict";var j7r=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]}),D7r=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L7r=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)&&j7r(e,t,r);return D7r(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.ChatStreamRequest=void 0;var xn=L7r(G()),F7r=F5(),k7r=lRe(),$7r=kie(),z7r=eD(),B7r=cRe(),U7r=zie(),q7r=L5(),H7r=Uie(),V7r=dRe();KS.ChatStreamRequest=xn.serialization.object({message:xn.serialization.string(),model:xn.serialization.string().optional(),preamble:xn.serialization.string().optional(),chatHistory:xn.serialization.property("chat_history",xn.serialization.list(F7r.Message).optional()),conversationId:xn.serialization.property("conversation_id",xn.serialization.string().optional()),promptTruncation:xn.serialization.property("prompt_truncation",k7r.ChatStreamRequestPromptTruncation.optional()),connectors:xn.serialization.list($7r.ChatConnector).optional(),searchQueriesOnly:xn.serialization.property("search_queries_only",xn.serialization.boolean().optional()),documents:xn.serialization.list(z7r.ChatDocument).optional(),citationQuality:xn.serialization.property("citation_quality",B7r.ChatStreamRequestCitationQuality.optional()),temperature:xn.serialization.number().optional(),maxTokens:xn.serialization.property("max_tokens",xn.serialization.number().optional()),maxInputTokens:xn.serialization.property("max_input_tokens",xn.serialization.number().optional()),k:xn.serialization.number().optional(),p:xn.serialization.number().optional(),seed:xn.serialization.number().optional(),stopSequences:xn.serialization.property("stop_sequences",xn.serialization.list(xn.serialization.string()).optional()),frequencyPenalty:xn.serialization.property("frequency_penalty",xn.serialization.number().optional()),presencePenalty:xn.serialization.property("presence_penalty",xn.serialization.number().optional()),rawPrompting:xn.serialization.property("raw_prompting",xn.serialization.boolean().optional()),returnPrompt:xn.serialization.property("return_prompt",xn.serialization.boolean().optional()),tools:xn.serialization.list(U7r.Tool).optional(),toolResults:xn.serialization.property("tool_results",xn.serialization.list(q7r.ToolResult).optional()),forceSingleStep:xn.serialization.property("force_single_step",xn.serialization.boolean().optional()),responseFormat:xn.serialization.property("response_format",H7r.ResponseFormat.optional()),safetyMode:xn.serialization.property("safety_mode",V7r.ChatStreamRequestSafetyMode.optional())})});var n1t=v(GS=>{"use strict";var W7r=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]}),K7r=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G7r=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)&&W7r(e,t,r);return K7r(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.ChatRequest=void 0;var Sn=G7r(G()),J7r=F5(),Z7r=fRe(),Y7r=kie(),X7r=eD(),Q7r=pRe(),eZr=zie(),tZr=L5(),rZr=Uie(),nZr=mRe();GS.ChatRequest=Sn.serialization.object({message:Sn.serialization.string(),model:Sn.serialization.string().optional(),preamble:Sn.serialization.string().optional(),chatHistory:Sn.serialization.property("chat_history",Sn.serialization.list(J7r.Message).optional()),conversationId:Sn.serialization.property("conversation_id",Sn.serialization.string().optional()),promptTruncation:Sn.serialization.property("prompt_truncation",Z7r.ChatRequestPromptTruncation.optional()),connectors:Sn.serialization.list(Y7r.ChatConnector).optional(),searchQueriesOnly:Sn.serialization.property("search_queries_only",Sn.serialization.boolean().optional()),documents:Sn.serialization.list(X7r.ChatDocument).optional(),citationQuality:Sn.serialization.property("citation_quality",Q7r.ChatRequestCitationQuality.optional()),temperature:Sn.serialization.number().optional(),maxTokens:Sn.serialization.property("max_tokens",Sn.serialization.number().optional()),maxInputTokens:Sn.serialization.property("max_input_tokens",Sn.serialization.number().optional()),k:Sn.serialization.number().optional(),p:Sn.serialization.number().optional(),seed:Sn.serialization.number().optional(),stopSequences:Sn.serialization.property("stop_sequences",Sn.serialization.list(Sn.serialization.string()).optional()),frequencyPenalty:Sn.serialization.property("frequency_penalty",Sn.serialization.number().optional()),presencePenalty:Sn.serialization.property("presence_penalty",Sn.serialization.number().optional()),rawPrompting:Sn.serialization.property("raw_prompting",Sn.serialization.boolean().optional()),returnPrompt:Sn.serialization.property("return_prompt",Sn.serialization.boolean().optional()),tools:Sn.serialization.list(eZr.Tool).optional(),toolResults:Sn.serialization.property("tool_results",Sn.serialization.list(tZr.ToolResult).optional()),forceSingleStep:Sn.serialization.property("force_single_step",Sn.serialization.boolean().optional()),responseFormat:Sn.serialization.property("response_format",rZr.ResponseFormat.optional()),safetyMode:Sn.serialization.property("safety_mode",nZr.ChatRequestSafetyMode.optional())})});var o1t=v(JS=>{"use strict";var oZr=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]}),iZr=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aZr=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)&&oZr(e,t,r);return iZr(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.GenerateStreamRequest=void 0;var ya=aZr(G()),sZr=hRe(),uZr=gRe();JS.GenerateStreamRequest=ya.serialization.object({prompt:ya.serialization.string(),model:ya.serialization.string().optional(),numGenerations:ya.serialization.property("num_generations",ya.serialization.number().optional()),maxTokens:ya.serialization.property("max_tokens",ya.serialization.number().optional()),truncate:sZr.GenerateStreamRequestTruncate.optional(),temperature:ya.serialization.number().optional(),seed:ya.serialization.number().optional(),preset:ya.serialization.string().optional(),endSequences:ya.serialization.property("end_sequences",ya.serialization.list(ya.serialization.string()).optional()),stopSequences:ya.serialization.property("stop_sequences",ya.serialization.list(ya.serialization.string()).optional()),k:ya.serialization.number().optional(),p:ya.serialization.number().optional(),frequencyPenalty:ya.serialization.property("frequency_penalty",ya.serialization.number().optional()),presencePenalty:ya.serialization.property("presence_penalty",ya.serialization.number().optional()),returnLikelihoods:ya.serialization.property("return_likelihoods",uZr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:ya.serialization.property("raw_prompting",ya.serialization.boolean().optional())})});var i1t=v(ZS=>{"use strict";var lZr=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]}),cZr=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dZr=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)&&lZr(e,t,r);return cZr(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.GenerateRequest=void 0;var ba=dZr(G()),fZr=yRe(),pZr=bRe();ZS.GenerateRequest=ba.serialization.object({prompt:ba.serialization.string(),model:ba.serialization.string().optional(),numGenerations:ba.serialization.property("num_generations",ba.serialization.number().optional()),maxTokens:ba.serialization.property("max_tokens",ba.serialization.number().optional()),truncate:fZr.GenerateRequestTruncate.optional(),temperature:ba.serialization.number().optional(),seed:ba.serialization.number().optional(),preset:ba.serialization.string().optional(),endSequences:ba.serialization.property("end_sequences",ba.serialization.list(ba.serialization.string()).optional()),stopSequences:ba.serialization.property("stop_sequences",ba.serialization.list(ba.serialization.string()).optional()),k:ba.serialization.number().optional(),p:ba.serialization.number().optional(),frequencyPenalty:ba.serialization.property("frequency_penalty",ba.serialization.number().optional()),presencePenalty:ba.serialization.property("presence_penalty",ba.serialization.number().optional()),returnLikelihoods:ba.serialization.property("return_likelihoods",pZr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:ba.serialization.property("raw_prompting",ba.serialization.boolean().optional())})});var a1t=v(YS=>{"use strict";var mZr=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]}),hZr=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gZr=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)&&mZr(e,t,r);return hZr(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.EmbedRequest=void 0;var pD=gZr(G()),yZr=Pie(),bZr=Eie(),_Zr=_Re();YS.EmbedRequest=pD.serialization.object({texts:pD.serialization.list(pD.serialization.string()),model:pD.serialization.string().optional(),inputType:pD.serialization.property("input_type",yZr.EmbedInputType.optional()),embeddingTypes:pD.serialization.property("embedding_types",pD.serialization.list(bZr.EmbeddingType).optional()),truncate:_Zr.EmbedRequestTruncate.optional()})});var s1t=v(XS=>{"use strict";var vZr=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]}),wZr=XS&&XS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xZr=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)&&vZr(e,t,r);return wZr(e,t),e};Object.defineProperty(XS,"__esModule",{value:!0});XS.RerankRequest=void 0;var gh=xZr(G()),SZr=TRe();XS.RerankRequest=gh.serialization.object({model:gh.serialization.string().optional(),query:gh.serialization.string(),documents:gh.serialization.list(SZr.RerankRequestDocumentsItem),topN:gh.serialization.property("top_n",gh.serialization.number().optional()),rankFields:gh.serialization.property("rank_fields",gh.serialization.list(gh.serialization.string()).optional()),returnDocuments:gh.serialization.property("return_documents",gh.serialization.boolean().optional()),maxChunksPerDoc:gh.serialization.property("max_chunks_per_doc",gh.serialization.number().optional())})});var u1t=v(QS=>{"use strict";var CZr=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]}),OZr=QS&&QS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PZr=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)&&CZr(e,t,r);return OZr(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.ClassifyRequest=void 0;var _U=PZr(G()),EZr=w1e(),TZr=RRe();QS.ClassifyRequest=_U.serialization.object({inputs:_U.serialization.list(_U.serialization.string()),examples:_U.serialization.list(EZr.ClassifyExample).optional(),model:_U.serialization.string().optional(),preset:_U.serialization.string().optional(),truncate:TZr.ClassifyRequestTruncate.optional()})});var l1t=v(eC=>{"use strict";var AZr=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]}),IZr=eC&&eC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MZr=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)&&AZr(e,t,r);return IZr(e,t),e};Object.defineProperty(eC,"__esModule",{value:!0});eC.SummarizeRequest=void 0;var vU=MZr(G()),RZr=FRe(),NZr=kRe(),jZr=$Re();eC.SummarizeRequest=vU.serialization.object({text:vU.serialization.string(),length:RZr.SummarizeRequestLength.optional(),format:NZr.SummarizeRequestFormat.optional(),model:vU.serialization.string().optional(),extractiveness:jZr.SummarizeRequestExtractiveness.optional(),temperature:vU.serialization.number().optional(),additionalCommand:vU.serialization.property("additional_command",vU.serialization.string().optional())})});var c1t=v(tC=>{"use strict";var DZr=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]}),LZr=tC&&tC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FZr=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)&&DZr(e,t,r);return LZr(e,t),e};Object.defineProperty(tC,"__esModule",{value:!0});tC.TokenizeRequest=void 0;var L1e=FZr(G());tC.TokenizeRequest=L1e.serialization.object({text:L1e.serialization.string(),model:L1e.serialization.string()})});var d1t=v(rC=>{"use strict";var kZr=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]}),$Zr=rC&&rC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zZr=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)&&kZr(e,t,r);return $Zr(e,t),e};Object.defineProperty(rC,"__esModule",{value:!0});rC.DetokenizeRequest=void 0;var Qie=zZr(G());rC.DetokenizeRequest=Qie.serialization.object({tokens:Qie.serialization.list(Qie.serialization.number()),model:Qie.serialization.string()})});var f1t=v(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.DetokenizeRequest=Ps.TokenizeRequest=Ps.SummarizeRequest=Ps.ClassifyRequest=Ps.RerankRequest=Ps.EmbedRequest=Ps.GenerateRequest=Ps.GenerateStreamRequest=Ps.ChatRequest=Ps.ChatStreamRequest=void 0;var BZr=r1t();Object.defineProperty(Ps,"ChatStreamRequest",{enumerable:!0,get:function(){return BZr.ChatStreamRequest}});var UZr=n1t();Object.defineProperty(Ps,"ChatRequest",{enumerable:!0,get:function(){return UZr.ChatRequest}});var qZr=o1t();Object.defineProperty(Ps,"GenerateStreamRequest",{enumerable:!0,get:function(){return qZr.GenerateStreamRequest}});var HZr=i1t();Object.defineProperty(Ps,"GenerateRequest",{enumerable:!0,get:function(){return HZr.GenerateRequest}});var VZr=a1t();Object.defineProperty(Ps,"EmbedRequest",{enumerable:!0,get:function(){return VZr.EmbedRequest}});var WZr=s1t();Object.defineProperty(Ps,"RerankRequest",{enumerable:!0,get:function(){return WZr.RerankRequest}});var KZr=u1t();Object.defineProperty(Ps,"ClassifyRequest",{enumerable:!0,get:function(){return KZr.ClassifyRequest}});var GZr=l1t();Object.defineProperty(Ps,"SummarizeRequest",{enumerable:!0,get:function(){return GZr.SummarizeRequest}});var JZr=c1t();Object.defineProperty(Ps,"TokenizeRequest",{enumerable:!0,get:function(){return JZr.TokenizeRequest}});var ZZr=d1t();Object.defineProperty(Ps,"DetokenizeRequest",{enumerable:!0,get:function(){return ZZr.DetokenizeRequest}})});var p1t=v(mD=>{"use strict";var YZr=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]}),XZr=mD&&mD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YZr(e,t,r)};Object.defineProperty(mD,"__esModule",{value:!0});XZr(f1t(),mD)});var kP=v(FP=>{"use strict";var QZr=FP&&FP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F1e=FP&&FP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QZr(e,t,r)};Object.defineProperty(FP,"__esModule",{value:!0});F1e(rRt(),FP);F1e(t1t(),FP);F1e(p1t(),FP)});var k1e=v(pi=>{"use strict";var eYr=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]}),tYr=pi&&pi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rYr=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)&&eYr(e,t,r);return tYr(e,t),e},eae=pi&&pi.__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())})},nYr=pi&&pi.__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(pi,"__esModule",{value:!0});pi.fetchOverride=pi.parseAWSEvent=pi.getEndpointFromUrl=pi.getAuthHeaders=pi.getUrl=pi.mapResponseFromBedrock=void 0;var oYr=CSe(),iYr=(iwt(),dc(owt)),aYr=dxt(),sYr=PSt(),uYr=JV(),lYr=G(),cYr=QAe(),dYr=HIt(),q5=rYr(kP()),fYr=(t,e)=>eae(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),pYr={chat:q5.StreamedChatResponse,generate:q5.GenerateStreamedResponse},mYr={chat:q5.NonStreamedChatResponse,embed:q5.EmbedResponse,generate:q5.Generation},hYr=(t,e,r)=>eae(void 0,void 0,void 0,function*(){let n=t?pYr[e]:mYr[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});pi.mapResponseFromBedrock=hYr;var gYr=(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]};pi.getUrl=gYr;var yYr=(t,e,r,n,o,i)=>eae(void 0,void 0,void 0,function*(){let a=(0,iYr.fromNodeProviderChain)(),s=yield fYr(()=>{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 sYr.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:oYr.Sha256});delete r.connection,r.host=t.hostname;let l=new aYr.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});pi.getAuthHeaders=yYr;var bYr=(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}`)};pi.getEndpointFromUrl=bYr;var _Yr=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}}};pi.parseAWSEvent=_Yr;var vYr=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>eae(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,pi.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,pi.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,lYr.fetcher)(i);if(!p.ok)return p;try{if(c){let b=(0,cYr.readableStreamAsyncIterable)(p.body),g=new dYr.LineDecoder,y=new uYr.PassThrough;try{for(var m=nYr(b),h;h=yield m.next(),!h.done;){let x=h.value;for(let S of g.decode(x)){let O=(0,pi.parseAWSEvent)(S);if(O){let E=yield(0,pi.mapResponseFromBedrock)(c,u,O);y.push(JSON.stringify(E)+`
|
||
`)}}}}catch(x){a={error:x}}finally{try{h&&!h.done&&(s=m.return)&&(yield s.call(m))}finally{if(a)throw a.error}}for(let x of g.flush()){let S=(0,pi.parseAWSEvent)(x);if(S){let O=yield(0,pi.mapResponseFromBedrock)(c,u,S);y.push(JSON.stringify(O)+`
|
||
`)}}return y.end(),{ok:!0,body:y}}else{let b=yield p.body;return{ok:!0,body:yield(0,pi.mapResponseFromBedrock)(c,u,b)}}}catch(b){throw b}});pi.fetchOverride=vYr});var $P=v(tae=>{"use strict";Object.defineProperty(tae,"__esModule",{value:!0});tae.CohereEnvironment=void 0;tae.CohereEnvironment={Production:"https://api.cohere.com"}});var WI=v((m1t,rae)=>{(function(t,e,r){typeof rae<"u"&&rae.exports?rae.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",m1t,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 z1e=v(cm=>{"use strict";var wYr=cm&&cm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xYr=cm&&cm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H5=cm&&cm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wYr(e,t,r);return xYr(e,t),e},nae=cm&&cm.__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())})},SYr=cm&&cm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cm,"__esModule",{value:!0});cm.V2=void 0;var h1t=H5($P()),um=H5(G()),Es=H5(lP()),lm=H5(kP()),g1t=SYr(WI()),zP=H5(Hs()),$1e=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return nae(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:um.fetcher)({url:(0,g1t.default)((o=yield um.Supplier.get(this._options.environment))!==null&&o!==void 0?o:h1t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield um.Supplier.get(this._options.clientName))!=null?yield um.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":um.RUNTIME.type,"X-Fern-Runtime-Version":um.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},lm.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 um.Stream({stream:i.body,parse:a=>nae(this,void 0,void 0,function*(){return lm.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 Es.BadRequestError(i.error.body);case 401:throw new Es.UnauthorizedError(i.error.body);case 403:throw new Es.ForbiddenError(i.error.body);case 404:throw new Es.NotFoundError(i.error.body);case 422:throw new Es.UnprocessableEntityError(lm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Es.TooManyRequestsError(lm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Es.ClientClosedRequestError(lm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Es.InternalServerError(i.error.body);case 501:throw new Es.NotImplementedError(lm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Es.ServiceUnavailableError(i.error.body);case 504:throw new Es.GatewayTimeoutError(lm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new zP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new zP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new zP.CohereTimeoutError;case"unknown":throw new zP.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return nae(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:um.fetcher)({url:(0,g1t.default)((o=yield um.Supplier.get(this._options.environment))!==null&&o!==void 0?o:h1t.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield um.Supplier.get(this._options.clientName))!=null?yield um.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":um.RUNTIME.type,"X-Fern-Runtime-Version":um.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},lm.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 lm.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 Es.BadRequestError(i.error.body);case 401:throw new Es.UnauthorizedError(i.error.body);case 403:throw new Es.ForbiddenError(i.error.body);case 404:throw new Es.NotFoundError(i.error.body);case 422:throw new Es.UnprocessableEntityError(lm.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Es.TooManyRequestsError(lm.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Es.ClientClosedRequestError(lm.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Es.InternalServerError(i.error.body);case 501:throw new Es.NotImplementedError(lm.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Es.ServiceUnavailableError(i.error.body);case 504:throw new Es.GatewayTimeoutError(lm.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new zP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new zP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new zP.CohereTimeoutError;case"unknown":throw new zP.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return nae(this,void 0,void 0,function*(){let r=(e=yield um.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new zP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};cm.V2=$1e});var y1t=v(dm=>{"use strict";var CYr=dm&&dm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OYr=dm&&dm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W5=dm&&dm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CYr(e,t,r);return OYr(e,t),e},V5=dm&&dm.__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())})},PYr=dm&&dm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dm,"__esModule",{value:!0});dm.EmbedJobs=void 0;var oae=W5($P()),_a=W5(G()),Kr=W5(lP()),iae=PYr(WI()),Fa=W5(kP()),hd=W5(Hs()),B1e=class{constructor(e={}){this._options=e}list(e){var r,n;return V5(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:_a.fetcher)({url:(0,iae.default)((n=yield _a.Supplier.get(this._options.environment))!==null&&n!==void 0?n:oae.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _a.Supplier.get(this._options.clientName))!=null?yield _a.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":_a.RUNTIME.type,"X-Fern-Runtime-Version":_a.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 Fa.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 Kr.BadRequestError(o.error.body);case 401:throw new Kr.UnauthorizedError(o.error.body);case 403:throw new Kr.ForbiddenError(o.error.body);case 404:throw new Kr.NotFoundError(o.error.body);case 422:throw new Kr.UnprocessableEntityError(Fa.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Kr.TooManyRequestsError(Fa.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Kr.ClientClosedRequestError(Fa.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Kr.InternalServerError(o.error.body);case 501:throw new Kr.NotImplementedError(Fa.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Kr.ServiceUnavailableError(o.error.body);case 504:throw new Kr.GatewayTimeoutError(Fa.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new hd.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new hd.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new hd.CohereTimeoutError;case"unknown":throw new hd.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return V5(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_a.fetcher)({url:(0,iae.default)((o=yield _a.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oae.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _a.Supplier.get(this._options.clientName))!=null?yield _a.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":_a.RUNTIME.type,"X-Fern-Runtime-Version":_a.RUNTIME.version},contentType:"application/json",requestType:"json",body:Fa.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 Fa.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 Kr.BadRequestError(i.error.body);case 401:throw new Kr.UnauthorizedError(i.error.body);case 403:throw new Kr.ForbiddenError(i.error.body);case 404:throw new Kr.NotFoundError(i.error.body);case 422:throw new Kr.UnprocessableEntityError(Fa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Kr.TooManyRequestsError(Fa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Kr.ClientClosedRequestError(Fa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Kr.InternalServerError(i.error.body);case 501:throw new Kr.NotImplementedError(Fa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Kr.ServiceUnavailableError(i.error.body);case 504:throw new Kr.GatewayTimeoutError(Fa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new hd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new hd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new hd.CohereTimeoutError;case"unknown":throw new hd.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return V5(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_a.fetcher)({url:(0,iae.default)((o=yield _a.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oae.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _a.Supplier.get(this._options.clientName))!=null?yield _a.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":_a.RUNTIME.type,"X-Fern-Runtime-Version":_a.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 Fa.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 Kr.BadRequestError(i.error.body);case 401:throw new Kr.UnauthorizedError(i.error.body);case 403:throw new Kr.ForbiddenError(i.error.body);case 404:throw new Kr.NotFoundError(i.error.body);case 422:throw new Kr.UnprocessableEntityError(Fa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Kr.TooManyRequestsError(Fa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Kr.ClientClosedRequestError(Fa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Kr.InternalServerError(i.error.body);case 501:throw new Kr.NotImplementedError(Fa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Kr.ServiceUnavailableError(i.error.body);case 504:throw new Kr.GatewayTimeoutError(Fa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new hd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new hd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new hd.CohereTimeoutError;case"unknown":throw new hd.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return V5(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_a.fetcher)({url:(0,iae.default)((o=yield _a.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oae.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _a.Supplier.get(this._options.clientName))!=null?yield _a.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":_a.RUNTIME.type,"X-Fern-Runtime-Version":_a.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 Kr.BadRequestError(i.error.body);case 401:throw new Kr.UnauthorizedError(i.error.body);case 403:throw new Kr.ForbiddenError(i.error.body);case 404:throw new Kr.NotFoundError(i.error.body);case 422:throw new Kr.UnprocessableEntityError(Fa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Kr.TooManyRequestsError(Fa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Kr.ClientClosedRequestError(Fa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Kr.InternalServerError(i.error.body);case 501:throw new Kr.NotImplementedError(Fa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Kr.ServiceUnavailableError(i.error.body);case 504:throw new Kr.GatewayTimeoutError(Fa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new hd.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new hd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new hd.CohereTimeoutError;case"unknown":throw new hd.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return V5(this,void 0,void 0,function*(){let r=(e=yield _a.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new hd.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};dm.EmbedJobs=B1e});var b1t=v(fm=>{"use strict";var EYr=fm&&fm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TYr=fm&&fm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J5=fm&&fm.__importStar||function(t){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 TYr(e,t),e},wU=fm&&fm.__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())})},AYr=fm&&fm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fm,"__esModule",{value:!0});fm.Datasets=void 0;var K5=J5($P()),jo=J5(G()),lr=J5(lP()),G5=AYr(WI()),wi=J5(kP()),Js=J5(Hs()),U1e=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return wU(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:jo.fetcher)({url:(0,G5.default)((o=yield jo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:K5.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jo.Supplier.get(this._options.clientName))!=null?yield jo.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":jo.RUNTIME.type,"X-Fern-Runtime-Version":jo.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 wi.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 lr.BadRequestError(f.error.body);case 401:throw new lr.UnauthorizedError(f.error.body);case 403:throw new lr.ForbiddenError(f.error.body);case 404:throw new lr.NotFoundError(f.error.body);case 422:throw new lr.UnprocessableEntityError(wi.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new lr.TooManyRequestsError(wi.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new lr.ClientClosedRequestError(wi.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new lr.InternalServerError(f.error.body);case 501:throw new lr.NotImplementedError(wi.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new lr.ServiceUnavailableError(f.error.body);case 504:throw new lr.GatewayTimeoutError(wi.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Js.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new Js.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new Js.CohereTimeoutError;case"unknown":throw new Js.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return wU(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 jo.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:jo.fetcher)({url:(0,G5.default)((a=yield jo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:K5.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jo.Supplier.get(this._options.clientName))!=null?yield jo.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":jo.RUNTIME.type,"X-Fern-Runtime-Version":jo.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 wi.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 lr.BadRequestError(c.error.body);case 401:throw new lr.UnauthorizedError(c.error.body);case 403:throw new lr.ForbiddenError(c.error.body);case 404:throw new lr.NotFoundError(c.error.body);case 422:throw new lr.UnprocessableEntityError(wi.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new lr.TooManyRequestsError(wi.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new lr.ClientClosedRequestError(wi.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new lr.InternalServerError(c.error.body);case 501:throw new lr.NotImplementedError(wi.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new lr.ServiceUnavailableError(c.error.body);case 504:throw new lr.GatewayTimeoutError(wi.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Js.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Js.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Js.CohereTimeoutError;case"unknown":throw new Js.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return wU(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:jo.fetcher)({url:(0,G5.default)((n=yield jo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:K5.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jo.Supplier.get(this._options.clientName))!=null?yield jo.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":jo.RUNTIME.type,"X-Fern-Runtime-Version":jo.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 wi.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 lr.BadRequestError(o.error.body);case 401:throw new lr.UnauthorizedError(o.error.body);case 403:throw new lr.ForbiddenError(o.error.body);case 404:throw new lr.NotFoundError(o.error.body);case 422:throw new lr.UnprocessableEntityError(wi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new lr.TooManyRequestsError(wi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new lr.ClientClosedRequestError(wi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new lr.InternalServerError(o.error.body);case 501:throw new lr.NotImplementedError(wi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new lr.ServiceUnavailableError(o.error.body);case 504:throw new lr.GatewayTimeoutError(wi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Js.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Js.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Js.CohereTimeoutError;case"unknown":throw new Js.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return wU(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:jo.fetcher)({url:(0,G5.default)((o=yield jo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:K5.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jo.Supplier.get(this._options.clientName))!=null?yield jo.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":jo.RUNTIME.type,"X-Fern-Runtime-Version":jo.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 wi.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 lr.BadRequestError(i.error.body);case 401:throw new lr.UnauthorizedError(i.error.body);case 403:throw new lr.ForbiddenError(i.error.body);case 404:throw new lr.NotFoundError(i.error.body);case 422:throw new lr.UnprocessableEntityError(wi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new lr.TooManyRequestsError(wi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new lr.ClientClosedRequestError(wi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new lr.InternalServerError(i.error.body);case 501:throw new lr.NotImplementedError(wi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new lr.ServiceUnavailableError(i.error.body);case 504:throw new lr.GatewayTimeoutError(wi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Js.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Js.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Js.CohereTimeoutError;case"unknown":throw new Js.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return wU(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:jo.fetcher)({url:(0,G5.default)((o=yield jo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:K5.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jo.Supplier.get(this._options.clientName))!=null?yield jo.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":jo.RUNTIME.type,"X-Fern-Runtime-Version":jo.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 wi.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 lr.BadRequestError(i.error.body);case 401:throw new lr.UnauthorizedError(i.error.body);case 403:throw new lr.ForbiddenError(i.error.body);case 404:throw new lr.NotFoundError(i.error.body);case 422:throw new lr.UnprocessableEntityError(wi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new lr.TooManyRequestsError(wi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new lr.ClientClosedRequestError(wi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new lr.InternalServerError(i.error.body);case 501:throw new lr.NotImplementedError(wi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new lr.ServiceUnavailableError(i.error.body);case 504:throw new lr.GatewayTimeoutError(wi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Js.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Js.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Js.CohereTimeoutError;case"unknown":throw new Js.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return wU(this,void 0,void 0,function*(){let r=(e=yield jo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Js.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};fm.Datasets=U1e});var _1t=v(pm=>{"use strict";var IYr=pm&&pm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=pm&&pm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z5=pm&&pm.__importStar||function(t){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},hD=pm&&pm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},RYr=pm&&pm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pm,"__esModule",{value:!0});pm.Connectors=void 0;var xU=Z5($P()),zn=Z5(G()),Tt=Z5(lP()),SU=RYr(WI()),Dn=Z5(kP()),va=Z5(Hs()),q1e=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return hD(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:zn.fetcher)({url:(0,SU.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xU.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 Dn.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 Tt.BadRequestError(u.error.body);case 401:throw new Tt.UnauthorizedError(u.error.body);case 403:throw new Tt.ForbiddenError(u.error.body);case 404:throw new Tt.NotFoundError(u.error.body);case 422:throw new Tt.UnprocessableEntityError(Dn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Tt.TooManyRequestsError(Dn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Tt.ClientClosedRequestError(Dn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Tt.InternalServerError(u.error.body);case 501:throw new Tt.NotImplementedError(Dn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Tt.ServiceUnavailableError(u.error.body);case 504:throw new Tt.GatewayTimeoutError(Dn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new va.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new va.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new va.CohereTimeoutError;case"unknown":throw new va.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return hD(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zn.fetcher)({url:(0,SU.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xU.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.RUNTIME.version},contentType:"application/json",requestType:"json",body:Dn.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 Dn.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 Tt.BadRequestError(i.error.body);case 401:throw new Tt.UnauthorizedError(i.error.body);case 403:throw new Tt.ForbiddenError(i.error.body);case 404:throw new Tt.NotFoundError(i.error.body);case 422:throw new Tt.UnprocessableEntityError(Dn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Tt.TooManyRequestsError(Dn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Tt.ClientClosedRequestError(Dn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Tt.InternalServerError(i.error.body);case 501:throw new Tt.NotImplementedError(Dn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Tt.ServiceUnavailableError(i.error.body);case 504:throw new Tt.GatewayTimeoutError(Dn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new va.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new va.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new va.CohereTimeoutError;case"unknown":throw new va.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return hD(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zn.fetcher)({url:(0,SU.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xU.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 Dn.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 Tt.BadRequestError(i.error.body);case 401:throw new Tt.UnauthorizedError(i.error.body);case 403:throw new Tt.ForbiddenError(i.error.body);case 404:throw new Tt.NotFoundError(i.error.body);case 422:throw new Tt.UnprocessableEntityError(Dn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Tt.TooManyRequestsError(Dn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Tt.ClientClosedRequestError(Dn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Tt.InternalServerError(i.error.body);case 501:throw new Tt.NotImplementedError(Dn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Tt.ServiceUnavailableError(i.error.body);case 504:throw new Tt.GatewayTimeoutError(Dn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new va.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new va.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new va.CohereTimeoutError;case"unknown":throw new va.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return hD(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:zn.fetcher)({url:(0,SU.default)((o=yield zn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xU.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 Dn.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 Tt.BadRequestError(i.error.body);case 401:throw new Tt.UnauthorizedError(i.error.body);case 403:throw new Tt.ForbiddenError(i.error.body);case 404:throw new Tt.NotFoundError(i.error.body);case 422:throw new Tt.UnprocessableEntityError(Dn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Tt.TooManyRequestsError(Dn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Tt.ClientClosedRequestError(Dn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Tt.InternalServerError(i.error.body);case 501:throw new Tt.NotImplementedError(Dn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Tt.ServiceUnavailableError(i.error.body);case 504:throw new Tt.GatewayTimeoutError(Dn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new va.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new va.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new va.CohereTimeoutError;case"unknown":throw new va.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return hD(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:zn.fetcher)({url:(0,SU.default)((i=yield zn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:xU.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.RUNTIME.version},contentType:"application/json",requestType:"json",body:Dn.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 Dn.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 Tt.BadRequestError(a.error.body);case 401:throw new Tt.UnauthorizedError(a.error.body);case 403:throw new Tt.ForbiddenError(a.error.body);case 404:throw new Tt.NotFoundError(a.error.body);case 422:throw new Tt.UnprocessableEntityError(Dn.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Tt.TooManyRequestsError(Dn.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Tt.ClientClosedRequestError(Dn.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Tt.InternalServerError(a.error.body);case 501:throw new Tt.NotImplementedError(Dn.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Tt.ServiceUnavailableError(a.error.body);case 504:throw new Tt.GatewayTimeoutError(Dn.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new va.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new va.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new va.CohereTimeoutError;case"unknown":throw new va.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return hD(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:zn.fetcher)({url:(0,SU.default)((i=yield zn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:xU.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield zn.Supplier.get(this._options.clientName))!=null?yield zn.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":zn.RUNTIME.type,"X-Fern-Runtime-Version":zn.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 Dn.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 Tt.BadRequestError(u.error.body);case 401:throw new Tt.UnauthorizedError(u.error.body);case 403:throw new Tt.ForbiddenError(u.error.body);case 404:throw new Tt.NotFoundError(u.error.body);case 422:throw new Tt.UnprocessableEntityError(Dn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Tt.TooManyRequestsError(Dn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Tt.ClientClosedRequestError(Dn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Tt.InternalServerError(u.error.body);case 501:throw new Tt.NotImplementedError(Dn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Tt.ServiceUnavailableError(u.error.body);case 504:throw new Tt.GatewayTimeoutError(Dn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new va.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new va.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new va.CohereTimeoutError;case"unknown":throw new va.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return hD(this,void 0,void 0,function*(){let r=(e=yield zn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new va.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};pm.Connectors=q1e});var x1t=v(mm=>{"use strict";var NYr=mm&&mm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jYr=mm&&mm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5=mm&&mm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NYr(e,t,r);return jYr(e,t),e},H1e=mm&&mm.__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())})},DYr=mm&&mm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mm,"__esModule",{value:!0});mm.Models=void 0;var v1t=Y5($P()),yh=Y5(G()),Ts=Y5(lP()),w1t=DYr(WI()),Vg=Y5(kP()),BP=Y5(Hs()),V1e=class{constructor(e={}){this._options=e}get(e,r){var n,o;return H1e(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:yh.fetcher)({url:(0,w1t.default)((o=yield yh.Supplier.get(this._options.environment))!==null&&o!==void 0?o:v1t.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yh.Supplier.get(this._options.clientName))!=null?yield yh.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":yh.RUNTIME.type,"X-Fern-Runtime-Version":yh.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 Vg.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 Ts.BadRequestError(i.error.body);case 401:throw new Ts.UnauthorizedError(i.error.body);case 403:throw new Ts.ForbiddenError(i.error.body);case 404:throw new Ts.NotFoundError(i.error.body);case 422:throw new Ts.UnprocessableEntityError(Vg.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ts.TooManyRequestsError(Vg.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ts.ClientClosedRequestError(Vg.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ts.InternalServerError(i.error.body);case 501:throw new Ts.NotImplementedError(Vg.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ts.ServiceUnavailableError(i.error.body);case 504:throw new Ts.GatewayTimeoutError(Vg.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new BP.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new BP.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new BP.CohereTimeoutError;case"unknown":throw new BP.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return H1e(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:yh.fetcher)({url:(0,w1t.default)((o=yield yh.Supplier.get(this._options.environment))!==null&&o!==void 0?o:v1t.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yh.Supplier.get(this._options.clientName))!=null?yield yh.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":yh.RUNTIME.type,"X-Fern-Runtime-Version":yh.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 Vg.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 Ts.BadRequestError(c.error.body);case 401:throw new Ts.UnauthorizedError(c.error.body);case 403:throw new Ts.ForbiddenError(c.error.body);case 404:throw new Ts.NotFoundError(c.error.body);case 422:throw new Ts.UnprocessableEntityError(Vg.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ts.TooManyRequestsError(Vg.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ts.ClientClosedRequestError(Vg.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ts.InternalServerError(c.error.body);case 501:throw new Ts.NotImplementedError(Vg.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ts.ServiceUnavailableError(c.error.body);case 504:throw new Ts.GatewayTimeoutError(Vg.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new BP.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new BP.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new BP.CohereTimeoutError;case"unknown":throw new BP.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return H1e(this,void 0,void 0,function*(){let r=(e=yield yh.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new BP.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};mm.Models=V1e});var S1t=v(hm=>{"use strict";var LYr=hm&&hm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FYr=hm&&hm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X5=hm&&hm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LYr(e,t,r);return FYr(e,t),e},KI=hm&&hm.__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())})},kYr=hm&&hm.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hm,"__esModule",{value:!0});hm.Finetuning=void 0;var gD=X5($P()),Xr=X5(G()),an=X5(lP()),yD=kYr(WI()),UP=X5(kP()),Ai=X5(Hs()),W1e=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return KI(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:Xr.fetcher)({url:(0,yD.default)((o=yield Xr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:gD.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.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 UP.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 an.BadRequestError(l.error.body);case 401:throw new an.UnauthorizedError(l.error.body);case 403:throw new an.ForbiddenError(l.error.body);case 404:throw new an.NotFoundError(l.error.body);case 500:throw new an.InternalServerError(l.error.body);case 503:throw new an.ServiceUnavailableError(l.error.body);default:throw new Ai.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Ai.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return KI(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,yD.default)((o=yield Xr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:gD.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},contentType:"application/json",requestType:"json",body:UP.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 UP.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 an.BadRequestError(i.error.body);case 401:throw new an.UnauthorizedError(i.error.body);case 403:throw new an.ForbiddenError(i.error.body);case 404:throw new an.NotFoundError(i.error.body);case 500:throw new an.InternalServerError(i.error.body);case 503:throw new an.ServiceUnavailableError(i.error.body);default:throw new Ai.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ai.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return KI(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,yD.default)((o=yield Xr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:gD.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.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 UP.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 an.BadRequestError(i.error.body);case 401:throw new an.UnauthorizedError(i.error.body);case 403:throw new an.ForbiddenError(i.error.body);case 404:throw new an.NotFoundError(i.error.body);case 500:throw new an.InternalServerError(i.error.body);case 503:throw new an.ServiceUnavailableError(i.error.body);default:throw new Ai.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ai.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return KI(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,yD.default)((o=yield Xr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:gD.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.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 UP.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 an.BadRequestError(i.error.body);case 401:throw new an.UnauthorizedError(i.error.body);case 403:throw new an.ForbiddenError(i.error.body);case 404:throw new an.NotFoundError(i.error.body);case 500:throw new an.InternalServerError(i.error.body);case 503:throw new an.ServiceUnavailableError(i.error.body);default:throw new Ai.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ai.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return KI(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Xr.fetcher)({url:(0,yD.default)((i=yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gD.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},contentType:"application/json",requestType:"json",body:UP.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 UP.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 an.BadRequestError(a.error.body);case 401:throw new an.UnauthorizedError(a.error.body);case 403:throw new an.ForbiddenError(a.error.body);case 404:throw new an.NotFoundError(a.error.body);case 500:throw new an.InternalServerError(a.error.body);case 503:throw new an.ServiceUnavailableError(a.error.body);default:throw new Ai.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Ai.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return KI(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:Xr.fetcher)({url:(0,yD.default)((i=yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gD.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.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 UP.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 an.BadRequestError(c.error.body);case 401:throw new an.UnauthorizedError(c.error.body);case 403:throw new an.ForbiddenError(c.error.body);case 404:throw new an.NotFoundError(c.error.body);case 500:throw new an.InternalServerError(c.error.body);case 503:throw new an.ServiceUnavailableError(c.error.body);default:throw new Ai.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Ai.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return KI(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:Xr.fetcher)({url:(0,yD.default)((i=yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gD.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.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":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.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 UP.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 an.BadRequestError(l.error.body);case 401:throw new an.UnauthorizedError(l.error.body);case 403:throw new an.ForbiddenError(l.error.body);case 404:throw new an.NotFoundError(l.error.body);case 500:throw new an.InternalServerError(l.error.body);case 503:throw new an.ServiceUnavailableError(l.error.body);default:throw new Ai.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Ai.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Ai.CohereTimeoutError;case"unknown":throw new Ai.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return KI(this,void 0,void 0,function*(){let r=(e=yield Xr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ai.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};hm.Finetuning=W1e});var aae=v(ym=>{"use strict";var $Yr=ym&&ym.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zYr=ym&&ym.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q5=ym&&ym.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Yr(e,t,r);return zYr(e,t),e},gm=ym&&ym.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},BYr=ym&&ym.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ym,"__esModule",{value:!0});ym.CohereClient=void 0;var Eb=Q5($P()),xt=Q5(G()),Ee=Q5(lP()),dt=Q5(kP()),Tb=BYr(WI()),Vr=Q5(Hs()),UYr=z1e(),qYr=y1t(),HYr=b1t(),VYr=_1t(),WYr=x1t(),KYr=S1t(),K1e=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new xt.Stream({stream:i.body,parse:a=>gm(this,void 0,void 0,function*(){return dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.GenerateStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new xt.Stream({stream:i.body,parse:a=>gm(this,void 0,void 0,function*(){return dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return gm(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xt.fetcher)({url:(0,Tb.default)((o=yield xt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Eb.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",body:dt.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 dt.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 Ee.BadRequestError(i.error.body);case 401:throw new Ee.UnauthorizedError(i.error.body);case 403:throw new Ee.ForbiddenError(i.error.body);case 404:throw new Ee.NotFoundError(i.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(i.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(i.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return gm(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:xt.fetcher)({url:(0,Tb.default)((n=yield xt.Supplier.get(this._options.environment))!==null&&n!==void 0?n:Eb.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xt.Supplier.get(this._options.clientName))!=null?yield xt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":xt.RUNTIME.type,"X-Fern-Runtime-Version":xt.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return dt.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 Ee.BadRequestError(o.error.body);case 401:throw new Ee.UnauthorizedError(o.error.body);case 403:throw new Ee.ForbiddenError(o.error.body);case 404:throw new Ee.NotFoundError(o.error.body);case 422:throw new Ee.UnprocessableEntityError(dt.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(dt.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(dt.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ee.InternalServerError(o.error.body);case 501:throw new Ee.NotImplementedError(dt.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ee.ServiceUnavailableError(o.error.body);case 504:throw new Ee.GatewayTimeoutError(dt.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Vr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Vr.CohereTimeoutError;case"unknown":throw new Vr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new UYr.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new qYr.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new HYr.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new VYr.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new WYr.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new KYr.Finetuning(this._options)}_getAuthorizationHeader(){var e;return gm(this,void 0,void 0,function*(){let r=(e=yield xt.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Vr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};ym.CohereClient=K1e});var J1e=v(sae=>{"use strict";Object.defineProperty(sae,"__esModule",{value:!0});sae.AwsClient=void 0;var GYr=aae(),G1e=class extends GYr.CohereClient{constructor(e){e.token="n/a",super(e)}};sae.AwsClient=G1e});var C1t=v(uae=>{"use strict";Object.defineProperty(uae,"__esModule",{value:!0});uae.BedrockClient=void 0;var JYr=k1e(),ZYr=J1e(),Z1e=class extends ZYr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,JYr.fetchOverride)("bedrock",e)}))}};uae.BedrockClient=Z1e});var O1t=v(lae=>{"use strict";Object.defineProperty(lae,"__esModule",{value:!0});lae.CohereClientV2=void 0;var YYr=z1e(),XYr=aae(),Y1e=class{constructor(e){this._options=e,this.client=new XYr.CohereClient(this._options),this.clientV2=new YYr.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}};lae.CohereClientV2=Y1e});var P1t=v(cae=>{"use strict";Object.defineProperty(cae,"__esModule",{value:!0});cae.CustomClient=void 0;var QYr=aae(),X1e=class extends QYr.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}};cae.CustomClient=X1e});var E1t=v(dae=>{"use strict";Object.defineProperty(dae,"__esModule",{value:!0});dae.SagemakerClient=void 0;var eXr=J1e(),tXr=k1e(),Q1e=class extends eXr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,tXr.fetchOverride)("sagemaker",e)}))}};dae.SagemakerClient=Q1e});var e9=v(ka=>{"use strict";var rXr=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]}),nXr=ka&&ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oXr=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)&&rXr(e,t,r);return nXr(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=oXr(lP());var iXr=C1t();Object.defineProperty(ka,"BedrockClient",{enumerable:!0,get:function(){return iXr.BedrockClient}});var aXr=O1t();Object.defineProperty(ka,"CohereClientV2",{enumerable:!0,get:function(){return aXr.CohereClientV2}});var sXr=P1t();Object.defineProperty(ka,"CohereClient",{enumerable:!0,get:function(){return sXr.CustomClient}});var uXr=$P();Object.defineProperty(ka,"CohereEnvironment",{enumerable:!0,get:function(){return uXr.CohereEnvironment}});var T1t=Hs();Object.defineProperty(ka,"CohereError",{enumerable:!0,get:function(){return T1t.CohereError}});Object.defineProperty(ka,"CohereTimeoutError",{enumerable:!0,get:function(){return T1t.CohereTimeoutError}});var lXr=E1t();Object.defineProperty(ka,"SagemakerClient",{enumerable:!0,get:function(){return lXr.SagemakerClient}})});var As=w(()=>{lN()});function Ib(t){t?(xc[0]=xc[16]=xc[1]=xc[2]=xc[3]=xc[4]=xc[5]=xc[6]=xc[7]=xc[8]=xc[9]=xc[10]=xc[11]=xc[12]=xc[13]=xc[14]=xc[15]=0,this.blocks=xc):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 cXr,Cn,dXr,Ab,xc,A1t,eNe,I1t=w(()=>{"use strict";cXr=typeof window=="object"?window:{},Cn="0123456789abcdef".split(""),dXr=[-2147483648,8388608,32768,128],Ab=[24,16,8,0],xc=[];Ib.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===cXr.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]<<Ab[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<Ab[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<Ab[o++&3],a[o>>2]|=(128|r&63)<<Ab[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<Ab[o++&3],a[o>>2]|=(128|r>>6&63)<<Ab[o++&3],a[o>>2]|=(128|r&63)<<Ab[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<Ab[o++&3],a[o>>2]|=(128|r>>12&63)<<Ab[o++&3],a[o>>2]|=(128|r>>6&63)<<Ab[o++&3],a[o>>2]|=(128|r&63)<<Ab[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}};Ib.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=dXr[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()}};Ib.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};Ib.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return Cn[t>>28&15]+Cn[t>>24&15]+Cn[t>>20&15]+Cn[t>>16&15]+Cn[t>>12&15]+Cn[t>>8&15]+Cn[t>>4&15]+Cn[t&15]+Cn[e>>28&15]+Cn[e>>24&15]+Cn[e>>20&15]+Cn[e>>16&15]+Cn[e>>12&15]+Cn[e>>8&15]+Cn[e>>4&15]+Cn[e&15]+Cn[r>>28&15]+Cn[r>>24&15]+Cn[r>>20&15]+Cn[r>>16&15]+Cn[r>>12&15]+Cn[r>>8&15]+Cn[r>>4&15]+Cn[r&15]+Cn[n>>28&15]+Cn[n>>24&15]+Cn[n>>20&15]+Cn[n>>16&15]+Cn[n>>12&15]+Cn[n>>8&15]+Cn[n>>4&15]+Cn[n&15]+Cn[o>>28&15]+Cn[o>>24&15]+Cn[o>>20&15]+Cn[o>>16&15]+Cn[o>>12&15]+Cn[o>>8&15]+Cn[o>>4&15]+Cn[o&15]};Ib.prototype.toString=Ib.prototype.hex;Ib.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]};Ib.prototype.array=Ib.prototype.digest;Ib.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};A1t=!1,eNe=t=>(A1t||(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(`
|
||
`)),A1t=!0),new Ib(!0).update(t).hex())});function nC(t,e){e?(Sc[0]=Sc[16]=Sc[1]=Sc[2]=Sc[3]=Sc[4]=Sc[5]=Sc[6]=Sc[7]=Sc[8]=Sc[9]=Sc[10]=Sc[11]=Sc[12]=Sc[13]=Sc[14]=Sc[15]=0,this.blocks=Sc):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 Ft,fXr,Mb,fae,Sc,M1t=w(()=>{"use strict";Ft="0123456789abcdef".split(""),fXr=[-2147483648,8388608,32768,128],Mb=[24,16,8,0],fae=[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],Sc=[];nC.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]<<Mb[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<Mb[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<Mb[i++&3],s[i>>>2]|=(128|n&63)<<Mb[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<Mb[i++&3],s[i>>>2]|=(128|n>>>6&63)<<Mb[i++&3],s[i>>>2]|=(128|n&63)<<Mb[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<Mb[i++&3],s[i>>>2]|=(128|n>>>12&63)<<Mb[i++&3],s[i>>>2]|=(128|n>>>6&63)<<Mb[i++&3],s[i>>>2]|=(128|n&63)<<Mb[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}};nC.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=fXr[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()}};nC.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=this.blocks,l,c,d,f,p,m,h,b,g,y,x;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(x=e&r,l=0;l<64;l+=4)this.first?(this.is224?(b=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(b=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),b=t&e,f=b^t&r^x,h=o&i^~o&a,p=s+d+h+fae[l]+u[l],m=c+f,s=n+p<<0,n=p+m<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=n&t,f=g^n&e^b,h=a&s^~a&o,p=i+d+h+fae[l+1]+u[l+1],m=c+f,a=r+p<<0,r=p+m<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),y=r&n,f=y^r&t^g,h=i&a^~i&s,p=o+d+h+fae[l+2]+u[l+2],m=c+f,i=e+p<<0,e=p+m<<0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),x=e&r,f=x^e&n^y,h=i&a^~i&s,p=o+d+h+fae[l+3]+u[l+3],m=c+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+a<<0,this.h7=this.h7+s<<0};nC.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=Ft[t>>>28&15]+Ft[t>>>24&15]+Ft[t>>>20&15]+Ft[t>>>16&15]+Ft[t>>>12&15]+Ft[t>>>8&15]+Ft[t>>>4&15]+Ft[t&15]+Ft[e>>>28&15]+Ft[e>>>24&15]+Ft[e>>>20&15]+Ft[e>>>16&15]+Ft[e>>>12&15]+Ft[e>>>8&15]+Ft[e>>>4&15]+Ft[e&15]+Ft[r>>>28&15]+Ft[r>>>24&15]+Ft[r>>>20&15]+Ft[r>>>16&15]+Ft[r>>>12&15]+Ft[r>>>8&15]+Ft[r>>>4&15]+Ft[r&15]+Ft[n>>>28&15]+Ft[n>>>24&15]+Ft[n>>>20&15]+Ft[n>>>16&15]+Ft[n>>>12&15]+Ft[n>>>8&15]+Ft[n>>>4&15]+Ft[n&15]+Ft[o>>>28&15]+Ft[o>>>24&15]+Ft[o>>>20&15]+Ft[o>>>16&15]+Ft[o>>>12&15]+Ft[o>>>8&15]+Ft[o>>>4&15]+Ft[o&15]+Ft[i>>>28&15]+Ft[i>>>24&15]+Ft[i>>>20&15]+Ft[i>>>16&15]+Ft[i>>>12&15]+Ft[i>>>8&15]+Ft[i>>>4&15]+Ft[i&15]+Ft[a>>>28&15]+Ft[a>>>24&15]+Ft[a>>>20&15]+Ft[a>>>16&15]+Ft[a>>>12&15]+Ft[a>>>8&15]+Ft[a>>>4&15]+Ft[a&15];return this.is224||(u+=Ft[s>>>28&15]+Ft[s>>>24&15]+Ft[s>>>20&15]+Ft[s>>>16&15]+Ft[s>>>12&15]+Ft[s>>>8&15]+Ft[s>>>4&15]+Ft[s&15]),u};nC.prototype.toString=nC.prototype.hex;nC.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};nC.prototype.array=nC.prototype.digest;nC.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 R1t=w(()=>{I1t();M1t()});var pXr,tNe,mXr,pae,N1t=w(()=>{R1t();YT();pXr=(...t)=>eNe(t.join("_")),tNe=class{constructor(){Object.defineProperty(this,"keyEncoder",{enumerable:!0,configurable:!0,writable:!0,value:pXr})}makeDefaultKeyEncoder(e){this.keyEncoder=e}},mXr=new Map,pae=class t extends tNe{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(mXr)}}});function bXr(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 _Xr(t,e){return t.length===1?[e.get(t.join(","))]:bXr(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function vXr(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function nNe(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 j1t,hXr,gXr,yXr,rNe,mae,D1t=w(()=>{j1t=F(uwe(),1),hXr=Object.defineProperty,gXr=(t,e,r)=>e in t?hXr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yXr=(t,e,r)=>(gXr(t,typeof e!="symbol"?e+"":e,r),r);rNe=class{constructor(t,e){Kc(this,"specialTokens");Kc(this,"inverseSpecialTokens");Kc(this,"patStr");Kc(this,"textEncoder",new TextEncoder);Kc(this,"textDecoder",new TextDecoder("utf-8"));Kc(this,"rankMap",new Map);Kc(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=j1t.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=rNe.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=rNe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(..._Xr(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;i<t.length;++i){let a=t[i],s=this.textMap.get(a)??this.inverseSpecialTokens[a];s!=null&&(e.push(s),r+=s.length)}let n=new Uint8Array(r),o=0;for(let i of e)n.set(i,o),o+=i.length;return this.textDecoder.decode(n)}},mae=rNe;yXr(mae,"specialTokenRegex",t=>new RegExp(t.map(e=>vXr(e)).join("|"),"g"))});var L1t=w(()=>{D1t()});async function F1t(t){return t in hae||(hae[t]=wXr.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new mae(e)).catch(e=>{throw delete hae[t],e})),await hae[t]}async function k1t(t){return F1t(nNe(t))}var hae,wXr,oNe=w(()=>{L1t();o$();hae={},wXr=new qm({})});function gd(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 xXr,SXr,CU,OU,t9=w(()=>{N1t();VH();YT();o$();oNe();sf();xXr=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;SXr=()=>!1,CU=class extends jn{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??SXr(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},OU=class extends CU{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=pae.global():this.cache=void 0,this.caller=new qm(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 k1t("modelName"in this?xXr(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 h$(e):Array.isArray(e)?new g$(e.map(Zy)):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 bh=w(()=>{t9()});function iNe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function aNe(t){return t!==void 0&&jn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function sNe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Wm(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 Cc(t){return sNe(t)||aNe(t)||iNe(t)}var gae=w(()=>{sf();LO()});function GI(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Wp(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function oC(t,e){let r=typeof e=="number"?void 0:e,n;return Cc(t)?n={type:"function",function:GI(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var $1t=w(()=>{gae();uN();gae()});var _h=w(()=>{$1t()});function uNe(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];(j9e(i)||D9e(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),L9e(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var du,z1t=w(()=>{lN();n$();t9();QT();sf();L_();CY();LO();vH();uN();du=class t extends OU{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 ru.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(),[uNe(o)],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let m=c?.at(0)?.runId;m!=null&&p.message._updateId(`run-${m}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,r_e(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(m=>m?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(Zy)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await ru.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(uNe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(Kbe)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let m of d){if(m.message.id==null){let h=a?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}f===void 0?f=m:f=fc(f,m),r_e(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let m=f.value;for(let h of m.generations){if(h.message.id==null){let b=a?.at(0)?.runId;b!=null&&h.message._updateId(`run-${b}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata}}return m.generations.length===1&&(m.generations[0].message.response_metadata={...m.llmOutput,...m.generations[0].message.response_metadata}),s[p]=m.generations,u[p]=m.llmOutput,a?.[p]?.handleLLMEnd({generations:[m.generations],llmOutput:m.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,MH,{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(b=>b.map(Zy)),s={...i.metadata,...this.getLsParams(o)},u=await ru.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(uNe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(b,g)=>{let y=t._convertInputToPromptValue(b).toString(),x=await r.lookup(y,n);return x==null&&d.push(g),x}))).map((b,g)=>({result:b,runManager:c?.[g]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),m=[];await Promise.all(p.map(async({result:b,runManager:g},y)=>{if(b.status==="fulfilled"){let x=b.value;return m[y]=x.map(S=>("message"in S&&ig(S.message)&&Di(S.message)&&(S.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),S.generationInfo={...S.generationInfo,tokenUsage:{}},S)),x.length&&await g?.handleLLMNewToken(x[0].text),g?.handleLLMEnd({generations:[x]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(b.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(b.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,MH,{value:c?{runIds:c?.map(b=>b.runId)}:void 0,configurable:!0}),h}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(Zy)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,b)=>{let g=d[b];c[g]=h;let y=t._convertInputToPromptValue(i[g]).toString();return u.update(y,l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(Zy)],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 $s(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=nA(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;Wm(n)?l=[{type:"function",function:{name:u,description:i,parameters:Wp(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(h=>{if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let b=h.tool_calls.find(g=>g.name===u);if(!b)throw new Error(`No tool call found with name ${u}.`);return b.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=Eo.assign({parsed:(h,b)=>d.invoke(h.raw,b)}),p=Eo.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return Pi.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}}});var iC=w(()=>{z1t()});var Of=w(()=>{n$()});var Kn=w(()=>{eN()});function B1t(t,e=0){return(yd[t[e+0]]+yd[t[e+1]]+yd[t[e+2]]+yd[t[e+3]]+"-"+yd[t[e+4]]+yd[t[e+5]]+"-"+yd[t[e+6]]+yd[t[e+7]]+"-"+yd[t[e+8]]+yd[t[e+9]]+"-"+yd[t[e+10]]+yd[t[e+11]]+yd[t[e+12]]+yd[t[e+13]]+yd[t[e+14]]+yd[t[e+15]]).toLowerCase()}var yd,yae,U1t=w(()=>{yd=[];for(yae=0;yae<256;++yae)yd.push((yae+256).toString(16).slice(1))});function lNe(){if(!bae&&(bae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!bae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bae(CXr)}var bae,CXr,q1t=w(()=>{CXr=new Uint8Array(16)});var OXr,cNe,H1t=w(()=>{OXr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),cNe={randomUUID:OXr}});function PXr(t,e,r){if(cNe.randomUUID&&!e&&!t)return cNe.randomUUID();t=t||{};var n=t.random||(t.rng||lNe)();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 B1t(n)}var dNe,V1t=w(()=>{H1t();q1t();U1t();dNe=PXr});var W1t=w(()=>{V1t()});function K1t(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 _ae(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=>Di(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 TXr(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function G1t(t){return t._getType()==="tool"}function J1t(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 AXr(t){if(t){if(t.every(TXr))return t;if(t.every(gd))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:J1t(e.function.parameters)}));if(t.every(Cc))return t.map(e=>{let r=Ga(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:J1t(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var Z1t,vae,Y1t=w(()=>{Z1t=F(e9(),1);ug();As();bh();_h();iC();Of();As();Kn();W1t();vae=class extends du{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??ct("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new Z1t.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:AXr(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(!(Di(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=_ae(c,s);i.push(d),s=[]}}else i.push(_ae(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=_ae(c,s);i.push(d),s=[]}}else i.push(_ae(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(G1t(o)){let i=o,a=n.filter(s=>Di(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:K1t(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!G1t(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Di(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:K1t(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:dNe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let m=p.generationInfo?.completion??0;d[m]===void 0?d[m]=p:d[m]=d[m].concat(p)}return{generations:Object.entries(d).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new En({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 eo({text:a.text,message:new yr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new eo({text:"",message:new yr({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 eo({text:"",message:new yr({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 X1t=w(()=>{lN();n$();QT();t9();L_();vH()});var bD=w(()=>{X1t()});var IXr,eNt=w(()=>{IXr=F(e9(),1);Kn();bD()});var gp,tNt=w(()=>{o$();gp=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new qm(e??{})}}});var qP=w(()=>{tNt()});var yp,rNt=w(()=>{yp=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var Wg=w(()=>{rNt()});var nNt,wae,oNt=w(()=>{nNt=F(e9(),1);Kn();qP();Wg();wae=class extends gp{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||ct("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new nNt.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=yp(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 iNt=w(()=>{});var aNt=w(()=>{iNt()});var MXr,sNt=w(()=>{aNt();Kn();MXr=F(e9(),1)});var uNt=w(()=>{Y1t();eNt();oNt();sNt()});var fNe=w(()=>{uNt()});function LXr(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${DXr}/${jXr}`),e.join(" ")}async function FXr(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",LXr(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 aC(`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 aC(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new aC(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function kXr(t,e,r,n,o,i){let a=new pNe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},UXr(i)),{method:"POST",headers:await FXr(a),body:o})}}async function i9(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await kXr(t,e,r,n,o,i);return $Xr(s,u,a)}async function $Xr(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){zXr(o,t)}return n.ok||await BXr(n,t),n}function zXr(t,e){let r=t;throw t instanceof Sae||t instanceof aC||(r=new Pf(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function BXr(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 Sae(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function UXr(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 hNe(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.`),xae(t.candidates[0]))throw new JI(`${ZI(t)}`,t);return qXr(t)}else if(t.promptFeedback)throw new JI(`Text not available. ${ZI(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.`),xae(t.candidates[0]))throw new JI(`${ZI(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),yNt(t)[0]}else if(t.promptFeedback)throw new JI(`Function call not available. ${ZI(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.`),xae(t.candidates[0]))throw new JI(`${ZI(t)}`,t);return yNt(t)}else if(t.promptFeedback)throw new JI(`Function call not available. ${ZI(t)}`,t)},t}function qXr(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 yNt(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 xae(t){return!!t.finishReason&&HXr.includes(t.finishReason)}function ZI(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];xae(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function n9(t){return this instanceof n9?(this.v=t,this):new n9(t)}function VXr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof n9?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 WXr(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=JXr(e),[n,o]=r.tee();return{stream:GXr(n),response:KXr(o)}}async function KXr(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return hNe(ZXr(e));e.push(o)}}function GXr(t){return VXr(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield n9(r.read());if(o)break;yield yield n9(hNe(n))}})}function JXr(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 Pf("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(bNt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new Pf(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(bNt)}return i()})}}})}function ZXr(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 xNt(t,e,r,n){let o=await i9(e,xD.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return WXr(o)}async function SNt(t,e,r,n){let i=await(await i9(e,xD.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:hNe(i)}}function CNt(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 o9(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 YXr(e)}function YXr(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 Pf("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 Pf("No content is provided for sending chat message.");return n?e:r}function XXr(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 aC("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=o9(t);n.contents=[i]}return{generateContentRequest:n}}function _Nt(t){let e;return t.contents?e=t:e={contents:[o9(t)]},t.systemInstruction&&(e.systemInstruction=CNt(t.systemInstruction)),e}function QXr(t){return typeof t=="string"||Array.isArray(t)?{content:o9(t)}:t}function tQr(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new Pf(`First content should be with role 'user', got ${n}`);if(!fNt.includes(n))throw new Pf(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(fNt)}`);if(!Array.isArray(o))throw new Pf("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Pf("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 vNt)u in s&&(i[u]+=1);let a=eQr[n];for(let s of vNt)if(!a.includes(s)&&i[s]>0)throw new Pf(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function rQr(t,e,r,n){return(await i9(e,xD.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function nQr(t,e,r,n){return(await i9(e,xD.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function oQr(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await i9(e,xD.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var lNt,cNt,dNt,fNt,_D,vD,pNt,mNt,r9,hNt,wD,gNt,Pf,JI,Sae,aC,RXr,NXr,jXr,DXr,xD,pNe,HXr,bNt,vNt,eQr,wNt,mNe,Cae,SD,a9=w(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(lNt||(lNt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(cNt||(cNt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(dNt||(dNt={}));fNt=["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"})(_D||(_D={}));(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"})(vD||(vD={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(pNt||(pNt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(mNt||(mNt={}));(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"})(r9||(r9={}));(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"})(hNt||(hNt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(wD||(wD={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(gNt||(gNt={}));Pf=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},JI=class extends Pf{constructor(e,r){super(e),this.response=r}},Sae=class extends Pf{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},aC=class extends Pf{};RXr="https://generativelanguage.googleapis.com",NXr="v1beta",jXr="0.21.0",DXr="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"})(xD||(xD={}));pNe=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)||NXr,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||RXr}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};HXr=[r9.RECITATION,r9.SAFETY,r9.LANGUAGE];bNt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;vNt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],eQr={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};wNt="SILENT_ERROR",mNe=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&&(tQr(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=o9(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(()=>SNt(this._apiKey,this.model,c,d)).then(p=>{var m;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=ZI(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=o9(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=xNt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(wNt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=ZI(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==wNt&&console.error(p)}),f}};Cae=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=CNt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=_Nt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return SNt(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=_Nt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return xNt(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 mNe(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=XXr(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 rQr(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=QXr(e),o=Object.assign(Object.assign({},this._requestOptions),r);return nQr(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return oQr(this.apiKey,this.model,e,n)}};SD=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new Pf("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new Cae(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new aC("Cached content must contain a `name` field.");if(!e.model)throw new aC("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 aC(`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 Cae(this.apiKey,i,n)}}});var ONt=w(()=>{LO()});var CD=w(()=>{ONt()});function PU(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(PU):typeof e[r]=="object"&&e[r]!==null&&(e[r]=PU(e[r])));return e}return t}function Oae(t){let e=PU(Ga(t)),{$schema:r,...n}=e;return n}function PNt(t){let e=PU(t),{$schema:r,...n}=e;return n}var Pae=w(()=>{ug()});function iQr(t){let e=t._getType();return ks.isInstance(t)?t.role:e==="tool"?e:t.name??e}function aQr(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 sQr(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function uQr(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 sQr(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 gNe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!ig(o))throw new Error("Unsupported message input");let a=iQr(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=aQr(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=uQr(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 ENt(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 En({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function TNt(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 eo({text:s,message:new yr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function ANt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Cc(e)){let r=Oae(e.schema);return{name:e.name,description:e.description,parameters:r}}return gd(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:PNt(e.function.parameters)}:e})}]}var yNe=w(()=>{As();Of();_h();bh();Pae()});var s9,INt=w(()=>{eb();s9=class extends cN{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 Km(`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 bNe(t,e){let r=lQr(t),n=dQr(r,e);return{tools:r,toolConfig:n}}function lQr(t){let e=[],r=[];return t.forEach(o=>{if(Cc(o)){let[i]=ANt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(gd(o)){let{functionDeclarations:i}=cQr(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 cQr(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:PU(t.function.parameters)}]}}function dQr(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:wD.ANY,auto:wD.AUTO,none:wD.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:wD.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var MNt=w(()=>{a9();_h();bh();yNe();Pae()});var Eae,RNt=w(()=>{a9();Kn();iC();Jp();CD();Pae();yNe();INt();MNt();Eae=class extends du{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??ct("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 SD(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 SD(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:bNe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?bNe(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=gNe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=ENt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=gNe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let m=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:m,total_tokens:m}}}let f=TNt(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(k_(n)){let m=Oae(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new s9({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,s=n.name):m={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[m]}],u=new s9({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=Eo.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Eo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Pi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var Tae,NNt=w(()=>{a9();Kn();qP();Wg();Tae=class extends gp{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??ct("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 SD(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=yp(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 jNt=w(()=>{RNt();NNt()});var _Ne=w(()=>{jNt()});function fQr(t){return t&&DataView.prototype.isPrototypeOf(t)}function EU(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 wNe(t){return typeof t!="string"&&(t=String(t)),t}function xNe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return bp.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Yl(t){this.map={},t instanceof Yl?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 vNe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function kNt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function pQr(t){var e=new FileReader,r=kNt(e);return e.readAsArrayBuffer(t),r}function mQr(t){var e=new FileReader,r=kNt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function hQr(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 LNt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function $Nt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:bp.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:bp.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:bp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():bp.arrayBuffer&&bp.blob&&fQr(t)?(this._bodyArrayBuffer=LNt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):bp.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||FNt(t))?this._bodyArrayBuffer=LNt(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):bp.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},bp.blob&&(this.blob=function(){var t=vNe(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=vNe(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(bp.blob)return this.blob().then(pQr);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=vNe(this);if(t)return t;if(this._bodyBlob)return mQr(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(hQr(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},bp.formData&&(this.formData=function(){return this.text().then(bQr)}),this.json=function(){return this.text().then(JSON.parse)},this}function yQr(t){var e=t.toUpperCase();return gQr.indexOf(e)>-1?e:t}function PD(t,e){if(!(this instanceof PD))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 PD){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new Yl(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 Yl(e.headers)),this.method=yQr(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in bd){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 bQr(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 _Qr(t){var e=new Yl,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 sC(t,e){if(!(this instanceof sC))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 Yl(e.headers),this.url=e.url||"",this._initBody(t)}function zNt(t,e){return new Promise(function(r,n){var o=new PD(t,e);if(o.signal&&o.signal.aborted)return n(new OD("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:_Qr(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 sC(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 OD("Aborted","AbortError"))},0)};function s(l){try{return l===""&&bd.location.href?bd.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&&(bp.blob?i.responseType="blob":bp.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Yl||bd.Headers&&e.headers instanceof bd.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(EU(l)),i.setRequestHeader(l,wNe(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 bd,bp,DNt,FNt,gQr,vQr,OD,BNt=w(()=>{bd=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},bp={searchParams:"URLSearchParams"in bd,iterable:"Symbol"in bd&&"iterator"in Symbol,blob:"FileReader"in bd&&"Blob"in bd&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in bd,arrayBuffer:"ArrayBuffer"in bd};bp.arrayBuffer&&(DNt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],FNt=ArrayBuffer.isView||function(t){return t&&DNt.indexOf(Object.prototype.toString.call(t))>-1});Yl.prototype.append=function(t,e){t=EU(t),e=wNe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};Yl.prototype.delete=function(t){delete this.map[EU(t)]};Yl.prototype.get=function(t){return t=EU(t),this.has(t)?this.map[t]:null};Yl.prototype.has=function(t){return this.map.hasOwnProperty(EU(t))};Yl.prototype.set=function(t,e){this.map[EU(t)]=wNe(e)};Yl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};Yl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),xNe(t)};Yl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),xNe(t)};Yl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),xNe(t)};bp.iterable&&(Yl.prototype[Symbol.iterator]=Yl.prototype.entries);gQr=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];PD.prototype.clone=function(){return new PD(this,{body:this._bodyInit})};$Nt.call(PD.prototype);$Nt.call(sC.prototype);sC.prototype.clone=function(){return new sC(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Yl(this.headers),url:this.url})};sC.error=function(){var t=new sC(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};vQr=[301,302,303,307,308];sC.redirect=function(t,e){if(vQr.indexOf(e)===-1)throw new RangeError("Invalid status code");return new sC(null,{status:e,headers:{location:t}})};OD=bd.DOMException;try{new OD}catch{OD=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},OD.prototype=Object.create(Error.prototype),OD.prototype.constructor=OD}zNt.polyfill=!0;bd.fetch||(bd.fetch=zNt,bd.Headers=Yl,bd.Request=PD,bd.Response=sC)});function CQr(){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 OQr(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 wQr,qNt,HNt,xQr,SQr,SNe,ONe,PNe,ENe,TNe,UNt,TU,PQr,EQr,TQr,AQr,IQr,CNe,AU,NBo,Aae=w(()=>{BNt();wQr="0.5.14",qNt="11434",HNt=`http://127.0.0.1:${qNt}`,xQr=Object.defineProperty,SQr=(t,e,r)=>e in t?xQr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,SNe=(t,e,r)=>(SQr(t,typeof e!="symbol"?e+"":e,r),r),ONe=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)}},PNe=class{constructor(e,r,n){SNe(this,"abortController"),SNe(this,"itr"),SNe(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.")}},ENe=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 ONe(e,t.status)};TNe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${wQr} (${CQr()})`};r.headers=OQr(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)},UNt=async(t,e,r)=>{let n=await TNe(t,e,{headers:r?.headers});return await ENe(n),n},TU=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await TNe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await ENe(a),a},PQr=async(t,e,r,n)=>{let o=await TNe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await ENe(o),o},EQr=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)}},TQr=t=>{if(!t)return HNt;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=qNt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},AQr=Object.defineProperty,IQr=(t,e,r)=>e in t?AQr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CNe=(t,e,r)=>(IQr(t,typeof e!="symbol"?e+"":e,r),r),AU=class{constructor(e){CNe(this,"config"),CNe(this,"fetch"),CNe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=TQr(e?.host??HNt)),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 TU(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=EQr(a.body),u=new PNe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await TU(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 PQr(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await TU(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await UNt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await TU(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await TU(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await TU(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await UNt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},NBo=new AU});var VNt=w(()=>{L_()});function WNt(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]]).toLowerCase()}var _d,Iae,KNt=w(()=>{_d=[];for(Iae=0;Iae<256;++Iae)_d.push((Iae+256).toString(16).slice(1))});function ANe(){if(!Mae&&(Mae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mae(MQr)}var Mae,MQr,GNt=w(()=>{MQr=new Uint8Array(16)});var RQr,INe,JNt=w(()=>{RQr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),INe={randomUUID:RQr}});function NQr(t,e,r){if(INe.randomUUID&&!e&&!t)return INe.randomUUID();t=t||{};var n=t.random||(t.rng||ANe)();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 WNt(n)}var MNe,ZNt=w(()=>{JNt();GNt();KNt();MNe=NQr});var YNt=w(()=>{ZNt()});function RNe(t,e){return new yr({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:MNe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function XNt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function jQr(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 DQr(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:[XNt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[XNt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function LQr(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 FQr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function QNt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return DQr(e);if(e._getType()==="ai")return jQr(e);if(e._getType()==="system")return LQr(e);if(e._getType()==="tool")return FQr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var ejt=w(()=>{As();YNt()});var Rae,tjt=w(()=>{As();iC();Aae();Of();As();Jp();_h();VNt();eb();CD();ug();ejt();Rae=class extends du{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 AU({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=>oC(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=>oC(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=fc(o,a.message):o=a.message;let i=new En({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=QNt(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 eo({text:c.content,message:RNe(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 eo({text:c.content??"",message:RNe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new eo({text:"",message:new yr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=k_(e),o=n?Ga(e):e,i=this.bind({format:o}),a=n?Xc.fromZodSchema(e):new Qc;if(!r?.includeRaw)return i.pipe(a);let s=Eo.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=Eo.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return Pi.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var Nae,rjt=w(()=>{qP();Aae();Nae=class extends gp{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 AU({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 njt=w(()=>{});var ojt=w(()=>{Of();bD();Aae()});var ijt=w(()=>{tjt();rjt();njt();ojt()});var NNe=w(()=>{ijt()});function Xt(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function ie(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 Kg=w(()=>{});var jNe,DNe=w(()=>{jNe=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return jNe=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 u9(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var l9,jae=w(()=>{l9=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 gt,Xl,Is,YI,uC,IU,MU,RU,NU,jU,DU,LU,FU,kU,$U,lC,cC=w(()=>{jae();gt=class extends Error{},Xl=class t extends gt{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 YI({message:n,cause:l9(r)});let i=r?.error;return e===400?new IU(e,i,n,o):e===401?new MU(e,i,n,o):e===403?new RU(e,i,n,o):e===404?new NU(e,i,n,o):e===409?new jU(e,i,n,o):e===422?new DU(e,i,n,o):e===429?new LU(e,i,n,o):e>=500?new FU(e,i,n,o):new t(e,i,n,o)}},Is=class extends Xl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},YI=class extends Xl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},uC=class extends YI{constructor({message:e}={}){super({message:e??"Request timed out."})}},IU=class extends Xl{},MU=class extends Xl{},RU=class extends Xl{},NU=class extends Xl{},jU=class extends Xl{},DU=class extends Xl{},LU=class extends Xl{},FU=class extends Xl{},kU=class extends gt{constructor(){super("Could not parse response content as the length limit was reached")}},$U=class extends gt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},lC=class extends Error{constructor(e){super(e)}}});function sjt(t){return typeof t!="object"?{}:t??{}}function ujt(t){if(!t)return!0;for(let e in t)return!1;return!0}function ljt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function zU(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var $Qr,ajt,Ef,LNe,cjt,djt,HP=w(()=>{cC();$Qr=/^[a-z][a-z0-9+.-]*:/i,ajt=t=>$Qr.test(t),Ef=t=>(Ef=Array.isArray,Ef(t)),LNe=Ef;cjt=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new gt(`${t} must be an integer`);if(e<0)throw new gt(`${t} must be a positive integer`);return e},djt=t=>{try{return JSON.parse(t)}catch{return}}});var dC,BU=w(()=>{dC=t=>new Promise(e=>setTimeout(e,t))});var XI,FNe=w(()=>{XI="5.12.1"});function zQr(){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 UQr(){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 hjt,BQr,fjt,pjt,mjt,gjt,kNe=w(()=>{FNe();hjt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";BQr=()=>{let t=zQr();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":XI,"X-Stainless-OS":pjt(Deno.build.os),"X-Stainless-Arch":fjt(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":XI,"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":XI,"X-Stainless-OS":pjt(globalThis.process.platform??"unknown"),"X-Stainless-Arch":fjt(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=UQr();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":XI,"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":XI,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};fjt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",pjt=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"),gjt=()=>mjt??(mjt=BQr())});function yjt(){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 $Ne(...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 Dae(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return $Ne({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function zNe(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 bjt(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 c9=w(()=>{});var _jt,vjt=w(()=>{_jt=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var Lae,BNe,Fae,UNe,kae=w(()=>{Lae="RFC3986",BNe=t=>String(t),Fae={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:BNe},UNe="RFC1738"});function xjt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function HNe(t,e){if(Ef(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var $ae,fC,qNe,wjt,Sjt=w(()=>{kae();HP();$ae=(t,e)=>($ae=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),$ae(t,e)),fC=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),qNe=1024,wjt=(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+=qNe){let u=i.length>=qNe?i.slice(s,s+qNe):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===UNe&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=fC[d];continue}if(d<2048){l[l.length]=fC[192|d>>6]+fC[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=fC[224|d>>12]+fC[128|d>>6&63]+fC[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=fC[240|d>>18]+fC[128|d>>12&63]+fC[128|d>>6&63]+fC[128|d&63]}a+=l.join("")}return a}});function VQr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function Ejt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b,g){let y=t,x=g,S=0,O=!1;for(;(x=x.get(VNe))!==void 0&&!O;){let R=x.get(t);if(S+=1,typeof R<"u"){if(R===S)throw new RangeError("Cyclic object value");O=!0}typeof x.get(VNe)>"u"&&(S=0)}if(typeof l=="function"?y=l(e,y):y instanceof Date?y=f?.(y):r==="comma"&&Ef(y)&&(y=HNe(y,function(R){return R instanceof Date?f?.(R):R})),y===null){if(i)return u&&!h?u(e,Ql.encoder,b,"key",p):e;y=""}if(VQr(y)||xjt(y)){if(u){let R=h?e:u(e,Ql.encoder,b,"key",p);return[m?.(R)+"="+m?.(u(y,Ql.encoder,b,"value",p))]}return[m?.(e)+"="+m?.(String(y))]}let E=[];if(typeof y>"u")return E;let P;if(r==="comma"&&Ef(y))h&&u&&(y=HNe(y,u)),P=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ef(l))P=l;else{let R=Object.keys(y);P=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&Ef(y)&&y.length===1?A+"[]":A;if(o&&Ef(y)&&y.length===0)return I+"[]";for(let R=0;R<P.length;++R){let N=P[R],j=typeof N=="object"&&typeof N.value<"u"?N.value:y[N];if(a&&j===null)continue;let $=d&&s?N.replace(/\./g,"%2E"):N,k=Ef(y)?typeof r=="function"?r(I,$):I:I+(d?"."+$:"["+$+"]");g.set(t,S);let H=new WeakMap;H.set(VNe,g),Pjt(E,Ejt(j,k,r,n,o,i,a,s,r==="comma"&&h&&Ef(y)?null:u,l,c,d,f,p,m,h,b,H))}return E}function WQr(t=Ql){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||Ql.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=Lae;if(typeof t.format<"u"){if(!$ae(Fae,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=Fae[r],o=Ql.filter;(typeof t.filter=="function"||Ef(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Ojt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Ql.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:Ql.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ql.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ql.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ql.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Ql.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ql.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Ql.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Ql.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ql.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ql.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ql.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ql.strictNullHandling}}function WNe(t,e={}){let r=t,n=WQr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Ef(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Ojt[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||Pjt(a,Ejt(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 Ojt,Pjt,Cjt,Ql,VNe,Tjt=w(()=>{Sjt();kae();HP();Ojt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Pjt=function(t,e){Array.prototype.push.apply(t,Ef(e)?e:[e])},Ql={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:wjt,encodeValuesOnly:!1,format:Lae,formatter:BNe,indices:!1,serializeDate(t){return(Cjt??(Cjt=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};VNe={}});var Ajt=w(()=>{kae();Tjt()});function Rjt(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 UU(t){let e;return(Ijt??(e=new globalThis.TextEncoder,Ijt=e.encode.bind(e)))(t)}function KNe(t){let e;return(Mjt??(e=new globalThis.TextDecoder,Mjt=e.decode.bind(e)))(t)}var Ijt,Mjt,zae=w(()=>{});function GQr(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 Njt(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 vh,wh,ED,jjt=w(()=>{Kg();zae();ED=class{constructor(){vh.set(this,void 0),wh.set(this,void 0),Xt(this,vh,new Uint8Array,"f"),Xt(this,wh,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?UU(e):e;Xt(this,vh,Rjt([ie(this,vh,"f"),r]),"f");let n=[],o;for(;(o=GQr(ie(this,vh,"f"),ie(this,wh,"f")))!=null;){if(o.carriage&&ie(this,wh,"f")==null){Xt(this,wh,o.index,"f");continue}if(ie(this,wh,"f")!=null&&(o.index!==ie(this,wh,"f")+1||o.carriage)){n.push(KNe(ie(this,vh,"f").subarray(0,ie(this,wh,"f")-1))),Xt(this,vh,ie(this,vh,"f").subarray(ie(this,wh,"f")),"f"),Xt(this,wh,null,"f");continue}let i=ie(this,wh,"f")!==null?o.preceding-1:o.preceding,a=KNe(ie(this,vh,"f").subarray(0,i));n.push(a),Xt(this,vh,ie(this,vh,"f").subarray(o.index),"f"),Xt(this,wh,null,"f")}return n}flush(){return ie(this,vh,"f").length?this.decode(`
|
||
`):[]}};vh=new WeakMap,wh=new WeakMap;ED.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);ED.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function d9(){}function Bae(t,e,r){return!e||Uae[t]>Uae[r]?d9:e[t].bind(e)}function Zs(t){let e=t.logger,r=t.logLevel??"off";if(!e)return JQr;let n=Djt.get(e);if(n&&n[0]===r)return n[1];let o={error:Bae("error",e,r),warn:Bae("warn",e,r),info:Bae("info",e,r),debug:Bae("debug",e,r)};return Djt.set(e,[r,o]),o}var Uae,GNe,JQr,Djt,VP,f9=w(()=>{HP();Uae={off:0,error:200,warn:300,info:400,debug:500},GNe=(t,e,r)=>{if(t){if(ljt(Uae,t))return t;Zs(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Uae))}`)}};JQr={error:d9,warn:d9,info:d9,debug:d9},Djt=new WeakMap;VP=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*ZQr(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new gt("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 gt("Attempted to iterate over a response with no body");let r=new JNe,n=new ED,o=zNe(t.body);for await(let i of YQr(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*YQr(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"?UU(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=Njt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function XQr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var p9,pC,JNe,ZNe=w(()=>{Kg();cC();c9();jjt();c9();jae();zae();f9();cC();pC=class t{constructor(e,r,n){this.iterator=e,p9.set(this,void 0),this.controller=r,Xt(this,p9,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?Zs(n):console;async function*a(){if(o)throw new gt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of ZQr(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 Xl(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 Xl(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(u9(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 ED,u=zNe(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 gt("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(u9(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(p9=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,ie(this,p9,"f")),new t(()=>o(r),this.controller,ie(this,p9,"f"))]}toReadableStream(){let e=this,r;return $Ne({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=UU(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};JNe=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]=XQr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function qae(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return Zs(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):pC.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 YNe(d,r)}return await r.text()})();return Zs(t).debug(`[${n}] response parsed`,VP({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function YNe(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 XNe=w(()=>{ZNe();f9()});var m9,TD,Hae=w(()=>{Kg();XNe();TD=class t extends Promise{constructor(e,r,n=qae){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,m9.set(this,void 0),Xt(this,m9,e,"f")}_thenUnwrap(e){return new t(ie(this,m9,"f"),this.responsePromise,async(r,n)=>YNe(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(ie(this,m9,"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)}};m9=new WeakMap});var Vae,Wae,h9,mC,hn,$a=w(()=>{Kg();cC();XNe();Hae();HP();Wae=class{constructor(e,r,n,o){Vae.set(this,void 0),Xt(this,Vae,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 gt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await ie(this,Vae,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Vae=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},h9=class extends TD{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await qae(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},mC=class extends Wae{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}},hn=class extends Wae{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:{...sjt(this.options.query),after:r}}:null}}});function qU(t,e,r){return eje(),new File(t,e??"unknown_file",r)}function g9(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 een(t){let e=typeof t=="function"?t:t.fetch,r=Ljt.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 Ljt.set(e,n),n}var eje,tje,xh,Ljt,ten,ren,QNe,WP=w(()=>{c9();eje=()=>{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`.":""))}};tje=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",xh=async(t,e)=>({...t,body:await ten(t.body,e)}),Ljt=new WeakMap;ten=async(t,e)=>{if(!await een(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])=>QNe(r,n,o))),r},ren=t=>t instanceof Blob&&"name"in t,QNe=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,qU([await r.blob()],g9(r)));else if(tje(r))t.append(e,qU([await new Response(Dae(r)).blob()],g9(r)));else if(ren(r))t.append(e,r,g9(r));else if(Array.isArray(r))await Promise.all(r.map(n=>QNe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>QNe(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 y9(t,e,r){if(eje(),t=await t,nen(t))return t instanceof File?t:qU([await t.arrayBuffer()],t.name);if(oen(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),qU(await rje(o),e,r)}let n=await rje(t);if(e||(e=g9(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return qU(n,e,r)}async function rje(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Fjt(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(tje(t))for await(let r of t)e.push(...await rje(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${ien(t)}`)}return e}function ien(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var Fjt,nen,oen,kjt=w(()=>{WP();WP();Fjt=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",nen=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Fjt(t),oen=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var nje=w(()=>{kjt()});var Be,Cr=w(()=>{Be=class{constructor(e){this._client=e}}});function zjt(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var $jt,sen,je,Vi=w(()=>{cC();$jt=Object.freeze(Object.create(null)),sen=(t=zjt)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??$jt)??$jt)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new gt(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},je=sen(zjt)});var AD,Kae=w(()=>{Cr();$a();Vi();AD=class extends Be{list(e,r={},n){return this._client.getAPIList(je`/chat/completions/${e}/messages`,hn,{query:r,...n})}}});var Rb=w(()=>{cC()});function b9(t){return t!==void 0&&"function"in t&&t.function!==void 0}function Bjt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function _9(t){return t?.$brand==="auto-parseable-response-format"}function ID(t){return t?.$brand==="auto-parseable-tool"}function Ujt(t,e){return!e||!oje(e)?{...t,choices:t.choices.map(r=>(Hjt(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:v9(t,e)}function v9(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new kU;if(n.finish_reason==="content_filter")throw new $U;return Hjt(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>den(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?cen(e,n.message.content):null}}});return{...t,choices:r}}function cen(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 den(t,e){let r=t.tools?.find(n=>b9(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:ID(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function qjt(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>b9(n)&&n.function?.name===e.function.name);return b9(r)&&(ID(r)||r?.function.strict||!1)}function oje(t){return _9(t.response_format)?!0:t.tools?.some(e=>ID(e)||e.type==="function"&&e.function.strict===!0)??!1}function Hjt(t){for(let e of t||[])if(e.type!=="function")throw new gt(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function Vjt(t){for(let e of t??[]){if(e.type!=="function")throw new gt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new gt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var HU=w(()=>{Rb()});var VU,ije,aje=w(()=>{VU=t=>t?.role==="assistant",ije=t=>t?.role==="tool"});var sje,Gae,Jae,w9,x9,Zae,S9,KP,C9,Yae,Xae,WU,Wjt,QI,Qae=w(()=>{Kg();Rb();QI=class{constructor(){sje.add(this),this.controller=new AbortController,Gae.set(this,void 0),Jae.set(this,()=>{}),w9.set(this,()=>{}),x9.set(this,void 0),Zae.set(this,()=>{}),S9.set(this,()=>{}),KP.set(this,{}),C9.set(this,!1),Yae.set(this,!1),Xae.set(this,!1),WU.set(this,!1),Xt(this,Gae,new Promise((e,r)=>{Xt(this,Jae,e,"f"),Xt(this,w9,r,"f")}),"f"),Xt(this,x9,new Promise((e,r)=>{Xt(this,Zae,e,"f"),Xt(this,S9,r,"f")}),"f"),ie(this,Gae,"f").catch(()=>{}),ie(this,x9,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},ie(this,sje,"m",Wjt).bind(this))},0)}_connected(){this.ended||(ie(this,Jae,"f").call(this),this._emit("connect"))}get ended(){return ie(this,C9,"f")}get errored(){return ie(this,Yae,"f")}get aborted(){return ie(this,Xae,"f")}abort(){this.controller.abort()}on(e,r){return(ie(this,KP,"f")[e]||(ie(this,KP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=ie(this,KP,"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(ie(this,KP,"f")[e]||(ie(this,KP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Xt(this,WU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Xt(this,WU,!0,"f"),await ie(this,x9,"f")}_emit(e,...r){if(ie(this,C9,"f"))return;e==="end"&&(Xt(this,C9,!0,"f"),ie(this,Zae,"f").call(this));let n=ie(this,KP,"f")[e];if(n&&(ie(this,KP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!ie(this,WU,"f")&&!n?.length&&Promise.reject(o),ie(this,w9,"f").call(this,o),ie(this,S9,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!ie(this,WU,"f")&&!n?.length&&Promise.reject(o),ie(this,w9,"f").call(this,o),ie(this,S9,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Gae=new WeakMap,Jae=new WeakMap,w9=new WeakMap,x9=new WeakMap,Zae=new WeakMap,S9=new WeakMap,KP=new WeakMap,C9=new WeakMap,Yae=new WeakMap,Xae=new WeakMap,WU=new WeakMap,sje=new WeakSet,Wjt=function(e){if(Xt(this,Yae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Is),e instanceof Is)return Xt(this,Xae,!0,"f"),this._emit("abort",e);if(e instanceof gt)return this._emit("error",e);if(e instanceof Error){let r=new gt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new gt(String(e)))}});function Kjt(t){return typeof t.parse=="function"}var uje=w(()=>{});var _p,lje,ese,cje,dje,fje,Gjt,Jjt,fen,KU,pje=w(()=>{Kg();Rb();HU();aje();Qae();uje();fen=10,KU=class extends QI{constructor(){super(...arguments),_p.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),ije(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(VU(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 gt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),ie(this,_p,"m",lje).call(this)}async finalMessage(){return await this.done(),ie(this,_p,"m",ese).call(this)}async finalFunctionToolCall(){return await this.done(),ie(this,_p,"m",cje).call(this)}async finalFunctionToolCallResult(){return await this.done(),ie(this,_p,"m",dje).call(this)}async totalUsage(){return await this.done(),ie(this,_p,"m",fje).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=ie(this,_p,"m",ese).call(this);r&&this._emit("finalMessage",r);let n=ie(this,_p,"m",lje).call(this);n&&this._emit("finalContent",n);let o=ie(this,_p,"m",cje).call(this);o&&this._emit("finalFunctionToolCall",o);let i=ie(this,_p,"m",dje).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",ie(this,_p,"m",fje).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),ie(this,_p,"m",Gjt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(v9(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=fen}=n||{},c=r.tools.map(p=>{if(ID(p)){if(!p.$callback)throw new gt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new gt("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let b of h.tool_calls){if(b.type!=="function")continue;let g=b.id,{name:y,arguments:x}=b.function,S=d[y];if(S){if(u&&u!==y){let A=`Invalid tool_call: ${JSON.stringify(y)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}}else{let A=`Invalid tool_call: ${JSON.stringify(y)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}let O;try{O=Kjt(S)?await S.parse(x):x}catch(A){let I=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:I});continue}let E=await S.function(O,this),P=ie(this,_p,"m",Jjt).call(this,E);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};_p=new WeakSet,lje=function(){return ie(this,_p,"m",ese).call(this).content??null},ese=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(VU(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new gt("stream ended without producing a ChatCompletionMessage with role=assistant")},cje=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(VU(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},dje=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(ije(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}},fje=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},Gjt=function(e){if(e.n!=null&&e.n>1)throw new gt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Jjt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var O9,mje=w(()=>{pje();aje();O9=class t extends KU{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),VU(e)&&e.content&&this._emit("content",e.content)}}});function pen(t,e=Oc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return men(t.trim(),e)}var Oc,hje,gje,men,yje,Zjt=w(()=>{Oc={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},hje=class extends Error{},gje=class extends Error{};men=(t,e)=>{let r=t.length,n=0,o=f=>{throw new hje(`${f} at position ${n}`)},i=f=>{throw new gje(`${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"||Oc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Oc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Oc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Oc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Oc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Oc.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(m){i(String(m))}else if(Oc.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&&Oc.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Oc.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Oc.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(Oc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Oc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Oc.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&&!(Oc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Oc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;n<r&&`
|
||
\r `.includes(t[n]);)n++};return a()},yje=t=>pen(t,Oc.ALL^Oc.NUM)});var bje=w(()=>{ZNe()});function hen(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 gt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:b,...g}=l,y=l.role;if(!y)throw new gt(`missing role for choice ${d}`);if(h){let{arguments:x,name:S}=h;if(x==null)throw new gt(`missing function_call.arguments for choice ${d}`);if(!S)throw new gt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:S},role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return b?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:y,content:m,refusal:l.refusal??null,tool_calls:b.map((x,S)=>{let{function:O,type:E,id:P,...A}=x,{arguments:I,name:R,...N}=O||{};if(P==null)throw new gt(`missing choices[${d}].tool_calls[${S}].id
|
||
${nse(t)}`);if(E==null)throw new gt(`missing choices[${d}].tool_calls[${S}].type
|
||
${nse(t)}`);if(R==null)throw new gt(`missing choices[${d}].tool_calls[${S}].function.name
|
||
${nse(t)}`);if(I==null)throw new gt(`missing choices[${d}].tool_calls[${S}].function.arguments
|
||
${nse(t)}`);return{...A,id:P,type:E,function:{...N,name:R,arguments:I}}})}}:{...p,message:{...g,content:m,role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return Ujt(u,e)}function nse(t){return JSON.stringify(t)}var ec,GP,GU,eM,_je,tse,vje,wje,xje,rse,Sje,Yjt,MD,ose=w(()=>{Kg();Zjt();Rb();HU();bje();pje();MD=class t extends KU{constructor(e){super(),ec.add(this),GP.set(this,void 0),GU.set(this,void 0),eM.set(this,void 0),Xt(this,GP,e,"f"),Xt(this,GU,[],"f")}get currentChatCompletionSnapshot(){return ie(this,eM,"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())),ie(this,ec,"m",_je).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)ie(this,ec,"m",vje).call(this,a);if(i.controller.signal?.aborted)throw new Is;return this._addChatCompletion(ie(this,ec,"m",rse).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),ie(this,ec,"m",_je).call(this),this._connected();let o=pC.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(ie(this,ec,"m",rse).call(this)),ie(this,ec,"m",vje).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Is;return this._addChatCompletion(ie(this,ec,"m",rse).call(this))}[(GP=new WeakMap,GU=new WeakMap,eM=new WeakMap,ec=new WeakSet,_je=function(){this.ended||Xt(this,eM,void 0,"f")},tse=function(r){let n=ie(this,GU,"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},ie(this,GU,"f")[r.index]=n,n)},vje=function(r){if(this.ended)return;let n=ie(this,ec,"m",Yjt).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=ie(this,ec,"m",tse).call(this,i);i.finish_reason&&(ie(this,ec,"m",xje).call(this,i),a.current_tool_call_index!=null&&ie(this,ec,"m",wje).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(ie(this,ec,"m",xje).call(this,i),a.current_tool_call_index!=null&&ie(this,ec,"m",wje).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))}}},wje=function(r,n){if(ie(this,ec,"m",tse).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=ie(this,GP,"f")?.tools?.find(s=>b9(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:ID(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},xje=function(r){let n=ie(this,ec,"m",tse).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=ie(this,ec,"m",Sje).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}))},rse=function(){if(this.ended)throw new gt("stream has ended, this shouldn't happen");let r=ie(this,eM,"f");if(!r)throw new gt("request ended without sending any chunks");return Xt(this,eM,void 0,"f"),Xt(this,GU,[],"f"),hen(r,ie(this,GP,"f"))},Sje=function(){let r=ie(this,GP,"f")?.response_format;return _9(r)?r:null},Yjt=function(r){var n,o,i,a;let s=ie(this,eM,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Xt(this,eM,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...A}=p;Object.assign(h.logprobs,A),E&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...E)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,ie(this,GP,"f")&&oje(ie(this,GP,"f")))){if(d==="length")throw new kU;if(d==="content_filter")throw new $U}if(Object.assign(h,m),!c)continue;let{content:b,refusal:g,function_call:y,role:x,tool_calls:S,...O}=c;if(Object.assign(h.message,O),g&&(h.message.refusal=(h.message.refusal||"")+g),x&&(h.message.role=x),y&&(h.message.function_call?(y.name&&(h.message.function_call.name=y.name),y.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=y.arguments)):h.message.function_call=y),b&&(h.message.content=(h.message.content||"")+b,!h.message.refusal&&ie(this,ec,"m",Sje).call(this)&&(h.message.parsed=yje(h.message.content))),S){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:E,id:P,type:A,function:I,...R}of S){let N=(a=h.message.tool_calls)[E]??(a[E]={});Object.assign(N,R),P&&(N.id=P),A&&(N.type=A),I&&(N.function??(N.function={name:I.name??"",arguments:""})),I?.name&&(N.function.name=I.name),I?.arguments&&(N.function.arguments+=I.arguments,qjt(ie(this,GP,"f"),N)&&(N.function.parsed_arguments=yje(N.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 pC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var P9,Cje=w(()=>{ose();P9=class t extends MD{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 JP,E9=w(()=>{Cr();Kae();Kae();$a();Vi();mje();Cje();ose();HU();Cje();uje();ose();mje();JP=class extends Be{constructor(){super(...arguments),this.messages=new AD(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(je`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(je`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",hn,{query:e,...r})}delete(e,r){return this._client.delete(je`/chat/completions/${e}`,r)}parse(e,r){return Vjt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>v9(n,e))}runTools(e,r){return e.stream?P9.runTools(this._client,e,r):O9.runTools(this._client,e,r)}stream(e,r){return MD.createChatCompletion(this._client,e,r)}};JP.Messages=AD});var tM,Oje=w(()=>{Cr();E9();E9();tM=class extends Be{constructor(){super(...arguments),this.completions=new JP(this._client)}};tM.Completions=JP});var Xjt=w(()=>{E9();E9();Kae()});var Qjt=w(()=>{Oje();Xjt()});var eDt=w(()=>{});function*yen(t){if(!t)return;if(tDt 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():LNe(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=LNe(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 tDt,mt,fu=w(()=>{HP();tDt=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 yen(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{[tDt]:!0,values:e,nulls:r}}});var JU,Pje=w(()=>{Cr();fu();JU=class extends Be{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:mt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var ZU,Eje=w(()=>{Cr();WP();ZU=class extends Be{create(e,r){return this._client.post("/audio/transcriptions",xh({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var YU,Tje=w(()=>{Cr();WP();YU=class extends Be{create(e,r){return this._client.post("/audio/translations",xh({body:e,...r,__metadata:{model:e.model}},this._client))}}});var hC,Aje=w(()=>{Cr();Pje();Pje();Eje();Eje();Tje();Tje();hC=class extends Be{constructor(){super(...arguments),this.transcriptions=new ZU(this._client),this.translations=new YU(this._client),this.speech=new JU(this._client)}};hC.Transcriptions=ZU;hC.Translations=YU;hC.Speech=JU});var RD,Ije=w(()=>{Cr();$a();Vi();RD=class extends Be{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(je`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",hn,{query:e,...r})}cancel(e,r){return this._client.post(je`/batches/${e}/cancel`,r)}}});var XU,Mje=w(()=>{Cr();$a();fu();Vi();XU=class extends Be{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(je`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(je`/assistants/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",hn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(je`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var QU,Rje=w(()=>{Cr();fu();QU=class extends Be{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var eq,Nje=w(()=>{Cr();fu();eq=class extends Be{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var rM,jje=w(()=>{Cr();Rje();Rje();Nje();Nje();rM=class extends Be{constructor(){super(...arguments),this.sessions=new QU(this._client),this.transcriptionSessions=new eq(this._client)}};rM.Sessions=QU;rM.TranscriptionSessions=eq});var tq,Dje=w(()=>{Cr();$a();fu();Vi();tq=class extends Be{create(e,r,n){return this._client.post(je`/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(je`/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(je`/threads/${o}/messages/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(je`/threads/${e}/messages`,hn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(je`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var rq,Lje=w(()=>{Cr();$a();fu();Vi();rq=class extends Be{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(je`/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(je`/threads/${o}/runs/${e}/steps`,hn,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var rDt,nDt=w(()=>{cC();zae();rDt=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 Nb,Fje=w(()=>{Nb=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 T9=w(()=>{HP();nDt();Fje();f9();DNe();BU()});var vd,jD,kje,gC,ise,jb,DD,nq,ND,use,Sh,ase,sse,M9,A9,I9,oDt,iDt,aDt,sDt,uDt,lDt,cDt,ZP,$je=w(()=>{Kg();bje();Rb();Qae();T9();ZP=class extends QI{constructor(){super(...arguments),vd.add(this),kje.set(this,[]),gC.set(this,{}),ise.set(this,{}),jb.set(this,void 0),DD.set(this,void 0),nq.set(this,void 0),ND.set(this,void 0),use.set(this,void 0),Sh.set(this,void 0),ase.set(this,void 0),sse.set(this,void 0),M9.set(this,void 0)}[(kje=new WeakMap,gC=new WeakMap,ise=new WeakMap,jb=new WeakMap,DD=new WeakMap,nq=new WeakMap,ND=new WeakMap,use=new WeakMap,Sh=new WeakMap,ase=new WeakMap,sse=new WeakMap,M9=new WeakMap,vd=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 jD;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=pC.fromReadableStream(e,this.controller);for await(let i of o)ie(this,vd,"m",A9).call(this,i);if(o.controller.signal?.aborted)throw new Is;return this._addRun(ie(this,vd,"m",I9).call(this))}toReadableStream(){return new pC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new jD;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)ie(this,vd,"m",A9).call(this,u);if(s.controller.signal?.aborted)throw new Is;return this._addRun(ie(this,vd,"m",I9).call(this))}static createThreadAssistantStream(e,r,n){let o=new jD;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 jD;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return ie(this,ase,"f")}currentRun(){return ie(this,sse,"f")}currentMessageSnapshot(){return ie(this,jb,"f")}currentRunStepSnapshot(){return ie(this,M9,"f")}async finalRunSteps(){return await this.done(),Object.values(ie(this,gC,"f"))}async finalMessages(){return await this.done(),Object.values(ie(this,ise,"f"))}async finalRun(){if(await this.done(),!ie(this,DD,"f"))throw Error("Final run was not received.");return ie(this,DD,"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)ie(this,vd,"m",A9).call(this,s);if(a.controller.signal?.aborted)throw new Is;return this._addRun(ie(this,vd,"m",I9).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)ie(this,vd,"m",A9).call(this,u);if(s.controller.signal?.aborted)throw new Is;return this._addRun(ie(this,vd,"m",I9).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(zU(i)&&zU(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(!zU(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)}};jD=ZP,A9=function(e){if(!this.ended)switch(Xt(this,ase,e,"f"),ie(this,vd,"m",aDt).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":ie(this,vd,"m",cDt).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":ie(this,vd,"m",iDt).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":ie(this,vd,"m",oDt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},I9=function(){if(this.ended)throw new gt("stream has ended, this shouldn't happen");if(!ie(this,DD,"f"))throw Error("Final run has not been received");return ie(this,DD,"f")},oDt=function(e){let[r,n]=ie(this,vd,"m",uDt).call(this,e,ie(this,jb,"f"));Xt(this,jb,r,"f"),ie(this,ise,"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!=ie(this,nq,"f")){if(ie(this,ND,"f"))switch(ie(this,ND,"f").type){case"text":this._emit("textDone",ie(this,ND,"f").text,ie(this,jb,"f"));break;case"image_file":this._emit("imageFileDone",ie(this,ND,"f").image_file,ie(this,jb,"f"));break}Xt(this,nq,o.index,"f")}Xt(this,ND,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(ie(this,nq,"f")!==void 0){let o=e.data.content[ie(this,nq,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,ie(this,jb,"f"));break;case"text":this._emit("textDone",o.text,ie(this,jb,"f"));break}}ie(this,jb,"f")&&this._emit("messageDone",e.data),Xt(this,jb,void 0,"f")}},iDt=function(e){let r=ie(this,vd,"m",sDt).call(this,e);switch(Xt(this,M9,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==ie(this,use,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(ie(this,Sh,"f")&&this._emit("toolCallDone",ie(this,Sh,"f")),Xt(this,use,i.index,"f"),Xt(this,Sh,r.step_details.tool_calls[i.index],"f"),ie(this,Sh,"f")&&this._emit("toolCallCreated",ie(this,Sh,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Xt(this,M9,void 0,"f"),e.data.step_details.type=="tool_calls"&&ie(this,Sh,"f")&&(this._emit("toolCallDone",ie(this,Sh,"f")),Xt(this,Sh,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},aDt=function(e){ie(this,kje,"f").push(e),this._emit("event",e)},sDt=function(e){switch(e.event){case"thread.run.step.created":return ie(this,gC,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=ie(this,gC,"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=jD.accumulateDelta(r,n.delta);ie(this,gC,"f")[e.data.id]=o}return ie(this,gC,"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":ie(this,gC,"f")[e.data.id]=e.data;break}if(ie(this,gC,"f")[e.data.id])return ie(this,gC,"f")[e.data.id];throw new Error("No snapshot available")},uDt=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]=ie(this,vd,"m",lDt).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")},lDt=function(e,r){return jD.accumulateDelta(r,e)},cDt=function(e){switch(Xt(this,sse,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":Xt(this,DD,e.data,"f"),ie(this,Sh,"f")&&(this._emit("toolCallDone",ie(this,Sh,"f")),Xt(this,Sh,void 0,"f"));break;case"thread.run.cancelling":break}}});var LD,zje=w(()=>{Cr();Lje();Lje();$a();fu();$je();BU();Vi();LD=class extends Be{constructor(){super(...arguments),this.steps=new rq(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(je`/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(je`/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(je`/threads/${o}/runs/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(je`/threads/${e}/runs`,hn,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(je`/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 ZP.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 dC(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return ZP.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(je`/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 ZP.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};LD.Steps=rq});var nM,Bje=w(()=>{Cr();Dje();Dje();zje();zje();fu();$je();Vi();nM=class extends Be{constructor(){super(...arguments),this.runs=new LD(this._client),this.messages=new tq(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(je`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(je`/threads/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(je`/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 ZP.createThreadAssistantStream(e,this._client.beta.threads,r)}};nM.Runs=LD;nM.Messages=tq});var yC,Uje=w(()=>{Cr();Mje();Mje();jje();jje();Bje();Bje();yC=class extends Be{constructor(){super(...arguments),this.realtime=new rM(this._client),this.assistants=new XU(this._client),this.threads=new nM(this._client)}};yC.Realtime=rM;yC.Assistants=XU;yC.Threads=nM});var FD,qje=w(()=>{Cr();FD=class extends Be{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var oq,Hje=w(()=>{Cr();fu();Vi();oq=class extends Be{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(je`/containers/${o}/files/${e}/content`,{...n,headers:mt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var kD,Vje=w(()=>{Cr();Hje();Hje();$a();fu();WP();Vi();kD=class extends Be{constructor(){super(...arguments),this.content=new oq(this._client)}create(e,r,n){return this._client.post(je`/containers/${e}/files`,xh({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(je`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(je`/containers/${e}/files`,hn,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(je`/containers/${o}/files/${e}`,{...n,headers:mt([{Accept:"*/*"},n?.headers])})}};kD.Content=oq});var oM,Wje=w(()=>{Cr();Vje();Vje();$a();fu();Vi();oM=class extends Be{constructor(){super(...arguments),this.files=new kD(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(je`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",hn,{query:e,...r})}delete(e,r){return this._client.delete(je`/containers/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}};oM.Files=kD});var $D,Kje=w(()=>{Cr();T9();$D=class extends Be{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&Zs(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:(Zs(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=rDt(u)}),a)))}}});var iq,Gje=w(()=>{Cr();$a();Vi();iq=class extends Be{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(je`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(je`/evals/${o}/runs/${e}/output_items`,hn,{query:i,...n})}}});var zD,Jje=w(()=>{Cr();Gje();Gje();$a();Vi();zD=class extends Be{constructor(){super(...arguments),this.outputItems=new iq(this._client)}create(e,r,n){return this._client.post(je`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(je`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(je`/evals/${e}/runs`,hn,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(je`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(je`/evals/${o}/runs/${e}`,n)}};zD.OutputItems=iq});var iM,Zje=w(()=>{Cr();Jje();Jje();$a();Vi();iM=class extends Be{constructor(){super(...arguments),this.runs=new zD(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(je`/evals/${e}`,r)}update(e,r,n){return this._client.post(je`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",hn,{query:e,...r})}delete(e,r){return this._client.delete(je`/evals/${e}`,r)}};iM.Runs=zD});var BD,Yje=w(()=>{Cr();$a();fu();BU();Rb();WP();Vi();BD=class extends Be{create(e,r){return this._client.post("/files",xh({body:e,...r},this._client))}retrieve(e,r){return this._client.get(je`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",hn,{query:e,...r})}delete(e,r){return this._client.delete(je`/files/${e}`,r)}content(e,r){return this._client.get(je`/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 dC(r),a=await this.retrieve(e),Date.now()-i>n)throw new uC({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var aq,Xje=w(()=>{Cr();aq=class extends Be{}});var sq,Qje=w(()=>{Cr();sq=class extends Be{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 UD,eDe=w(()=>{Cr();Qje();Qje();UD=class extends Be{constructor(){super(...arguments),this.graders=new sq(this._client)}};UD.Graders=sq});var uq,tDe=w(()=>{Cr();$a();Vi();uq=class extends Be{create(e,r,n){return this._client.getAPIList(je`/fine_tuning/checkpoints/${e}/permissions`,mC,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(je`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(je`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var qD,rDe=w(()=>{Cr();tDe();tDe();qD=class extends Be{constructor(){super(...arguments),this.permissions=new uq(this._client)}};qD.Permissions=uq});var lq,nDe=w(()=>{Cr();$a();Vi();lq=class extends Be{list(e,r={},n){return this._client.getAPIList(je`/fine_tuning/jobs/${e}/checkpoints`,hn,{query:r,...n})}}});var HD,oDe=w(()=>{Cr();nDe();nDe();$a();Vi();HD=class extends Be{constructor(){super(...arguments),this.checkpoints=new lq(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(je`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",hn,{query:e,...r})}cancel(e,r){return this._client.post(je`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(je`/fine_tuning/jobs/${e}/events`,hn,{query:r,...n})}pause(e,r){return this._client.post(je`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(je`/fine_tuning/jobs/${e}/resume`,r)}};HD.Checkpoints=lq});var Db,iDe=w(()=>{Cr();Xje();Xje();eDe();eDe();rDe();rDe();oDe();oDe();Db=class extends Be{constructor(){super(...arguments),this.methods=new aq(this._client),this.jobs=new HD(this._client),this.checkpoints=new qD(this._client),this.alpha=new UD(this._client)}};Db.Methods=aq;Db.Jobs=HD;Db.Checkpoints=qD;Db.Alpha=UD});var cq,aDe=w(()=>{Cr();cq=class extends Be{}});var aM,sDe=w(()=>{Cr();aDe();aDe();aM=class extends Be{constructor(){super(...arguments),this.graderModels=new cq(this._client)}};aM.GraderModels=cq});var VD,uDe=w(()=>{Cr();WP();VD=class extends Be{createVariation(e,r){return this._client.post("/images/variations",xh({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",xh({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 WD,lDe=w(()=>{Cr();$a();Vi();WD=class extends Be{retrieve(e,r){return this._client.get(je`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",mC,e)}delete(e,r){return this._client.delete(je`/models/${e}`,r)}}});var KD,cDe=w(()=>{Cr();KD=class extends Be{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function dDt(t,e){return!e||!Uen(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)}:dDe(t,e)}function dDe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Ven(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:Ben(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||lse(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 Ben(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Uen(t){return!!_9(t.text?.format)}function qen(t){return t?.$brand==="auto-parseable-tool"}function Hen(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Ven(t,e){let r=Hen(t.tools??[],e.name);return{...e,...e,parsed_arguments:qen(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function lse(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 cse=w(()=>{Rb();HU()});function Wen(t,e){return dDt(t,e)}var dq,dse,sM,fse,fDt,pDt,mDt,hDt,pse,gDt=w(()=>{Kg();Rb();Qae();cse();pse=class t extends QI{constructor(e){super(),dq.add(this),dse.set(this,void 0),sM.set(this,void 0),fse.set(this,void 0),Xt(this,dse,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())),ie(this,dq,"m",fDt).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)ie(this,dq,"m",pDt).call(this,s,a);if(i.controller.signal?.aborted)throw new Is;return ie(this,dq,"m",mDt).call(this)}[(dse=new WeakMap,sM=new WeakMap,fse=new WeakMap,dq=new WeakSet,fDt=function(){this.ended||Xt(this,sM,void 0,"f")},pDt=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=ie(this,dq,"m",hDt).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 gt(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new gt(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new gt(`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 gt(`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}},mDt=function(){if(this.ended)throw new gt("stream has ended, this shouldn't happen");let r=ie(this,sM,"f");if(!r)throw new gt("request ended without sending any events");Xt(this,sM,void 0,"f");let n=Wen(r,ie(this,dse,"f"));return Xt(this,fse,n,"f"),n},hDt=function(r){let n=ie(this,sM,"f");if(!n){if(r.type!=="response.created")throw new gt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=Xt(this,sM,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 gt(`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 gt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new gt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new gt(`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 gt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{Xt(this,sM,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=ie(this,fse,"f");if(!e)throw new gt("stream ended without producing a ChatCompletion");return e}}});var fq,fDe=w(()=>{Cr();$a();Vi();fq=class extends Be{list(e,r={},n){return this._client.getAPIList(je`/responses/${e}/input_items`,hn,{query:r,...n})}}});var uM,pDe=w(()=>{cse();gDt();Cr();fDe();fDe();fu();Vi();uM=class extends Be{constructor(){super(...arguments),this.inputItems=new fq(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"&&lse(n),n))}retrieve(e,r={},n){return this._client.get(je`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&lse(o),o))}delete(e,r){return this._client.delete(je`/responses/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>dDe(n,e))}stream(e,r){return pse.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(je`/responses/${e}/cancel`,r)}};uM.InputItems=fq});var pq,mDe=w(()=>{Cr();WP();Vi();pq=class extends Be{create(e,r,n){return this._client.post(je`/uploads/${e}/parts`,xh({body:r,...n},this._client))}}});var lM,hDe=w(()=>{Cr();mDe();mDe();Vi();lM=class extends Be{constructor(){super(...arguments),this.parts=new pq(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(je`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(je`/uploads/${e}/complete`,{body:r,...n})}};lM.Parts=pq});var yDt,bDt=w(()=>{yDt=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 mq,gDe=w(()=>{Cr();$a();fu();BU();bDt();Vi();mq=class extends Be{create(e,r,n){return this._client.post(je`/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(je`/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(je`/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(je`/vector_stores/${o}/file_batches/${e}/files`,hn,{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 dC(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await yDt(d),await this.createAndPoll(e,{file_ids:l})}}});var hq,yDe=w(()=>{Cr();$a();fu();T9();Vi();hq=class extends Be{create(e,r,n){return this._client.post(je`/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(je`/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(je`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(je`/vector_stores/${e}/files`,hn,{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(je`/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 dC(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(je`/vector_stores/${o}/files/${e}/content`,mC,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var YP,bDe=w(()=>{Cr();gDe();gDe();yDe();yDe();$a();fu();Vi();YP=class extends Be{constructor(){super(...arguments),this.files=new hq(this._client),this.fileBatches=new mq(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(je`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(je`/vector_stores/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",hn,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(je`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(je`/vector_stores/${e}/search`,mC,{body:r,method:"post",...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};YP.Files=hq;YP.FileBatches=mq});var gq,_Dt,mse,GD,_De=w(()=>{Kg();Rb();Cr();fu();GD=class extends Be{constructor(){super(...arguments),gq.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");ie(this,gq,"m",_Dt).call(this,n);let i=mt([r]).values,a=ie(this,gq,"m",mse).call(this,i,"webhook-signature"),s=ie(this,gq,"m",mse).call(this,i,"webhook-timestamp"),u=ie(this,gq,"m",mse).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new lC("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new lC("Webhook timestamp is too old");if(l>c+o)throw new lC("Webhook timestamp is too new");let d=a.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=u?`${u}.${s}.${e}`:`${s}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let b=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,b,new TextEncoder().encode(p)))return}catch{continue}throw new lC("The given webhook signature does not match the expected signature")}};gq=new WeakSet,_Dt=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")},mse=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 vDt=w(()=>{Qjt();eDt();Aje();Ije();Uje();qje();Wje();Kje();Zje();Yje();iDe();sDe();uDe();lDe();cDe();pDe();hDe();bDe();_De()});var vDe,wDe,hse,wDt,_r,gse=w(()=>{Kg();DNe();HP();BU();jae();kNe();c9();vjt();Ajt();FNe();cC();$a();nje();vDt();Hae();Ije();qje();Kje();Yje();uDe();lDe();cDe();_De();Aje();Uje();Oje();Wje();Zje();iDe();sDe();pDe();hDe();bDe();kNe();fu();Fje();f9();HP();_r=class{constructor({baseURL:e=Nb("OPENAI_BASE_URL"),apiKey:r=Nb("OPENAI_API_KEY"),organization:n=Nb("OPENAI_ORG_ID")??null,project:o=Nb("OPENAI_PROJECT_ID")??null,webhookSecret:i=Nb("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(vDe.add(this),hse.set(this,void 0),this.completions=new FD(this),this.chat=new tM(this),this.embeddings=new $D(this),this.files=new BD(this),this.images=new VD(this),this.audio=new hC(this),this.moderations=new KD(this),this.models=new WD(this),this.fineTuning=new Db(this),this.graders=new aM(this),this.vectorStores=new YP(this),this.webhooks=new GD(this),this.beta=new yC(this),this.batches=new RD(this),this.uploads=new lM(this),this.responses=new uM(this),this.evals=new iM(this),this.containers=new oM(this),r===void 0)throw new gt("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&&hjt())throw new gt(`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??wDe.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=GNe(s.logLevel,"ClientOptions.logLevel",this)??GNe(Nb("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??yjt(),Xt(this,hse,_jt,"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 WNe(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${XI}`}defaultIdempotencyKey(){return`stainless-node-retry-${jNe()}`}makeStatusError(e,r,n,o){return Xl.generate(e,r,n,o)}buildURL(e,r,n){let o=!ie(this,vDe,"m",wDt).call(this)&&n||this.baseURL,i=ajt(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return ujt(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 TD(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(Zs(this).debug(`[${l}] sending request`,VP({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new Is;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(l9),m=Date.now();if(p instanceof Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Is;let y=u9(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Zs(this).info(`[${l}] connection ${y?"timed out":"failed"} - ${g}`),Zs(this).debug(`[${l}] connection ${y?"timed out":"failed"} (${g})`,VP({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw Zs(this).info(`[${l}] connection ${y?"timed out":"failed"} - error; no more retries left`),Zs(this).debug(`[${l}] connection ${y?"timed out":"failed"} (error; no more retries left)`,VP({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),y?new uC:new YI({cause:p})}let h=[...p.headers.entries()].filter(([g])=>g==="x-request-id").map(([g,y])=>", "+g+": "+JSON.stringify(y)).join(""),b=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let P=`retrying, ${r} attempts remaining`;return await bjt(p.body),Zs(this).info(`${b} - ${P}`),Zs(this).debug(`[${l}] response error (${P})`,VP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let y=g?"error; no more retries left":"error; not retryable";Zs(this).info(`${b} - ${y}`);let x=await p.text().catch(P=>l9(P).message),S=djt(x),O=S?void 0:x;throw Zs(this).debug(`[${l}] response error (${y})`,VP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:O,durationMs:Date.now()-d})),this.makeStatusError(p.status,S,O,p.headers)}return Zs(this).info(b),Zs(this).debug(`[${l}] response start`,VP({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new h9(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 dC(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&&cjt("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))}:{},...gjt(),"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:Dae(e)}:ie(this,hse,"f").call(this,{body:e,headers:n})}};wDe=_r,hse=new WeakMap,vDe=new WeakSet,wDt=function(){return this.baseURL!=="https://api.openai.com/v1"};_r.OpenAI=wDe;_r.DEFAULT_TIMEOUT=6e5;_r.OpenAIError=gt;_r.APIError=Xl;_r.APIConnectionError=YI;_r.APIConnectionTimeoutError=uC;_r.APIUserAbortError=Is;_r.NotFoundError=NU;_r.ConflictError=jU;_r.RateLimitError=LU;_r.BadRequestError=IU;_r.AuthenticationError=MU;_r.InternalServerError=FU;_r.PermissionDeniedError=RU;_r.UnprocessableEntityError=DU;_r.InvalidWebhookSignatureError=lC;_r.toFile=y9;_r.Completions=FD;_r.Chat=tM;_r.Embeddings=$D;_r.Files=BD;_r.Images=VD;_r.Audio=hC;_r.Moderations=KD;_r.Models=WD;_r.FineTuning=Db;_r.Graders=aM;_r.VectorStores=YP;_r.Webhooks=GD;_r.Beta=yC;_r.Batches=RD;_r.Uploads=lM;_r.Responses=uM;_r.Evals=iM;_r.Containers=oM});var JD,Xen,xDt,SDt=w(()=>{Rb();T9();gse();fu();JD=class extends _r{constructor({baseURL:e=Nb("OPENAI_BASE_URL"),apiKey:r=Nb("AZURE_OPENAI_API_KEY"),apiVersion:n=Nb("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new gt("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 gt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new gt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=xDt),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new gt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new gt("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(Xen.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!zU(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 gt(`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!==xDt)e.headers.values.set("api-key",this.apiKey);else throw new gt("Unable to handle auth");return super.prepareOptions(e)}},Xen=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]),xDt="<Missing Key>"});var bC=w(()=>{gse();nje();Hae();gse();$a();cC();SDt()});function bm(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=Yk(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Km([`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 _C(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 _m(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var xDe,wd,CDt=w(()=>{m$();hve();iA();oN();LO();xDe=class extends pN{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(Di(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=>bm(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}},wd=class extends xDe{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 gKe(this.zodSchema,e);if(r.success)return r.data;throw new Km(`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 ODt=w(()=>{CDt()});var yq=w(()=>{ODt()});var SDe=w(()=>{uN()});function XP(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 cM=w(()=>{});var EDt,PDt,TDt,yse=w(()=>{EDt=Symbol("Let zodToJsonSchema decide on which parser to use"),PDt={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"},TDt=t=>typeof t=="string"?{...PDt,basePath:["#"],definitions:{},name:t}:{...PDt,basePath:["#"],definitions:{},...t}});function ADt(t){if(!t)return!0;for(let e in t)return!1;return!0}var R9,CDe=w(()=>{R9=t=>"_def"in t?t._def:t});var IDt,ODe=w(()=>{yse();CDe();IDt=t=>{let e=TDt(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])=>[R9(o),{def:R9(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function PDe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function oo(t,e,r,n,o){t[e]=r,PDe(t,e,n,o)}var dM=w(()=>{});function MDt(){return{}}var EDe=w(()=>{});function RDt(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=vr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&oo(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&oo(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(oo(r,"minItems",t.exactLength.value,t.exactLength.message,e),oo(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var TDe=w(()=>{Qf();dM();pu()});function NDt(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?oo(r,"minimum",n.value,n.message,e):oo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),oo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?oo(r,"maximum",n.value,n.message,e):oo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),oo(r,"maximum",n.value,n.message,e));break;case"multipleOf":oo(r,"multipleOf",n.value,n.message,e);break}return r}var ADe=w(()=>{dM()});function jDt(){return{type:"boolean"}}var IDe=w(()=>{});function DDt(t,e){return vr(t.type._def,e)}var MDe=w(()=>{pu()});var LDt,RDe=w(()=>{pu();LDt=(t,e)=>vr(t.innerType._def,e)});function NDe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>NDe(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 Qen(t,e)}}var Qen,jDe=w(()=>{dM();Qen=(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":oo(r,"minimum",n.value,n.message,e);break;case"max":oo(r,"maximum",n.value,n.message,e);break}return r}});function FDt(t,e){return{...vr(t.innerType._def,e),default:t.defaultValue()}}var DDe=w(()=>{pu()});function kDt(t,e,r){return e.effectStrategy==="input"?vr(t.schema._def,e,r):{}}var LDe=w(()=>{pu()});function $Dt(t){return{type:"string",enum:[...t.values]}}var FDe=w(()=>{});function zDt(t,e){let r=[vr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),vr(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(etn(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 etn,kDe=w(()=>{pu();etn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function BDt(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 $De=w(()=>{});function bse(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?ttn(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":oo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":oo(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":Lb(r,"email",o.message,e);break;case"format:idn-email":Lb(r,"idn-email",o.message,e);break;case"pattern:zod":Fb(r,ZD.email,o.message,e);break}break;case"url":Lb(r,"uri",o.message,e);break;case"uuid":Lb(r,"uuid",o.message,e);break;case"regex":Fb(r,o.regex,o.message,e);break;case"cuid":Fb(r,ZD.cuid,o.message,e);break;case"cuid2":Fb(r,ZD.cuid2,o.message,e);break;case"startsWith":Fb(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Fb(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Lb(r,"date-time",o.message,e);break;case"date":Lb(r,"date",o.message,e);break;case"time":Lb(r,"time",o.message,e);break;case"duration":Lb(r,"duration",o.message,e);break;case"length":oo(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),oo(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Fb(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Lb(r,"ipv4",o.message,e),o.version!=="v4"&&Lb(r,"ipv6",o.message,e);break}case"emoji":Fb(r,ZD.emoji,o.message,e);break;case"ulid":{Fb(r,ZD.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Lb(r,"binary",o.message,e);break}case"contentEncoding:base64":{oo(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Fb(r,ZD.base64,o.message,e);break}}break}case"nanoid":Fb(r,ZD.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var zDe,ZD,ttn,Lb,Fb,UDt,_se=w(()=>{dM();ZD={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:()=>(zDe===void 0&&(zDe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zDe),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}$/};ttn=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Lb=(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}}})):oo(t,"format",e,r,n)},Fb=(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:UDt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):oo(t,"pattern",UDt(e,n),r,n)},UDt=(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 vse(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]:vr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:vr(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(bse(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 wse=w(()=>{Qf();pu();_se()});function qDt(t,e){if(e.mapStrategy==="record")return vse(t,e);let r=vr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=vr(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 BDe=w(()=>{pu();wse()});function HDt(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 UDe=w(()=>{});function VDt(){return{not:{}}}var qDe=w(()=>{});function WDt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var HDe=w(()=>{});function GDt(t,e){if(e.target==="openApi3")return KDt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in N9&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=N9[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 KDt(t,e)}var N9,KDt,xse=w(()=>{pu();N9={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};KDt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>vr(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 JDt(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:N9[t.innerType._def.typeName],nullable:!0}:{type:[N9[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=vr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=vr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var VDe=w(()=>{pu();xse()});function ZDt(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",PDe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?oo(r,"minimum",n.value,n.message,e):oo(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),oo(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?oo(r,"maximum",n.value,n.message,e):oo(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),oo(r,"maximum",n.value,n.message,e));break;case"multipleOf":oo(r,"multipleOf",n.value,n.message,e);break}return r}var WDe=w(()=>{dM()});function rtn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":vr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":vr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function YDt(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=vr(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:rtn(t,e)};return r.required.length||delete r.required,r}var KDe=w(()=>{pu()});var XDt,GDe=w(()=>{pu();XDt=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return vr(t.innerType._def,{...e,currentPath:e.currentPath});let r=vr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var QDt,JDe=w(()=>{pu();QDt=(t,e)=>{if(e.pipeStrategy==="input")return vr(t.in._def,e);if(e.pipeStrategy==="output")return vr(t.out._def,e);let r=vr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=vr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function eLt(t,e){return vr(t.type._def,e)}var ZDe=w(()=>{pu()});function tLt(t,e){let n={type:"array",uniqueItems:!0,items:vr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&oo(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&oo(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var YDe=w(()=>{dM();pu()});function rLt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>vr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:vr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>vr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var XDe=w(()=>{pu()});function nLt(){return{not:{}}}var QDe=w(()=>{});function oLt(){return{}}var eLe=w(()=>{});var iLt,tLe=w(()=>{pu();iLt=(t,e)=>vr(t.innerType._def,e)});function vr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==EDt)return a}if(n&&!r){let a=ntn(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=itn(t,t.typeName,e,r);return i&&atn(t,e,i),o.jsonSchema=i,i}var ntn,otn,itn,atn,pu=w(()=>{Qf();EDe();TDe();ADe();IDe();MDe();RDe();jDe();DDe();LDe();FDe();kDe();$De();BDe();UDe();qDe();HDe();VDe();WDe();KDe();GDe();JDe();ZDe();wse();YDe();_se();XDe();QDe();xse();eLe();tLe();yse();ntn=(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:otn(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}},otn=(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("/")},itn=(t,e,r,n)=>{switch(e){case re.ZodString:return bse(t,r);case re.ZodNumber:return ZDt(t,r);case re.ZodObject:return YDt(t,r);case re.ZodBigInt:return NDt(t,r);case re.ZodBoolean:return jDt();case re.ZodDate:return NDe(t,r);case re.ZodUndefined:return nLt();case re.ZodNull:return WDt(r);case re.ZodArray:return RDt(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return GDt(t,r);case re.ZodIntersection:return zDt(t,r);case re.ZodTuple:return rLt(t,r);case re.ZodRecord:return vse(t,r);case re.ZodLiteral:return BDt(t,r);case re.ZodEnum:return $Dt(t);case re.ZodNativeEnum:return HDt(t);case re.ZodNullable:return JDt(t,r);case re.ZodOptional:return XDt(t,r);case re.ZodMap:return qDt(t,r);case re.ZodSet:return tLt(t,r);case re.ZodLazy:return vr(t.getter()._def,r);case re.ZodPromise:return eLt(t,r);case re.ZodNaN:case re.ZodNever:return VDt();case re.ZodEffects:return kDt(t,r,n);case re.ZodAny:return MDt();case re.ZodUnknown:return oLt();case re.ZodDefault:return FDt(t,r);case re.ZodBranded:return DDt(t,r);case re.ZodReadonly:return iLt(t,r);case re.ZodCatch:return LDt(t,r);case re.ZodPipeline:return QDt(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},atn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var rLe,nLe=w(()=>{pu();ODe();CDe();rLe=(t,e)=>{let r=IDt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=vr(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(ADt(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]=vr(R9(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 aLt=w(()=>{yse();ODe();dM();pu();EDe();TDe();ADe();IDe();MDe();RDe();jDe();DDe();LDe();FDe();kDe();$De();BDe();UDe();qDe();HDe();VDe();WDe();KDe();GDe();JDe();ZDe();tLe();wse();YDe();_se();XDe();QDe();xse();eLe();nLe();nLe()});function stn(t,e){return rLe(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function sLt(t,e,r){return Bjt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:stn(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var uLt=w(()=>{HU();aLt();cse()});function j9(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}var lLt=w(()=>{});function fM(t){let e;return t.constructor.name===uC.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Is.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=j9(t,"INVALID_TOOL_RESULTS"):t.status===401?e=j9(t,"MODEL_AUTHENTICATION"):t.status===429?e=j9(t,"MODEL_RATE_LIMIT"):t.status===404?e=j9(t,"MODEL_NOT_FOUND"):e=t,e}function oLe(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 utn(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function cLt(t,e,r){if(Vm(t))return sLt(t,e,r);if(Vp(t))return utn({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:FH(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>oY(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}var YD=w(()=>{bC();_h();CD();SDe();aY();uLt();lLt()});function ltn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function dLt(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(fLt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
|
||
`)}function fLt(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}: ${Sse(o,e)},`):r.push(`${n}?: ${Sse(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
|
||
`)}function Sse(t,e){if(ltn(t))return t.anyOf.map(r=>Sse(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["{",fLt(t,e+2),"}"].join(`
|
||
`);case"array":return t.items?`${Sse(t.items,e)}[]`:"any[]";default:return""}}var pLt=w(()=>{});function mLt(t,e){let r;return Cc(t)?r=oC(t):r=t,r.type==="function"&&e?.strict!==void 0&&(r.function.strict=e.strict),r}function Cse(t){return"type"in t&&t.type!=="function"&&t.type!=="custom"}function hLt(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function gLt(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 iLe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function yLt(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 bLt(t){return t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function _Lt(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 vLt(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 wLt=w(()=>{_h();YD()});function Ese(t){return t&&(/^o\d/.test(t)||t.startsWith("gpt-5"))}function ctn(t){return t!==void 0&&typeof t.schema=="object"}function dtn(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 sLe(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(!ks.isInstance(t))throw new Error("Invalid generic chat message");return dtn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function aLe(t,e){return t.flatMap(r=>{let n=sLe(r);n==="system"&&Ese(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>Jy(a)?SH(a,xLt):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=""),Di(r)&&r.tool_calls?.length?(i.tool_calls=r.tool_calls.map(_C),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 bq,xLt,D9,Ose,Pse,vC,Tse=w(()=>{bC();As();Of();Kn();iC();bh();Jp();eb();yq();CD();SDe();cM();YD();pLt();wLt();bq="__openai_function_call_ids__";xLt={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=Xk({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=Qbe(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=Qbe(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(!Xk({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`)}};D9=class extends du{_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??ct("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??ct("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(!Ese(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&&Wm(e.json_schema.schema)?cLt(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=XP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new _r(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return gLt(e)?vLt(e.metadata.customTool):gd(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:mLt(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=>Cse(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(sLe(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=dLt(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;ctn(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"){Wm(n)?u=Xc.fromZodSchema(n):u=new Qc;let f=Wp(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:nA(n),schema:n,strict:r?.strict},p=Wp(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}}}),Wm(n)){let m=Xc.fromZodSchema(n);u=tp.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else u=new Qc}else{let f=o??"extract";if(Wm(n)){let p=Wp(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 wd({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n});let m=Wp(n);s=this.withConfig({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...m}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new wd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Eo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Eo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Pi.from([{raw:s},d])}},Ose=class extends D9{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:hLt(e?.tool_choice)?e?.tool_choice:(()=>{let i=oLe(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 fM(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(bm(l,{returnId:!0}))}catch(c){let d;typeof c=="object"&&c!=null&&"message"in c&&typeof c.message=="string"&&(d=c.message),i.push(_m(l,d))}s[bq]??(s[bq]={}),u.id&&(s[bq][u.call_id]=u.id)}else if(u.type==="reasoning")s.reasoning=u;else if(u.type==="custom_tool_call"){let l=yLt(u);l?o.push(l):i.push(_m(u,"Malformed custom tool call"))}else s.tool_outputs??(s.tool_outputs=[]),s.tool_outputs.push(u);return new En({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[bq]={[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 eo({text:r.map(l=>l.text).join(""),message:new yr({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=sLe(r);if(o==="system"&&Ese(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?.[bq];Di(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(c=>bLt(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}),Jy(s)?SH(s,xLt):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)Cse(o)?(o.type==="image_generation"&&r?.stream&&(o.partial_images=1),n.push(o)):gd(o)?n.push({type:"function",name:o.function.name,parameters:o.function.parameters,description:o.function.description,strict:r?.strict??null}):iLe(o)&&n.push(_Lt(o));return n}},Pse=class extends D9{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:oLe(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),Ese(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=aLe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this._getEstimatedTokenCountFromPrompt(e,c,d),p=await this._getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}),{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Di(b.message)&&(b.message.usage_metadata=o),b.message=new En(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async*_streamResponseChunks(e,r,n){let o=aLe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertCompletionsDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model,m.service_tier=l.service_tier),this.logprobs&&(m.logprobs=c.logprobs);let h=new eo({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new eo({message:new yr({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 fM(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(bm(u,{returnId:!0}))}catch(l){i.push(_m(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 En({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new ks(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 Yf({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 yr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new of({content:i,response_metadata:s}):o==="developer"?new of({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Um({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new sg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Zf({content:i,role:o,response_metadata:s})}},vC=class t extends D9{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 Ose(e),this.completions=e?.completions??new Pse(e)}_useResponsesApi(e){let r=e?.tools?.some(Cse),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(iLe);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 SLt(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function Ase(t){let e=ftn(()=>{if(SLt(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&SLt(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 ftn,Ise=w(()=>{ftn=t=>t()});var CLt=w(()=>{bC();Kn();Tse();cM();Ise()});var uLe=w(()=>{bC();bh();Of();Kn();bD();Wg();cM();YD()});var ELt=w(()=>{bC();Kn();uLe();cM();Ise()});var wC,lLe=w(()=>{bC();Kn();qP();Wg();cM();YD();wC=class extends gp{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??ct("OPENAI_API_KEY");this.organization=r?.configuration?.organization??ct("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=yp(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=XP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new _r(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw fM(n)}})}}});var Mse,TLt=w(()=>{bC();Kn();lLe();cM();YD();Ise();Mse=class extends wC{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??ct("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??ct("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??ct("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??ct("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(ct("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||ct("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=XP(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL;let a=Ase(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 JD({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 fM(n)}})}}});var ALt=w(()=>{});function Ch(t,e){let r=bY(e.schema),n=zH(e.schema);if(!e.schema||r||n)return new Nse({...e,description:e.description??(e.schema&&nA(e.schema))??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=Ka(u,{callbacks:s?.getChild()});Yc.runWithConfig(Up(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new cLe({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d=Ka(u,{callbacks:s?.getChild()});Yc.runWithConfig(Up(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})})}function ptn(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!z9e(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new MO({content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new MO({content:mtn(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function mtn(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var Rse,QP,Nse,cLe,ILt=w(()=>{J7();$H();QT();t9();j_();Qk();sN();qZ();LO();uN();gae();Rse=class extends CU{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=_n(r$(this.defaultConfig,r));return ZT(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=ZT(e)?e.args:e,i;if(Wm(this.schema))try{i=await f$(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
|
||
Details: ${m.message}`),new nN(h,JSON.stringify(e))}else{let m=da(o,this.schema);if(!m.valid){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
|
||
Details: ${m.errors.map(b=>`${b.keywordLocation}: ${b.error}`).join(`
|
||
`)}`),new nN(h,JSON.stringify(e))}i=o}let a=aN(r),u=await ru.configure(a.callbacks,this.callbacks,a.tags||n,this.tags,a.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName);delete a.runId;let l;try{l=await this._call(i,u,a)}catch(m){throw await u?.handleToolError(m),m}let c,d;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[c,d]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
|
||
Result: ${JSON.stringify(l)}`);else c=l;let f;ZT(e)&&(f=e.id),!f&&N9e(a)&&(f=a.toolCall.id);let p=ptn({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},QP=class extends Rse{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:rn.object({input:rn.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},Nse=class extends QP{static lc_name(){return"DynamicTool"}constructor(e){super(e),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,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,r){let n=aN(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,r,n){return this.func(e,r,n)}},cLe=class extends Rse{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),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,"func",{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.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,r,n){let o=aN(r);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,n)}_call(e,r,n){return this.func(e,r,n)}}});var eE=w(()=>{ILt()});var dLe,MLt=w(()=>{Kn();bC();eE();dLe=class extends QP{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??ct("OPENAI_API_KEY"),n=e?.organization??ct("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new _r(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(dLe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var RLt=w(()=>{MLt()});var NLt=w(()=>{Tse()});var jLt=w(()=>{sN()});var DLt=w(()=>{Jp();jLt();eE()});var LLt=w(()=>{bC();Tse();CLt();uLe();ELt();TLt();lLe();ALt();YD();cM();RLt();NLt();DLt()});var jse=w(()=>{LLt()});var Dse,FLt=w(()=>{qP();Wg();Kn();Dse=class extends gp{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||ct("JINA_API_KEY")||ct("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=yp(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 kLt=w(()=>{FLt()});var Lse,$Lt=w(()=>{kLt();Lse=class extends Dse{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var Fse,zLt=w(()=>{jse();Fse=class extends wC{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 kse,htn,mu,XD=w(()=>{Ur();CN();BA();er();Gg();on();fNe();_Ne();NNe();jse();kse=require("obsidian");$Lt();zLt();htn={"copilot-plus":Fse,"copilot-plus-jina":Lse,openai:wC,cohereai:wae,google:Tae,"azure openai":Mse,ollama:Nae,"lm-studio":wC,"3rd party (openai-format)":wC},mu=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ae().plusLicenseKey,"copilot-plus-jina":()=>ae().plusLicenseKey,openai:()=>ae().openAIApiKey,cohereai:()=>ae().cohereApiKey,google:()=>ae().googleApiKey,"azure openai":()=>ae().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),Ma(()=>this.initialize())}initialize(){let e=ae().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=htn[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(cA).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=Yr(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=Yr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ae();if(!t.modelMap.hasOwnProperty(e))throw new Hr(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ae().isPlusUser)throw new kse.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Hr("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Wi.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new kse.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Hr("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Hr(`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 Hr(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ae(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await po(r.plusLicenseKey),timeout:1e4,batchSize:ae().embeddingBatchSize,configuration:{baseURL:dA,fetch:e.enableCors?ou:void 0}},"copilot-plus-jina":{model:n,apiKey:await po(r.plusLicenseKey),timeout:1e4,batchSize:ae().embeddingBatchSize,dimensions:e.dimensions,baseUrl:dA+"/embeddings",configuration:{fetch:e.enableCors?ou:void 0}},openai:{modelName:n,apiKey:await po(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ae().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?ou:void 0}},cohereai:{model:n,apiKey:await po(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await po(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await po(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 po(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await po(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?ou:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await po(e.apiKey||""),batchSize:ae().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?ou: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 kse.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: `+ci(n)+`
|
||
with CORS Error: `+ci(o);throw new Error(i)}}}}});function qLt(t){return t!==void 0&&L9.includes(t)?BLt[t]:void 0}var BLt,ULt,L9,$se=w(()=>{BLt={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"},ULt={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},L9=Object.keys(BLt)});function Ki(t,e){if(e.length<fLe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=fLe)Array.prototype.push.apply(t,e.slice(n,n+fLe))}}function GLt(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 btn(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function _tn(){return typeof process<"u"&&process.release&&process.release.name==="node"}function KLt(){return BigInt(Math.floor(performance.now()*1e6))}function QD(t){return typeof t=="number"&&(t=BigInt(t)),t<HLt?`${t}ns`:t<VLt?`${t/HLt}\u03BCs`:t<WLt?`${t/VLt}ms`:`${t/WLt}s`}function kb(){return btn()?KLt():_tn()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?KLt():BigInt(0)}function F9(){return`${gtn}-${ytn++}`}function _q(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 JLt(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function vq(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 zse(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 wq(t,e){return zse(t,[e])[e]}function pLe(t,e){let r=vtn[e];if(r===void 0)throw new Error(Gt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function Bse(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 hu(t){return t?.constructor?.name==="AsyncFunction"}var gtn,ytn,HLt,VLt,WLt,fLe,vtn,Ys=w(()=>{Pc();gtn=Date.now().toString().slice(5),ytn=0,HLt=BigInt(1e3),VLt=BigInt(1e6),WLt=BigInt(1e9),fLe=65535;vtn={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Gt(t,...e){let r=new Error(GLt(xtn[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var wtn,xtn,Pc=w(()=>{$se();Ys();wtn=L9.join(`
|
||
- `),xtn={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:
|
||
- ${wtn}`,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 ZLt(t){return{raw:Number(t),formatted:QD(t)}}function YLt(t){if(t.id){if(typeof t.id!="string")throw Gt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return F9()}function mLe(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(tE(n)){let i=gLe(n);if(!Array.isArray(o)||o.length!==i)throw Gt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(xq(n)){if(!Array.isArray(o))return r;let i=hLe(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=mLe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function XLt(t){return t==="geopoint"}function tE(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function xq(t){return typeof t=="string"&&Stn[t]}function hLe(t){return Ctn[t]}function gLe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Gt("INVALID_VECTOR_VALUE",t);case e<=0:throw Gt("INVALID_VECTOR_SIZE",t);default:return e}}var Stn,Ctn,k9=w(()=>{Pc();Ys();Ys();Stn={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Ctn={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function QLt(){return{idToInternalId:new Map,internalIdToId:[],save:Otn,load:Ptn}}function Otn(t){return{internalIdToId:t.internalIdToId}}function Ptn(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 Ii(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?Ii(t,e.toString()):e}function Jg(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var Zg=w(()=>{});function Ttn(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Atn(t,e){let r=Ii(t.sharedInternalDocumentStore,e);return t.docs[r]}function Itn(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=Ii(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function Mtn(t){return t.docs}function Rtn(t,e,r){let n=Ii(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function Ntn(t,e){let r=Ii(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function jtn(t){return t.count}function Dtn(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function Ltn(t){return{docs:t.docs,count:t.count}}function eFt(){return{create:Ttn,get:Atn,getMultiple:Itn,getAll:Mtn,store:Rtn,remove:Ntn,count:jtn,load:Dtn,save:Ltn}}var yLe=w(()=>{Zg()});function rFt(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),Gt("PLUGIN_CRASHED")}return r}var tFt,nFt=w(()=>{Pc();tFt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function $b(t,e,r,n){if(t.some(hu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function eL(t,e,r){if(t.some(hu))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function Sq(t,e,r,n,o){if(t.some(hu))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function Cq(t,e,r,n){if(t.some(hu))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function iFt(t,e){if(t.some(hu))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var oFt,bLe,pM=w(()=>{Ys();oFt=["tokenizer","index","documentsStore","sorter"],bLe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function _Le(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(Yg(t.l),Yg(t.r))+1,e.h=Math.max(Yg(e.l),Yg(e.r))+1,e}function vLe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(Yg(t.l),Yg(t.r))+1,e.h=Math.max(Yg(e.l),Yg(e.r))+1,e}function sFt(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&Ki(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function wLe(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&&Ki(n,i.v),!r&&i.k>e&&Ki(n,i.v),o.push(i.r),o.push(i.l))}return n}function xLe(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&&Ki(n,i.v),!r&&i.k<e&&Ki(n,i.v),o.push(i.r),o.push(i.l))}return n}function uFt(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 lFt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function cFt(t,e,r,n=500){function o(i,a,s){if(i===null)return aFt++,{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 aFt%n===0?ktn(i,a):i}t.root=o(t.root,e,r)}function ktn(t,e){t.h=1+Math.max(Yg(t.l),Yg(t.r));let r=Yg(t.l)-Yg(t.r);return r>1&&e<t.l.k?vLe(t):r<-1&&e>t.r.k?_Le(t):r>1&&e>t.l.k?(t.l=_Le(t.l),vLe(t)):r<-1&&e<t.r.k?(t.r=vLe(t.r),_Le(t)):t}function Yg(t){return t!==null?t.h:-1}function dFt(t,e){let r=uFt(t.root,e);return r===null?null:r.v}function $tn(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 fFt(t,e,r){let n=uFt(t.root,r);if(n){if(n.v.length===1){$tn(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var aFt,pFt=w(()=>{Ys();aFt=0});function mFt(){return{numberToDocumentId:new Map}}function hFt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function gFt(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 yFt(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&&Ki(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&&Ki(i,u)}return i}}throw new Error("Invalid operation")}function bFt(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 vq(i)}}throw new Error("Invalid operation")}var _Ft=w(()=>{Ys()});function ztn(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 SLe(t,e,r){let n=ztn(t,e,r);return{distance:n,isBounded:n>=0}}var CLe=w(()=>{});function Oq(t,e){t.w=e.w+t.s}function Use(t,e){t.d.push(e)}function Btn(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function PLe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(_q(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&SLe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),_q(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))PLe(t.c[i],e,r,n,o);return e}function vFt(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 tL(t=!1,e="",r=""){return new OLe(r,e,t)}function wFt(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=vFt(u,a),d=c.length;if(u===a){Use(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=tL(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,Oq(p,t),Oq(m,p),Use(p,r);return}if(d<l&&d<a.length){let p=tL(!1,c,i);p.c[f]=s,t.c[i]=p;let m=p.c[f];m.s=u.substring(d),m.k=f;let h=a[d],b=tL(!0,e.substring(o+d),h);Use(b,r),p.c[h]=b,Oq(p,t),Oq(b,p),Oq(m,p);return}o+=l-1,t=s}else{let u=tL(!0,a,i);Use(u,r),t.c[i]=u,Oq(u,t);return}}}function $9(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){PLe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(SLe(e,a,o).isBounded&&(i[a]=[]),_q(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&&$9(t.c[e[r]],e,r+1,n,o,i),$9(t,e,r+1,n-1,o,i);for(let a in t.c)$9(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&$9(t.c[a],e,r+1,n-1,o,i)}}}function ELe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,$9(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=vFt(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 PLe(t,i,e,r,n),i}}function xFt(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||Btn(t,r)}else return!1}return!0}var OLe,SFt=w(()=>{CLe();Ys();OLe=class{constructor(e,r,n){Kc(this,"k");Kc(this,"s");Kc(this,"c",{});Kc(this,"d",[]);Kc(this,"e");Kc(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 CFt(){return{root:null}}function OFt(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 PFt(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 EFt(t,e,r,n=!0,o="asc",i=!1){let a=i?IFt:AFt,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 TFt(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=qtn(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=Utn(e);if(n){let u=o?IFt:AFt;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 Utn(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 qtn(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 AFt(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 IFt(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,b,g=1e3,y,x,S,O,E;do{let j=Math.sin(h),$=Math.cos(h);S=Math.sqrt(m*j*(m*j)+(f*p-d*m*$)*(f*p-d*m*$)),O=d*p+f*m*$,E=Math.atan2(S,O),y=f*m*j/S,x=1-y*y;let k=O-2*d*p/x,H=n/16*x*(4+n*(4-3*x));b=h,h=u+(1-H)*n*y*(E+H*S*(k+H*O*(-1+2*k*k)))}while(Math.abs(h-b)>1e-12&&--g>0);let P=x*(6378137*6378137-o*o)/(o*o),A=1+P/16384*(4096+P*(-768+P*(320-175*P))),I=P/1024*(256+P*(-128+P*(74-47*P))),R=I*S*(O-2*d*p/x+I/4*(O*(-1+2*S*S)-I/6*E*(-3+4*S*S)*(-3+4*E*E)));return o*A*(E-R)}var MFt=w(()=>{});function qse(t,e,r=0,n){if(e===0)throw Gt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let b=t[h],g=b.length;for(let y=0;y<g;y++){let[x,S]=b[y],O=S*e,E=o.get(x)?.[0];E!==void 0?o.set(x,[E*1.5+O,(o?.get(x)?.[1]||0)+1]):o.set(x,[O,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,b)=>b[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,b)=>h[2]>b[2]?-1:h[2]<b[2]?1:h[1]>b[1]?-1:h[1]<b[1]?1:0),d;for(let h=0;h<u&&c[h][2]===n;h++)d=h;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h<f;h++)p[h]=[c[h][0],c[h][1]];if(r===0)return p.slice(0,d+1);let m=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+m)}function TLe(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 z9=w(()=>{Pc()});function ALe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function Hse(t,e,r,n=.8){let o=ALe(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 Vse=w(()=>{});function Htn(t,e,r,n,o){let i=Ii(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 Vtn(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=Ii(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 Wtn(t,e,r,n){let o=Ii(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 Ktn(t,e,r){t.tokenOccurrences[e][r]--}function Gtn(t,e,r,n,o){let i=Array.from(o),a=e.avgFieldLength[r],s=e.fieldLengths[r],u=e.tokenOccurrences[r],l=e.frequencies[r],c=typeof u[n]=="number"?u[n]??0:0,d=[],f=i.length;for(let p=0;p<f;p++){let m=Ii(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,b=TLe(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,b])}return d}function NFt(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)){NFt(t,e,a,n,s);continue}if(tE(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:gLe(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:lFt(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:tL(),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:mFt(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:CFt(),isArray:u};break;default:throw Gt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function Jtn(t,e,r,n,o,i,a,s){return u=>{let l=Ii(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;cFt(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),wFt(d,p,l);break}case"Flat":{hFt(d,u,l);break}case"BKD":{OFt(d,u,[l]);break}}}}function Ztn(t,e,r,n,o,i,a,s,u,l){if(tE(i))return Ytn(e,r,o,n);let c=Jtn(t,e,r,n,a,s,u,l);if(!xq(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function Ytn(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=ALe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function RFt(t,e,r,n,o,i,a,s,u){let l=Ii(e.sharedInternalDocumentStore,n);if(tE(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return fFt(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),xFt(d,p,l);return!0}case"Flat":return gFt(d,l,o),!0;case"BKD":return PFt(d,o,l),!1}}function Xtn(t,e,r,n,o,i,a,s,u){if(!xq(i))return RFt(t,e,r,n,o,i,a,s,u);let l=hLe(i),c=o,d=c.length;for(let f=0;f<d;f++)RFt(t,e,r,n,c[f],l,a,s,u);return!0}function Qtn(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Gt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=ELe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(_q(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function ern(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 Gt("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];Ki(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:b=!1}=a[d],g=pLe(f,m),y=EFt(s.root,p,g,h,void 0,b);Ki(o[i],y.flatMap(({docIDs:x})=>x))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=TFt(s.root,f,p,void 0,m);Ki(o[i],h.flatMap(({docIDs:b})=>b))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=ELe(s,{term:p,exact:!0});Ki(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Gt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?bFt:yFt;Ki(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=wLe(s,f,!1);break}case"gte":{p=wLe(s,f,!0);break}case"lt":{p=xLe(s,f,!1);break}case"lte":{p=xLe(s,f,!0);break}case"eq":{p=dFt(s,f)??[];break}case"between":{let[m,h]=f;p=sFt(s,m,h);break}}Ki(o[i],p)}}return vq(Object.values(o))}function trn(t){return t.searchableProperties}function rrn(t){return t.searchablePropertiesWithTypes}function jFt(t){let e=tL(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]=jFt(t.c[r]);return e}function nrn(t){return{numberToDocumentId:new Map(t)}}function orn(t){return Array.from(t.numberToDocumentId.entries())}function irn(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:m,isArray:h}=r[f];switch(m){case"Radix":c[f]={type:"Radix",node:jFt(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:nrn(p),isArray:h};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function arn(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:orn(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function DFt(){return{create:NFt,insert:Ztn,remove:Xtn,insertDocumentScoreParameters:Htn,insertTokenScoreParameters:Vtn,removeDocumentScoreParameters:Wtn,removeTokenScoreParameters:Ktn,calculateResultScores:Gtn,search:Qtn,searchByWhereClause:ern,getSearchableProperties:trn,getSearchablePropertiesWithTypes:rrn,load:irn,save:arn}}var ILe=w(()=>{Pc();pFt();_Ft();SFt();MFt();Ys();z9();Vse();k9();Zg()});function LFt(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=LFt(t,e,s,n,u);Ki(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!tE(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 Gt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function urn(t,e,r,n){return n?.enabled!==!1?LFt(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function lrn(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=Ii(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&MLe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function FFt(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)prn(t,r);t.isSorted=!0}function crn(t,e,r){return e[1].localeCompare(r[1],qLt(t))}function drn(t,e){return t[1]-e[1]}function frn(t,e){return e[1]?-1:1}function prn(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=crn.bind(null,t.language);break;case"number":n=drn.bind(null);break;case"boolean":n=frn.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 mrn(t){let e=Object.keys(t.sorts);for(let r of e)MLe(t,r)}function MLe(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 hrn(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=Ii(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function grn(t,e,r){if(!t.enabled)throw Gt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Gt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return MLe(t,n),FFt(t),e.sort((a,s)=>{let u=i.docs.get(Ii(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(Ii(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 yrn(t){return t.enabled?t.sortableProperties:[]}function brn(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function _rn(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 vrn(t){if(!t.enabled)return{enabled:!1};mrn(t),FFt(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 kFt(){return{create:urn,insert:lrn,remove:hrn,save:vrn,load:_rn,sortBy:grn,getSortableProperties:yrn,getSortablePropertiesWithTypes:brn}}var RLe=w(()=>{Pc();k9();Zg();Ys();$se()});function Srn(t){return t<192||t>383?t:xrn[t-192]||t}function $Ft(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Srn(t.charCodeAt(r));return String.fromCharCode(...e)}var xrn,zFt=w(()=>{xrn=[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 UFt(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(NLe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(BFt),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+xC+Kse+"[^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(BFt),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(NLe),e&&n.test(e)&&(t=e+Crn[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(NLe),e&&n.test(e)&&(t=e+Orn[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(Wse),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(Wse),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(Wse),o=new RegExp(Ern),i=new RegExp("^"+xC+Kse+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(Wse),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var Crn,Orn,Prn,Kse,xC,B9,NLe,Ern,Wse,BFt,qFt=w(()=>{Crn={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"},Orn={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Prn="[^aeiou]",Kse="[aeiouy]",xC=Prn+"[^aeiouy]*",B9=Kse+"[aeiou]*",NLe="^("+xC+")?"+B9+xC,Ern="^("+xC+")?"+B9+xC+"("+B9+")?$",Wse="^("+xC+")?"+B9+xC+B9+xC,BFt="^("+xC+")?"+Kse});function jLe(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=$Ft(e),this.normalizationCache.set(r,e),e)}function Trn(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function HFt(t,e,r){if(e&&e!==this.language)throw Gt("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=ULt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Trn(n);return this.allowDuplicates?o:Array.from(new Set(o))}function DLe(t={}){if(!t.language)t.language="english";else if(!L9.includes(t.language))throw Gt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Gt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=UFt;else throw Gt("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 Gt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Gt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Gt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:HFt,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:jLe,normalizationCache:new Map};return n.tokenize=HFt.bind(n),n.normalizeToken=jLe,n}var Gse=w(()=>{Pc();zFt();$se();qFt()});function Irn(t){let e={formatElapsedTime:ZLt,getDocumentIndexId:YLt,getDocumentProperties:zse,validateSchema:mLe};for(let r of bLe){let n=r;if(t[n]){if(typeof t[n]!="function")throw Gt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!oFt.includes(r)&&!bLe.includes(r))throw Gt("UNSUPPORTED_COMPONENT",r)}function Pq({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=F9());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=DLe(a):a=DLe({language:r??"english"}),n.tokenizer&&r)throw Gt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=QLt();s||(s=DFt()),l||(l=kFt()),u||(u=eFt()),Irn(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=n,h={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:m,id:o,plugins:i,version:Mrn()};h.data={index:h.index.create(h,c,t),docs:h.documentsStore.create(h,c),sorting:h.sorter.create(h,c,t,e)};for(let g of tFt)h[g]=(h[g]??[]).concat(rFt(h,g));let b=h.afterCreate;return b&&iFt(b,h),h}function Mrn(){return"{{VERSION}}"}var VFt=w(()=>{k9();yLe();nFt();pM();ILe();Zg();RLe();Gse();Pc();Ys()});var WFt=w(()=>{});var LLe=w(()=>{k9();yLe();ILe();Gse();RLe();Zg()});var Jse,FLe,kLe,$Le=w(()=>{Jse="fulltext",FLe="hybrid",kLe="vector"});var mM,hM,zLe=w(()=>{$Le();mM=Symbol("orama.insertions"),hM=Symbol("orama.removals")});function BLe(t){typeof t[mM]!="number"&&(queueMicrotask(()=>{t[mM]=void 0}),t[mM]=0),t[mM]>1e3?(KFt("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[mM]=-1):t[mM]>=0&&t[mM]++}function ULe(t){typeof t[hM]!="number"&&(queueMicrotask(()=>{t[hM]=void 0}),t[hM]=0),t[hM]>1e3?(KFt("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[hM]=-1):t[hM]>=0&&t[hM]++}var KFt,qLe=w(()=>{zLe();KFt=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function U9(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Gt("SCHEMA_VALIDATION_FAILURE",i);return hu(t.index.beforeInsert)||hu(t.index.insert)||hu(t.index.afterInsert)?Drn(t,e,r,n,o):Lrn(t,e,r,n,o)}async function Drn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Gt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Gt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await $b(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];GFt(m,h,f,p)}return await Frn(t,s,l,d,u,r,e,o),n||await $b(t.afterInsert,t,s,e),BLe(t),s}function Lrn(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Gt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Gt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||$b(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];GFt(m,h,f,p)}return krn(t,s,l,d,u,r,e,o),n||$b(t.afterInsert,t,s,e),BLe(t),s}function GFt(t,e,r,n){if(!(XLt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(tE(e)&&Array.isArray(n))&&!(xq(e)&&Array.isArray(n))&&!(Nrn.has(e)&&jrn.has(t))&&t!==e)throw Gt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function Frn(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 krn(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 Nrn,jrn,HLe=w(()=>{LLe();Ys();pM();qLe();Pc();Nrn=new Set(["enum","enum[]"]),jrn=new Set(["string","number"])});function rL(t,e,r,n){return hu(t.index.beforeRemove)||hu(t.index.remove)||hu(t.index.afterRemove)?$rn(t,e,r,n):zrn(t,e,r,n)}async function $rn(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=Jg(t.internalDocumentIDStore,Ii(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await $b(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await $b(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),ULe(t),o}function zrn(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=Jg(t.internalDocumentIDStore,Ii(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||$b(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||$b(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),ULe(t),o}function q9(t,e,r,n,o){return hu(t.index.beforeRemove)||hu(t.index.remove)||hu(t.index.afterRemove)||hu(t.beforeRemoveMultiple)||hu(t.afterRemoveMultiple)?Brn(t,e,r,n,o):Urn(t,e,r,n,o)}async function Brn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>Jg(t.internalDocumentIDStore,Ii(t.internalDocumentIDStore,s)));return o||await eL(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 rL(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await eL(t.afterRemoveMultiple,t,a),i}function Urn(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>Jg(t.internalDocumentIDStore,Ii(t.internalDocumentIDStore,l)));o||eL(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)rL(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||eL(t.afterRemoveMultiple,t,a),i}var VLe=w(()=>{pM();Zg();qLe();Ys()});function qrn(t,e){return t[1]-e[1]}function Hrn(t,e){return e[1]-t[1]}function Vrn(t="desc"){return t.toLowerCase()==="asc"?qrn:Hrn}function Eq(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let m=0;m<f;m++){let h=d[m];p[m]=[`${h.from}-${h.to}`,0]}c=Object.fromEntries(p)}n[l]={count:0,values:c??{}}}let u=i.length;for(let l=0;l<u;l++){let c=i[l];for(let d of a){let f=d.includes(".")?wq(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;JFt(h,m)(f);break}case"number[]":{let h=new Set,b=r[d].ranges,g=JFt(b,m,h);for(let y of f)g(y);break}case"boolean":case"enum":case"string":{ZFt(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=ZFt(m,p==="boolean[]"?"boolean":"string",new Set);for(let y of f)g(y);break}default:throw Gt("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=Vrn(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function JFt(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 ZFt(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 Zse=w(()=>{Pc();Ys()});function Tq(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 Yse=w(()=>{});function Aq(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let g=0;g<o;g++){let y=n[g];if(typeof i[y]>"u")throw Gt("UNKNOWN_GROUP_BY_PROPERTY",y);if(!YFt.includes(i[y]))throw Gt("INVALID_GROUP_BY_PROPERTY",y,YFt.join(", "),i[y])}let a=e.map(([g])=>Jg(t.internalDocumentIDStore,g)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g<o;g++){let y=n[g],x={property:y,perValue:{}},S=new Set;for(let O=0;O<u;O++){let E=s[O],P=wq(E,y);if(typeof P>"u")continue;let A=typeof P!="boolean"?P:""+P,I=x.perValue[A]??{indexes:[],count:0};I.count>=l||(I.indexes.push(O),I.count++,x.perValue[A]=I,S.add(P))}c.push(Array.from(S)),d[y]=x}let f=XFt(c),p=f.length,m=[];for(let g=0;g<p;g++){let y=f[g],x=y.length,S={values:[],indexes:[]},O=[];for(let E=0;E<x;E++){let P=y[E],A=n[E];O.push(d[A].perValue[typeof P!="boolean"?P:""+P].indexes),S.values.push(P)}S.indexes=vq(O).sort((E,P)=>E-P),S.indexes.length!==0&&m.push(S)}let h=m.length,b=Array.from({length:h});for(let g=0;g<h;g++){let y=m[g],x=r.reduce||Wrn,S=y.indexes.map(A=>({id:a[A],score:e[A][1],document:s[A]})),O=x.reducer.bind(null,y.values),E=x.getInitialValue(y.indexes.length),P=S.reduce(O,E);b[g]={values:y.values,result:P}}return b}function XFt(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=XFt(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];Ki(s,a),o.push(s)}return o}var Wrn,YFt,Xse=w(()=>{Pc();Ys();Zg();Wrn={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},YFt=["string","number","boolean"]});function QFt(t,e,r){let n=kb(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(Qse,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,b=e.preflight===!0,{index:g,docs:y}=t.data,x=t.tokenizer.tokenize(d??"",r),S=t.caches.propertiesToSearch;if(!S){let j=t.index.getSearchablePropertiesWithTypes(g);S=t.index.getSearchableProperties(g),S=S.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=S}if(f&&f!=="*"){for(let j of f)if(!S.includes(j))throw Gt("UNKNOWN_INDEX",j,S.join(", "));S=S.filter(j=>f.includes(j))}let O=nL(t.tokenizer,t.index,t.documentsStore,r,e,S,x,t.documentsStore.count(y),n),E=Object.keys(e.where??{}).length>0,P=[];E&&(P=t.index.searchByWhereClause(O,g,e.where));let A=x.length;if(A||f?.length){let j=S.length;for(let $=0;$<j;$++){let k=S[$],H=O.indexMap[k];if(A!==0)for(let D=0;D<A;D++){let z=x[D],B=t.index.search(O,g,k,z);Ki(H[z],B)}else{H[""]=[];let D=t.index.search(O,g,k,"");Ki(H[""],D)}let V=Object.values(H);O.docsIntersection[k]=qse(V,e?.boost?.[k]??1,p,A);let Q=O.docsIntersection[k],Z=Q.length;for(let D=0;D<Z;D++){let[z,B]=Q[D],K=O.uniqueDocsIDs[z];K?O.uniqueDocsIDs[z]=K+B+.5:O.uniqueDocsIDs[z]=B}}}else x.length===0&&d?O.uniqueDocsIDs={}:O.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(j=>[j,0]));let I=Object.entries(O.uniqueDocsIDs).map(([j,$])=>[+j,$]);if(E&&(I=Tq(P,I)),e.sortBy)if(typeof e.sortBy=="function"){let j=I.map(([H])=>H),k=t.documentsStore.getMultiple(t.data.docs,j).map((H,V)=>[I[V][0],I[V][1],H]);k.sort(e.sortBy),I=k.map(([H,V])=>[H,V])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([j,$])=>[Ii(t.internalDocumentIDStore,j),$]);else I=I.sort(JLt);let R;b||(R=m?tkt(t,I,c,l,m):eue(t,I,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof R<"u"&&(N.hits=R.filter(Boolean),h||Bse(N,s)),u){let j=Eq(t,I,e.facets);N.facets=j}return e.groupBy&&(N.groups=Aq(t,I,e.groupBy)),N.elapsed=t.formatElapsedTime(kb()-O.timeStart),N}async function a(){t.beforeSearch&&await Cq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Sq(t.afterSearch,t,e,r,s),s}return o?a():i()}var ekt=w(()=>{z9();Zse();Yse();Xse();pM();Zg();Pc();Ys();oL()});function WLe(t,e,r="english"){let n=kb(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Gt("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:b,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Gt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Gt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let y=Hse(s.value,p,f,e.similarity).map(([j,$])=>[Ii(t.internalDocumentIDStore,j),$]),x=t.caches.propertiesToSearch;if(!x){let j=t.index.getSearchablePropertiesWithTypes(b);x=t.index.getSearchableProperties(b),x=x.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=x}let S=[],O=nL(t.tokenizer,t.index,t.documentsStore,r,e,x,S,t.documentsStore.count(g),n),E=[];h&&(E=t.index.searchByWhereClause(O,b,e.where),y=Tq(E,y));let P=[];m&&(P=Eq(t,y,e.facets));let A=Array.from({length:u});for(let j=0;j<u;j++){let $=y[j+l];if(!$)break;let k=t.data.docs.docs[$[0]];if(k){c||(k[s.property]=null);let H={id:Jg(t.internalDocumentIDStore,$[0]),score:$[1],document:k};A[j]=H}}let I=[];e.groupBy&&(I=Aq(t,y,e.groupBy));let N=kb()-n;return{count:y.length,hits:A.filter(Boolean),elapsed:{raw:Number(N),formatted:QD(N)},...P?{facets:P}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await Cq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Sq(t.afterSearch,t,e,r,s),s}return o?a():i()}var KLe=w(()=>{oL();Ys();Zse();Pc();Vse();Yse();Xse();Zg();pM()});function nkt(t,e,r){let n=kb(),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=Krn(t,e,r),f=Grn(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,b=Zrn(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),y=t.caches.propertiesToSearch;if(!y){let N=t.index.getSearchablePropertiesWithTypes(p);y=t.index.getSearchableProperties(p),y=y.filter(j=>N[j].startsWith("string")),t.caches.propertiesToSearch=y}if(e.properties&&e.properties!=="*"){for(let N of e.properties)if(!y.includes(N))throw Gt("UNKNOWN_INDEX",N,y.join(", "));y=y.filter(N=>e.properties.includes(N))}let x=nL(t.tokenizer,t.index,t.documentsStore,r,e,y,g,t.documentsStore.count(m),n),S=Object.keys(e.where??{}).length>0,O=[];S&&(O=t.index.searchByWhereClause(x,p,e.where),b=Tq(O,b));let E;c&&(E=Eq(t,b,e.facets));let P;e.groupBy&&(P=Aq(t,b,e.groupBy));let A=eue(t,b,s,u).filter(Boolean),I=kb(),R={count:b.length,elapsed:{raw:Number(I-n),formatted:QD(I-n)},hits:A,...E?{facets:E}:{},...P?{groups:P}:{}};if(!l){let N=Object.keys(t.data.index.vectorIndexes);Bse(R,N)}return R}async function a(){t.beforeSearch&&await Cq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await Sq(t.afterSearch,t,e,r,s),s}return o?a():i()}function Krn(t,e,r){let n=kb();e.relevance=Object.assign(Qse,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let b of i)if(!m.has(b))throw Gt("UNKNOWN_INDEX",b,c.join(", "));c=c.filter(b=>h.has(b))}let d=nL(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h<m;h++){let b=c[h];if(f!==0)for(let O=0;O<f;O++){let E=l[O],P=t.index.search(d,s,b,E);Ki(d.indexMap[b][E],P)}else{let O=[];d.indexMap[b][""]=O;let E=t.index.search(d,s,b,"");Ki(O,E)}let g=d.indexMap[b],y=Object.values(g);d.docsIntersection[b]=qse(y,e?.boost?.[b]??1,a,f);let x=d.docsIntersection[b],S=x.length;for(let O=0;O<S;O++){let[E,P]=x[O],A=d.uniqueDocsIDs[E];d.uniqueDocsIDs[E]=A?A+P+.5:P}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(m=>[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return okt(p)}function Grn(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 Gt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Gt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Hse(r.value,i,o,e.similarity).map(([s,u])=>[Ii(t.internalDocumentIDStore,s),u]);return okt(a)}function GLe([,t]){return t}function okt(t){let e=Math.max.apply(Math,t.map(GLe));return t.map(([r,n])=>[r,n/e])}function rkt(t,e){return t/e}function Jrn(t,e){return(r,n)=>r*t+n*e}function Zrn(t,e,r,n){let o=Math.max.apply(Math,t.map(GLe)),i=Math.max.apply(Math,e.map(GLe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:Yrn(r),l=new Map,c=t.length,d=Jrn(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],b=rkt(h,o),g=d(b,0);l.set(m,g)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],b=rkt(h,i),g=l.get(m)??0;l.set(m,g+d(0,b))}return[...l].sort((p,m)=>m[1]-p[1])}function Yrn(t){return{text:.5,vector:.5}}var ikt=w(()=>{Ys();Yse();z9();Pc();oL();Zse();Xse();Vse();Zg();oL();pM()});function nL(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 xd(t,e,r){let n=e.mode??Jse;if(n===Jse)return QFt(t,e,r);if(n===kLe)return WLe(t,e);if(n===FLe)return nkt(t,e);throw Gt("INVALID_SEARCH_MODE",n)}function tkt(t,e,r,n,o){let i=t.data.docs,a=new Map,s=[],u=new Set,l=e.length,c=0;for(let d=0;d<l;d++){let f=e[d];if(typeof f>"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),b=wq(h,o);if(!(typeof b>"u"||a.has(b))&&(a.set(b,!0),c++,!(c<=r)&&(s.push({id:Jg(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function eue(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:Jg(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var Qse,oL=w(()=>{Zg();Pc();Ys();$Le();ekt();KLe();ikt();Qse={k:1.2,b:.75,d:.5}});function tue(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 JLe(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 akt=w(()=>{});var skt=w(()=>{pM();Pc();HLe();VLe();Ys()});var ukt=w(()=>{Pc();oL()});var lkt=w(()=>{CLe();Ys();z9();Gse()});var H9=w(()=>{VFt();WFt();HLe();VLe();oL();KLe();akt();skt();ukt();zLe();LLe();lkt()});function tnn(t,e){let r=ckt(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function ckt(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var k7o,$7o,Qrn,enn,ZLe,rnn,rue,dkt=w(()=>{k7o=new Error("timeout while waiting for mutex to become available"),$7o=new Error("mutex already locked"),Qrn=new Error("request for lock canceled"),enn=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())})},ZLe=class{constructor(e,r=Qrn){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=ckt(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return enn(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]=[]),tnn(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}};rnn=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())})},rue=class{constructor(e){this._semaphore=new ZLe(1,e)}acquire(){return rnn(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 fkt=v(()=>{});var Gn=v((nue,pkt)=>{(function(t,e){typeof nue=="object"?pkt.exports=nue=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(nue,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=fkt()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(y){var x;return g.prototype=y,x=new g,g.prototype=null,x}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var y=i(this);return g&&y.mixIn(g),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments)}),y.init.prototype=y,y.$super=this,y},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var y in g)g.hasOwnProperty(y)&&(this[y]=g[y]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,y){g=this.words=g||[],y!=r?this.sigBytes=y:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var y=this.words,x=g.words,S=this.sigBytes,O=g.sigBytes;if(this.clamp(),S%4)for(var E=0;E<O;E++){var P=x[E>>>2]>>>24-E%4*8&255;y[S+E>>>2]|=P<<24-(S+E)%4*8}else for(var A=0;A<O;A+=4)y[S+A>>>2]=x[A>>>2];return this.sigBytes+=O,this},clamp:function(){var g=this.words,y=this.sigBytes;g[y>>>2]&=4294967295<<32-y%4*8,g.length=e.ceil(y/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var y=[],x=0;x<g;x+=4)y.push(o());return new l.init(y,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var y=g.words,x=g.sigBytes,S=[],O=0;O<x;O++){var E=y[O>>>2]>>>24-O%4*8&255;S.push((E>>>4).toString(16)),S.push((E&15).toString(16))}return S.join("")},parse:function(g){for(var y=g.length,x=[],S=0;S<y;S+=2)x[S>>>3]|=parseInt(g.substr(S,2),16)<<24-S%8*4;return new l.init(x,y/2)}},f=c.Latin1={stringify:function(g){for(var y=g.words,x=g.sigBytes,S=[],O=0;O<x;O++){var E=y[O>>>2]>>>24-O%4*8&255;S.push(String.fromCharCode(E))}return S.join("")},parse:function(g){for(var y=g.length,x=[],S=0;S<y;S++)x[S>>>2]|=(g.charCodeAt(S)&255)<<24-S%4*8;return new l.init(x,y)}},p=c.Utf8={stringify:function(g){try{return decodeURIComponent(escape(f.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return f.parse(unescape(encodeURIComponent(g)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var y,x=this._data,S=x.words,O=x.sigBytes,E=this.blockSize,P=E*4,A=O/P;g?A=e.ceil(A):A=e.max((A|0)-this._minBufferSize,0);var I=A*E,R=e.min(I*4,O);if(I){for(var N=0;N<I;N+=E)this._doProcessBlock(S,N);y=S.splice(0,I),x.sigBytes-=R}return new l.init(y,R)},clone:function(){var g=u.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0}),h=s.Hasher=m.extend({cfg:u.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var y=this._doFinalize();return y},blockSize:512/32,_createHelper:function(g){return function(y,x){return new g.init(x).finalize(y)}},_createHmacHelper:function(g){return function(y,x){return new b.HMAC.init(g,x).finalize(y)}}}),b=a.algo={};return a}(Math);return t})});var V9=v((oue,mkt)=>{(function(t,e){typeof oue=="object"?mkt.exports=oue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(oue,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 gkt=v((iue,hkt)=>{(function(t,e){typeof iue=="object"?hkt.exports=iue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(iue,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 bkt=v((aue,ykt)=>{(function(t,e){typeof aue=="object"?ykt.exports=aue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(aue,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 gM=v((sue,_kt)=>{(function(t,e){typeof sue=="object"?_kt.exports=sue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(sue,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,b=p<<16|m<<8|h,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(b>>>6*(3-g)&63));var y=c.charAt(64);if(y)for(;d.length%4;)d.push(y);return d.join("")},parse:function(s){var u=s.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var d=0;d<l.length;d++)c[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=s.indexOf(f);p!==-1&&(u=p)}return a(s,u,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var wkt=v((uue,vkt)=>{(function(t,e){typeof uue=="object"?vkt.exports=uue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(uue,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var m=l[p>>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,b=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|b,y=0;y<4&&p+y*.75<c;y++)f.push(d.charAt(g>>>6*(3-y)&63));var x=d.charAt(64);if(x)for(;f.length%4;)f.push(x);return f.join("")},parse:function(s,u){u===void 0&&(u=!0);var l=s.length,c=u?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<c.length;f++)d[c.charCodeAt(f)]=f}var p=c.charAt(64);if(p){var m=s.indexOf(p);m!==-1&&(l=m)}return a(s,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var yM=v((lue,xkt)=>{(function(t,e){typeof lue=="object"?xkt.exports=lue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(lue,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var b=m+h,g=p[b];p[b]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var y=this._hash.words,x=p[m+0],S=p[m+1],O=p[m+2],E=p[m+3],P=p[m+4],A=p[m+5],I=p[m+6],R=p[m+7],N=p[m+8],j=p[m+9],$=p[m+10],k=p[m+11],H=p[m+12],V=p[m+13],Q=p[m+14],Z=p[m+15],D=y[0],z=y[1],B=y[2],K=y[3];D=l(D,z,B,K,x,7,s[0]),K=l(K,D,z,B,S,12,s[1]),B=l(B,K,D,z,O,17,s[2]),z=l(z,B,K,D,E,22,s[3]),D=l(D,z,B,K,P,7,s[4]),K=l(K,D,z,B,A,12,s[5]),B=l(B,K,D,z,I,17,s[6]),z=l(z,B,K,D,R,22,s[7]),D=l(D,z,B,K,N,7,s[8]),K=l(K,D,z,B,j,12,s[9]),B=l(B,K,D,z,$,17,s[10]),z=l(z,B,K,D,k,22,s[11]),D=l(D,z,B,K,H,7,s[12]),K=l(K,D,z,B,V,12,s[13]),B=l(B,K,D,z,Q,17,s[14]),z=l(z,B,K,D,Z,22,s[15]),D=c(D,z,B,K,S,5,s[16]),K=c(K,D,z,B,I,9,s[17]),B=c(B,K,D,z,k,14,s[18]),z=c(z,B,K,D,x,20,s[19]),D=c(D,z,B,K,A,5,s[20]),K=c(K,D,z,B,$,9,s[21]),B=c(B,K,D,z,Z,14,s[22]),z=c(z,B,K,D,P,20,s[23]),D=c(D,z,B,K,j,5,s[24]),K=c(K,D,z,B,Q,9,s[25]),B=c(B,K,D,z,E,14,s[26]),z=c(z,B,K,D,N,20,s[27]),D=c(D,z,B,K,V,5,s[28]),K=c(K,D,z,B,O,9,s[29]),B=c(B,K,D,z,R,14,s[30]),z=c(z,B,K,D,H,20,s[31]),D=d(D,z,B,K,A,4,s[32]),K=d(K,D,z,B,N,11,s[33]),B=d(B,K,D,z,k,16,s[34]),z=d(z,B,K,D,Q,23,s[35]),D=d(D,z,B,K,S,4,s[36]),K=d(K,D,z,B,P,11,s[37]),B=d(B,K,D,z,R,16,s[38]),z=d(z,B,K,D,$,23,s[39]),D=d(D,z,B,K,V,4,s[40]),K=d(K,D,z,B,x,11,s[41]),B=d(B,K,D,z,E,16,s[42]),z=d(z,B,K,D,I,23,s[43]),D=d(D,z,B,K,j,4,s[44]),K=d(K,D,z,B,H,11,s[45]),B=d(B,K,D,z,Z,16,s[46]),z=d(z,B,K,D,O,23,s[47]),D=f(D,z,B,K,x,6,s[48]),K=f(K,D,z,B,R,10,s[49]),B=f(B,K,D,z,Q,15,s[50]),z=f(z,B,K,D,A,21,s[51]),D=f(D,z,B,K,H,6,s[52]),K=f(K,D,z,B,E,10,s[53]),B=f(B,K,D,z,$,15,s[54]),z=f(z,B,K,D,S,21,s[55]),D=f(D,z,B,K,N,6,s[56]),K=f(K,D,z,B,Z,10,s[57]),B=f(B,K,D,z,I,15,s[58]),z=f(z,B,K,D,V,21,s[59]),D=f(D,z,B,K,P,6,s[60]),K=f(K,D,z,B,k,10,s[61]),B=f(B,K,D,z,O,15,s[62]),z=f(z,B,K,D,j,21,s[63]),y[0]=y[0]+D|0,y[1]=y[1]+z|0,y[2]=y[2]+B|0,y[3]=y[3]+K|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,b=p.sigBytes*8;m[b>>>5]|=128<<24-b%32;var g=e.floor(h/4294967296),y=h;m[(b+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var x=this._hash,S=x.words,O=0;O<4;O++){var E=S[O];S[O]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return x},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,b,g,y,x){var S=p+(m&h|~m&b)+g+x;return(S<<y|S>>>32-y)+m}function c(p,m,h,b,g,y,x){var S=p+(m&b|h&~b)+g+x;return(S<<y|S>>>32-y)+m}function d(p,m,h,b,g,y,x){var S=p+(m^h^b)+g+x;return(S<<y|S>>>32-y)+m}function f(p,m,h,b,g,y,x){var S=p+(h^(m|~b))+g+x;return(S<<y|S>>>32-y)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var YLe=v((cue,Skt)=>{(function(t,e){typeof cue=="object"?Skt.exports=cue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(cue,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],b=0;b<80;b++){if(b<16)a[b]=u[l+b]|0;else{var g=a[b-3]^a[b-8]^a[b-14]^a[b-16];a[b]=g<<1|g>>>31}var y=(d<<5|d>>>27)+h+a[b];b<20?y+=(f&p|~f&m)+1518500249:b<40?y+=(f^p^m)+1859775393:b<60?y+=(f&p|f&m|p&m)-1894007588:y+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=y}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+m|0,c[4]=c[4]+h|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var fue=v((due,Ckt)=>{(function(t,e){typeof due=="object"?Ckt.exports=due=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(due,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var b=e.sqrt(h),g=2;g<=b;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],b=p[2],g=p[3],y=p[4],x=p[5],S=p[6],O=p[7],E=0;E<64;E++){if(E<16)l[E]=d[f+E]|0;else{var P=l[E-15],A=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,I=l[E-2],R=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[E]=A+l[E-7]+R+l[E-16]}var N=y&x^~y&S,j=m&h^m&b^h&b,$=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),k=(y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25),H=O+k+N+u[E]+l[E],V=$+j;O=S,S=x,x=y,y=g+H|0,g=b,b=h,h=m,m=H+V|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+b|0,p[3]=p[3]+g|0,p[4]=p[4]+y|0,p[5]=p[5]+x|0,p[6]=p[6]+S|0,p[7]=p[7]+O|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var Pkt=v((pue,Okt)=>{(function(t,e,r){typeof pue=="object"?Okt.exports=pue=e(Gn(),fue()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(pue,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 XLe=v((mue,Ekt)=>{(function(t,e,r){typeof mue=="object"?Ekt.exports=mue=e(Gn(),V9()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(mue,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],b=m[1],g=m[2],y=m[3],x=m[4],S=m[5],O=m[6],E=m[7],P=h.high,A=h.low,I=b.high,R=b.low,N=g.high,j=g.low,$=y.high,k=y.low,H=x.high,V=x.low,Q=S.high,Z=S.low,D=O.high,z=O.low,B=E.high,K=E.low,q=P,te=A,U=I,W=R,Y=N,se=j,Te=$,de=k,Ue=H,Ke=V,at=Q,hr=Z,Nn=D,De=z,_t=B,Oe=K,$e=0;$e<80;$e++){var ce,qt,Ze=c[$e];if($e<16)qt=Ze.high=f[p+$e*2]|0,ce=Ze.low=f[p+$e*2+1]|0;else{var Ne=c[$e-15],ue=Ne.high,pe=Ne.low,Pe=(ue>>>1|pe<<31)^(ue>>>8|pe<<24)^ue>>>7,Ae=(pe>>>1|ue<<31)^(pe>>>8|ue<<24)^(pe>>>7|ue<<25),ot=c[$e-2],Nr=ot.high,ua=ot.low,Va=(Nr>>>19|ua<<13)^(Nr<<3|ua>>>29)^Nr>>>6,km=(ua>>>19|Nr<<13)^(ua<<3|Nr>>>29)^(ua>>>6|Nr<<26),qy=c[$e-7],ys=qy.high,Jh=qy.low,$m=c[$e-16],Zh=$m.high,Qn=$m.low;ce=Ae+Jh,qt=Pe+ys+(ce>>>0<Ae>>>0?1:0),ce=ce+km,qt=qt+Va+(ce>>>0<km>>>0?1:0),ce=ce+Qn,qt=qt+Zh+(ce>>>0<Qn>>>0?1:0),Ze.high=qt,Ze.low=ce}var FT=Ue&at^~Ue&Nn,P1=Ke&hr^~Ke&De,kT=q&U^q&Y^U&Y,bs=te&W^te&se^W&se,tu=(q>>>28|te<<4)^(q<<30|te>>>2)^(q<<25|te>>>7),Wa=(te>>>28|q<<4)^(te<<30|q>>>2)^(te<<25|q>>>7),Uf=(Ue>>>14|Ke<<18)^(Ue>>>18|Ke<<14)^(Ue<<23|Ke>>>9),Yd=(Ke>>>14|Ue<<18)^(Ke>>>18|Ue<<14)^(Ke<<23|Ue>>>9),Ds=l[$e],Mp=Ds.high,qf=Ds.low,Un=Oe+Yd,et=_t+Uf+(Un>>>0<Oe>>>0?1:0),Un=Un+P1,et=et+FT+(Un>>>0<P1>>>0?1:0),Un=Un+qf,et=et+Mp+(Un>>>0<qf>>>0?1:0),Un=Un+ce,et=et+qt+(Un>>>0<ce>>>0?1:0),Hf=Wa+bs,zm=tu+kT+(Hf>>>0<Wa>>>0?1:0);_t=Nn,Oe=De,Nn=at,De=hr,at=Ue,hr=Ke,Ke=de+Un|0,Ue=Te+et+(Ke>>>0<de>>>0?1:0)|0,Te=Y,de=se,Y=U,se=W,U=q,W=te,te=Un+Hf|0,q=et+zm+(te>>>0<Un>>>0?1:0)|0}A=h.low=A+te,h.high=P+q+(A>>>0<te>>>0?1:0),R=b.low=R+W,b.high=I+U+(R>>>0<W>>>0?1:0),j=g.low=j+se,g.high=N+Y+(j>>>0<se>>>0?1:0),k=y.low=k+de,y.high=$+Te+(k>>>0<de>>>0?1:0),V=x.low=V+Ke,x.high=H+Ue+(V>>>0<Ke>>>0?1:0),Z=S.low=Z+hr,S.high=Q+at+(Z>>>0<hr>>>0?1:0),z=O.low=z+De,O.high=D+Nn+(z>>>0<De>>>0?1:0),K=E.low=K+Oe,E.high=B+_t+(K>>>0<Oe>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,h=f.sigBytes*8;p[h>>>5]|=128<<24-h%32,p[(h+128>>>10<<5)+30]=Math.floor(m/4294967296),p[(h+128>>>10<<5)+31]=m,f.sigBytes=p.length*4,this._process();var b=this._hash.toX32();return b},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 Akt=v((hue,Tkt)=>{(function(t,e,r){typeof hue=="object"?Tkt.exports=hue=e(Gn(),V9(),XLe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(hue,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 Mkt=v((gue,Ikt)=>{(function(t,e,r){typeof gue=="object"?Ikt.exports=gue=e(Gn(),V9()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(gue,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,b=0;b<24;b++){l[m+5*h]=(b+1)*(b+2)/2%64;var g=h%5,y=(2*m+3*h)%5;m=g,h=y}for(var m=0;m<5;m++)for(var h=0;h<5;h++)c[m+5*h]=h+(2*m+3*h)%5*5;for(var x=1,S=0;S<24;S++){for(var O=0,E=0,P=0;P<7;P++){if(x&1){var A=(1<<P)-1;A<32?E^=1<<A:O^=1<<A-32}x&128?x=x<<1^113:x<<=1}d[S]=s.create(O,E)}})();var f=[];(function(){for(var m=0;m<25;m++)f[m]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],h=0;h<25;h++)m[h]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,h){for(var b=this._state,g=this.blockSize/2,y=0;y<g;y++){var x=m[h+2*y],S=m[h+2*y+1];x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360;var O=b[y];O.high^=S,O.low^=x}for(var E=0;E<24;E++){for(var P=0;P<5;P++){for(var A=0,I=0,R=0;R<5;R++){var O=b[P+5*R];A^=O.high,I^=O.low}var N=f[P];N.high=A,N.low=I}for(var P=0;P<5;P++)for(var j=f[(P+4)%5],$=f[(P+1)%5],k=$.high,H=$.low,A=j.high^(k<<1|H>>>31),I=j.low^(H<<1|k>>>31),R=0;R<5;R++){var O=b[P+5*R];O.high^=A,O.low^=I}for(var V=1;V<25;V++){var A,I,O=b[V],Q=O.high,Z=O.low,D=l[V];D<32?(A=Q<<D|Z>>>32-D,I=Z<<D|Q>>>32-D):(A=Z<<D-32|Q>>>64-D,I=Q<<D-32|Z>>>64-D);var z=f[c[V]];z.high=A,z.low=I}var B=f[0],K=b[0];B.high=K.high,B.low=K.low;for(var P=0;P<5;P++)for(var R=0;R<5;R++){var V=P+5*R,O=b[V],q=f[V],te=f[(P+1)%5+5*R],U=f[(P+2)%5+5*R];O.high=q.high^~te.high&U.high,O.low=q.low^~te.low&U.low}var O=b[0],W=d[E];O.high^=W.high,O.low^=W.low}},_doFinalize:function(){var m=this._data,h=m.words,b=this._nDataBytes*8,g=m.sigBytes*8,y=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/y)*y>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var x=this._state,S=this.cfg.outputLength/8,O=S/8,E=[],P=0;P<O;P++){var A=x[P],I=A.high,R=A.low;I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,E.push(R),E.push(I)}return new o.init(E,S)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),b=0;b<25;b++)h[b]=h[b].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var Nkt=v((yue,Rkt)=>{(function(t,e){typeof yue=="object"?Rkt.exports=yue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(yue,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,O){for(var E=0;E<16;E++){var P=O+E,A=S[P];S[P]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var I=this._hash.words,R=d.words,N=f.words,j=s.words,$=u.words,k=l.words,H=c.words,V,Q,Z,D,z,B,K,q,te,U;B=V=I[0],K=Q=I[1],q=Z=I[2],te=D=I[3],U=z=I[4];for(var W,E=0;E<80;E+=1)W=V+S[O+j[E]]|0,E<16?W+=m(Q,Z,D)+R[0]:E<32?W+=h(Q,Z,D)+R[1]:E<48?W+=b(Q,Z,D)+R[2]:E<64?W+=g(Q,Z,D)+R[3]:W+=y(Q,Z,D)+R[4],W=W|0,W=x(W,k[E]),W=W+z|0,V=z,z=D,D=x(Z,10),Z=Q,Q=W,W=B+S[O+$[E]]|0,E<16?W+=y(K,q,te)+N[0]:E<32?W+=g(K,q,te)+N[1]:E<48?W+=b(K,q,te)+N[2]:E<64?W+=h(K,q,te)+N[3]:W+=m(K,q,te)+N[4],W=W|0,W=x(W,H[E]),W=W+U|0,B=U,U=te,te=x(q,10),q=K,K=W;W=I[1]+Z+te|0,I[1]=I[2]+D+U|0,I[2]=I[3]+z+B|0,I[3]=I[4]+V+K|0,I[4]=I[0]+Q+q|0,I[0]=W},_doFinalize:function(){var S=this._data,O=S.words,E=this._nDataBytes*8,P=S.sigBytes*8;O[P>>>5]|=128<<24-P%32,O[(P+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,S.sigBytes=(O.length+1)*4,this._process();for(var A=this._hash,I=A.words,R=0;R<5;R++){var N=I[R];I[R]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return A},clone:function(){var S=i.clone.call(this);return S._hash=this._hash.clone(),S}});function m(S,O,E){return S^O^E}function h(S,O,E){return S&O|~S&E}function b(S,O,E){return(S|~O)^E}function g(S,O,E){return S&E|O&~E}function y(S,O,E){return S^(O|~E)}function x(S,O){return S<<O|S>>>32-O}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var _ue=v((bue,jkt)=>{(function(t,e){typeof bue=="object"?jkt.exports=bue=e(Gn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(bue,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,b=0;b<c;b++)m[b]^=1549556828,h[b]^=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 Lkt=v((vue,Dkt)=>{(function(t,e,r){typeof vue=="object"?Dkt.exports=vue=e(Gn(),fue(),_ue()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(vue,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,b=m.words,g=d.keySize,y=d.iterations;h.length<g;){var x=f.update(c).finalize(m);f.reset();for(var S=x.words,O=S.length,E=x,P=1;P<y;P++){E=f.finalize(E),f.reset();for(var A=E.words,I=0;I<O;I++)S[I]^=A[I]}p.concat(x),b[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var rE=v((wue,Fkt)=>{(function(t,e,r){typeof wue=="object"?Fkt.exports=wue=e(Gn(),YLe(),_ue()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(wue,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,b=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<b;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=h*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var tc=v((xue,kkt)=>{(function(t,e,r){typeof xue=="object"?kkt.exports=xue=e(Gn(),rE()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(xue,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(N,j){return this.create(this._ENC_XFORM_MODE,N,j)},createDecryptor:function(N,j){return this.create(this._DEC_XFORM_MODE,N,j)},init:function(N,j,$){this.cfg=this.cfg.extend($),this._xformMode=N,this._key=j,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var j=this._doFinalize();return j},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(j){return typeof j=="string"?R:P}return function(j){return{encrypt:function($,k,H){return N(k).encrypt(j,$,k,H)},decrypt:function($,k,H){return N(k).decrypt(j,$,k,H)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(N,j){return this.Encryptor.create(N,j)},createDecryptor:function(N,j){return this.Decryptor.create(N,j)},init:function(N,j){this._cipher=N,this._iv=j}}),b=m.CBC=function(){var N=h.extend();N.Encryptor=N.extend({processBlock:function($,k){var H=this._cipher,V=H.blockSize;j.call(this,$,k,V),H.encryptBlock($,k),this._prevBlock=$.slice(k,k+V)}}),N.Decryptor=N.extend({processBlock:function($,k){var H=this._cipher,V=H.blockSize,Q=$.slice(k,k+V);H.decryptBlock($,k),j.call(this,$,k,V),this._prevBlock=Q}});function j($,k,H){var V,Q=this._iv;Q?(V=Q,this._iv=e):V=this._prevBlock;for(var Z=0;Z<H;Z++)$[k+Z]^=V[Z]}return N}(),g=r.pad={},y=g.Pkcs7={pad:function(N,j){for(var $=j*4,k=$-N.sigBytes%$,H=k<<24|k<<16|k<<8|k,V=[],Q=0;Q<k;Q+=4)V.push(H);var Z=i.create(V,k);N.concat(Z)},unpad:function(N){var j=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=j}},x=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:b,padding:y}),reset:function(){var N;f.reset.call(this);var j=this.cfg,$=j.iv,k=j.mode;this._xformMode==this._ENC_XFORM_MODE?N=k.createEncryptor:(N=k.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,$&&$.words):(this._mode=N.call(k,this,$&&$.words),this._mode.__creator=N)},_doProcessBlock:function(N,j){this._mode.processBlock(N,j)},_doFinalize:function(){var N,j=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(j.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),j.unpad(N)),N},blockSize:128/32}),S=n.CipherParams=o.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),O=r.format={},E=O.OpenSSL={stringify:function(N){var j,$=N.ciphertext,k=N.salt;return k?j=i.create([1398893684,1701076831]).concat(k).concat($):j=$,j.toString(l)},parse:function(N){var j,$=l.parse(N),k=$.words;return k[0]==1398893684&&k[1]==1701076831&&(j=i.create(k.slice(2,4)),k.splice(0,4),$.sigBytes-=16),S.create({ciphertext:$,salt:j})}},P=n.SerializableCipher=o.extend({cfg:o.extend({format:E}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var H=N.createEncryptor($,k),V=H.finalize(j),Q=H.cfg;return S.create({ciphertext:V,key:$,iv:Q.iv,algorithm:N,mode:Q.mode,padding:Q.padding,blockSize:N.blockSize,formatter:k.format})},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var H=N.createDecryptor($,k).finalize(j.ciphertext);return H},_parse:function(N,j){return typeof N=="string"?j.parse(N,this):N}}),A=r.kdf={},I=A.OpenSSL={execute:function(N,j,$,k,H){if(k||(k=i.random(64/8)),H)var V=d.create({keySize:j+$,hasher:H}).compute(N,k);else var V=d.create({keySize:j+$}).compute(N,k);var Q=i.create(V.words.slice(j),$*4);return V.sigBytes=j*4,S.create({key:V,iv:Q,salt:k})}},R=n.PasswordBasedCipher=P.extend({cfg:P.cfg.extend({kdf:I}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var H=k.kdf.execute($,N.keySize,N.ivSize,k.salt,k.hasher);k.iv=H.iv;var V=P.encrypt.call(this,N,j,H.key,k);return V.mixIn(H),V},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var H=k.kdf.execute($,N.keySize,N.ivSize,j.salt,k.hasher);k.iv=H.iv;var V=P.decrypt.call(this,N,j,H.key,k);return V}})}()})});var zkt=v((Sue,$kt)=>{(function(t,e,r){typeof Sue=="object"?$kt.exports=Sue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Sue,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 Ukt=v((Cue,Bkt)=>{(function(t,e,r){typeof Cue=="object"?Bkt.exports=Cue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Cue,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 Hkt=v((Oue,qkt)=>{(function(t,e,r){typeof Oue=="object"?qkt.exports=Oue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Oue,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 Wkt=v((Pue,Vkt)=>{(function(t,e,r){typeof Pue=="object"?Vkt.exports=Pue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Pue,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 Gkt=v((Eue,Kkt)=>{(function(t,e,r){typeof Eue=="object"?Kkt.exports=Eue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Eue,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 Zkt=v((Tue,Jkt)=>{(function(t,e,r){typeof Tue=="object"?Jkt.exports=Tue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Tue,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 Xkt=v((Aue,Ykt)=>{(function(t,e,r){typeof Aue=="object"?Ykt.exports=Aue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Aue,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 e$t=v((Iue,Qkt)=>{(function(t,e,r){typeof Iue=="object"?Qkt.exports=Iue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Iue,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 r$t=v((Mue,t$t)=>{(function(t,e,r){typeof Mue=="object"?t$t.exports=Mue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Mue,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 o$t=v((Rue,n$t)=>{(function(t,e,r){typeof Rue=="object"?n$t.exports=Rue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Rue,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var a$t=v((Nue,i$t)=>{(function(t,e,r){typeof Nue=="object"?i$t.exports=Nue=e(Gn(),tc()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Nue,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 u$t=v((jue,s$t)=>{(function(t,e,r){typeof jue=="object"?s$t.exports=jue=e(Gn(),gM(),yM(),rE(),tc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(jue,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],m=[];(function(){for(var g=[],y=0;y<256;y++)y<128?g[y]=y<<1:g[y]=y<<1^283;for(var x=0,S=0,y=0;y<256;y++){var O=S^S<<1^S<<2^S<<3^S<<4;O=O>>>8^O&255^99,i[x]=O,a[O]=x;var E=g[x],P=g[E],A=g[P],I=g[O]*257^O*16843008;s[x]=I<<24|I>>>8,u[x]=I<<16|I>>>16,l[x]=I<<8|I>>>24,c[x]=I;var I=A*16843009^P*65537^E*257^x*16843008;d[O]=I<<24|I>>>8,f[O]=I<<16|I>>>16,p[O]=I<<8|I>>>24,m[O]=I,x?(x=E^g[g[g[A^E]]],S^=g[g[S]]):x=S=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],b=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var y=this._keyPriorReset=this._key,x=y.words,S=y.sigBytes/4,O=this._nRounds=S+6,E=(O+1)*4,P=this._keySchedule=[],A=0;A<E;A++)A<S?P[A]=x[A]:(g=P[A-1],A%S?S>6&&A%S==4&&(g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255]):(g=g<<8|g>>>24,g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255],g^=h[A/S|0]<<24),P[A]=P[A-S]^g);for(var I=this._invKeySchedule=[],R=0;R<E;R++){var A=E-R;if(R%4)var g=P[A];else var g=P[A-4];R<4||A<=4?I[R]=g:I[R]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,y){this._doCryptBlock(g,y,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,y){var x=g[y+1];g[y+1]=g[y+3],g[y+3]=x,this._doCryptBlock(g,y,this._invKeySchedule,d,f,p,m,a);var x=g[y+1];g[y+1]=g[y+3],g[y+3]=x},_doCryptBlock:function(g,y,x,S,O,E,P,A){for(var I=this._nRounds,R=g[y]^x[0],N=g[y+1]^x[1],j=g[y+2]^x[2],$=g[y+3]^x[3],k=4,H=1;H<I;H++){var V=S[R>>>24]^O[N>>>16&255]^E[j>>>8&255]^P[$&255]^x[k++],Q=S[N>>>24]^O[j>>>16&255]^E[$>>>8&255]^P[R&255]^x[k++],Z=S[j>>>24]^O[$>>>16&255]^E[R>>>8&255]^P[N&255]^x[k++],D=S[$>>>24]^O[R>>>16&255]^E[N>>>8&255]^P[j&255]^x[k++];R=V,N=Q,j=Z,$=D}var V=(A[R>>>24]<<24|A[N>>>16&255]<<16|A[j>>>8&255]<<8|A[$&255])^x[k++],Q=(A[N>>>24]<<24|A[j>>>16&255]<<16|A[$>>>8&255]<<8|A[R&255])^x[k++],Z=(A[j>>>24]<<24|A[$>>>16&255]<<16|A[R>>>8&255]<<8|A[N&255])^x[k++],D=(A[$>>>24]<<24|A[R>>>16&255]<<16|A[N>>>8&255]<<8|A[j&255])^x[k++];g[y]=V,g[y+1]=Q,g[y+2]=Z,g[y+3]=D},keySize:256/32});e.AES=n._createHelper(b)}(),t.AES})});var c$t=v((Due,l$t)=>{(function(t,e,r){typeof Due=="object"?l$t.exports=Due=e(Gn(),gM(),yM(),rE(),tc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Due,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,b=h.words,g=[],y=0;y<56;y++){var x=a[y]-1;g[y]=b[x>>>5]>>>31-x%32&1}for(var S=this._subKeys=[],O=0;O<16;O++){for(var E=S[O]=[],P=u[O],y=0;y<24;y++)E[y/6|0]|=g[(s[y]-1+P)%28]<<31-y%6,E[4+(y/6|0)]|=g[28+(s[y+24]-1+P)%28]<<31-y%6;E[0]=E[0]<<1|E[0]>>>31;for(var y=1;y<7;y++)E[y]=E[y]>>>(y-1)*4+3;E[7]=E[7]<<5|E[7]>>>27}for(var A=this._invSubKeys=[],y=0;y<16;y++)A[y]=S[15-y]},encryptBlock:function(h,b){this._doCryptBlock(h,b,this._subKeys)},decryptBlock:function(h,b){this._doCryptBlock(h,b,this._invSubKeys)},_doCryptBlock:function(h,b,g){this._lBlock=h[b],this._rBlock=h[b+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 y=0;y<16;y++){for(var x=g[y],S=this._lBlock,O=this._rBlock,E=0,P=0;P<8;P++)E|=l[P][((O^x[P])&c[P])>>>0];this._lBlock=O,this._rBlock=S^E}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[b]=this._lBlock,h[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,b){var g=(this._lBlock>>>h^this._rBlock)&b;this._rBlock^=g,this._lBlock^=g<<h}function p(h,b){var g=(this._rBlock>>>h^this._lBlock)&b;this._lBlock^=g,this._rBlock^=g<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,b=h.words;if(b.length!==2&&b.length!==4&&b.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=b.slice(0,2),y=b.length<4?b.slice(0,2):b.slice(2,4),x=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(y)),this._des3=d.createEncryptor(n.create(x))},encryptBlock:function(h,b){this._des1.encryptBlock(h,b),this._des2.decryptBlock(h,b),this._des3.encryptBlock(h,b)},decryptBlock:function(h,b){this._des3.decryptBlock(h,b),this._des2.encryptBlock(h,b),this._des1.decryptBlock(h,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var f$t=v((Lue,d$t)=>{(function(t,e,r){typeof Lue=="object"?d$t.exports=Lue=e(Gn(),gM(),yM(),rE(),tc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Lue,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var b=d[f];d[f]=d[p],d[p]=b}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 m$t=v((Fue,p$t)=>{(function(t,e,r){typeof Fue=="object"?p$t.exports=Fue=e(Gn(),gM(),yM(),rE(),tc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Fue,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,b=h[0],g=h[1],y=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,x=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,S=y>>>16|x&4294901760,O=x<<16|y&65535;m[0]^=y,m[1]^=S,m[2]^=x,m[3]^=O,m[4]^=y,m[5]^=S,m[6]^=x,m[7]^=O;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var g$t=v((kue,h$t)=>{(function(t,e,r){typeof kue=="object"?h$t.exports=kue=e(Gn(),gM(),yM(),rE(),tc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(kue,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,b=h[0],g=h[1],y=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,x=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,S=y>>>16|x&4294901760,O=x<<16|y&65535;p[0]^=y,p[1]^=S,p[2]^=x,p[3]^=O,p[4]^=y,p[5]^=S,p[6]^=x,p[7]^=O;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var b$t=v(($ue,y$t)=>{(function(t,e,r){typeof $ue=="object"?y$t.exports=$ue=e(Gn(),gM(),yM(),rE(),tc()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})($ue,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let b=h>>24&255,g=h>>16&255,y=h>>8&255,x=h&255,S=m.sbox[0][b]+m.sbox[1][g];return S=S^m.sbox[2][y],S=S+m.sbox[3][x],S}function c(m,h,b){let g=h,y=b,x;for(let S=0;S<i;++S)g=g^m.pbox[S],y=l(m,g)^y,x=g,g=y,y=x;return x=g,g=y,y=x,y=y^m.pbox[i],g=g^m.pbox[i+1],{left:g,right:y}}function d(m,h,b){let g=h,y=b,x;for(let S=i+1;S>1;--S)g=g^m.pbox[S],y=l(m,g)^y,x=g,g=y,y=x;return x=g,g=y,y=x,y=y^m.pbox[1],g=g^m.pbox[0],{left:g,right:y}}function f(m,h,b){for(let O=0;O<4;O++){m.sbox[O]=[];for(let E=0;E<256;E++)m.sbox[O][E]=s[O][E]}let g=0;for(let O=0;O<i+2;O++)m.pbox[O]=a[O]^h[g],g++,g>=b&&(g=0);let y=0,x=0,S=0;for(let O=0;O<i+2;O+=2)S=c(m,y,x),y=S.left,x=S.right,m.pbox[O]=y,m.pbox[O+1]=x;for(let O=0;O<4;O++)for(let E=0;E<256;E+=2)S=c(m,y,x),y=S.left,x=S.right,m.sbox[O][E]=y,m.sbox[O][E+1]=x;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,b=m.sigBytes/4;f(u,h,b)}},encryptBlock:function(m,h){var b=c(u,m[h],m[h+1]);m[h]=b.left,m[h+1]=b.right},decryptBlock:function(m,h){var b=d(u,m[h],m[h+1]);m[h]=b.left,m[h+1]=b.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var Iq=v((zue,_$t)=>{(function(t,e,r){typeof zue=="object"?_$t.exports=zue=e(Gn(),V9(),gkt(),bkt(),gM(),wkt(),yM(),YLe(),fue(),Pkt(),XLe(),Akt(),Mkt(),Nkt(),_ue(),Lkt(),rE(),tc(),zkt(),Ukt(),Hkt(),Wkt(),Gkt(),Zkt(),Xkt(),e$t(),r$t(),o$t(),a$t(),u$t(),c$t(),f$t(),m$t(),g$t(),b$t()):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)})(zue,function(t){return t})});var QLe,nnn,Bue,v$t=w(()=>{BA();er();H9();QLe="copilot-index-chunk-",nnn=".json",Bue=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${QLe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${QLe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${nnn}`}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,[]);ae().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,ae().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ae().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 JLe(e),n=ae().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(ae().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)),ae().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([m])=>c.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(c.map((m,h)=>[(h+1).toString(),m])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),ae().debug&&console.log(`Saved partition ${l+1}/${n}`)}ae().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Hr(`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 Hr("Invalid legacy database format");let l=await Pq({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await tue(l,u),l}let r=await this.loadMetadata(),n=await Pq({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 Hr("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++):ae().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 tue(n,o),n}catch(e){throw console.error("Error loading database:",e),new Hr(`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}/${QLe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Hr(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ae().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 Hr("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Hr("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))}}});async function x$t(t){if(!t)throw new Hr("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Hr("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${mu.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Hr("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function S$t(t){let e="",{inclusions:r,exclusions:n}=Tf(),o=t.vault.getMarkdownFiles().filter(i=>gu(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function Xg(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function onn(){return ae().qaExclusions?Xg(ae().qaExclusions):[]}function inn(){return ae().qaInclusions?Xg(ae().qaInclusions):[]}function Tf(t){let e=t?.inclusions?Xg(t.inclusions):t?.isProject?[]:inn(),r=t?.exclusions?Xg(t.exclusions):t?.isProject?[]:onn();return{inclusions:e.length>0?W9(e):null,exclusions:r.length>0?W9(r):null}}function gu(t,e,r){return!(r&&w$t(t.path,r)||e&&!w$t(t.path,e))}function W9(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 K9({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function ann(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof eFe.TFile){let n=bN(r);if(e.some(o=>n.includes(P$(o))))return!0}return!1}function snn(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 unn(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 lnn(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof eFe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function w$t(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return ann(t,r??[])||snn(t,n??[])||unn(t,o??[])||lnn(t,i??[])}function Uue(t){let e=[];try{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 que(t){return`#${t}`}function G9(t){return`[[${t.basename}]]`}function C$t(t){return`*.${t}`}var eFe,Qg=w(()=>{BA();XD();er();on();eFe=require("obsidian")});var O$t,SC,nE,Hue=w(()=>{XD();BA();Tn();er();on();H9();dkt();O$t=F(Iq()),SC=require("obsidian");v$t();Qg();nE=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new rue;Ma(async()=>{let r=ae();SC.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):SC.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await mu.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(J("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await mu.getInstance().getEmbeddingsAPI()),J("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Hr("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Bue(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),SC.Platform.isMobile&&ae().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Hr("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),J("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){fe("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){fe("Error initializing Orama database:",r),new SC.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(SC.Platform.isMobile&&ae().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await mu.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Hr("Orama database not found.")}catch(e){throw fe("Failed to initialize database during save:",e),new Hr("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ae().debug&&J("Orama database saved successfully at:",this.dbPath)}catch(e){throw fe("Error saving Orama 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 SC.Notice("Local Copilot index cleared successfully."),J("Local Copilot index cleared successfully, new instance created.")}catch(r){throw fe("Error clearing the local Copilot index:",r),new SC.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Hr("Orama database not found.");try{let r=await xd(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await q9(this.oramaDb,r.hits.map(n=>n.id),500),ae().debug&&J(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){fe("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(ae().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),J("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,O$t.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Hr("Embedding instance not found.");let r=await x$t(e);if(!r||r===0)throw new Hr("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await Pq({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return J(`Created new Orama database for ${this.dbPath}. Embedding model: ${mu.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 xd(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await xd(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 xd(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return fe("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,ae().numPartitions),o=await xd(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await rL(r,o.hits[0].id);try{return await U9(r,e),J(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(fe(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await U9(r,o.hits[0].document)}catch(a){fe("Failed to restore previous document version:",a)}return}}catch(n){fe(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await xd(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return fe("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){J("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw fe("Failed to initialize database:",o),new Hr("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await xd(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=mu.getModelName(e);if(!EGe(n,o))return new SC.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),J(`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 J("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await xd(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){J("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await mu.getInstance().getEmbeddingsAPI();if(!e)throw new Hr("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Hr("Failed to initialize database after attempt.")}catch(e){throw fe("Failed to initialize database during garbage collection:",e),new Hr("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:(J("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await rL(this.oramaDb,o[0].id):await q9(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw fe("Error garbage collecting the Copilot index:",e),new Hr("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Hr("Orama 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 fe("Error getting indexed files:",e),new Hr("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await xd(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw fe("Error checking if database is empty:",e),new Hr("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 Hr("Orama 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 Hr("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?J("Files missing embeddings after integrity check:",r.join(", ")):J("Index integrity check completed. All documents have embeddings.")}catch(e){throw fe("Error checking index integrity:",e),new Hr("Failed to check index integrity.")}}}});var Mq,cnn,Vue,P$t=w(()=>{Us();td();er();Mq=require("obsidian");Qg();cnn=5e3,Vue=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(Mq.Platform.isMobile&&ae().disableIndexOnMobile||bg()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof Mq.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}=Tf(),u=gu(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(()=>{ae().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},cnn)};this.handleFileDelete=async e=>{e instanceof Mq.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){ae().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 J9,E$t=w(()=>{J9=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 oE,T$t=w(()=>{oE=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 Wue,A$t=w(()=>{sf();Wue=class extends jn{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 I$t=w(()=>{T$t();A$t()});var Kue=w(()=>{I$t()});var M$t=w(()=>{oNe()});var tFe,Gue,R$t=w(()=>{Kue();M$t();tFe=class extends Wue{constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","document_transformers","text_splitters"]}),Object.defineProperty(this,"chunkSize",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"chunkOverlap",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"keepSeparator",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lengthFunction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chunkSize=e?.chunkSize??this.chunkSize,this.chunkOverlap=e?.chunkOverlap??this.chunkOverlap,this.keepSeparator=e?.keepSeparator??this.keepSeparator,this.lengthFunction=e?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,r={}){return this.splitDocuments(e,r)}splitOnSeparator(e,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=e.split(new RegExp(`(?=${o})`))}else n=e.split(r);else n=e.split("");return n.filter(o=>o!=="")}async createDocuments(e,r=[],n={}){let o=r.length>0?r:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<e.length;l+=1){let c=e[l],d=1,f=null,p=-1;for(let m of await this.splitText(c)){let h=i,b=c.indexOf(m,p+1);if(f===null){let S=this.numberOfNewLines(c,0,b);d+=S}else{let S=p+await this.lengthFunction(f);if(S<b){let O=this.numberOfNewLines(c,S,b);d+=O}else if(S>b){let O=this.numberOfNewLines(c,b,S);d-=O}s&&(h+=a)}let g=this.numberOfNewLines(m),y=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};y.lines={from:d,to:d+g};let x={...o[l],loc:y};h+=m,u.push(new oE({pageContent:h,metadata:x})),d+=g,f=m,p=b}}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}},Gue=class t extends tFe{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 N$t=w(()=>{R$t()});var j$t=w(()=>{N$t()});var D$t=w(()=>{j$t()});var L$t=w(()=>{D$t()});var F$t,CC,Jue,k$t=w(()=>{Ur();XD();Tn();E$t();er();on();F$t=F(Iq());L$t();CC=require("obsidian");Qg();Jue=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=ae();this.rateLimiter=new J9(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,Ma(async()=>{let i=ae();this.rateLimiter=new J9(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 CC.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 CC.Notice("No valid content to index."),0;for(let s=0;s<a.length&&!this.state.isIndexingCancelled;s+=this.embeddingBatchSize){await this.handlePause();let u=a.slice(s,s+this.embeddingBatchSize);try{await this.rateLimiter.wait();let l=await n.embedDocuments(u.map(f=>f.content));if(!l||l.length!==u.length)throw new Error(`Embedding model returned ${l?.length??0} embeddings for ${u.length} documents`);for(let f=0;f<u.length;f++){let p=u[f],m=l[f];if(!m||!Array.isArray(m)||m.length===0){fe(`Invalid embedding for document ${p.fileInfo.path}: ${m}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:m,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(h){this.handleError(h,{filePath:p.fileInfo.path,errors:r}),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}}this.state.indexedCount=this.state.processedFiles.size,this.updateIndexingNoticeMessage();let c=Math.floor((this.state.indexedCount-u.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>c&&(await this.dbOps.saveDB(),console.log("Copilot index checkpoint save completed."))}catch(l){if(this.handleError(l,{filePath:u?.[0]?.fileInfo?.path,errors:r,batch:u}),this.isRateLimitError(l))break}}return this.finalizeIndexing(r),setTimeout(()=>{this.dbOps.saveDB().then(()=>{J("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{fe("Background integrity check failed:",s)})}).catch(s=>{fe("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=mu.getModelName(r),o=Gue.fromLanguage("markdown",{chunkSize:FGe}),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:Bs(new Date(a.stat.ctime)).display,modified:Bs(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,F$t.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=Tf(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>gu(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(!gu(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 J([`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 CC.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 CC.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=ae(),o=Xg(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...Uue(this.app),...Xg(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 CC.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 CC.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 CC.Notice("Indexing cancelled");return}e.length>0?new CC.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new CC.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(),ae().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 $$t={};Qd($$t,{default:()=>wa});var Z9,wa,OC=w(()=>{BA();XD();er();Z9=require("obsidian");Hue();P$t();k$t();wa=class t{constructor(){this.embeddingsManager=mu.getInstance(),this.dbOps=new nE(app),this.indexOps=new Jue(app,this.dbOps,this.embeddingsManager),this.eventHandler=new Vue(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={...ae()};let e=async()=>{let r=ae(),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())}};Ma(()=>{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 Hr&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new Z9.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(),Z9.Platform.isMobile&&ae().disableIndexOnMobile?(new Z9.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 Vxe(t){return t.split("|")[1]==="copilot-plus"}function Rq(){return Hn().isPlusUser}async function Zue(){return ae().plusLicenseKey?(await Wi.getInstance().validateLicenseKey()).isValid:(aFe(),!1)}function B$t(){let t=dnn,e=oFe,r=ae().embeddingModelKey;J("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),fJe(t),ON("copilot_plus"),lA({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(J("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(OC(),$$t)).then(n=>{n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{fe("Failed to trigger indexing after Plus settings applied:",n),new z$t.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):J("applyPlusSettings: No embedding model change, skipping indexing")}function iFe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function XN(t){window.open(iFe(t),"_blank")}function U$t(){ht("isPlusUser",!0)}function aFe(){let t=ae().isPlusUser;ht("isPlusUser",!1),t&&new xQ(app).open()}var z$t,rFe,dnn,nFe,oFe,yYo,bYo,sP=w(()=>{Us();td();PQe();Ur();Gg();Tn();er();z$t=require("obsidian"),rFe="copilot-plus-flash",dnn=rFe+"|"+"copilot-plus",nFe="copilot-plus-small",oFe=nFe+"|"+"copilot-plus",yYo=ed.defaultModelKey,bYo=ed.embeddingModelKey});var q$t,H$t,Wi,Gg=w(()=>{Ur();CN();Tn();sP();er();q$t=F(Yp()),H$t=require("obsidian"),Wi=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ae().plusLicenseKey)throw new H$t.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=ae().userId;let a=new URL(`${dA}${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 po(ae().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 J(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ae().userId);let o=new URL(`${dA}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await po(ae().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 J(`==== ${e} FormData request ====:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(){let{data:e,error:r}=await this.makeRequest("/license",{license_key:await po(ae().plusLicenseKey)},"POST",!0,!0);return r?r.message==="Invalid license key"?(aFe(),{isValid:!1}):{isValid:void 0}:(U$t(),{isValid:!0,plan:e?.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=q$t.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 lFe=v((TYo,G$t)=>{var fnn="Expected a function",W$t=NaN,pnn="[object Symbol]",mnn=/^\s+|\s+$/g,hnn=/^[-+]0x[0-9a-f]+$/i,gnn=/^0b[01]+$/i,ynn=/^0o[0-7]+$/i,bnn=parseInt,_nn=typeof window=="object"&&window&&window.Object===Object&&window,vnn=typeof self=="object"&&self&&self.Object===Object&&self,wnn=_nn||vnn||Function("return this")(),xnn=Object.prototype,Snn=xnn.toString,Cnn=Math.max,Onn=Math.min,sFe=function(){return wnn.Date.now()};function Pnn(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(fnn);e=K$t(e)||0,uFe(r)&&(c=!!r.leading,d="maxWait"in r,i=d?Cnn(K$t(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(E){var P=n,A=o;return n=o=void 0,l=E,a=t.apply(A,P),a}function m(E){return l=E,s=setTimeout(g,e),c?p(E):a}function h(E){var P=E-u,A=E-l,I=e-P;return d?Onn(I,i-A):I}function b(E){var P=E-u,A=E-l;return u===void 0||P>=e||P<0||d&&A>=i}function g(){var E=sFe();if(b(E))return y(E);s=setTimeout(g,h(E))}function y(E){return s=void 0,f&&n?p(E):(n=o=void 0,a)}function x(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function S(){return s===void 0?a:y(sFe())}function O(){var E=sFe(),P=b(E);if(n=arguments,o=this,u=E,P){if(s===void 0)return m(u);if(d)return s=setTimeout(g,e),p(u)}return s===void 0&&(s=setTimeout(g,e)),a}return O.cancel=x,O.flush=S,O}function uFe(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Enn(t){return!!t&&typeof t=="object"}function Tnn(t){return typeof t=="symbol"||Enn(t)&&Snn.call(t)==pnn}function K$t(t){if(typeof t=="number")return t;if(Tnn(t))return W$t;if(uFe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=uFe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(mnn,"");var r=gnn.test(t);return r||ynn.test(t)?bnn(t.slice(2),r?2:8):hnn.test(t)?W$t:+t}G$t.exports=Pnn});var izt=v((gFe,yFe)=>{(function(t,e){typeof gFe=="object"&&typeof yFe<"u"?yFe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(gFe,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 wM=v((bFe,_Fe)=>{(function(t,e){typeof bFe=="object"&&typeof _Fe<"u"?_Fe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(bFe,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={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(j){var $=["th","st","nd","rd"],k=j%100;return"["+j+($[(k-20)%10]||$[k]||$[0])+"]"}},g=function(j,$,k){var H=String(j);return!H||H.length>=$?j:""+Array($+1-H.length).join(k)+j},y={s:g,z:function(j){var $=-j.utcOffset(),k=Math.abs($),H=Math.floor(k/60),V=k%60;return($<=0?"+":"-")+g(H,2,"0")+":"+g(V,2,"0")},m:function j($,k){if($.date()<k.date())return-j(k,$);var H=12*(k.year()-$.year())+(k.month()-$.month()),V=$.clone().add(H,l),Q=k-V<0,Z=$.clone().add(H+(Q?-1:1),l);return+(-(H+(k-V)/(Q?V-Z:Z-V))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},x="en",S={};S[x]=b;var O="$isDayjsObject",E=function(j){return j instanceof R||!(!j||!j[O])},P=function j($,k,H){var V;if(!$)return x;if(typeof $=="string"){var Q=$.toLowerCase();S[Q]&&(V=Q),k&&(S[Q]=k,V=Q);var Z=$.split("-");if(!V&&Z.length>1)return j(Z[0])}else{var D=$.name;S[D]=$,V=D}return!H&&V&&(x=V),V||!H&&x},A=function(j,$){if(E(j))return j.clone();var k=typeof $=="object"?$:{};return k.date=j,k.args=arguments,new R(k)},I=y;I.l=P,I.i=E,I.w=function(j,$){return A(j,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var R=function(){function j(k){this.$L=P(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[O]=!0}var $=j.prototype;return $.parse=function(k){this.$d=function(H){var V=H.date,Q=H.utc;if(V===null)return new Date(NaN);if(I.u(V))return new Date;if(V instanceof Date)return new Date(V);if(typeof V=="string"&&!/Z$/i.test(V)){var Z=V.match(m);if(Z){var D=Z[2]-1||0,z=(Z[7]||"0").substring(0,3);return Q?new Date(Date.UTC(Z[1],D,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,z)):new Date(Z[1],D,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,z)}}return new Date(V)}(k),this.init()},$.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},$.$utils=function(){return I},$.isValid=function(){return this.$d.toString()!==p},$.isSame=function(k,H){var V=A(k);return this.startOf(H)<=V&&V<=this.endOf(H)},$.isAfter=function(k,H){return A(k)<this.startOf(H)},$.isBefore=function(k,H){return this.endOf(H)<A(k)},$.$g=function(k,H,V){return I.u(k)?this[H]:this.set(V,k)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(k,H){var V=this,Q=!!I.u(H)||H,Z=I.p(k),D=function(Y,se){var Te=I.w(V.$u?Date.UTC(V.$y,se,Y):new Date(V.$y,se,Y),V);return Q?Te:Te.endOf(s)},z=function(Y,se){return I.w(V.toDate()[Y].apply(V.toDate("s"),(Q?[0,0,0,0]:[23,59,59,999]).slice(se)),V)},B=this.$W,K=this.$M,q=this.$D,te="set"+(this.$u?"UTC":"");switch(Z){case d:return Q?D(1,0):D(31,11);case l:return Q?D(1,K):D(0,K+1);case u:var U=this.$locale().weekStart||0,W=(B<U?B+7:B)-U;return D(Q?q-W:q+(6-W),K);case s:case f:return z(te+"Hours",0);case a:return z(te+"Minutes",1);case i:return z(te+"Seconds",2);case o:return z(te+"Milliseconds",3);default:return this.clone()}},$.endOf=function(k){return this.startOf(k,!1)},$.$set=function(k,H){var V,Q=I.p(k),Z="set"+(this.$u?"UTC":""),D=(V={},V[s]=Z+"Date",V[f]=Z+"Date",V[l]=Z+"Month",V[d]=Z+"FullYear",V[a]=Z+"Hours",V[i]=Z+"Minutes",V[o]=Z+"Seconds",V[n]=Z+"Milliseconds",V)[Q],z=Q===s?this.$D+(H-this.$W):H;if(Q===l||Q===d){var B=this.clone().set(f,1);B.$d[D](z),B.init(),this.$d=B.set(f,Math.min(this.$D,B.daysInMonth())).$d}else D&&this.$d[D](z);return this.init(),this},$.set=function(k,H){return this.clone().$set(k,H)},$.get=function(k){return this[I.p(k)]()},$.add=function(k,H){var V,Q=this;k=Number(k);var Z=I.p(H),D=function(K){var q=A(Q);return I.w(q.date(q.date()+Math.round(K*k)),Q)};if(Z===l)return this.set(l,this.$M+k);if(Z===d)return this.set(d,this.$y+k);if(Z===s)return D(1);if(Z===u)return D(7);var z=(V={},V[i]=e,V[a]=r,V[o]=t,V)[Z]||1,B=this.$d.getTime()+k*z;return I.w(B,this)},$.subtract=function(k,H){return this.add(-1*k,H)},$.format=function(k){var H=this,V=this.$locale();if(!this.isValid())return V.invalidDate||p;var Q=k||"YYYY-MM-DDTHH:mm:ssZ",Z=I.z(this),D=this.$H,z=this.$m,B=this.$M,K=V.weekdays,q=V.months,te=V.meridiem,U=function(se,Te,de,Ue){return se&&(se[Te]||se(H,Q))||de[Te].slice(0,Ue)},W=function(se){return I.s(D%12||12,se,"0")},Y=te||function(se,Te,de){var Ue=se<12?"AM":"PM";return de?Ue.toLowerCase():Ue};return Q.replace(h,function(se,Te){return Te||function(de){switch(de){case"YY":return String(H.$y).slice(-2);case"YYYY":return I.s(H.$y,4,"0");case"M":return B+1;case"MM":return I.s(B+1,2,"0");case"MMM":return U(V.monthsShort,B,q,3);case"MMMM":return U(q,B);case"D":return H.$D;case"DD":return I.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return U(V.weekdaysMin,H.$W,K,2);case"ddd":return U(V.weekdaysShort,H.$W,K,3);case"dddd":return K[H.$W];case"H":return String(D);case"HH":return I.s(D,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return Y(D,z,!0);case"A":return Y(D,z,!1);case"m":return String(z);case"mm":return I.s(z,2,"0");case"s":return String(H.$s);case"ss":return I.s(H.$s,2,"0");case"SSS":return I.s(H.$ms,3,"0");case"Z":return Z}return null}(se)||Z.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(k,H,V){var Q,Z=this,D=I.p(H),z=A(k),B=(z.utcOffset()-this.utcOffset())*e,K=this-z,q=function(){return I.m(Z,z)};switch(D){case d:Q=q()/12;break;case l:Q=q();break;case c:Q=q()/3;break;case u:Q=(K-B)/6048e5;break;case s:Q=(K-B)/864e5;break;case a:Q=K/r;break;case i:Q=K/e;break;case o:Q=K/t;break;default:Q=K}return V?Q:I.a(Q)},$.daysInMonth=function(){return this.endOf(l).$D},$.$locale=function(){return S[this.$L]},$.locale=function(k,H){if(!k)return this.$L;var V=this.clone(),Q=P(k,H,!0);return Q&&(V.$L=Q),V},$.clone=function(){return I.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},j}(),N=R.prototype;return A.prototype=N,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(j){N[j[1]]=function($){return this.$g($,j[0],j[1])}}),A.extend=function(j,$){return j.$i||(j($,R,A),j.$i=!0),A},A.locale=P,A.isDayjs=E,A.unix=function(j){return A(1e3*j)},A.en=S[x],A.Ls=S,A.p={},A})});var Fo=v(eze=>{"use strict";Object.defineProperty(eze,"__esModule",{value:!0});eze.pathToFunc=Nln;var Rln=Object.prototype.hasOwnProperty;function Nln(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!Rln.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 ide=v(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.SDK_METADATA=cy.ServerList=cy.ServerEu=void 0;cy.serverURLFromOptions=Dln;var jln=Fo();cy.ServerEu="eu";cy.ServerList={[cy.ServerEu]:"https://api.mistral.ai"};function Dln(t){let e=t.serverURL,r={};if(!e){let o=t.server??cy.ServerEu;e=cy.ServerList[o]||""}let n=(0,jln.pathToFunc)(e)(r);return new URL(n)}cy.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 rze=v(tze=>{"use strict";Object.defineProperty(tze,"__esModule",{value:!0});tze.readableStreamToArrayBuffer=Lln;async function Lln(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 W2t=v(ade=>{"use strict";Object.defineProperty(ade,"__esModule",{value:!0});ade.CustomUserAgentHook=void 0;var Fln=ide(),nze=class{beforeRequest(e,r){let o=`mistral-client-typescript/${Fln.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};ade.CustomUserAgentHook=nze});var G2t=v(sde=>{"use strict";Object.defineProperty(sde,"__esModule",{value:!0});sde.DeprecationWarningHook=void 0;var K2t="x-model-deprecation-timestamp",oze=class{afterSuccess(e,r){return r.headers.has(K2t)&&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(K2t)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};sde.DeprecationWarningHook=oze});var J2t=v(ize=>{"use strict";Object.defineProperty(ize,"__esModule",{value:!0});ize.initHooks=zln;var kln=W2t(),$ln=G2t();function zln(t){let e=new kln.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new $ln.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var Z2t=v(ude=>{"use strict";Object.defineProperty(ude,"__esModule",{value:!0});ude.SDKHooks=void 0;var Bln=J2t(),aze=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,Bln.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}}};ude.SDKHooks=aze});var fze=v(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.ConnectionError=xm.RequestTimeoutError=xm.RequestAbortedError=xm.InvalidRequestError=xm.UnexpectedClientError=xm.HTTPClientError=void 0;var dR=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)}};xm.HTTPClientError=dR;var sze=class extends dR{constructor(){super(...arguments),this.name="UnexpectedClientError"}};xm.UnexpectedClientError=sze;var uze=class extends dR{constructor(){super(...arguments),this.name="InvalidRequestError"}};xm.InvalidRequestError=uze;var lze=class extends dR{constructor(){super(...arguments),this.name="RequestAbortedError"}};xm.RequestAbortedError=lze;var cze=class extends dR{constructor(){super(...arguments),this.name="RequestTimeoutError"}};xm.RequestTimeoutError=cze;var dze=class extends dR{constructor(){super(...arguments),this.name="ConnectionError"}};xm.ConnectionError=dze});var dy=v(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});c4.OK=Uln;c4.ERR=qln;c4.unwrap=Hln;c4.unwrapAsync=Vln;function Uln(t){return{ok:!0,value:t}}function qln(t){return{ok:!1,error:t}}function Hln(t){if(!t.ok)throw t.error;return t.value}async function Vln(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var XK=v(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.getParsedType=ta.ZodParsedType=ta.objectUtil=ta.util=void 0;var pze;(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})(pze||(ta.util=pze={}));var Y2t;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Y2t||(ta.objectUtil=Y2t={}));ta.ZodParsedType=pze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Wln=t=>{switch(typeof t){case"undefined":return ta.ZodParsedType.undefined;case"string":return ta.ZodParsedType.string;case"number":return Number.isNaN(t)?ta.ZodParsedType.nan:ta.ZodParsedType.number;case"boolean":return ta.ZodParsedType.boolean;case"function":return ta.ZodParsedType.function;case"bigint":return ta.ZodParsedType.bigint;case"symbol":return ta.ZodParsedType.symbol;case"object":return Array.isArray(t)?ta.ZodParsedType.array:t===null?ta.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ta.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?ta.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?ta.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?ta.ZodParsedType.date:ta.ZodParsedType.object;default:return ta.ZodParsedType.unknown}};ta.getParsedType=Wln});var lde=v(fR=>{"use strict";Object.defineProperty(fR,"__esModule",{value:!0});fR.ZodError=fR.quotelessJson=fR.ZodIssueCode=void 0;var X2t=XK();fR.ZodIssueCode=X2t.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 Kln=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");fR.quotelessJson=Kln;var QK=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,X2t.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()}};fR.ZodError=QK;QK.create=t=>new QK(t)});var hze=v(mze=>{"use strict";Object.defineProperty(mze,"__esModule",{value:!0});var Nf=lde(),rF=XK(),Gln=(t,e)=>{let r;switch(t.code){case Nf.ZodIssueCode.invalid_type:t.received===rF.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Nf.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,rF.util.jsonStringifyReplacer)}`;break;case Nf.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${rF.util.joinValues(t.keys,", ")}`;break;case Nf.ZodIssueCode.invalid_union:r="Invalid input";break;case Nf.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rF.util.joinValues(t.options)}`;break;case Nf.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${rF.util.joinValues(t.options)}, received '${t.received}'`;break;case Nf.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Nf.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Nf.ZodIssueCode.invalid_date:r="Invalid date";break;case Nf.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}"`:rF.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Nf.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 Nf.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 Nf.ZodIssueCode.custom:r="Invalid input";break;case Nf.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Nf.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Nf.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,rF.util.assertNever(t)}return{message:r}};mze.default=Gln});var cde=v(pR=>{"use strict";var Jln=pR&&pR.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pR,"__esModule",{value:!0});pR.defaultErrorMap=void 0;pR.setErrorMap=Zln;pR.getErrorMap=Yln;var Q2t=Jln(hze());pR.defaultErrorMap=Q2t.default;var e4t=Q2t.default;function Zln(t){e4t=t}function Yln(){return e4t}});var yze=v(Mi=>{"use strict";var Xln=Mi&&Mi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.isAsync=Mi.isValid=Mi.isDirty=Mi.isAborted=Mi.OK=Mi.DIRTY=Mi.INVALID=Mi.ParseStatus=Mi.EMPTY_PATH=Mi.makeIssue=void 0;Mi.addIssueToContext=tcn;var Qln=cde(),t4t=Xln(hze()),ecn=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}};Mi.makeIssue=ecn;Mi.EMPTY_PATH=[];function tcn(t,e){let r=(0,Qln.getErrorMap)(),n=(0,Mi.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===t4t.default?void 0:t4t.default].filter(o=>!!o)});t.common.issues.push(n)}var gze=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 Mi.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 Mi.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}}};Mi.ParseStatus=gze;Mi.INVALID=Object.freeze({status:"aborted"});var rcn=t=>({status:"dirty",value:t});Mi.DIRTY=rcn;var ncn=t=>({status:"valid",value:t});Mi.OK=ncn;var ocn=t=>t.status==="aborted";Mi.isAborted=ocn;var icn=t=>t.status==="dirty";Mi.isDirty=icn;var acn=t=>t.status==="valid";Mi.isValid=acn;var scn=t=>typeof Promise<"u"&&t instanceof Promise;Mi.isAsync=scn});var n4t=v(r4t=>{"use strict";Object.defineProperty(r4t,"__esModule",{value:!0})});var i4t=v(dde=>{"use strict";Object.defineProperty(dde,"__esModule",{value:!0});dde.errorUtil=void 0;var o4t;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(o4t||(dde.errorUtil=o4t={}))});var y4t=v(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.discriminatedUnion=ne.date=ne.boolean=ne.bigint=ne.array=ne.any=ne.coerce=ne.ZodFirstPartyTypeKind=ne.late=ne.ZodSchema=ne.Schema=ne.ZodReadonly=ne.ZodPipeline=ne.ZodBranded=ne.BRAND=ne.ZodNaN=ne.ZodCatch=ne.ZodDefault=ne.ZodNullable=ne.ZodOptional=ne.ZodTransformer=ne.ZodEffects=ne.ZodPromise=ne.ZodNativeEnum=ne.ZodEnum=ne.ZodLiteral=ne.ZodLazy=ne.ZodFunction=ne.ZodSet=ne.ZodMap=ne.ZodRecord=ne.ZodTuple=ne.ZodIntersection=ne.ZodDiscriminatedUnion=ne.ZodUnion=ne.ZodObject=ne.ZodArray=ne.ZodVoid=ne.ZodNever=ne.ZodUnknown=ne.ZodAny=ne.ZodNull=ne.ZodUndefined=ne.ZodSymbol=ne.ZodDate=ne.ZodBoolean=ne.ZodBigInt=ne.ZodNumber=ne.ZodString=ne.ZodType=void 0;ne.NEVER=ne.void=ne.unknown=ne.union=ne.undefined=ne.tuple=ne.transformer=ne.symbol=ne.string=ne.strictObject=ne.set=ne.record=ne.promise=ne.preprocess=ne.pipeline=ne.ostring=ne.optional=ne.onumber=ne.oboolean=ne.object=ne.number=ne.nullable=ne.null=ne.never=ne.nativeEnum=ne.nan=ne.map=ne.literal=ne.lazy=ne.intersection=ne.instanceof=ne.function=ne.enum=ne.effect=void 0;ne.datetimeRegex=c4t;ne.custom=f4t;var Ye=lde(),fde=cde(),Jt=i4t(),oe=yze(),st=XK(),py=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}},a4t=(t,e)=>{if((0,oe.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 ln(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var cn=class{get description(){return this._def.description}_getType(e){return(0,st.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,st.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new oe.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,st.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,oe.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,st.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return a4t(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,st.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,oe.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,oe.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,st.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,oe.isAsync)(o)?o:Promise.resolve(o));return a4t(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 jh({schema:this,typeName:Or.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 fy.create(this,this._def)}nullable(){return UC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return PE.create(this)}promise(){return gR.create(this,this._def)}or(e){return lF.create([this,e],this._def)}and(e){return cF.create(this,e,this._def)}transform(e){return new jh({...ln(this._def),schema:this,typeName:Or.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new hF({...ln(this._def),innerType:this,defaultValue:r,typeName:Or.ZodDefault})}brand(){return new eG({typeName:Or.ZodBranded,type:this,...ln(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new gF({...ln(this._def),innerType:this,catchValue:r,typeName:Or.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return tG.create(this,e)}readonly(){return yF.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};ne.ZodType=cn;ne.Schema=cn;ne.ZodSchema=cn;var ucn=/^c[^\s-]{8,}$/i,lcn=/^[0-9a-z]+$/,ccn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dcn=/^[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,fcn=/^[a-z0-9_-]{21}$/i,pcn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mcn=/^[-+]?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)?)??$/,hcn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gcn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bze,ycn=/^(?:(?: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])$/,bcn=/^(?:(?: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])$/,_cn=/^(([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]))$/,vcn=/^(([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])$/,wcn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xcn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,u4t="((\\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])))",Scn=new RegExp(`^${u4t}$`);function l4t(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 Ccn(t){return new RegExp(`^${l4t(t)}$`)}function c4t(t){let e=`${u4t}T${l4t(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 Ocn(t,e){return!!((e==="v4"||!e)&&ycn.test(t)||(e==="v6"||!e)&&_cn.test(t))}function Pcn(t,e){if(!pcn.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 Ecn(t,e){return!!((e==="v4"||!e)&&bcn.test(t)||(e==="v6"||!e)&&vcn.test(t))}var mR=class t extends cn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==st.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.string,received:i.parsedType}),oe.INVALID}let n=new oe.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,oe.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,oe.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,oe.addIssueToContext)(o,{code:Ye.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,oe.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")hcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"email",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")bze||(bze=new RegExp(gcn,"u")),bze.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"emoji",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")dcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"uuid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")fcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"nanoid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")ucn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"cuid",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")lcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"cuid2",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")ccn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.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,oe.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,oe.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,oe.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,oe.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,oe.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?c4t(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Scn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Ccn(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{code:Ye.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?mcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"duration",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Ocn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"ip",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Pcn(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"jwt",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Ecn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"cidr",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?wcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"base64",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?xcn.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,oe.addIssueToContext)(o,{validation:"base64url",code:Ye.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):st.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,...Jt.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Jt.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Jt.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Jt.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Jt.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Jt.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Jt.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Jt.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Jt.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Jt.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Jt.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Jt.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Jt.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Jt.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,...Jt.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,...Jt.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Jt.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Jt.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Jt.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Jt.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Jt.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Jt.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Jt.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Jt.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Jt.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}};ne.ZodString=mR;mR.create=t=>new mR({checks:[],typeName:Or.ZodString,coerce:t?.coerce??!1,...ln(t)});function Tcn(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 nF=class t extends cn{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)!==st.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.number,received:i.parsedType}),oe.INVALID}let n,o=new oe.ParseStatus;for(let i of this._def.checks)i.kind==="int"?st.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,oe.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,oe.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,oe.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"?Tcn(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,oe.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,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.not_finite,message:i.message}),o.dirty()):st.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Jt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Jt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Jt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Jt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Jt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Jt.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Jt.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Jt.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Jt.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Jt.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"&&st.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)}};ne.ZodNumber=nF;nF.create=t=>new nF({checks:[],typeName:Or.ZodNumber,coerce:t?.coerce||!1,...ln(t)});var oF=class t extends cn{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)!==st.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new oe.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,oe.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,oe.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,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):st.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.bigint,received:r.parsedType}),oe.INVALID}gte(e,r){return this.setLimit("min",e,!0,Jt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Jt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Jt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Jt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Jt.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:Jt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Jt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Jt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Jt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Jt.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}};ne.ZodBigInt=oF;oF.create=t=>new oF({checks:[],typeName:Or.ZodBigInt,coerce:t?.coerce??!1,...ln(t)});var iF=class extends cn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==st.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.boolean,received:n.parsedType}),oe.INVALID}return(0,oe.OK)(e.data)}};ne.ZodBoolean=iF;iF.create=t=>new iF({typeName:Or.ZodBoolean,coerce:t?.coerce||!1,...ln(t)});var aF=class t extends cn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==st.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.date,received:i.parsedType}),oe.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(i,{code:Ye.ZodIssueCode.invalid_date}),oe.INVALID}let n=new oe.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,oe.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,oe.addIssueToContext)(o,{code:Ye.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):st.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:Jt.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Jt.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}};ne.ZodDate=aF;aF.create=t=>new aF({checks:[],coerce:t?.coerce||!1,typeName:Or.ZodDate,...ln(t)});var f4=class extends cn{_parse(e){if(this._getType(e)!==st.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.symbol,received:n.parsedType}),oe.INVALID}return(0,oe.OK)(e.data)}};ne.ZodSymbol=f4;f4.create=t=>new f4({typeName:Or.ZodSymbol,...ln(t)});var sF=class extends cn{_parse(e){if(this._getType(e)!==st.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.undefined,received:n.parsedType}),oe.INVALID}return(0,oe.OK)(e.data)}};ne.ZodUndefined=sF;sF.create=t=>new sF({typeName:Or.ZodUndefined,...ln(t)});var uF=class extends cn{_parse(e){if(this._getType(e)!==st.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.null,received:n.parsedType}),oe.INVALID}return(0,oe.OK)(e.data)}};ne.ZodNull=uF;uF.create=t=>new uF({typeName:Or.ZodNull,...ln(t)});var hR=class extends cn{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,oe.OK)(e.data)}};ne.ZodAny=hR;hR.create=t=>new hR({typeName:Or.ZodAny,...ln(t)});var OE=class extends cn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,oe.OK)(e.data)}};ne.ZodUnknown=OE;OE.create=t=>new OE({typeName:Or.ZodUnknown,...ln(t)});var e_=class extends cn{_parse(e){let r=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.never,received:r.parsedType}),oe.INVALID}};ne.ZodNever=e_;e_.create=t=>new e_({typeName:Or.ZodNever,...ln(t)});var p4=class extends cn{_parse(e){if(this._getType(e)!==st.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.void,received:n.parsedType}),oe.INVALID}return(0,oe.OK)(e.data)}};ne.ZodVoid=p4;p4.create=t=>new p4({typeName:Or.ZodVoid,...ln(t)});var PE=class t extends cn{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==st.ZodParsedType.array)return(0,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.array,received:r.parsedType}),oe.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,oe.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,oe.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,oe.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 py(r,a,r.path,s)))).then(a=>oe.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new py(r,a,r.path,s)));return oe.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Jt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Jt.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Jt.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};ne.ZodArray=PE;PE.create=(t,e)=>new PE({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Or.ZodArray,...ln(e)});function d4(t){if(t instanceof Sm){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=fy.create(d4(n))}return new Sm({...t._def,shape:()=>e})}else return t instanceof PE?new PE({...t._def,type:d4(t.element)}):t instanceof fy?fy.create(d4(t.unwrap())):t instanceof UC?UC.create(d4(t.unwrap())):t instanceof BC?BC.create(t.items.map(e=>d4(e))):t}var Sm=class t extends cn{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=st.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==st.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(l,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.object,received:l.parsedType}),oe.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof e_&&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 py(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof e_){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,oe.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 py(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=>oe.ParseStatus.mergeObjectSync(n,l)):oe.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Jt.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:Jt.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:Or.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 st.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 st.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return d4(this)}partial(e){let r={};for(let n of st.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 st.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof fy;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return d4t(st.util.objectKeys(this.shape))}};ne.ZodObject=Sm;Sm.create=(t,e)=>new Sm({shape:()=>t,unknownKeys:"strip",catchall:e_.create(),typeName:Or.ZodObject,...ln(e)});Sm.strictCreate=(t,e)=>new Sm({shape:()=>t,unknownKeys:"strict",catchall:e_.create(),typeName:Or.ZodObject,...ln(e)});Sm.lazycreate=(t,e)=>new Sm({shape:t,unknownKeys:"strip",catchall:e_.create(),typeName:Or.ZodObject,...ln(e)});var lF=class extends cn{_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,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union,unionErrors:a}),oe.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,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union,unionErrors:s}),oe.INVALID}}get options(){return this._def.options}};ne.ZodUnion=lF;lF.create=(t,e)=>new lF({options:t,typeName:Or.ZodUnion,...ln(e)});var CE=t=>t instanceof dF?CE(t.schema):t instanceof jh?CE(t.innerType()):t instanceof fF?[t.value]:t instanceof pF?t.options:t instanceof mF?st.util.objectValues(t.enum):t instanceof hF?CE(t._def.innerType):t instanceof sF?[void 0]:t instanceof uF?[null]:t instanceof fy?[void 0,...CE(t.unwrap())]:t instanceof UC?[null,...CE(t.unwrap())]:t instanceof eG||t instanceof yF?CE(t.unwrap()):t instanceof gF?CE(t._def.innerType):[],pde=class t extends cn{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==st.ZodParsedType.object)return(0,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.object,received:r.parsedType}),oe.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,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe.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=CE(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:Or.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...ln(n)})}};ne.ZodDiscriminatedUnion=pde;function _ze(t,e){let r=(0,st.getParsedType)(t),n=(0,st.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===st.ZodParsedType.object&&n===st.ZodParsedType.object){let o=st.util.objectKeys(e),i=st.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=_ze(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===st.ZodParsedType.array&&n===st.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=_ze(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===st.ZodParsedType.date&&n===st.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var cF=class extends cn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,oe.isAborted)(i)||(0,oe.isAborted)(a))return oe.INVALID;let s=_ze(i.value,a.value);return s.valid?(((0,oe.isDirty)(i)||(0,oe.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_intersection_types}),oe.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}))}};ne.ZodIntersection=cF;cF.create=(t,e,r)=>new cF({left:t,right:e,typeName:Or.ZodIntersection,...ln(r)});var BC=class t extends cn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==st.ZodParsedType.array)return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.array,received:n.parsedType}),oe.INVALID;if(n.data.length<this._def.items.length)return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,oe.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 py(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>oe.ParseStatus.mergeArray(r,a)):oe.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ne.ZodTuple=BC;BC.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new BC({items:t,typeName:Or.ZodTuple,rest:null,...ln(e)})};var mde=class t extends cn{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!==st.ZodParsedType.object)return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.object,received:n.parsedType}),oe.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new py(n,s,n.path,s)),value:a._parse(new py(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?oe.ParseStatus.mergeObjectAsync(r,o):oe.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof cn?new t({keyType:e,valueType:r,typeName:Or.ZodRecord,...ln(n)}):new t({keyType:mR.create(),valueType:e,typeName:Or.ZodRecord,...ln(r)})}};ne.ZodRecord=mde;var m4=class extends cn{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!==st.ZodParsedType.map)return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.map,received:n.parsedType}),oe.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new py(n,s,n.path,[l,"key"])),value:i._parse(new py(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 oe.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 oe.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};ne.ZodMap=m4;m4.create=(t,e,r)=>new m4({valueType:e,keyType:t,typeName:Or.ZodMap,...ln(r)});var h4=class t extends cn{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==st.ZodParsedType.set)return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.set,received:n.parsedType}),oe.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,oe.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,oe.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 oe.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 py(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:Jt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Jt.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ne.ZodSet=h4;h4.create=(t,e)=>new h4({valueType:t,minSize:null,maxSize:null,typeName:Or.ZodSet,...ln(e)});var hde=class t extends cn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==st.ZodParsedType.function)return(0,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.function,received:r.parsedType}),oe.INVALID;function n(s,u){return(0,oe.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,fde.getErrorMap)(),fde.defaultErrorMap].filter(l=>!!l),issueData:{code:Ye.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,oe.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,fde.getErrorMap)(),fde.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 gR){let s=this;return(0,oe.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,oe.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:BC.create(e).rest(OE.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||BC.create([]).rest(OE.create()),returns:r||OE.create(),typeName:Or.ZodFunction,...ln(n)})}};ne.ZodFunction=hde;var dF=class extends cn{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})}};ne.ZodLazy=dF;dF.create=(t,e)=>new dF({getter:t,typeName:Or.ZodLazy,...ln(e)});var fF=class extends cn{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(r,{received:r.data,code:Ye.ZodIssueCode.invalid_literal,expected:this._def.value}),oe.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};ne.ZodLiteral=fF;fF.create=(t,e)=>new fF({value:t,typeName:Or.ZodLiteral,...ln(e)});function d4t(t,e){return new pF({values:t,typeName:Or.ZodEnum,...ln(e)})}var pF=class t extends cn{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,oe.addIssueToContext)(r,{expected:st.util.joinValues(n),received:r.parsedType,code:Ye.ZodIssueCode.invalid_type}),oe.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,oe.addIssueToContext)(r,{received:r.data,code:Ye.ZodIssueCode.invalid_enum_value,options:n}),oe.INVALID}return(0,oe.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})}};ne.ZodEnum=pF;pF.create=d4t;var mF=class extends cn{_parse(e){let r=st.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==st.ZodParsedType.string&&n.parsedType!==st.ZodParsedType.number){let o=st.util.objectValues(r);return(0,oe.addIssueToContext)(n,{expected:st.util.joinValues(o),received:n.parsedType,code:Ye.ZodIssueCode.invalid_type}),oe.INVALID}if(this._cache||(this._cache=new Set(st.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=st.util.objectValues(r);return(0,oe.addIssueToContext)(n,{received:n.data,code:Ye.ZodIssueCode.invalid_enum_value,options:o}),oe.INVALID}return(0,oe.OK)(e.data)}get enum(){return this._def.values}};ne.ZodNativeEnum=mF;mF.create=(t,e)=>new mF({values:t,typeName:Or.ZodNativeEnum,...ln(e)});var gR=class extends cn{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==st.ZodParsedType.promise&&r.common.async===!1)return(0,oe.addIssueToContext)(r,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.promise,received:r.parsedType}),oe.INVALID;let n=r.parsedType===st.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,oe.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ne.ZodPromise=gR;gR.create=(t,e)=>new gR({type:t,typeName:Or.ZodPromise,...ln(e)});var jh=class extends cn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Or.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,oe.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 oe.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?oe.INVALID:u.status==="dirty"||r.value==="dirty"?(0,oe.DIRTY)(u.value):u});{if(r.value==="aborted")return oe.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?oe.INVALID:s.status==="dirty"||r.value==="dirty"?(0,oe.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"?oe.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"?oe.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,oe.isValid)(a))return oe.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,oe.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):oe.INVALID);st.util.assertNever(o)}};ne.ZodEffects=jh;ne.ZodTransformer=jh;jh.create=(t,e,r)=>new jh({schema:t,typeName:Or.ZodEffects,effect:e,...ln(r)});jh.createWithPreprocess=(t,e,r)=>new jh({schema:e,effect:{type:"preprocess",transform:t},typeName:Or.ZodEffects,...ln(r)});var fy=class extends cn{_parse(e){return this._getType(e)===st.ZodParsedType.undefined?(0,oe.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ne.ZodOptional=fy;fy.create=(t,e)=>new fy({innerType:t,typeName:Or.ZodOptional,...ln(e)});var UC=class extends cn{_parse(e){return this._getType(e)===st.ZodParsedType.null?(0,oe.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ne.ZodNullable=UC;UC.create=(t,e)=>new UC({innerType:t,typeName:Or.ZodNullable,...ln(e)});var hF=class extends cn{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===st.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ne.ZodDefault=hF;hF.create=(t,e)=>new hF({innerType:t,typeName:Or.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ln(e)});var gF=class extends cn{_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,oe.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}};ne.ZodCatch=gF;gF.create=(t,e)=>new gF({innerType:t,typeName:Or.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ln(e)});var g4=class extends cn{_parse(e){if(this._getType(e)!==st.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,oe.addIssueToContext)(n,{code:Ye.ZodIssueCode.invalid_type,expected:st.ZodParsedType.nan,received:n.parsedType}),oe.INVALID}return{status:"valid",value:e.data}}};ne.ZodNaN=g4;g4.create=t=>new g4({typeName:Or.ZodNaN,...ln(t)});ne.BRAND=Symbol("zod_brand");var eG=class extends cn{_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}};ne.ZodBranded=eG;var tG=class t extends cn{_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"?oe.INVALID:i.status==="dirty"?(r.dirty(),(0,oe.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"?oe.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:Or.ZodPipeline})}};ne.ZodPipeline=tG;var yF=class extends cn{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,oe.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,oe.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ne.ZodReadonly=yF;yF.create=(t,e)=>new yF({innerType:t,typeName:Or.ZodReadonly,...ln(e)});function s4t(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function f4t(t,e={},r){return t?hR.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=s4t(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=s4t(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):hR.create()}ne.late={object:Sm.lazycreate};var Or;(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"})(Or||(ne.ZodFirstPartyTypeKind=Or={}));var Acn=(t,e={message:`Input not instance of ${t.name}`})=>f4t(r=>r instanceof t,e);ne.instanceof=Acn;var p4t=mR.create;ne.string=p4t;var m4t=nF.create;ne.number=m4t;var Icn=g4.create;ne.nan=Icn;var Mcn=oF.create;ne.bigint=Mcn;var h4t=iF.create;ne.boolean=h4t;var Rcn=aF.create;ne.date=Rcn;var Ncn=f4.create;ne.symbol=Ncn;var jcn=sF.create;ne.undefined=jcn;var Dcn=uF.create;ne.null=Dcn;var Lcn=hR.create;ne.any=Lcn;var Fcn=OE.create;ne.unknown=Fcn;var kcn=e_.create;ne.never=kcn;var $cn=p4.create;ne.void=$cn;var zcn=PE.create;ne.array=zcn;var Bcn=Sm.create;ne.object=Bcn;var Ucn=Sm.strictCreate;ne.strictObject=Ucn;var qcn=lF.create;ne.union=qcn;var Hcn=pde.create;ne.discriminatedUnion=Hcn;var Vcn=cF.create;ne.intersection=Vcn;var Wcn=BC.create;ne.tuple=Wcn;var Kcn=mde.create;ne.record=Kcn;var Gcn=m4.create;ne.map=Gcn;var Jcn=h4.create;ne.set=Jcn;var Zcn=hde.create;ne.function=Zcn;var Ycn=dF.create;ne.lazy=Ycn;var Xcn=fF.create;ne.literal=Xcn;var Qcn=pF.create;ne.enum=Qcn;var edn=mF.create;ne.nativeEnum=edn;var tdn=gR.create;ne.promise=tdn;var g4t=jh.create;ne.effect=g4t;ne.transformer=g4t;var rdn=fy.create;ne.optional=rdn;var ndn=UC.create;ne.nullable=ndn;var odn=jh.createWithPreprocess;ne.preprocess=odn;var idn=tG.create;ne.pipeline=idn;var adn=()=>p4t().optional();ne.ostring=adn;var sdn=()=>m4t().optional();ne.onumber=sdn;var udn=()=>h4t().optional();ne.oboolean=udn;ne.coerce={string:t=>mR.create({...t,coerce:!0}),number:t=>nF.create({...t,coerce:!0}),boolean:t=>iF.create({...t,coerce:!0}),bigint:t=>oF.create({...t,coerce:!0}),date:t=>aF.create({...t,coerce:!0})};ne.NEVER=oe.INVALID});var vze=v(my=>{"use strict";var ldn=my&&my.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=my&&my.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ldn(e,t,r)};Object.defineProperty(my,"__esModule",{value:!0});y4(cde(),my);y4(yze(),my);y4(n4t(),my);y4(XK(),my);y4(y4t(),my);y4(lde(),my)});var Ie=v(Cm=>{"use strict";var b4t=Cm&&Cm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cdn=Cm&&Cm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ddn=Cm&&Cm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b4t(e,t,r);return cdn(e,t),e},fdn=Cm&&Cm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&b4t(e,t,r)};Object.defineProperty(Cm,"__esModule",{value:!0});Cm.z=void 0;var _4t=ddn(vze());Cm.z=_4t;fdn(vze(),Cm);Cm.default=_4t});var Sze=v(Lc=>{"use strict";var pdn=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]}),mdn=Lc&&Lc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hdn=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)&&pdn(e,t,r);return mdn(e,t),e};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.zodInbound=Lc.zodOutbound=void 0;Lc.bytesToBase64=v4t;Lc.bytesFromBase64=wze;Lc.stringToBytes=xze;Lc.stringFromBytes=w4t;Lc.stringToBase64=gdn;Lc.stringFromBase64=ydn;var gde=hdn(Ie());function v4t(t){return btoa(String.fromCodePoint(...t))}function wze(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function xze(t){return new TextEncoder().encode(t)}function w4t(t){return new TextDecoder().decode(t)}function gdn(t){return v4t(xze(t))}function ydn(t){return w4t(wze(t))}Lc.zodOutbound=gde.instanceof(Uint8Array).or(gde.string().transform(xze));Lc.zodInbound=gde.instanceof(Uint8Array).or(gde.string().transform(wze))});var Oze=v(Cze=>{"use strict";Object.defineProperty(Cze,"__esModule",{value:!0});Cze.isPlainObject=bdn;function bdn(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 hi=v(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.encodeDeepObjectQuery=_o.encodePipeDelimitedQuery=_o.encodeSpaceDelimitedQuery=_o.encodeFormQuery=_o.encodeJSONQuery=_o.encodeSimple=_o.encodePipeDelimited=_o.encodeSpaceDelimited=_o.encodeForm=_o.EncodingError=void 0;_o.encodeMatrix=_dn;_o.encodeLabel=vdn;_o.encodeBodyForm=wdn;_o.encodeDeepObject=S4t;_o.encodeDeepObjectObject=Eze;_o.encodeJSON=C4t;_o.queryJoin=O4t;_o.queryEncoder=_4;_o.appendForm=Sdn;var x4t=Sze(),t_=Oze(),rG=class extends Error{constructor(e){super(e),this.name="EncodingError"}};_o.EncodingError=rG;function _dn(t,e,r){let n="",o=r?.explode?nG(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(b4(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=oG(u,f=>`${a(f)}`)?.join(","):(0,t_.isPlainObject)(u)?c=bde(Object.entries(u),([p,m])=>`,${i(p)},${a(m)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function vdn(t,e,r){let n="",o=r?.explode?nG(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(b4(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=oG(u,c=>`${a(c)}`)?.join("."):(0,t_.isPlainObject)(u)?l=bde(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,t_.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function Pze(t){return(e,r,n)=>{let o="",i=n?.explode?nG(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(b4(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=oG(c,p=>`${s(p)}`)?.join(u):(0,t_.isPlainObject)(c)?f=bde(Object.entries(c),([p,m])=>`${a(p)}${u}${s(m)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}_o.encodeForm=Pze(",");_o.encodeSpaceDelimited=Pze(" ");_o.encodePipeDelimited=Pze("|");function wdn(t,e,r){let n="",o=r?.explode?nG(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(b4(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,t_.isPlainObject)(u)?c=JSON.stringify(u,yde):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function S4t(t,e,r){if(e!=null){if(!(0,t_.isPlainObject)(e))throw new rG(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return Eze(t,e,r)}}function Eze(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,t_.isPlainObject)(e))throw new rG(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,t_.isPlainObject)(a)){let c=Eze(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=oG(u,c=>`${o(s)}=${o(b4(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function C4t(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,yde));return r?.explode?o:`${n(t)}=${o}`}var xdn=(t,e,r)=>{let n="",o=r?.explode?nG(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(b4(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=oG(u,c=>`${a(c)}`)?.join(","):(0,t_.isPlainObject)(u)?l=bde(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,t_.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};_o.encodeSimple=xdn;function nG(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,t_.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function b4(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,x4t.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,yde):`${t}`}function yde(t,e){return e instanceof Uint8Array?(0,x4t.bytesToBase64)(e):e}function oG(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 bde(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 O4t(...t){return t.filter(Boolean).join("&")}function _4(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 O4t(...i)}}_o.encodeJSONQuery=_4(C4t);_o.encodeFormQuery=_4(_o.encodeForm);_o.encodeSpaceDelimitedQuery=_4(_o.encodeSpaceDelimited);_o.encodePipeDelimitedQuery=_4(_o.encodePipeDelimited);_o.encodeDeepObjectQuery=_4(S4t);function Sdn(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 P4t=v(Tze=>{"use strict";Object.defineProperty(Tze,"__esModule",{value:!0});Tze.dlv=Cdn;function Cdn(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 Ize=v(Dh=>{"use strict";var Odn=Dh&&Dh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pdn=Dh&&Dh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Edn=Dh&&Dh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Odn(e,t,r);return Pdn(e,t),e};Object.defineProperty(Dh,"__esModule",{value:!0});Dh.envSchema=void 0;Dh.env=Tdn;Dh.resetEnv=Adn;var E4t=P4t(),Aze=Edn(Ie());Dh.envSchema=Aze.object({MISTRAL_API_KEY:Aze.string().optional(),MISTRAL_DEBUG:Aze.coerce.boolean().optional()});var iG;function Tdn(){return iG||(iG=Dh.envSchema.parse((0,E4t.dlv)(globalThis,"process.env")??(0,E4t.dlv)(globalThis,"Deno.env")??{}),iG)}function Adn(){iG=void 0}});var aG=v(qC=>{"use strict";Object.defineProperty(qC,"__esModule",{value:!0});qC.HTTPClient=void 0;qC.matchContentType=A4t;qC.matchStatusCode=I4t;qC.matchResponse=Rdn;qC.isConnectionError=Ndn;qC.isTimeoutError=jdn;qC.isAbortError=Ddn;var Idn=(t,e)=>e==null?fetch(t):fetch(t,e),Mze=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Idn}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}};qC.HTTPClient=Mze;var T4t=/\s*;\s*/g;function A4t(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(T4t),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(T4t),[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 Mdn=new RegExp("^[0-9]xx$","i");function I4t(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(!Mdn.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 Rdn(t,e,r){return I4t(t,e)&&A4t(t,r)}function Ndn(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 jdn(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 Ddn(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 R4t=v(_F=>{"use strict";Object.defineProperty(_F,"__esModule",{value:!0});_F.TemporaryError=_F.PermanentError=void 0;_F.retry=Fdn;var M4t=aG(),Ldn={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},sG=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)}};_F.PermanentError=sG;var bF=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};_F.TemporaryError=bF;async function Fdn(t,e){switch(e.config.strategy){case"backoff":return Bdn(kdn(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??Ldn);default:return await t()}}function kdn(t,e){return async()=>{try{let r=await t();if(zdn(r,e.statusCodes))throw new bF("Response failed with retryable status code",r);return r}catch(r){throw r instanceof bF||e.retryConnectionErrors&&((0,M4t.isTimeoutError)(r)||(0,M4t.isConnectionError)(r))?r:new sG("Permanent error",{cause:r})}}}var $dn=new RegExp("^[0-9]xx$","i");function zdn(t,e){let r=`${t.status}`;return e.some(n=>{if(!$dn.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 Bdn(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 sG)throw u.cause;if(Date.now()-a>r){if(u instanceof bF)return u.response;throw u}let c=0;u instanceof bF&&(c=Udn(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await qdn(d),s++}}function Udn(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 qdn(t){return new Promise(e=>setTimeout(e,t))}});var Lh=v(bR=>{"use strict";var uG=bR&&bR.__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=bR&&bR.__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)},vde,HC,EE;Object.defineProperty(bR,"__esModule",{value:!0});bR.ClientSDK=void 0;var N4t=Z2t(),v4=fze(),yR=dy(),Hdn=Sze(),j4t=ide(),Vdn=hi(),Wdn=Ize(),TE=aG(),Kdn=R4t(),_de=typeof globalThis>"u"?null:globalThis,Gdn=typeof _de=="object"&&_de!=null&&"importScripts"in _de&&typeof _de.importScripts=="function",Jdn=Gdn||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",Rze=class{constructor(e={}){vde.set(this,void 0),HC.set(this,void 0),EE.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof N4t.SDKHooks?uG(this,HC,r.hooks,"f"):uG(this,HC,new N4t.SDKHooks,"f"),this._options={...e,hooks:hy(this,HC,"f")};let n=(0,j4t.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=hy(this,HC,"f").sdkInit({baseURL:n,client:e.httpClient||new TE.HTTPClient});this._baseURL=o,uG(this,vde,i,"f"),uG(this,EE,e.debugLogger,"f"),!hy(this,EE,"f")&&(0,Wdn.env)().MISTRAL_DEBUG&&uG(this,EE,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,yR.ERR)(new v4.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 A=(0,Vdn.encodeForm)(E,P,{charEncoding:"percent"});typeof A<"u"&&p.push(A)}if(p.length&&(f+=`&${p.join("&")}`),f){let E=f.startsWith("&")?f.slice(1):f;c.search=`?${E}`}let m=new Headers(s),h=u?.basic.username,b=u?.basic.password;if(h!=null||b!=null){let E=(0,Hdn.stringToBase64)([h||"",b||""].join(":"));m.set("Authorization",`Basic ${E}`)}let g=new Headers(u?.headers||{});for(let[E,P]of g)m.set(E,P);let y=m.get("cookie")||"";for(let[E,P]of Object.entries(u?.cookies||{}))y+=`; ${E}=${P}`;y=y.startsWith("; ")?y.slice(2):y,m.set("cookie",y);let x=new Headers(n?.fetchOptions?.headers);for(let[E,P]of x)m.set(E,P);Jdn||m.set(r.uaHeader??"user-agent",j4t.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 O;try{O=hy(this,HC,"f").beforeCreateRequest(e,{url:c,options:{...S,body:r.body??null,headers:m,method:o}})}catch(E){return(0,yR.ERR)(new v4.UnexpectedClientError("Create request hook failed to execute",{cause:E}))}return(0,yR.OK)(new Request(O.url,O.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,Kdn.retry)(async()=>{let i=await hy(this,HC,"f").beforeRequest(n,e.clone());await Zdn(hy(this,EE,"f"),i).catch(s=>hy(this,EE,"f")?.log("Failed to log request:",s));let a=await hy(this,vde,"f").request(i);try{if((0,TE.matchStatusCode)(a,o)){let s=await hy(this,HC,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await hy(this,HC,"f").afterSuccess(n,a)}finally{await Ydn(hy(this,EE,"f"),a,i).catch(s=>hy(this,EE,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,yR.OK)(i),i=>{switch(!0){case(0,TE.isAbortError)(i):return(0,yR.ERR)(new v4.RequestAbortedError("Request aborted by client",{cause:i}));case(0,TE.isTimeoutError)(i):return(0,yR.ERR)(new v4.RequestTimeoutError("Request timed out",{cause:i}));case(0,TE.isConnectionError)(i):return(0,yR.ERR)(new v4.ConnectionError("Unable to make request",{cause:i}));default:return(0,yR.ERR)(new v4.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};bR.ClientSDK=Rze;vde=new WeakMap,HC=new WeakMap,EE=new WeakMap;var D4t=/^application\/(?:.{0,100}\+)?json/;async function Zdn(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 D4t.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 Ydn(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,TE.matchContentType)(e,"application/json")||D4t.test(o)):t.log(await e.clone().json());break;case(0,TE.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,TE.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,TE.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 jze=v(wde=>{"use strict";Object.defineProperty(wde,"__esModule",{value:!0});wde.SDKError=void 0;var Nze=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"}};wde.SDKError=Nze});var fG=v(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});dG.EventStream=void 0;dG.discardSentinel=efn;var lG=10,cG=13,L4t=new Set([lG,cG]),Xdn=[new Uint8Array([cG,lG,cG,lG]),new Uint8Array([cG,cG]),new Uint8Array([lG,lG])],Dze=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=F4t(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=Lze(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=Lze(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};dG.EventStream=Dze;function F4t(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!L4t.has(r)||!L4t.has(n))return null;for(let o of Xdn){let i=Qdn(e,t,o);if(i!=null)return i}return null}function Qdn(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 Lze(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 efn(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=F4t(n,d);if(f==null)continue;let p=o,m=n.slice(p,d);o=d+f.length,Lze(m,tfn)?.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 tfn(t){return t}});var $ze=v(r_=>{"use strict";var rfn=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]}),nfn=r_&&r_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ofn=r_&&r_.__importStar||function(t){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(r_,"__esModule",{value:!0});r_.SDKValidationError=void 0;r_.formatZodError=kze;var ifn=ofn(Ie()),Fze=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 ifn.ZodError?`${this.rawMessage}
|
||
${kze(this.cause)}`:this.toString()}};r_.SDKValidationError=Fze;function kze(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(`${kze(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var we=v(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});pG.parse=sfn;pG.safeParse=ufn;pG.collectExtraKeys=lfn;var afn=Ie(),$4t=$ze(),k4t=dy();function sfn(t,e,r){try{return e(t)}catch(n){throw n instanceof afn.ZodError?new $4t.SDKValidationError(r,n,t):n}}function ufn(t,e,r){try{return(0,k4t.OK)(e(t))}catch(n){return(0,k4t.ERR)(new $4t.SDKValidationError(r,n,t))}}function lfn(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 gi=v(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.jsonErr=ffn;Fc.json=pfn;Fc.textErr=mfn;Fc.text=hfn;Fc.bytesErr=gfn;Fc.bytes=yfn;Fc.streamErr=bfn;Fc.stream=_fn;Fc.sseErr=vfn;Fc.sse=wfn;Fc.nilErr=xfn;Fc.nil=Sfn;Fc.fail=Cfn;Fc.match=Ofn;Fc.unpackHeaders=xde;Fc.discardResponseBody=H4t;var z4t=jze(),cfn=fG(),B4t=aG(),U4t=Oze(),q4t=we(),dfn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function ffn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function pfn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function mfn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function hfn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function gfn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function yfn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function bfn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function _fn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function vfn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function wfn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function xfn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function Sfn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Cfn(t){return{enc:"fail",codes:t}}function Ofn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:dfn[l.enc];if(d&&(0,B4t.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,B4t.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new z4t.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,cfn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await H4t(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 z4t.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:xde(r.headers)}:null,...(0,U4t.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:xde(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:xde(r.headers)}:null,...(0,U4t.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,q4t.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,q4t.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var Pfn=/, */;function xde(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Pfn);return e}async function H4t(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var We=v(vF=>{"use strict";Object.defineProperty(vF,"__esModule",{value:!0});vF.invariant=Efn;vF.remap=Tfn;vF.combineSignals=Afn;vF.abortSignalAny=V4t;vF.compactMap=Ifn;var zze=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Efn(t,e){if(!t)throw new zze(e)}function Tfn(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 Afn(...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):V4t(e)}}function V4t(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 Ifn(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var yi=v(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.SecurityError=AE.SecurityErrorCode=void 0;AE.resolveSecurity=W4t;AE.resolveGlobalSecurity=Nfn;AE.extractSecurity=jfn;var Mfn=Ize(),Cde;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(Cde||(AE.SecurityErrorCode=Cde={}));var Ode=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(Cde.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(Cde.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};AE.SecurityError=Ode;function W4t(...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":Rfn(e,n);break;case"http:custom":break;case"http:bearer":Sde(e,n);break;case"oauth2":Sde(e,n);break;case"oauth2:password":Sde(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":Sde(e,n);break;default:throw Ode.unrecognizedType(o)}}),e)}function Rfn(t,e){e.value!=null&&(t.basic=e.value)}function Sde(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 Nfn(t){return W4t([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Mfn.env)().MISTRAL_API_KEY}])}async function jfn(t){if(t!=null)return typeof t=="function"?t():t}});var Bze=v(_u=>{"use strict";var Dfn=_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]}),Lfn=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ffn=_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)&&Dfn(e,t,r);return Lfn(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.ImageURL$=_u.ImageURL$outboundSchema=_u.ImageURL$inboundSchema=void 0;_u.imageURLToJSON=$fn;_u.imageURLFromJSON=zfn;var _R=Ffn(Ie()),kfn=we();_u.ImageURL$inboundSchema=_R.object({url:_R.string(),detail:_R.nullable(_R.string()).optional()});_u.ImageURL$outboundSchema=_R.object({url:_R.string(),detail:_R.nullable(_R.string()).optional()});var K4t;(function(t){t.inboundSchema=_u.ImageURL$inboundSchema,t.outboundSchema=_u.ImageURL$outboundSchema})(K4t||(_u.ImageURL$=K4t={}));function $fn(t){return JSON.stringify(_u.ImageURL$outboundSchema.parse(t))}function zfn(t){return(0,kfn.safeParse)(t,e=>_u.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var Uze=v(Lr=>{"use strict";var Bfn=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]}),Ufn=Lr&&Lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qfn=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)&&Bfn(e,t,r);return Ufn(e,t),e};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.ImageURLChunk$=Lr.ImageURLChunk$outboundSchema=Lr.ImageURLChunk$inboundSchema=Lr.ImageURLChunkType$=Lr.ImageURLChunkType$outboundSchema=Lr.ImageURLChunkType$inboundSchema=Lr.ImageURLChunkImageURL$=Lr.ImageURLChunkImageURL$outboundSchema=Lr.ImageURLChunkImageURL$inboundSchema=Lr.ImageURLChunkType=void 0;Lr.imageURLChunkImageURLToJSON=Hfn;Lr.imageURLChunkImageURLFromJSON=Vfn;Lr.imageURLChunkToJSON=Wfn;Lr.imageURLChunkFromJSON=Kfn;var n_=qfn(Ie()),Y4t=We(),X4t=we(),Pde=Bze();Lr.ImageURLChunkType={ImageUrl:"image_url"};Lr.ImageURLChunkImageURL$inboundSchema=n_.union([Pde.ImageURL$inboundSchema,n_.string()]);Lr.ImageURLChunkImageURL$outboundSchema=n_.union([Pde.ImageURL$outboundSchema,n_.string()]);var G4t;(function(t){t.inboundSchema=Lr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Lr.ImageURLChunkImageURL$outboundSchema})(G4t||(Lr.ImageURLChunkImageURL$=G4t={}));function Hfn(t){return JSON.stringify(Lr.ImageURLChunkImageURL$outboundSchema.parse(t))}function Vfn(t){return(0,X4t.safeParse)(t,e=>Lr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Lr.ImageURLChunkType$inboundSchema=n_.nativeEnum(Lr.ImageURLChunkType);Lr.ImageURLChunkType$outboundSchema=Lr.ImageURLChunkType$inboundSchema;var J4t;(function(t){t.inboundSchema=Lr.ImageURLChunkType$inboundSchema,t.outboundSchema=Lr.ImageURLChunkType$outboundSchema})(J4t||(Lr.ImageURLChunkType$=J4t={}));Lr.ImageURLChunk$inboundSchema=n_.object({image_url:n_.union([Pde.ImageURL$inboundSchema,n_.string()]),type:Lr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,Y4t.remap)(t,{image_url:"imageUrl"}));Lr.ImageURLChunk$outboundSchema=n_.object({imageUrl:n_.union([Pde.ImageURL$outboundSchema,n_.string()]),type:Lr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,Y4t.remap)(t,{imageUrl:"image_url"}));var Z4t;(function(t){t.inboundSchema=Lr.ImageURLChunk$inboundSchema,t.outboundSchema=Lr.ImageURLChunk$outboundSchema})(Z4t||(Lr.ImageURLChunk$=Z4t={}));function Wfn(t){return JSON.stringify(Lr.ImageURLChunk$outboundSchema.parse(t))}function Kfn(t){return(0,X4t.safeParse)(t,e=>Lr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var qze=v(vo=>{"use strict";var Gfn=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]}),Jfn=vo&&vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zfn=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)&&Gfn(e,t,r);return Jfn(e,t),e};Object.defineProperty(vo,"__esModule",{value:!0});vo.ReferenceChunk$=vo.ReferenceChunk$outboundSchema=vo.ReferenceChunk$inboundSchema=vo.ReferenceChunkType$=vo.ReferenceChunkType$outboundSchema=vo.ReferenceChunkType$inboundSchema=vo.ReferenceChunkType=void 0;vo.referenceChunkToJSON=Xfn;vo.referenceChunkFromJSON=Qfn;var wF=Zfn(Ie()),t3t=We(),Yfn=we();vo.ReferenceChunkType={Reference:"reference"};vo.ReferenceChunkType$inboundSchema=wF.nativeEnum(vo.ReferenceChunkType);vo.ReferenceChunkType$outboundSchema=vo.ReferenceChunkType$inboundSchema;var Q4t;(function(t){t.inboundSchema=vo.ReferenceChunkType$inboundSchema,t.outboundSchema=vo.ReferenceChunkType$outboundSchema})(Q4t||(vo.ReferenceChunkType$=Q4t={}));vo.ReferenceChunk$inboundSchema=wF.object({reference_ids:wF.array(wF.number().int()),type:vo.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,t3t.remap)(t,{reference_ids:"referenceIds"}));vo.ReferenceChunk$outboundSchema=wF.object({referenceIds:wF.array(wF.number().int()),type:vo.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,t3t.remap)(t,{referenceIds:"reference_ids"}));var e3t;(function(t){t.inboundSchema=vo.ReferenceChunk$inboundSchema,t.outboundSchema=vo.ReferenceChunk$outboundSchema})(e3t||(vo.ReferenceChunk$=e3t={}));function Xfn(t){return JSON.stringify(vo.ReferenceChunk$outboundSchema.parse(t))}function Qfn(t){return(0,Yfn.safeParse)(t,e=>vo.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var Ede=v(wo=>{"use strict";var epn=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]}),tpn=wo&&wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rpn=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)&&epn(e,t,r);return tpn(e,t),e};Object.defineProperty(wo,"__esModule",{value:!0});wo.TextChunk$=wo.TextChunk$outboundSchema=wo.TextChunk$inboundSchema=wo.TextChunkType$=wo.TextChunkType$outboundSchema=wo.TextChunkType$inboundSchema=wo.TextChunkType=void 0;wo.textChunkToJSON=opn;wo.textChunkFromJSON=ipn;var mG=rpn(Ie()),npn=we();wo.TextChunkType={Text:"text"};wo.TextChunkType$inboundSchema=mG.nativeEnum(wo.TextChunkType);wo.TextChunkType$outboundSchema=wo.TextChunkType$inboundSchema;var r3t;(function(t){t.inboundSchema=wo.TextChunkType$inboundSchema,t.outboundSchema=wo.TextChunkType$outboundSchema})(r3t||(wo.TextChunkType$=r3t={}));wo.TextChunk$inboundSchema=mG.object({text:mG.string(),type:wo.TextChunkType$inboundSchema.default("text")});wo.TextChunk$outboundSchema=mG.object({text:mG.string(),type:wo.TextChunkType$outboundSchema.default("text")});var n3t;(function(t){t.inboundSchema=wo.TextChunk$inboundSchema,t.outboundSchema=wo.TextChunk$outboundSchema})(n3t||(wo.TextChunk$=n3t={}));function opn(t){return JSON.stringify(wo.TextChunk$outboundSchema.parse(t))}function ipn(t){return(0,npn.safeParse)(t,e=>wo.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var w4=v(vu=>{"use strict";var apn=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]}),spn=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),upn=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)&&apn(e,t,r);return spn(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.ContentChunk$=vu.ContentChunk$outboundSchema=vu.ContentChunk$inboundSchema=void 0;vu.contentChunkToJSON=cpn;vu.contentChunkFromJSON=dpn;var Om=upn(Ie()),lpn=we(),i3t=Uze(),a3t=qze(),s3t=Ede();vu.ContentChunk$inboundSchema=Om.union([i3t.ImageURLChunk$inboundSchema.and(Om.object({type:Om.literal("image_url")}).transform(t=>({type:t.type}))),s3t.TextChunk$inboundSchema.and(Om.object({type:Om.literal("text")}).transform(t=>({type:t.type}))),a3t.ReferenceChunk$inboundSchema.and(Om.object({type:Om.literal("reference")}).transform(t=>({type:t.type})))]);vu.ContentChunk$outboundSchema=Om.union([i3t.ImageURLChunk$outboundSchema.and(Om.object({type:Om.literal("image_url")}).transform(t=>({type:t.type}))),s3t.TextChunk$outboundSchema.and(Om.object({type:Om.literal("text")}).transform(t=>({type:t.type}))),a3t.ReferenceChunk$outboundSchema.and(Om.object({type:Om.literal("reference")}).transform(t=>({type:t.type})))]);var o3t;(function(t){t.inboundSchema=vu.ContentChunk$inboundSchema,t.outboundSchema=vu.ContentChunk$outboundSchema})(o3t||(vu.ContentChunk$=o3t={}));function cpn(t){return JSON.stringify(vu.ContentChunk$outboundSchema.parse(t))}function dpn(t){return(0,lpn.safeParse)(t,e=>vu.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var Hze=v(ko=>{"use strict";var fpn=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]}),ppn=ko&&ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mpn=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)&&fpn(e,t,r);return ppn(e,t),e};Object.defineProperty(ko,"__esModule",{value:!0});ko.FunctionCall$=ko.FunctionCall$outboundSchema=ko.FunctionCall$inboundSchema=ko.Arguments$=ko.Arguments$outboundSchema=ko.Arguments$inboundSchema=void 0;ko.argumentsToJSON=hpn;ko.argumentsFromJSON=gpn;ko.functionCallToJSON=ypn;ko.functionCallFromJSON=bpn;var wu=mpn(Ie()),c3t=we();ko.Arguments$inboundSchema=wu.union([wu.record(wu.any()),wu.string()]);ko.Arguments$outboundSchema=wu.union([wu.record(wu.any()),wu.string()]);var u3t;(function(t){t.inboundSchema=ko.Arguments$inboundSchema,t.outboundSchema=ko.Arguments$outboundSchema})(u3t||(ko.Arguments$=u3t={}));function hpn(t){return JSON.stringify(ko.Arguments$outboundSchema.parse(t))}function gpn(t){return(0,c3t.safeParse)(t,e=>ko.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}ko.FunctionCall$inboundSchema=wu.object({name:wu.string(),arguments:wu.union([wu.record(wu.any()),wu.string()])});ko.FunctionCall$outboundSchema=wu.object({name:wu.string(),arguments:wu.union([wu.record(wu.any()),wu.string()])});var l3t;(function(t){t.inboundSchema=ko.FunctionCall$inboundSchema,t.outboundSchema=ko.FunctionCall$outboundSchema})(l3t||(ko.FunctionCall$=l3t={}));function ypn(t){return JSON.stringify(ko.FunctionCall$outboundSchema.parse(t))}function bpn(t){return(0,c3t.safeParse)(t,e=>ko.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var vR=v(Vze=>{"use strict";Object.defineProperty(Vze,"__esModule",{value:!0});Vze.catchUnrecognizedEnum=_pn;function _pn(t){return t}});var hG=v(xu=>{"use strict";var vpn=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]}),wpn=xu&&xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xpn=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)&&vpn(e,t,r);return wpn(e,t),e};Object.defineProperty(xu,"__esModule",{value:!0});xu.ToolTypes$=xu.ToolTypes$outboundSchema=xu.ToolTypes$inboundSchema=xu.ToolTypes=void 0;var xF=xpn(Ie()),Spn=vR();xu.ToolTypes={Function:"function"};xu.ToolTypes$inboundSchema=xF.union([xF.nativeEnum(xu.ToolTypes),xF.string().transform(Spn.catchUnrecognizedEnum)]);xu.ToolTypes$outboundSchema=xF.union([xF.nativeEnum(xu.ToolTypes),xF.string().and(xF.custom())]);var d3t;(function(t){t.inboundSchema=xu.ToolTypes$inboundSchema,t.outboundSchema=xu.ToolTypes$outboundSchema})(d3t||(xu.ToolTypes$=d3t={}))});var Tde=v(Su=>{"use strict";var Cpn=Su&&Su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Opn=Su&&Su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ppn=Su&&Su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cpn(e,t,r);return Opn(e,t),e};Object.defineProperty(Su,"__esModule",{value:!0});Su.ToolCall$=Su.ToolCall$outboundSchema=Su.ToolCall$inboundSchema=void 0;Su.toolCallToJSON=Tpn;Su.toolCallFromJSON=Apn;var x4=Ppn(Ie()),Epn=we(),p3t=Hze(),m3t=hG();Su.ToolCall$inboundSchema=x4.object({id:x4.string().default("null"),type:m3t.ToolTypes$inboundSchema.optional(),function:p3t.FunctionCall$inboundSchema,index:x4.number().int().default(0)});Su.ToolCall$outboundSchema=x4.object({id:x4.string().default("null"),type:m3t.ToolTypes$outboundSchema.optional(),function:p3t.FunctionCall$outboundSchema,index:x4.number().int().default(0)});var f3t;(function(t){t.inboundSchema=Su.ToolCall$inboundSchema,t.outboundSchema=Su.ToolCall$outboundSchema})(f3t||(Su.ToolCall$=f3t={}));function Tpn(t){return JSON.stringify(Su.ToolCall$outboundSchema.parse(t))}function Apn(t){return(0,Epn.safeParse)(t,e=>Su.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var wR=v(Fr=>{"use strict";var Ipn=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mpn=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rpn=Fr&&Fr.__importStar||function(t){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 Mpn(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.AssistantMessage$=Fr.AssistantMessage$outboundSchema=Fr.AssistantMessage$inboundSchema=Fr.AssistantMessageRole$=Fr.AssistantMessageRole$outboundSchema=Fr.AssistantMessageRole$inboundSchema=Fr.AssistantMessageContent$=Fr.AssistantMessageContent$outboundSchema=Fr.AssistantMessageContent$inboundSchema=Fr.AssistantMessageRole=void 0;Fr.assistantMessageContentToJSON=Npn;Fr.assistantMessageContentFromJSON=jpn;Fr.assistantMessageToJSON=Dpn;Fr.assistantMessageFromJSON=Lpn;var cs=Rpn(Ie()),b3t=We(),_3t=we(),Ade=w4(),v3t=Tde();Fr.AssistantMessageRole={Assistant:"assistant"};Fr.AssistantMessageContent$inboundSchema=cs.union([cs.string(),cs.array(Ade.ContentChunk$inboundSchema)]);Fr.AssistantMessageContent$outboundSchema=cs.union([cs.string(),cs.array(Ade.ContentChunk$outboundSchema)]);var h3t;(function(t){t.inboundSchema=Fr.AssistantMessageContent$inboundSchema,t.outboundSchema=Fr.AssistantMessageContent$outboundSchema})(h3t||(Fr.AssistantMessageContent$=h3t={}));function Npn(t){return JSON.stringify(Fr.AssistantMessageContent$outboundSchema.parse(t))}function jpn(t){return(0,_3t.safeParse)(t,e=>Fr.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Fr.AssistantMessageRole$inboundSchema=cs.nativeEnum(Fr.AssistantMessageRole);Fr.AssistantMessageRole$outboundSchema=Fr.AssistantMessageRole$inboundSchema;var g3t;(function(t){t.inboundSchema=Fr.AssistantMessageRole$inboundSchema,t.outboundSchema=Fr.AssistantMessageRole$outboundSchema})(g3t||(Fr.AssistantMessageRole$=g3t={}));Fr.AssistantMessage$inboundSchema=cs.object({content:cs.nullable(cs.union([cs.string(),cs.array(Ade.ContentChunk$inboundSchema)])).optional(),tool_calls:cs.nullable(cs.array(v3t.ToolCall$inboundSchema)).optional(),prefix:cs.boolean().default(!1),role:Fr.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,b3t.remap)(t,{tool_calls:"toolCalls"}));Fr.AssistantMessage$outboundSchema=cs.object({content:cs.nullable(cs.union([cs.string(),cs.array(Ade.ContentChunk$outboundSchema)])).optional(),toolCalls:cs.nullable(cs.array(v3t.ToolCall$outboundSchema)).optional(),prefix:cs.boolean().default(!1),role:Fr.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,b3t.remap)(t,{toolCalls:"tool_calls"}));var y3t;(function(t){t.inboundSchema=Fr.AssistantMessage$inboundSchema,t.outboundSchema=Fr.AssistantMessage$outboundSchema})(y3t||(Fr.AssistantMessage$=y3t={}));function Dpn(t){return JSON.stringify(Fr.AssistantMessage$outboundSchema.parse(t))}function Lpn(t){return(0,_3t.safeParse)(t,e=>Fr.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var S4=v($o=>{"use strict";var Fpn=$o&&$o.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=$o&&$o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$pn=$o&&$o.__importStar||function(t){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($o,"__esModule",{value:!0});$o.Prediction$=$o.Prediction$outboundSchema=$o.Prediction$inboundSchema=$o.PredictionType$=$o.PredictionType$outboundSchema=$o.PredictionType$inboundSchema=$o.PredictionType=void 0;$o.predictionToJSON=Bpn;$o.predictionFromJSON=Upn;var SF=$pn(Ie()),zpn=we();$o.PredictionType={Content:"content"};$o.PredictionType$inboundSchema=SF.nativeEnum($o.PredictionType);$o.PredictionType$outboundSchema=$o.PredictionType$inboundSchema;var w3t;(function(t){t.inboundSchema=$o.PredictionType$inboundSchema,t.outboundSchema=$o.PredictionType$outboundSchema})(w3t||($o.PredictionType$=w3t={}));$o.Prediction$inboundSchema=SF.object({type:SF.literal("content").default("content"),content:SF.string().default("")});$o.Prediction$outboundSchema=SF.object({type:SF.literal("content").default("content"),content:SF.string().default("")});var x3t;(function(t){t.inboundSchema=$o.Prediction$inboundSchema,t.outboundSchema=$o.Prediction$outboundSchema})(x3t||($o.Prediction$=x3t={}));function Bpn(t){return JSON.stringify($o.Prediction$outboundSchema.parse(t))}function Upn(t){return(0,zpn.safeParse)(t,e=>$o.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var Wze=v(Cu=>{"use strict";var qpn=Cu&&Cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vpn=Cu&&Cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qpn(e,t,r);return Hpn(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.JsonSchema$=Cu.JsonSchema$outboundSchema=Cu.JsonSchema$inboundSchema=void 0;Cu.jsonSchemaToJSON=Kpn;Cu.jsonSchemaFromJSON=Gpn;var Pm=Vpn(Ie()),C3t=We(),Wpn=we();Cu.JsonSchema$inboundSchema=Pm.object({name:Pm.string(),description:Pm.nullable(Pm.string()).optional(),schema:Pm.record(Pm.any()),strict:Pm.boolean().default(!1)}).transform(t=>(0,C3t.remap)(t,{schema:"schemaDefinition"}));Cu.JsonSchema$outboundSchema=Pm.object({name:Pm.string(),description:Pm.nullable(Pm.string()).optional(),schemaDefinition:Pm.record(Pm.any()),strict:Pm.boolean().default(!1)}).transform(t=>(0,C3t.remap)(t,{schemaDefinition:"schema"}));var S3t;(function(t){t.inboundSchema=Cu.JsonSchema$inboundSchema,t.outboundSchema=Cu.JsonSchema$outboundSchema})(S3t||(Cu.JsonSchema$=S3t={}));function Kpn(t){return JSON.stringify(Cu.JsonSchema$outboundSchema.parse(t))}function Gpn(t){return(0,Wpn.safeParse)(t,e=>Cu.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var Kze=v(Ou=>{"use strict";var Jpn=Ou&&Ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zpn=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ypn=Ou&&Ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jpn(e,t,r);return Zpn(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.ResponseFormats$=Ou.ResponseFormats$outboundSchema=Ou.ResponseFormats$inboundSchema=Ou.ResponseFormats=void 0;var Xpn=Ypn(Ie());Ou.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Ou.ResponseFormats$inboundSchema=Xpn.nativeEnum(Ou.ResponseFormats);Ou.ResponseFormats$outboundSchema=Ou.ResponseFormats$inboundSchema;var O3t;(function(t){t.inboundSchema=Ou.ResponseFormats$inboundSchema,t.outboundSchema=Ou.ResponseFormats$outboundSchema})(O3t||(Ou.ResponseFormats$=O3t={}))});var C4=v(Pu=>{"use strict";var Qpn=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),emn=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tmn=Pu&&Pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qpn(e,t,r);return emn(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.ResponseFormat$=Pu.ResponseFormat$outboundSchema=Pu.ResponseFormat$inboundSchema=void 0;Pu.responseFormatToJSON=nmn;Pu.responseFormatFromJSON=omn;var Ide=tmn(Ie()),E3t=We(),rmn=we(),T3t=Wze(),A3t=Kze();Pu.ResponseFormat$inboundSchema=Ide.object({type:A3t.ResponseFormats$inboundSchema.optional(),json_schema:Ide.nullable(T3t.JsonSchema$inboundSchema).optional()}).transform(t=>(0,E3t.remap)(t,{json_schema:"jsonSchema"}));Pu.ResponseFormat$outboundSchema=Ide.object({type:A3t.ResponseFormats$outboundSchema.optional(),jsonSchema:Ide.nullable(T3t.JsonSchema$outboundSchema).optional()}).transform(t=>(0,E3t.remap)(t,{jsonSchema:"json_schema"}));var P3t;(function(t){t.inboundSchema=Pu.ResponseFormat$inboundSchema,t.outboundSchema=Pu.ResponseFormat$outboundSchema})(P3t||(Pu.ResponseFormat$=P3t={}));function nmn(t){return JSON.stringify(Pu.ResponseFormat$outboundSchema.parse(t))}function omn(t){return(0,rmn.safeParse)(t,e=>Pu.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var CF=v(kr=>{"use strict";var imn=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]}),amn=kr&&kr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),smn=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)&&imn(e,t,r);return amn(e,t),e};Object.defineProperty(kr,"__esModule",{value:!0});kr.SystemMessage$=kr.SystemMessage$outboundSchema=kr.SystemMessage$inboundSchema=kr.Role$=kr.Role$outboundSchema=kr.Role$inboundSchema=kr.SystemMessageContent$=kr.SystemMessageContent$outboundSchema=kr.SystemMessageContent$inboundSchema=kr.Role=void 0;kr.systemMessageContentToJSON=umn;kr.systemMessageContentFromJSON=lmn;kr.systemMessageToJSON=cmn;kr.systemMessageFromJSON=dmn;var vp=smn(Ie()),N3t=we(),Mde=Ede();kr.Role={System:"system"};kr.SystemMessageContent$inboundSchema=vp.union([vp.string(),vp.array(Mde.TextChunk$inboundSchema)]);kr.SystemMessageContent$outboundSchema=vp.union([vp.string(),vp.array(Mde.TextChunk$outboundSchema)]);var I3t;(function(t){t.inboundSchema=kr.SystemMessageContent$inboundSchema,t.outboundSchema=kr.SystemMessageContent$outboundSchema})(I3t||(kr.SystemMessageContent$=I3t={}));function umn(t){return JSON.stringify(kr.SystemMessageContent$outboundSchema.parse(t))}function lmn(t){return(0,N3t.safeParse)(t,e=>kr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}kr.Role$inboundSchema=vp.nativeEnum(kr.Role);kr.Role$outboundSchema=kr.Role$inboundSchema;var M3t;(function(t){t.inboundSchema=kr.Role$inboundSchema,t.outboundSchema=kr.Role$outboundSchema})(M3t||(kr.Role$=M3t={}));kr.SystemMessage$inboundSchema=vp.object({content:vp.union([vp.string(),vp.array(Mde.TextChunk$inboundSchema)]),role:kr.Role$inboundSchema.default("system")});kr.SystemMessage$outboundSchema=vp.object({content:vp.union([vp.string(),vp.array(Mde.TextChunk$outboundSchema)]),role:kr.Role$outboundSchema.default("system")});var R3t;(function(t){t.inboundSchema=kr.SystemMessage$inboundSchema,t.outboundSchema=kr.SystemMessage$outboundSchema})(R3t||(kr.SystemMessage$=R3t={}));function cmn(t){return JSON.stringify(kr.SystemMessage$outboundSchema.parse(t))}function dmn(t){return(0,N3t.safeParse)(t,e=>kr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var Gze=v(Eu=>{"use strict";var fmn=Eu&&Eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mmn=Eu&&Eu.__importStar||function(t){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 pmn(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.FunctionT$=Eu.FunctionT$outboundSchema=Eu.FunctionT$inboundSchema=void 0;Eu.functionToJSON=gmn;Eu.functionFromJSON=ymn;var gy=mmn(Ie()),hmn=we();Eu.FunctionT$inboundSchema=gy.object({name:gy.string(),description:gy.string().default(""),strict:gy.boolean().default(!1),parameters:gy.record(gy.any())});Eu.FunctionT$outboundSchema=gy.object({name:gy.string(),description:gy.string().default(""),strict:gy.boolean().default(!1),parameters:gy.record(gy.any())});var j3t;(function(t){t.inboundSchema=Eu.FunctionT$inboundSchema,t.outboundSchema=Eu.FunctionT$outboundSchema})(j3t||(Eu.FunctionT$=j3t={}));function gmn(t){return JSON.stringify(Eu.FunctionT$outboundSchema.parse(t))}function ymn(t){return(0,hmn.safeParse)(t,e=>Eu.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var O4=v(Tu=>{"use strict";var bmn=Tu&&Tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_mn=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vmn=Tu&&Tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bmn(e,t,r);return _mn(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.Tool$=Tu.Tool$outboundSchema=Tu.Tool$inboundSchema=void 0;Tu.toolToJSON=xmn;Tu.toolFromJSON=Smn;var L3t=vmn(Ie()),wmn=we(),F3t=Gze(),k3t=hG();Tu.Tool$inboundSchema=L3t.object({type:k3t.ToolTypes$inboundSchema.optional(),function:F3t.FunctionT$inboundSchema});Tu.Tool$outboundSchema=L3t.object({type:k3t.ToolTypes$outboundSchema.optional(),function:F3t.FunctionT$outboundSchema});var D3t;(function(t){t.inboundSchema=Tu.Tool$inboundSchema,t.outboundSchema=Tu.Tool$outboundSchema})(D3t||(Tu.Tool$=D3t={}));function xmn(t){return JSON.stringify(Tu.Tool$outboundSchema.parse(t))}function Smn(t){return(0,wmn.safeParse)(t,e=>Tu.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var Jze=v(Au=>{"use strict";var Cmn=Au&&Au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Omn=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pmn=Au&&Au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cmn(e,t,r);return Omn(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.FunctionName$=Au.FunctionName$outboundSchema=Au.FunctionName$inboundSchema=void 0;Au.functionNameToJSON=Tmn;Au.functionNameFromJSON=Amn;var Rde=Pmn(Ie()),Emn=we();Au.FunctionName$inboundSchema=Rde.object({name:Rde.string()});Au.FunctionName$outboundSchema=Rde.object({name:Rde.string()});var $3t;(function(t){t.inboundSchema=Au.FunctionName$inboundSchema,t.outboundSchema=Au.FunctionName$outboundSchema})($3t||(Au.FunctionName$=$3t={}));function Tmn(t){return JSON.stringify(Au.FunctionName$outboundSchema.parse(t))}function Amn(t){return(0,Emn.safeParse)(t,e=>Au.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var P4=v(Iu=>{"use strict";var Imn=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mmn=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rmn=Iu&&Iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Imn(e,t,r);return Mmn(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ToolChoice$=Iu.ToolChoice$outboundSchema=Iu.ToolChoice$inboundSchema=void 0;Iu.toolChoiceToJSON=jmn;Iu.toolChoiceFromJSON=Dmn;var B3t=Rmn(Ie()),Nmn=we(),U3t=Jze(),q3t=hG();Iu.ToolChoice$inboundSchema=B3t.object({type:q3t.ToolTypes$inboundSchema.optional(),function:U3t.FunctionName$inboundSchema});Iu.ToolChoice$outboundSchema=B3t.object({type:q3t.ToolTypes$outboundSchema.optional(),function:U3t.FunctionName$outboundSchema});var z3t;(function(t){t.inboundSchema=Iu.ToolChoice$inboundSchema,t.outboundSchema=Iu.ToolChoice$outboundSchema})(z3t||(Iu.ToolChoice$=z3t={}));function jmn(t){return JSON.stringify(Iu.ToolChoice$outboundSchema.parse(t))}function Dmn(t){return(0,Nmn.safeParse)(t,e=>Iu.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var E4=v(Mu=>{"use strict";var Lmn=Mu&&Mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fmn=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kmn=Mu&&Mu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lmn(e,t,r);return Fmn(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.ToolChoiceEnum$=Mu.ToolChoiceEnum$outboundSchema=Mu.ToolChoiceEnum$inboundSchema=Mu.ToolChoiceEnum=void 0;var $mn=kmn(Ie());Mu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Mu.ToolChoiceEnum$inboundSchema=$mn.nativeEnum(Mu.ToolChoiceEnum);Mu.ToolChoiceEnum$outboundSchema=Mu.ToolChoiceEnum$inboundSchema;var H3t;(function(t){t.inboundSchema=Mu.ToolChoiceEnum$inboundSchema,t.outboundSchema=Mu.ToolChoiceEnum$outboundSchema})(H3t||(Mu.ToolChoiceEnum$=H3t={}))});var OF=v($r=>{"use strict";var zmn=$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]}),Bmn=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Umn=$r&&$r.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zmn(e,t,r);return Bmn(e,t),e};Object.defineProperty($r,"__esModule",{value:!0});$r.ToolMessage$=$r.ToolMessage$outboundSchema=$r.ToolMessage$inboundSchema=$r.ToolMessageRole$=$r.ToolMessageRole$outboundSchema=$r.ToolMessageRole$inboundSchema=$r.ToolMessageContent$=$r.ToolMessageContent$outboundSchema=$r.ToolMessageContent$inboundSchema=$r.ToolMessageRole=void 0;$r.toolMessageContentToJSON=qmn;$r.toolMessageContentFromJSON=Hmn;$r.toolMessageToJSON=Vmn;$r.toolMessageFromJSON=Wmn;var Sa=Umn(Ie()),G3t=We(),J3t=we(),Nde=w4();$r.ToolMessageRole={Tool:"tool"};$r.ToolMessageContent$inboundSchema=Sa.union([Sa.string(),Sa.array(Nde.ContentChunk$inboundSchema)]);$r.ToolMessageContent$outboundSchema=Sa.union([Sa.string(),Sa.array(Nde.ContentChunk$outboundSchema)]);var V3t;(function(t){t.inboundSchema=$r.ToolMessageContent$inboundSchema,t.outboundSchema=$r.ToolMessageContent$outboundSchema})(V3t||($r.ToolMessageContent$=V3t={}));function qmn(t){return JSON.stringify($r.ToolMessageContent$outboundSchema.parse(t))}function Hmn(t){return(0,J3t.safeParse)(t,e=>$r.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}$r.ToolMessageRole$inboundSchema=Sa.nativeEnum($r.ToolMessageRole);$r.ToolMessageRole$outboundSchema=$r.ToolMessageRole$inboundSchema;var W3t;(function(t){t.inboundSchema=$r.ToolMessageRole$inboundSchema,t.outboundSchema=$r.ToolMessageRole$outboundSchema})(W3t||($r.ToolMessageRole$=W3t={}));$r.ToolMessage$inboundSchema=Sa.object({content:Sa.nullable(Sa.union([Sa.string(),Sa.array(Nde.ContentChunk$inboundSchema)])),tool_call_id:Sa.nullable(Sa.string()).optional(),name:Sa.nullable(Sa.string()).optional(),role:$r.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,G3t.remap)(t,{tool_call_id:"toolCallId"}));$r.ToolMessage$outboundSchema=Sa.object({content:Sa.nullable(Sa.union([Sa.string(),Sa.array(Nde.ContentChunk$outboundSchema)])),toolCallId:Sa.nullable(Sa.string()).optional(),name:Sa.nullable(Sa.string()).optional(),role:$r.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,G3t.remap)(t,{toolCallId:"tool_call_id"}));var K3t;(function(t){t.inboundSchema=$r.ToolMessage$inboundSchema,t.outboundSchema=$r.ToolMessage$outboundSchema})(K3t||($r.ToolMessage$=K3t={}));function Vmn(t){return JSON.stringify($r.ToolMessage$outboundSchema.parse(t))}function Wmn(t){return(0,J3t.safeParse)(t,e=>$r.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var PF=v(zr=>{"use strict";var Kmn=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]}),Gmn=zr&&zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jmn=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)&&Kmn(e,t,r);return Gmn(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=Zmn;zr.userMessageContentFromJSON=Ymn;zr.userMessageToJSON=Xmn;zr.userMessageFromJSON=Qmn;var Ed=Jmn(Ie()),Q3t=we(),jde=w4();zr.UserMessageRole={User:"user"};zr.UserMessageContent$inboundSchema=Ed.union([Ed.string(),Ed.array(jde.ContentChunk$inboundSchema)]);zr.UserMessageContent$outboundSchema=Ed.union([Ed.string(),Ed.array(jde.ContentChunk$outboundSchema)]);var Z3t;(function(t){t.inboundSchema=zr.UserMessageContent$inboundSchema,t.outboundSchema=zr.UserMessageContent$outboundSchema})(Z3t||(zr.UserMessageContent$=Z3t={}));function Zmn(t){return JSON.stringify(zr.UserMessageContent$outboundSchema.parse(t))}function Ymn(t){return(0,Q3t.safeParse)(t,e=>zr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}zr.UserMessageRole$inboundSchema=Ed.nativeEnum(zr.UserMessageRole);zr.UserMessageRole$outboundSchema=zr.UserMessageRole$inboundSchema;var Y3t;(function(t){t.inboundSchema=zr.UserMessageRole$inboundSchema,t.outboundSchema=zr.UserMessageRole$outboundSchema})(Y3t||(zr.UserMessageRole$=Y3t={}));zr.UserMessage$inboundSchema=Ed.object({content:Ed.nullable(Ed.union([Ed.string(),Ed.array(jde.ContentChunk$inboundSchema)])),role:zr.UserMessageRole$inboundSchema.default("user")});zr.UserMessage$outboundSchema=Ed.object({content:Ed.nullable(Ed.union([Ed.string(),Ed.array(jde.ContentChunk$outboundSchema)])),role:zr.UserMessageRole$outboundSchema.default("user")});var X3t;(function(t){t.inboundSchema=zr.UserMessage$inboundSchema,t.outboundSchema=zr.UserMessage$outboundSchema})(X3t||(zr.UserMessage$=X3t={}));function Xmn(t){return JSON.stringify(zr.UserMessage$outboundSchema.parse(t))}function Qmn(t){return(0,Q3t.safeParse)(t,e=>zr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var uHt=v(rr=>{"use strict";var ehn=rr&&rr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),thn=rr&&rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rhn=rr&&rr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ehn(e,t,r);return thn(e,t),e};Object.defineProperty(rr,"__esModule",{value:!0});rr.AgentsCompletionRequest$=rr.AgentsCompletionRequest$outboundSchema=rr.AgentsCompletionRequest$inboundSchema=rr.AgentsCompletionRequestToolChoice$=rr.AgentsCompletionRequestToolChoice$outboundSchema=rr.AgentsCompletionRequestToolChoice$inboundSchema=rr.AgentsCompletionRequestMessages$=rr.AgentsCompletionRequestMessages$outboundSchema=rr.AgentsCompletionRequestMessages$inboundSchema=rr.AgentsCompletionRequestStop$=rr.AgentsCompletionRequestStop$outboundSchema=rr.AgentsCompletionRequestStop$inboundSchema=void 0;rr.agentsCompletionRequestStopToJSON=nhn;rr.agentsCompletionRequestStopFromJSON=ohn;rr.agentsCompletionRequestMessagesToJSON=ihn;rr.agentsCompletionRequestMessagesFromJSON=ahn;rr.agentsCompletionRequestToolChoiceToJSON=shn;rr.agentsCompletionRequestToolChoiceFromJSON=uhn;rr.agentsCompletionRequestToJSON=lhn;rr.agentsCompletionRequestFromJSON=chn;var rt=rhn(Ie()),oHt=We(),Dde=we(),Lde=wR(),iHt=S4(),aHt=C4(),Fde=CF(),sHt=O4(),kde=P4(),$de=E4(),zde=OF(),Bde=PF();rr.AgentsCompletionRequestStop$inboundSchema=rt.union([rt.string(),rt.array(rt.string())]);rr.AgentsCompletionRequestStop$outboundSchema=rt.union([rt.string(),rt.array(rt.string())]);var eHt;(function(t){t.inboundSchema=rr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequestStop$outboundSchema})(eHt||(rr.AgentsCompletionRequestStop$=eHt={}));function nhn(t){return JSON.stringify(rr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function ohn(t){return(0,Dde.safeParse)(t,e=>rr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}rr.AgentsCompletionRequestMessages$inboundSchema=rt.union([Fde.SystemMessage$inboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Bde.UserMessage$inboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Lde.AssistantMessage$inboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),zde.ToolMessage$inboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))]);rr.AgentsCompletionRequestMessages$outboundSchema=rt.union([Fde.SystemMessage$outboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Bde.UserMessage$outboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Lde.AssistantMessage$outboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),zde.ToolMessage$outboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))]);var tHt;(function(t){t.inboundSchema=rr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequestMessages$outboundSchema})(tHt||(rr.AgentsCompletionRequestMessages$=tHt={}));function ihn(t){return JSON.stringify(rr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function ahn(t){return(0,Dde.safeParse)(t,e=>rr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}rr.AgentsCompletionRequestToolChoice$inboundSchema=rt.union([kde.ToolChoice$inboundSchema,$de.ToolChoiceEnum$inboundSchema]);rr.AgentsCompletionRequestToolChoice$outboundSchema=rt.union([kde.ToolChoice$outboundSchema,$de.ToolChoiceEnum$outboundSchema]);var rHt;(function(t){t.inboundSchema=rr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequestToolChoice$outboundSchema})(rHt||(rr.AgentsCompletionRequestToolChoice$=rHt={}));function shn(t){return JSON.stringify(rr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function uhn(t){return(0,Dde.safeParse)(t,e=>rr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}rr.AgentsCompletionRequest$inboundSchema=rt.object({max_tokens:rt.nullable(rt.number().int()).optional(),stream:rt.boolean().default(!1),stop:rt.union([rt.string(),rt.array(rt.string())]).optional(),random_seed:rt.nullable(rt.number().int()).optional(),messages:rt.array(rt.union([Fde.SystemMessage$inboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Bde.UserMessage$inboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Lde.AssistantMessage$inboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),zde.ToolMessage$inboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:aHt.ResponseFormat$inboundSchema.optional(),tools:rt.nullable(rt.array(sHt.Tool$inboundSchema)).optional(),tool_choice:rt.union([kde.ToolChoice$inboundSchema,$de.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:rt.number().optional(),frequency_penalty:rt.number().optional(),n:rt.nullable(rt.number().int()).optional(),prediction:iHt.Prediction$inboundSchema.optional(),agent_id:rt.string()}).transform(t=>(0,oHt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));rr.AgentsCompletionRequest$outboundSchema=rt.object({maxTokens:rt.nullable(rt.number().int()).optional(),stream:rt.boolean().default(!1),stop:rt.union([rt.string(),rt.array(rt.string())]).optional(),randomSeed:rt.nullable(rt.number().int()).optional(),messages:rt.array(rt.union([Fde.SystemMessage$outboundSchema.and(rt.object({role:rt.literal("system")}).transform(t=>({role:t.role}))),Bde.UserMessage$outboundSchema.and(rt.object({role:rt.literal("user")}).transform(t=>({role:t.role}))),Lde.AssistantMessage$outboundSchema.and(rt.object({role:rt.literal("assistant")}).transform(t=>({role:t.role}))),zde.ToolMessage$outboundSchema.and(rt.object({role:rt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:aHt.ResponseFormat$outboundSchema.optional(),tools:rt.nullable(rt.array(sHt.Tool$outboundSchema)).optional(),toolChoice:rt.union([kde.ToolChoice$outboundSchema,$de.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:rt.number().optional(),frequencyPenalty:rt.number().optional(),n:rt.nullable(rt.number().int()).optional(),prediction:iHt.Prediction$outboundSchema.optional(),agentId:rt.string()}).transform(t=>(0,oHt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var nHt;(function(t){t.inboundSchema=rr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=rr.AgentsCompletionRequest$outboundSchema})(nHt||(rr.AgentsCompletionRequest$=nHt={}));function lhn(t){return JSON.stringify(rr.AgentsCompletionRequest$outboundSchema.parse(t))}function chn(t){return(0,Dde.safeParse)(t,e=>rr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var yHt=v(nr=>{"use strict";var dhn=nr&&nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fhn=nr&&nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),phn=nr&&nr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dhn(e,t,r);return fhn(e,t),e};Object.defineProperty(nr,"__esModule",{value:!0});nr.AgentsCompletionStreamRequest$=nr.AgentsCompletionStreamRequest$outboundSchema=nr.AgentsCompletionStreamRequest$inboundSchema=nr.AgentsCompletionStreamRequestToolChoice$=nr.AgentsCompletionStreamRequestToolChoice$outboundSchema=nr.AgentsCompletionStreamRequestToolChoice$inboundSchema=nr.AgentsCompletionStreamRequestMessages$=nr.AgentsCompletionStreamRequestMessages$outboundSchema=nr.AgentsCompletionStreamRequestMessages$inboundSchema=nr.AgentsCompletionStreamRequestStop$=nr.AgentsCompletionStreamRequestStop$outboundSchema=nr.AgentsCompletionStreamRequestStop$inboundSchema=void 0;nr.agentsCompletionStreamRequestStopToJSON=mhn;nr.agentsCompletionStreamRequestStopFromJSON=hhn;nr.agentsCompletionStreamRequestMessagesToJSON=ghn;nr.agentsCompletionStreamRequestMessagesFromJSON=yhn;nr.agentsCompletionStreamRequestToolChoiceToJSON=bhn;nr.agentsCompletionStreamRequestToolChoiceFromJSON=_hn;nr.agentsCompletionStreamRequestToJSON=vhn;nr.agentsCompletionStreamRequestFromJSON=whn;var nt=phn(Ie()),pHt=We(),Ude=we(),qde=wR(),mHt=S4(),hHt=C4(),Hde=CF(),gHt=O4(),Vde=P4(),Wde=E4(),Kde=OF(),Gde=PF();nr.AgentsCompletionStreamRequestStop$inboundSchema=nt.union([nt.string(),nt.array(nt.string())]);nr.AgentsCompletionStreamRequestStop$outboundSchema=nt.union([nt.string(),nt.array(nt.string())]);var lHt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequestStop$outboundSchema})(lHt||(nr.AgentsCompletionStreamRequestStop$=lHt={}));function mhn(t){return JSON.stringify(nr.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function hhn(t){return(0,Ude.safeParse)(t,e=>nr.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}nr.AgentsCompletionStreamRequestMessages$inboundSchema=nt.union([Hde.SystemMessage$inboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Gde.UserMessage$inboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),qde.AssistantMessage$inboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Kde.ToolMessage$inboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))]);nr.AgentsCompletionStreamRequestMessages$outboundSchema=nt.union([Hde.SystemMessage$outboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Gde.UserMessage$outboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),qde.AssistantMessage$outboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Kde.ToolMessage$outboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))]);var cHt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequestMessages$outboundSchema})(cHt||(nr.AgentsCompletionStreamRequestMessages$=cHt={}));function ghn(t){return JSON.stringify(nr.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function yhn(t){return(0,Ude.safeParse)(t,e=>nr.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}nr.AgentsCompletionStreamRequestToolChoice$inboundSchema=nt.union([Vde.ToolChoice$inboundSchema,Wde.ToolChoiceEnum$inboundSchema]);nr.AgentsCompletionStreamRequestToolChoice$outboundSchema=nt.union([Vde.ToolChoice$outboundSchema,Wde.ToolChoiceEnum$outboundSchema]);var dHt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequestToolChoice$outboundSchema})(dHt||(nr.AgentsCompletionStreamRequestToolChoice$=dHt={}));function bhn(t){return JSON.stringify(nr.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function _hn(t){return(0,Ude.safeParse)(t,e=>nr.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}nr.AgentsCompletionStreamRequest$inboundSchema=nt.object({max_tokens:nt.nullable(nt.number().int()).optional(),stream:nt.boolean().default(!0),stop:nt.union([nt.string(),nt.array(nt.string())]).optional(),random_seed:nt.nullable(nt.number().int()).optional(),messages:nt.array(nt.union([Hde.SystemMessage$inboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Gde.UserMessage$inboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),qde.AssistantMessage$inboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Kde.ToolMessage$inboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))])),response_format:hHt.ResponseFormat$inboundSchema.optional(),tools:nt.nullable(nt.array(gHt.Tool$inboundSchema)).optional(),tool_choice:nt.union([Vde.ToolChoice$inboundSchema,Wde.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:nt.number().optional(),frequency_penalty:nt.number().optional(),n:nt.nullable(nt.number().int()).optional(),prediction:mHt.Prediction$inboundSchema.optional(),agent_id:nt.string()}).transform(t=>(0,pHt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));nr.AgentsCompletionStreamRequest$outboundSchema=nt.object({maxTokens:nt.nullable(nt.number().int()).optional(),stream:nt.boolean().default(!0),stop:nt.union([nt.string(),nt.array(nt.string())]).optional(),randomSeed:nt.nullable(nt.number().int()).optional(),messages:nt.array(nt.union([Hde.SystemMessage$outboundSchema.and(nt.object({role:nt.literal("system")}).transform(t=>({role:t.role}))),Gde.UserMessage$outboundSchema.and(nt.object({role:nt.literal("user")}).transform(t=>({role:t.role}))),qde.AssistantMessage$outboundSchema.and(nt.object({role:nt.literal("assistant")}).transform(t=>({role:t.role}))),Kde.ToolMessage$outboundSchema.and(nt.object({role:nt.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:hHt.ResponseFormat$outboundSchema.optional(),tools:nt.nullable(nt.array(gHt.Tool$outboundSchema)).optional(),toolChoice:nt.union([Vde.ToolChoice$outboundSchema,Wde.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:nt.number().optional(),frequencyPenalty:nt.number().optional(),n:nt.nullable(nt.number().int()).optional(),prediction:mHt.Prediction$outboundSchema.optional(),agentId:nt.string()}).transform(t=>(0,pHt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var fHt;(function(t){t.inboundSchema=nr.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=nr.AgentsCompletionStreamRequest$outboundSchema})(fHt||(nr.AgentsCompletionStreamRequest$=fHt={}));function vhn(t){return JSON.stringify(nr.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function whn(t){return(0,Ude.safeParse)(t,e=>nr.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var Zze=v(Ru=>{"use strict";var xhn=Ru&&Ru.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Shn=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Chn=Ru&&Ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xhn(e,t,r);return Shn(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.ApiEndpoint$=Ru.ApiEndpoint$outboundSchema=Ru.ApiEndpoint$inboundSchema=Ru.ApiEndpoint=void 0;var EF=Chn(Ie()),Ohn=vR();Ru.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};Ru.ApiEndpoint$inboundSchema=EF.union([EF.nativeEnum(Ru.ApiEndpoint),EF.string().transform(Ohn.catchUnrecognizedEnum)]);Ru.ApiEndpoint$outboundSchema=EF.union([EF.nativeEnum(Ru.ApiEndpoint),EF.string().and(EF.custom())]);var bHt;(function(t){t.inboundSchema=Ru.ApiEndpoint$inboundSchema,t.outboundSchema=Ru.ApiEndpoint$outboundSchema})(bHt||(Ru.ApiEndpoint$=bHt={}))});var wHt=v(zo=>{"use strict";var Phn=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]}),Ehn=zo&&zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Thn=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)&&Phn(e,t,r);return Ehn(e,t),e};Object.defineProperty(zo,"__esModule",{value:!0});zo.ArchiveFTModelOut$=zo.ArchiveFTModelOut$outboundSchema=zo.ArchiveFTModelOut$inboundSchema=zo.ArchiveFTModelOutObject$=zo.ArchiveFTModelOutObject$outboundSchema=zo.ArchiveFTModelOutObject$inboundSchema=zo.ArchiveFTModelOutObject=void 0;zo.archiveFTModelOutToJSON=Ihn;zo.archiveFTModelOutFromJSON=Mhn;var IE=Thn(Ie()),Ahn=we();zo.ArchiveFTModelOutObject={Model:"model"};zo.ArchiveFTModelOutObject$inboundSchema=IE.nativeEnum(zo.ArchiveFTModelOutObject);zo.ArchiveFTModelOutObject$outboundSchema=zo.ArchiveFTModelOutObject$inboundSchema;var _Ht;(function(t){t.inboundSchema=zo.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=zo.ArchiveFTModelOutObject$outboundSchema})(_Ht||(zo.ArchiveFTModelOutObject$=_Ht={}));zo.ArchiveFTModelOut$inboundSchema=IE.object({id:IE.string(),object:IE.literal("model").default("model"),archived:IE.boolean().default(!0)});zo.ArchiveFTModelOut$outboundSchema=IE.object({id:IE.string(),object:IE.literal("model").default("model"),archived:IE.boolean().default(!0)});var vHt;(function(t){t.inboundSchema=zo.ArchiveFTModelOut$inboundSchema,t.outboundSchema=zo.ArchiveFTModelOut$outboundSchema})(vHt||(zo.ArchiveFTModelOut$=vHt={}));function Ihn(t){return JSON.stringify(zo.ArchiveFTModelOut$outboundSchema.parse(t))}function Mhn(t){return(0,Ahn.safeParse)(t,e=>zo.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Jde=v(Nu=>{"use strict";var Rhn=Nu&&Nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nhn=Nu&&Nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jhn=Nu&&Nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rhn(e,t,r);return Nhn(e,t),e};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.ModelCapabilities$=Nu.ModelCapabilities$outboundSchema=Nu.ModelCapabilities$inboundSchema=void 0;Nu.modelCapabilitiesToJSON=Lhn;Nu.modelCapabilitiesFromJSON=Fhn;var yy=jhn(Ie()),SHt=We(),Dhn=we();Nu.ModelCapabilities$inboundSchema=yy.object({completion_chat:yy.boolean().default(!0),completion_fim:yy.boolean().default(!1),function_calling:yy.boolean().default(!0),fine_tuning:yy.boolean().default(!1),vision:yy.boolean().default(!1)}).transform(t=>(0,SHt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Nu.ModelCapabilities$outboundSchema=yy.object({completionChat:yy.boolean().default(!0),completionFim:yy.boolean().default(!1),functionCalling:yy.boolean().default(!0),fineTuning:yy.boolean().default(!1),vision:yy.boolean().default(!1)}).transform(t=>(0,SHt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var xHt;(function(t){t.inboundSchema=Nu.ModelCapabilities$inboundSchema,t.outboundSchema=Nu.ModelCapabilities$outboundSchema})(xHt||(Nu.ModelCapabilities$=xHt={}));function Lhn(t){return JSON.stringify(Nu.ModelCapabilities$outboundSchema.parse(t))}function Fhn(t){return(0,Dhn.safeParse)(t,e=>Nu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var Yze=v(Bo=>{"use strict";var khn=Bo&&Bo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$hn=Bo&&Bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zhn=Bo&&Bo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&khn(e,t,r);return $hn(e,t),e};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BaseModelCard$=Bo.BaseModelCard$outboundSchema=Bo.BaseModelCard$inboundSchema=Bo.Type$=Bo.Type$outboundSchema=Bo.Type$inboundSchema=Bo.Type=void 0;Bo.baseModelCardToJSON=Uhn;Bo.baseModelCardFromJSON=qhn;var ao=zhn(Ie()),PHt=We(),Bhn=we(),EHt=Jde();Bo.Type={Base:"base"};Bo.Type$inboundSchema=ao.nativeEnum(Bo.Type);Bo.Type$outboundSchema=Bo.Type$inboundSchema;var CHt;(function(t){t.inboundSchema=Bo.Type$inboundSchema,t.outboundSchema=Bo.Type$outboundSchema})(CHt||(Bo.Type$=CHt={}));Bo.BaseModelCard$inboundSchema=ao.object({id:ao.string(),object:ao.string().default("model"),created:ao.number().int().optional(),owned_by:ao.string().default("mistralai"),capabilities:EHt.ModelCapabilities$inboundSchema,name:ao.nullable(ao.string()).optional(),description:ao.nullable(ao.string()).optional(),max_context_length:ao.number().int().default(32768),aliases:ao.array(ao.string()).optional(),deprecation:ao.nullable(ao.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:ao.nullable(ao.number()).optional(),type:ao.literal("base").default("base")}).transform(t=>(0,PHt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Bo.BaseModelCard$outboundSchema=ao.object({id:ao.string(),object:ao.string().default("model"),created:ao.number().int().optional(),ownedBy:ao.string().default("mistralai"),capabilities:EHt.ModelCapabilities$outboundSchema,name:ao.nullable(ao.string()).optional(),description:ao.nullable(ao.string()).optional(),maxContextLength:ao.number().int().default(32768),aliases:ao.array(ao.string()).optional(),deprecation:ao.nullable(ao.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:ao.nullable(ao.number()).optional(),type:ao.literal("base").default("base")}).transform(t=>(0,PHt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var OHt;(function(t){t.inboundSchema=Bo.BaseModelCard$inboundSchema,t.outboundSchema=Bo.BaseModelCard$outboundSchema})(OHt||(Bo.BaseModelCard$=OHt={}));function Uhn(t){return JSON.stringify(Bo.BaseModelCard$outboundSchema.parse(t))}function qhn(t){return(0,Bhn.safeParse)(t,e=>Bo.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var Xze=v(ju=>{"use strict";var Hhn=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]}),Vhn=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Whn=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)&&Hhn(e,t,r);return Vhn(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.BatchError$=ju.BatchError$outboundSchema=ju.BatchError$inboundSchema=void 0;ju.batchErrorToJSON=Ghn;ju.batchErrorFromJSON=Jhn;var T4=Whn(Ie()),Khn=we();ju.BatchError$inboundSchema=T4.object({message:T4.string(),count:T4.number().int().default(1)});ju.BatchError$outboundSchema=T4.object({message:T4.string(),count:T4.number().int().default(1)});var THt;(function(t){t.inboundSchema=ju.BatchError$inboundSchema,t.outboundSchema=ju.BatchError$outboundSchema})(THt||(ju.BatchError$=THt={}));function Ghn(t){return JSON.stringify(ju.BatchError$outboundSchema.parse(t))}function Jhn(t){return(0,Khn.safeParse)(t,e=>ju.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var RHt=v(Du=>{"use strict";var Zhn=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]}),Yhn=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xhn=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)&&Zhn(e,t,r);return Yhn(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.BatchJobIn$=Du.BatchJobIn$outboundSchema=Du.BatchJobIn$inboundSchema=void 0;Du.batchJobInToJSON=egn;Du.batchJobInFromJSON=tgn;var jf=Xhn(Ie()),IHt=We(),Qhn=we(),MHt=Zze();Du.BatchJobIn$inboundSchema=jf.object({input_files:jf.array(jf.string()),endpoint:MHt.ApiEndpoint$inboundSchema,model:jf.string(),metadata:jf.nullable(jf.record(jf.string())).optional(),timeout_hours:jf.number().int().default(24)}).transform(t=>(0,IHt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));Du.BatchJobIn$outboundSchema=jf.object({inputFiles:jf.array(jf.string()),endpoint:MHt.ApiEndpoint$outboundSchema,model:jf.string(),metadata:jf.nullable(jf.record(jf.string())).optional(),timeoutHours:jf.number().int().default(24)}).transform(t=>(0,IHt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var AHt;(function(t){t.inboundSchema=Du.BatchJobIn$inboundSchema,t.outboundSchema=Du.BatchJobIn$outboundSchema})(AHt||(Du.BatchJobIn$=AHt={}));function egn(t){return JSON.stringify(Du.BatchJobIn$outboundSchema.parse(t))}function tgn(t){return(0,Qhn.safeParse)(t,e=>Du.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var Qze=v(Lu=>{"use strict";var rgn=Lu&&Lu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ngn=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ogn=Lu&&Lu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rgn(e,t,r);return ngn(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.BatchJobStatus$=Lu.BatchJobStatus$outboundSchema=Lu.BatchJobStatus$inboundSchema=Lu.BatchJobStatus=void 0;var ign=ogn(Ie());Lu.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Lu.BatchJobStatus$inboundSchema=ign.nativeEnum(Lu.BatchJobStatus);Lu.BatchJobStatus$outboundSchema=Lu.BatchJobStatus$inboundSchema;var NHt;(function(t){t.inboundSchema=Lu.BatchJobStatus$inboundSchema,t.outboundSchema=Lu.BatchJobStatus$outboundSchema})(NHt||(Lu.BatchJobStatus$=NHt={}))});var eBe=v(Uo=>{"use strict";var agn=Uo&&Uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sgn=Uo&&Uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ugn=Uo&&Uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&agn(e,t,r);return sgn(e,t),e};Object.defineProperty(Uo,"__esModule",{value:!0});Uo.BatchJobOut$=Uo.BatchJobOut$outboundSchema=Uo.BatchJobOut$inboundSchema=Uo.BatchJobOutObject$=Uo.BatchJobOutObject$outboundSchema=Uo.BatchJobOutObject$inboundSchema=Uo.BatchJobOutObject=void 0;Uo.batchJobOutToJSON=cgn;Uo.batchJobOutFromJSON=dgn;var Sr=ugn(Ie()),LHt=We(),lgn=we(),FHt=Xze(),kHt=Qze();Uo.BatchJobOutObject={Batch:"batch"};Uo.BatchJobOutObject$inboundSchema=Sr.nativeEnum(Uo.BatchJobOutObject);Uo.BatchJobOutObject$outboundSchema=Uo.BatchJobOutObject$inboundSchema;var jHt;(function(t){t.inboundSchema=Uo.BatchJobOutObject$inboundSchema,t.outboundSchema=Uo.BatchJobOutObject$outboundSchema})(jHt||(Uo.BatchJobOutObject$=jHt={}));Uo.BatchJobOut$inboundSchema=Sr.object({id:Sr.string(),object:Sr.literal("batch").default("batch"),input_files:Sr.array(Sr.string()),metadata:Sr.nullable(Sr.record(Sr.any())).optional(),endpoint:Sr.string(),model:Sr.string(),output_file:Sr.nullable(Sr.string()).optional(),error_file:Sr.nullable(Sr.string()).optional(),errors:Sr.array(FHt.BatchError$inboundSchema),status:kHt.BatchJobStatus$inboundSchema,created_at:Sr.number().int(),total_requests:Sr.number().int(),completed_requests:Sr.number().int(),succeeded_requests:Sr.number().int(),failed_requests:Sr.number().int(),started_at:Sr.nullable(Sr.number().int()).optional(),completed_at:Sr.nullable(Sr.number().int()).optional()}).transform(t=>(0,LHt.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"}));Uo.BatchJobOut$outboundSchema=Sr.object({id:Sr.string(),object:Sr.literal("batch").default("batch"),inputFiles:Sr.array(Sr.string()),metadata:Sr.nullable(Sr.record(Sr.any())).optional(),endpoint:Sr.string(),model:Sr.string(),outputFile:Sr.nullable(Sr.string()).optional(),errorFile:Sr.nullable(Sr.string()).optional(),errors:Sr.array(FHt.BatchError$outboundSchema),status:kHt.BatchJobStatus$outboundSchema,createdAt:Sr.number().int(),totalRequests:Sr.number().int(),completedRequests:Sr.number().int(),succeededRequests:Sr.number().int(),failedRequests:Sr.number().int(),startedAt:Sr.nullable(Sr.number().int()).optional(),completedAt:Sr.nullable(Sr.number().int()).optional()}).transform(t=>(0,LHt.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 DHt;(function(t){t.inboundSchema=Uo.BatchJobOut$inboundSchema,t.outboundSchema=Uo.BatchJobOut$outboundSchema})(DHt||(Uo.BatchJobOut$=DHt={}));function cgn(t){return JSON.stringify(Uo.BatchJobOut$outboundSchema.parse(t))}function dgn(t){return(0,lgn.safeParse)(t,e=>Uo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var UHt=v(qo=>{"use strict";var fgn=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]}),pgn=qo&&qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mgn=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)&&fgn(e,t,r);return pgn(e,t),e};Object.defineProperty(qo,"__esModule",{value:!0});qo.BatchJobsOut$=qo.BatchJobsOut$outboundSchema=qo.BatchJobsOut$inboundSchema=qo.BatchJobsOutObject$=qo.BatchJobsOutObject$outboundSchema=qo.BatchJobsOutObject$inboundSchema=qo.BatchJobsOutObject=void 0;qo.batchJobsOutToJSON=ggn;qo.batchJobsOutFromJSON=ygn;var ME=mgn(Ie()),hgn=we(),BHt=eBe();qo.BatchJobsOutObject={List:"list"};qo.BatchJobsOutObject$inboundSchema=ME.nativeEnum(qo.BatchJobsOutObject);qo.BatchJobsOutObject$outboundSchema=qo.BatchJobsOutObject$inboundSchema;var $Ht;(function(t){t.inboundSchema=qo.BatchJobsOutObject$inboundSchema,t.outboundSchema=qo.BatchJobsOutObject$outboundSchema})($Ht||(qo.BatchJobsOutObject$=$Ht={}));qo.BatchJobsOut$inboundSchema=ME.object({data:ME.array(BHt.BatchJobOut$inboundSchema).optional(),object:ME.literal("list").default("list"),total:ME.number().int()});qo.BatchJobsOut$outboundSchema=ME.object({data:ME.array(BHt.BatchJobOut$outboundSchema).optional(),object:ME.literal("list").default("list"),total:ME.number().int()});var zHt;(function(t){t.inboundSchema=qo.BatchJobsOut$inboundSchema,t.outboundSchema=qo.BatchJobsOut$outboundSchema})(zHt||(qo.BatchJobsOut$=zHt={}));function ggn(t){return JSON.stringify(qo.BatchJobsOut$outboundSchema.parse(t))}function ygn(t){return(0,hgn.safeParse)(t,e=>qo.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var GHt=v(or=>{"use strict";var bgn=or&&or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_gn=or&&or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vgn=or&&or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bgn(e,t,r);return _gn(e,t),e};Object.defineProperty(or,"__esModule",{value:!0});or.ChatClassificationRequest$=or.ChatClassificationRequest$outboundSchema=or.ChatClassificationRequest$inboundSchema=or.ChatClassificationRequestInputs$=or.ChatClassificationRequestInputs$outboundSchema=or.ChatClassificationRequestInputs$inboundSchema=or.One$=or.One$outboundSchema=or.One$inboundSchema=or.Two$=or.Two$outboundSchema=or.Two$inboundSchema=void 0;or.twoToJSON=wgn;or.twoFromJSON=xgn;or.oneToJSON=Sgn;or.oneFromJSON=Cgn;or.chatClassificationRequestInputsToJSON=Ogn;or.chatClassificationRequestInputsFromJSON=Pgn;or.chatClassificationRequestToJSON=Egn;or.chatClassificationRequestFromJSON=Tgn;var ye=vgn(Ie()),KHt=We(),Zde=we(),by=wR(),_y=CF(),vy=OF(),wy=PF();or.Two$inboundSchema=ye.union([_y.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);or.Two$outboundSchema=ye.union([_y.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var qHt;(function(t){t.inboundSchema=or.Two$inboundSchema,t.outboundSchema=or.Two$outboundSchema})(qHt||(or.Two$=qHt={}));function wgn(t){return JSON.stringify(or.Two$outboundSchema.parse(t))}function xgn(t){return(0,Zde.safeParse)(t,e=>or.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}or.One$inboundSchema=ye.union([_y.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);or.One$outboundSchema=ye.union([_y.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var HHt;(function(t){t.inboundSchema=or.One$inboundSchema,t.outboundSchema=or.One$outboundSchema})(HHt||(or.One$=HHt={}));function Sgn(t){return JSON.stringify(or.One$outboundSchema.parse(t))}function Cgn(t){return(0,Zde.safeParse)(t,e=>or.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}or.ChatClassificationRequestInputs$inboundSchema=ye.union([ye.array(ye.union([_y.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([_y.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);or.ChatClassificationRequestInputs$outboundSchema=ye.union([ye.array(ye.union([_y.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([_y.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);var VHt;(function(t){t.inboundSchema=or.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=or.ChatClassificationRequestInputs$outboundSchema})(VHt||(or.ChatClassificationRequestInputs$=VHt={}));function Ogn(t){return JSON.stringify(or.ChatClassificationRequestInputs$outboundSchema.parse(t))}function Pgn(t){return(0,Zde.safeParse)(t,e=>or.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}or.ChatClassificationRequest$inboundSchema=ye.object({input:ye.union([ye.array(ye.union([_y.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([_y.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,KHt.remap)(t,{input:"inputs"}));or.ChatClassificationRequest$outboundSchema=ye.object({inputs:ye.union([ye.array(ye.union([_y.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([_y.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),wy.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),by.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),vy.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,KHt.remap)(t,{inputs:"input"}));var WHt;(function(t){t.inboundSchema=or.ChatClassificationRequest$inboundSchema,t.outboundSchema=or.ChatClassificationRequest$outboundSchema})(WHt||(or.ChatClassificationRequest$=WHt={}));function Egn(t){return JSON.stringify(or.ChatClassificationRequest$outboundSchema.parse(t))}function Tgn(t){return(0,Zde.safeParse)(t,e=>or.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Yde=v(xo=>{"use strict";var Agn=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]}),Ign=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mgn=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)&&Agn(e,t,r);return Ign(e,t),e};Object.defineProperty(xo,"__esModule",{value:!0});xo.ChatCompletionChoice$=xo.ChatCompletionChoice$outboundSchema=xo.ChatCompletionChoice$inboundSchema=xo.FinishReason$=xo.FinishReason$outboundSchema=xo.FinishReason$inboundSchema=xo.FinishReason=void 0;xo.chatCompletionChoiceToJSON=jgn;xo.chatCompletionChoiceFromJSON=Dgn;var o_=Mgn(Ie()),YHt=We(),Rgn=we(),Ngn=vR(),XHt=wR();xo.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};xo.FinishReason$inboundSchema=o_.union([o_.nativeEnum(xo.FinishReason),o_.string().transform(Ngn.catchUnrecognizedEnum)]);xo.FinishReason$outboundSchema=o_.union([o_.nativeEnum(xo.FinishReason),o_.string().and(o_.custom())]);var JHt;(function(t){t.inboundSchema=xo.FinishReason$inboundSchema,t.outboundSchema=xo.FinishReason$outboundSchema})(JHt||(xo.FinishReason$=JHt={}));xo.ChatCompletionChoice$inboundSchema=o_.object({index:o_.number().int(),message:XHt.AssistantMessage$inboundSchema,finish_reason:xo.FinishReason$inboundSchema}).transform(t=>(0,YHt.remap)(t,{finish_reason:"finishReason"}));xo.ChatCompletionChoice$outboundSchema=o_.object({index:o_.number().int(),message:XHt.AssistantMessage$outboundSchema,finishReason:xo.FinishReason$outboundSchema}).transform(t=>(0,YHt.remap)(t,{finishReason:"finish_reason"}));var ZHt;(function(t){t.inboundSchema=xo.ChatCompletionChoice$inboundSchema,t.outboundSchema=xo.ChatCompletionChoice$outboundSchema})(ZHt||(xo.ChatCompletionChoice$=ZHt={}));function jgn(t){return JSON.stringify(xo.ChatCompletionChoice$outboundSchema.parse(t))}function Dgn(t){return(0,Rgn.safeParse)(t,e=>xo.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var s6t=v(ir=>{"use strict";var Lgn=ir&&ir.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fgn=ir&&ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kgn=ir&&ir.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lgn(e,t,r);return Fgn(e,t),e};Object.defineProperty(ir,"__esModule",{value:!0});ir.ChatCompletionRequest$=ir.ChatCompletionRequest$outboundSchema=ir.ChatCompletionRequest$inboundSchema=ir.ChatCompletionRequestToolChoice$=ir.ChatCompletionRequestToolChoice$outboundSchema=ir.ChatCompletionRequestToolChoice$inboundSchema=ir.Messages$=ir.Messages$outboundSchema=ir.Messages$inboundSchema=ir.Stop$=ir.Stop$outboundSchema=ir.Stop$inboundSchema=void 0;ir.stopToJSON=$gn;ir.stopFromJSON=zgn;ir.messagesToJSON=Bgn;ir.messagesFromJSON=Ugn;ir.chatCompletionRequestToolChoiceToJSON=qgn;ir.chatCompletionRequestToolChoiceFromJSON=Hgn;ir.chatCompletionRequestToJSON=Vgn;ir.chatCompletionRequestFromJSON=Wgn;var qe=kgn(Ie()),n6t=We(),Xde=we(),Qde=wR(),o6t=S4(),i6t=C4(),efe=CF(),a6t=O4(),tfe=P4(),rfe=E4(),nfe=OF(),ofe=PF();ir.Stop$inboundSchema=qe.union([qe.string(),qe.array(qe.string())]);ir.Stop$outboundSchema=qe.union([qe.string(),qe.array(qe.string())]);var QHt;(function(t){t.inboundSchema=ir.Stop$inboundSchema,t.outboundSchema=ir.Stop$outboundSchema})(QHt||(ir.Stop$=QHt={}));function $gn(t){return JSON.stringify(ir.Stop$outboundSchema.parse(t))}function zgn(t){return(0,Xde.safeParse)(t,e=>ir.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}ir.Messages$inboundSchema=qe.union([efe.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),ofe.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),Qde.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role}))),nfe.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role})))]);ir.Messages$outboundSchema=qe.union([efe.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),ofe.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),Qde.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role}))),nfe.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role})))]);var e6t;(function(t){t.inboundSchema=ir.Messages$inboundSchema,t.outboundSchema=ir.Messages$outboundSchema})(e6t||(ir.Messages$=e6t={}));function Bgn(t){return JSON.stringify(ir.Messages$outboundSchema.parse(t))}function Ugn(t){return(0,Xde.safeParse)(t,e=>ir.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}ir.ChatCompletionRequestToolChoice$inboundSchema=qe.union([tfe.ToolChoice$inboundSchema,rfe.ToolChoiceEnum$inboundSchema]);ir.ChatCompletionRequestToolChoice$outboundSchema=qe.union([tfe.ToolChoice$outboundSchema,rfe.ToolChoiceEnum$outboundSchema]);var t6t;(function(t){t.inboundSchema=ir.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=ir.ChatCompletionRequestToolChoice$outboundSchema})(t6t||(ir.ChatCompletionRequestToolChoice$=t6t={}));function qgn(t){return JSON.stringify(ir.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function Hgn(t){return(0,Xde.safeParse)(t,e=>ir.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}ir.ChatCompletionRequest$inboundSchema=qe.object({model:qe.nullable(qe.string()),temperature:qe.nullable(qe.number()).optional(),top_p:qe.number().optional(),max_tokens:qe.nullable(qe.number().int()).optional(),stream:qe.boolean().default(!1),stop:qe.union([qe.string(),qe.array(qe.string())]).optional(),random_seed:qe.nullable(qe.number().int()).optional(),messages:qe.array(qe.union([efe.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),ofe.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),Qde.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role}))),nfe.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:i6t.ResponseFormat$inboundSchema.optional(),tools:qe.nullable(qe.array(a6t.Tool$inboundSchema)).optional(),tool_choice:qe.union([tfe.ToolChoice$inboundSchema,rfe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:qe.number().optional(),frequency_penalty:qe.number().optional(),n:qe.nullable(qe.number().int()).optional(),prediction:o6t.Prediction$inboundSchema.optional(),safe_prompt:qe.boolean().optional()}).transform(t=>(0,n6t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));ir.ChatCompletionRequest$outboundSchema=qe.object({model:qe.nullable(qe.string()),temperature:qe.nullable(qe.number()).optional(),topP:qe.number().optional(),maxTokens:qe.nullable(qe.number().int()).optional(),stream:qe.boolean().default(!1),stop:qe.union([qe.string(),qe.array(qe.string())]).optional(),randomSeed:qe.nullable(qe.number().int()).optional(),messages:qe.array(qe.union([efe.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),ofe.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),Qde.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role}))),nfe.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:i6t.ResponseFormat$outboundSchema.optional(),tools:qe.nullable(qe.array(a6t.Tool$outboundSchema)).optional(),toolChoice:qe.union([tfe.ToolChoice$outboundSchema,rfe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:qe.number().optional(),frequencyPenalty:qe.number().optional(),n:qe.nullable(qe.number().int()).optional(),prediction:o6t.Prediction$outboundSchema.optional(),safePrompt:qe.boolean().optional()}).transform(t=>(0,n6t.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 r6t;(function(t){t.inboundSchema=ir.ChatCompletionRequest$inboundSchema,t.outboundSchema=ir.ChatCompletionRequest$outboundSchema})(r6t||(ir.ChatCompletionRequest$=r6t={}));function Vgn(t){return JSON.stringify(ir.ChatCompletionRequest$outboundSchema.parse(t))}function Wgn(t){return(0,Xde.safeParse)(t,e=>ir.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var A4=v(Fu=>{"use strict";var Kgn=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]}),Ggn=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jgn=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)&&Kgn(e,t,r);return Ggn(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.UsageInfo$=Fu.UsageInfo$outboundSchema=Fu.UsageInfo$inboundSchema=void 0;Fu.usageInfoToJSON=Ygn;Fu.usageInfoFromJSON=Xgn;var xR=Jgn(Ie()),l6t=We(),Zgn=we();Fu.UsageInfo$inboundSchema=xR.object({prompt_tokens:xR.number().int(),completion_tokens:xR.number().int(),total_tokens:xR.number().int()}).transform(t=>(0,l6t.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));Fu.UsageInfo$outboundSchema=xR.object({promptTokens:xR.number().int(),completionTokens:xR.number().int(),totalTokens:xR.number().int()}).transform(t=>(0,l6t.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var u6t;(function(t){t.inboundSchema=Fu.UsageInfo$inboundSchema,t.outboundSchema=Fu.UsageInfo$outboundSchema})(u6t||(Fu.UsageInfo$=u6t={}));function Ygn(t){return JSON.stringify(Fu.UsageInfo$outboundSchema.parse(t))}function Xgn(t){return(0,Zgn.safeParse)(t,e=>Fu.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var p6t=v(ku=>{"use strict";var Qgn=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]}),eyn=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tyn=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)&&Qgn(e,t,r);return eyn(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.ChatCompletionResponse$=ku.ChatCompletionResponse$outboundSchema=ku.ChatCompletionResponse$inboundSchema=void 0;ku.chatCompletionResponseToJSON=nyn;ku.chatCompletionResponseFromJSON=oyn;var xy=tyn(Ie()),ryn=we(),d6t=Yde(),f6t=A4();ku.ChatCompletionResponse$inboundSchema=xy.object({id:xy.string(),object:xy.string(),model:xy.string(),usage:f6t.UsageInfo$inboundSchema,created:xy.number().int().optional(),choices:xy.array(d6t.ChatCompletionChoice$inboundSchema).optional()});ku.ChatCompletionResponse$outboundSchema=xy.object({id:xy.string(),object:xy.string(),model:xy.string(),usage:f6t.UsageInfo$outboundSchema,created:xy.number().int().optional(),choices:xy.array(d6t.ChatCompletionChoice$outboundSchema).optional()});var c6t;(function(t){t.inboundSchema=ku.ChatCompletionResponse$inboundSchema,t.outboundSchema=ku.ChatCompletionResponse$outboundSchema})(c6t||(ku.ChatCompletionResponse$=c6t={}));function nyn(t){return JSON.stringify(ku.ChatCompletionResponse$outboundSchema.parse(t))}function oyn(t){return(0,ryn.safeParse)(t,e=>ku.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var x6t=v(ar=>{"use strict";var iyn=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ayn=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),syn=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iyn(e,t,r);return ayn(e,t),e};Object.defineProperty(ar,"__esModule",{value:!0});ar.ChatCompletionStreamRequest$=ar.ChatCompletionStreamRequest$outboundSchema=ar.ChatCompletionStreamRequest$inboundSchema=ar.ChatCompletionStreamRequestToolChoice$=ar.ChatCompletionStreamRequestToolChoice$outboundSchema=ar.ChatCompletionStreamRequestToolChoice$inboundSchema=ar.ChatCompletionStreamRequestMessages$=ar.ChatCompletionStreamRequestMessages$outboundSchema=ar.ChatCompletionStreamRequestMessages$inboundSchema=ar.ChatCompletionStreamRequestStop$=ar.ChatCompletionStreamRequestStop$outboundSchema=ar.ChatCompletionStreamRequestStop$inboundSchema=void 0;ar.chatCompletionStreamRequestStopToJSON=uyn;ar.chatCompletionStreamRequestStopFromJSON=lyn;ar.chatCompletionStreamRequestMessagesToJSON=cyn;ar.chatCompletionStreamRequestMessagesFromJSON=dyn;ar.chatCompletionStreamRequestToolChoiceToJSON=fyn;ar.chatCompletionStreamRequestToolChoiceFromJSON=pyn;ar.chatCompletionStreamRequestToJSON=myn;ar.chatCompletionStreamRequestFromJSON=hyn;var He=syn(Ie()),b6t=We(),ife=we(),afe=wR(),_6t=S4(),v6t=C4(),sfe=CF(),w6t=O4(),ufe=P4(),lfe=E4(),cfe=OF(),dfe=PF();ar.ChatCompletionStreamRequestStop$inboundSchema=He.union([He.string(),He.array(He.string())]);ar.ChatCompletionStreamRequestStop$outboundSchema=He.union([He.string(),He.array(He.string())]);var m6t;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequestStop$outboundSchema})(m6t||(ar.ChatCompletionStreamRequestStop$=m6t={}));function uyn(t){return JSON.stringify(ar.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function lyn(t){return(0,ife.safeParse)(t,e=>ar.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}ar.ChatCompletionStreamRequestMessages$inboundSchema=He.union([sfe.SystemMessage$inboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),dfe.UserMessage$inboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),afe.AssistantMessage$inboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),cfe.ToolMessage$inboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))]);ar.ChatCompletionStreamRequestMessages$outboundSchema=He.union([sfe.SystemMessage$outboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),dfe.UserMessage$outboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),afe.AssistantMessage$outboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),cfe.ToolMessage$outboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))]);var h6t;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequestMessages$outboundSchema})(h6t||(ar.ChatCompletionStreamRequestMessages$=h6t={}));function cyn(t){return JSON.stringify(ar.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function dyn(t){return(0,ife.safeParse)(t,e=>ar.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}ar.ChatCompletionStreamRequestToolChoice$inboundSchema=He.union([ufe.ToolChoice$inboundSchema,lfe.ToolChoiceEnum$inboundSchema]);ar.ChatCompletionStreamRequestToolChoice$outboundSchema=He.union([ufe.ToolChoice$outboundSchema,lfe.ToolChoiceEnum$outboundSchema]);var g6t;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequestToolChoice$outboundSchema})(g6t||(ar.ChatCompletionStreamRequestToolChoice$=g6t={}));function fyn(t){return JSON.stringify(ar.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function pyn(t){return(0,ife.safeParse)(t,e=>ar.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}ar.ChatCompletionStreamRequest$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(!0),stop:He.union([He.string(),He.array(He.string())]).optional(),random_seed:He.nullable(He.number().int()).optional(),messages:He.array(He.union([sfe.SystemMessage$inboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),dfe.UserMessage$inboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),afe.AssistantMessage$inboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),cfe.ToolMessage$inboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))])),response_format:v6t.ResponseFormat$inboundSchema.optional(),tools:He.nullable(He.array(w6t.Tool$inboundSchema)).optional(),tool_choice:He.union([ufe.ToolChoice$inboundSchema,lfe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:He.number().optional(),frequency_penalty:He.number().optional(),n:He.nullable(He.number().int()).optional(),prediction:_6t.Prediction$inboundSchema.optional(),safe_prompt:He.boolean().optional()}).transform(t=>(0,b6t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));ar.ChatCompletionStreamRequest$outboundSchema=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(!0),stop:He.union([He.string(),He.array(He.string())]).optional(),randomSeed:He.nullable(He.number().int()).optional(),messages:He.array(He.union([sfe.SystemMessage$outboundSchema.and(He.object({role:He.literal("system")}).transform(t=>({role:t.role}))),dfe.UserMessage$outboundSchema.and(He.object({role:He.literal("user")}).transform(t=>({role:t.role}))),afe.AssistantMessage$outboundSchema.and(He.object({role:He.literal("assistant")}).transform(t=>({role:t.role}))),cfe.ToolMessage$outboundSchema.and(He.object({role:He.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:v6t.ResponseFormat$outboundSchema.optional(),tools:He.nullable(He.array(w6t.Tool$outboundSchema)).optional(),toolChoice:He.union([ufe.ToolChoice$outboundSchema,lfe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:He.number().optional(),frequencyPenalty:He.number().optional(),n:He.nullable(He.number().int()).optional(),prediction:_6t.Prediction$outboundSchema.optional(),safePrompt:He.boolean().optional()}).transform(t=>(0,b6t.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 y6t;(function(t){t.inboundSchema=ar.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=ar.ChatCompletionStreamRequest$outboundSchema})(y6t||(ar.ChatCompletionStreamRequest$=y6t={}));function myn(t){return JSON.stringify(ar.ChatCompletionStreamRequest$outboundSchema.parse(t))}function hyn(t){return(0,ife.safeParse)(t,e=>ar.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var tBe=v($u=>{"use strict";var gyn=$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]}),yyn=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),byn=$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)&&gyn(e,t,r);return yyn(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.MetricOut$=$u.MetricOut$outboundSchema=$u.MetricOut$inboundSchema=void 0;$u.metricOutToJSON=vyn;$u.metricOutFromJSON=wyn;var Em=byn(Ie()),C6t=We(),_yn=we();$u.MetricOut$inboundSchema=Em.object({train_loss:Em.nullable(Em.number()).optional(),valid_loss:Em.nullable(Em.number()).optional(),valid_mean_token_accuracy:Em.nullable(Em.number()).optional()}).transform(t=>(0,C6t.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));$u.MetricOut$outboundSchema=Em.object({trainLoss:Em.nullable(Em.number()).optional(),validLoss:Em.nullable(Em.number()).optional(),validMeanTokenAccuracy:Em.nullable(Em.number()).optional()}).transform(t=>(0,C6t.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var S6t;(function(t){t.inboundSchema=$u.MetricOut$inboundSchema,t.outboundSchema=$u.MetricOut$outboundSchema})(S6t||($u.MetricOut$=S6t={}));function vyn(t){return JSON.stringify($u.MetricOut$outboundSchema.parse(t))}function wyn(t){return(0,_yn.safeParse)(t,e=>$u.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var rBe=v(zu=>{"use strict";var xyn=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]}),Syn=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cyn=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)&&xyn(e,t,r);return Syn(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.CheckpointOut$=zu.CheckpointOut$outboundSchema=zu.CheckpointOut$inboundSchema=void 0;zu.checkpointOutToJSON=Pyn;zu.checkpointOutFromJSON=Eyn;var I4=Cyn(Ie()),P6t=We(),Oyn=we(),E6t=tBe();zu.CheckpointOut$inboundSchema=I4.object({metrics:E6t.MetricOut$inboundSchema,step_number:I4.number().int(),created_at:I4.number().int()}).transform(t=>(0,P6t.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));zu.CheckpointOut$outboundSchema=I4.object({metrics:E6t.MetricOut$outboundSchema,stepNumber:I4.number().int(),createdAt:I4.number().int()}).transform(t=>(0,P6t.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var O6t;(function(t){t.inboundSchema=zu.CheckpointOut$inboundSchema,t.outboundSchema=zu.CheckpointOut$outboundSchema})(O6t||(zu.CheckpointOut$=O6t={}));function Pyn(t){return JSON.stringify(zu.CheckpointOut$outboundSchema.parse(t))}function Eyn(t){return(0,Oyn.safeParse)(t,e=>zu.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var nBe=v(Bu=>{"use strict";var Tyn=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]}),Ayn=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iyn=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)&&Tyn(e,t,r);return Ayn(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.ClassificationObject$=Bu.ClassificationObject$outboundSchema=Bu.ClassificationObject$inboundSchema=void 0;Bu.classificationObjectToJSON=Ryn;Bu.classificationObjectFromJSON=Nyn;var VC=Iyn(Ie()),A6t=We(),Myn=we();Bu.ClassificationObject$inboundSchema=VC.object({categories:VC.record(VC.boolean()).optional(),category_scores:VC.record(VC.number()).optional()}).transform(t=>(0,A6t.remap)(t,{category_scores:"categoryScores"}));Bu.ClassificationObject$outboundSchema=VC.object({categories:VC.record(VC.boolean()).optional(),categoryScores:VC.record(VC.number()).optional()}).transform(t=>(0,A6t.remap)(t,{categoryScores:"category_scores"}));var T6t;(function(t){t.inboundSchema=Bu.ClassificationObject$inboundSchema,t.outboundSchema=Bu.ClassificationObject$outboundSchema})(T6t||(Bu.ClassificationObject$=T6t={}));function Ryn(t){return JSON.stringify(Bu.ClassificationObject$outboundSchema.parse(t))}function Nyn(t){return(0,Myn.safeParse)(t,e=>Bu.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var j6t=v(Ho=>{"use strict";var jyn=Ho&&Ho.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dyn=Ho&&Ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lyn=Ho&&Ho.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jyn(e,t,r);return Dyn(e,t),e};Object.defineProperty(Ho,"__esModule",{value:!0});Ho.ClassificationRequest$=Ho.ClassificationRequest$outboundSchema=Ho.ClassificationRequest$inboundSchema=Ho.ClassificationRequestInputs$=Ho.ClassificationRequestInputs$outboundSchema=Ho.ClassificationRequestInputs$inboundSchema=void 0;Ho.classificationRequestInputsToJSON=Fyn;Ho.classificationRequestInputsFromJSON=kyn;Ho.classificationRequestToJSON=$yn;Ho.classificationRequestFromJSON=zyn;var Ns=Lyn(Ie()),R6t=We(),N6t=we();Ho.ClassificationRequestInputs$inboundSchema=Ns.union([Ns.string(),Ns.array(Ns.string())]);Ho.ClassificationRequestInputs$outboundSchema=Ns.union([Ns.string(),Ns.array(Ns.string())]);var I6t;(function(t){t.inboundSchema=Ho.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Ho.ClassificationRequestInputs$outboundSchema})(I6t||(Ho.ClassificationRequestInputs$=I6t={}));function Fyn(t){return JSON.stringify(Ho.ClassificationRequestInputs$outboundSchema.parse(t))}function kyn(t){return(0,N6t.safeParse)(t,e=>Ho.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Ho.ClassificationRequest$inboundSchema=Ns.object({input:Ns.union([Ns.string(),Ns.array(Ns.string())]),model:Ns.nullable(Ns.string()).optional()}).transform(t=>(0,R6t.remap)(t,{input:"inputs"}));Ho.ClassificationRequest$outboundSchema=Ns.object({inputs:Ns.union([Ns.string(),Ns.array(Ns.string())]),model:Ns.nullable(Ns.string()).optional()}).transform(t=>(0,R6t.remap)(t,{inputs:"input"}));var M6t;(function(t){t.inboundSchema=Ho.ClassificationRequest$inboundSchema,t.outboundSchema=Ho.ClassificationRequest$outboundSchema})(M6t||(Ho.ClassificationRequest$=M6t={}));function $yn(t){return JSON.stringify(Ho.ClassificationRequest$outboundSchema.parse(t))}function zyn(t){return(0,N6t.safeParse)(t,e=>Ho.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var F6t=v(Uu=>{"use strict";var Byn=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]}),Uyn=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qyn=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)&&Byn(e,t,r);return Uyn(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ClassificationResponse$=Uu.ClassificationResponse$outboundSchema=Uu.ClassificationResponse$inboundSchema=void 0;Uu.classificationResponseToJSON=Vyn;Uu.classificationResponseFromJSON=Wyn;var SR=qyn(Ie()),Hyn=we(),L6t=nBe();Uu.ClassificationResponse$inboundSchema=SR.object({id:SR.string().optional(),model:SR.string().optional(),results:SR.array(L6t.ClassificationObject$inboundSchema).optional()});Uu.ClassificationResponse$outboundSchema=SR.object({id:SR.string().optional(),model:SR.string().optional(),results:SR.array(L6t.ClassificationObject$outboundSchema).optional()});var D6t;(function(t){t.inboundSchema=Uu.ClassificationResponse$inboundSchema,t.outboundSchema=Uu.ClassificationResponse$outboundSchema})(D6t||(Uu.ClassificationResponse$=D6t={}));function Vyn(t){return JSON.stringify(Uu.ClassificationResponse$outboundSchema.parse(t))}function Wyn(t){return(0,Hyn.safeParse)(t,e=>Uu.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var oBe=v(Vo=>{"use strict";var Kyn=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]}),Gyn=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jyn=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)&&Kyn(e,t,r);return Gyn(e,t),e};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.DeltaMessage$=Vo.DeltaMessage$outboundSchema=Vo.DeltaMessage$inboundSchema=Vo.Content$=Vo.Content$outboundSchema=Vo.Content$inboundSchema=void 0;Vo.contentToJSON=Zyn;Vo.contentFromJSON=Yyn;Vo.deltaMessageToJSON=Xyn;Vo.deltaMessageFromJSON=Qyn;var za=Jyn(Ie()),z6t=We(),B6t=we(),ffe=w4(),U6t=Tde();Vo.Content$inboundSchema=za.union([za.string(),za.array(ffe.ContentChunk$inboundSchema)]);Vo.Content$outboundSchema=za.union([za.string(),za.array(ffe.ContentChunk$outboundSchema)]);var k6t;(function(t){t.inboundSchema=Vo.Content$inboundSchema,t.outboundSchema=Vo.Content$outboundSchema})(k6t||(Vo.Content$=k6t={}));function Zyn(t){return JSON.stringify(Vo.Content$outboundSchema.parse(t))}function Yyn(t){return(0,B6t.safeParse)(t,e=>Vo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Vo.DeltaMessage$inboundSchema=za.object({role:za.nullable(za.string()).optional(),content:za.nullable(za.union([za.string(),za.array(ffe.ContentChunk$inboundSchema)])).optional(),tool_calls:za.nullable(za.array(U6t.ToolCall$inboundSchema)).optional()}).transform(t=>(0,z6t.remap)(t,{tool_calls:"toolCalls"}));Vo.DeltaMessage$outboundSchema=za.object({role:za.nullable(za.string()).optional(),content:za.nullable(za.union([za.string(),za.array(ffe.ContentChunk$outboundSchema)])).optional(),toolCalls:za.nullable(za.array(U6t.ToolCall$outboundSchema)).optional()}).transform(t=>(0,z6t.remap)(t,{toolCalls:"tool_calls"}));var $6t;(function(t){t.inboundSchema=Vo.DeltaMessage$inboundSchema,t.outboundSchema=Vo.DeltaMessage$outboundSchema})($6t||(Vo.DeltaMessage$=$6t={}));function Xyn(t){return JSON.stringify(Vo.DeltaMessage$outboundSchema.parse(t))}function Qyn(t){return(0,B6t.safeParse)(t,e=>Vo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var iBe=v(So=>{"use strict";var ebn=So&&So.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tbn=So&&So.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rbn=So&&So.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ebn(e,t,r);return tbn(e,t),e};Object.defineProperty(So,"__esModule",{value:!0});So.CompletionResponseStreamChoice$=So.CompletionResponseStreamChoice$outboundSchema=So.CompletionResponseStreamChoice$inboundSchema=So.CompletionResponseStreamChoiceFinishReason$=So.CompletionResponseStreamChoiceFinishReason$outboundSchema=So.CompletionResponseStreamChoiceFinishReason$inboundSchema=So.CompletionResponseStreamChoiceFinishReason=void 0;So.completionResponseStreamChoiceToJSON=ibn;So.completionResponseStreamChoiceFromJSON=abn;var Fh=rbn(Ie()),V6t=We(),nbn=we(),obn=vR(),W6t=oBe();So.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};So.CompletionResponseStreamChoiceFinishReason$inboundSchema=Fh.union([Fh.nativeEnum(So.CompletionResponseStreamChoiceFinishReason),Fh.string().transform(obn.catchUnrecognizedEnum)]);So.CompletionResponseStreamChoiceFinishReason$outboundSchema=Fh.union([Fh.nativeEnum(So.CompletionResponseStreamChoiceFinishReason),Fh.string().and(Fh.custom())]);var q6t;(function(t){t.inboundSchema=So.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=So.CompletionResponseStreamChoiceFinishReason$outboundSchema})(q6t||(So.CompletionResponseStreamChoiceFinishReason$=q6t={}));So.CompletionResponseStreamChoice$inboundSchema=Fh.object({index:Fh.number().int(),delta:W6t.DeltaMessage$inboundSchema,finish_reason:Fh.nullable(So.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,V6t.remap)(t,{finish_reason:"finishReason"}));So.CompletionResponseStreamChoice$outboundSchema=Fh.object({index:Fh.number().int(),delta:W6t.DeltaMessage$outboundSchema,finishReason:Fh.nullable(So.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,V6t.remap)(t,{finishReason:"finish_reason"}));var H6t;(function(t){t.inboundSchema=So.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=So.CompletionResponseStreamChoice$outboundSchema})(H6t||(So.CompletionResponseStreamChoice$=H6t={}));function ibn(t){return JSON.stringify(So.CompletionResponseStreamChoice$outboundSchema.parse(t))}function abn(t){return(0,nbn.safeParse)(t,e=>So.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var aBe=v(qu=>{"use strict";var sbn=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]}),ubn=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lbn=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)&&sbn(e,t,r);return ubn(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.CompletionChunk$=qu.CompletionChunk$outboundSchema=qu.CompletionChunk$inboundSchema=void 0;qu.completionChunkToJSON=dbn;qu.completionChunkFromJSON=fbn;var Sy=lbn(Ie()),cbn=we(),G6t=iBe(),J6t=A4();qu.CompletionChunk$inboundSchema=Sy.object({id:Sy.string(),object:Sy.string().optional(),created:Sy.number().int().optional(),model:Sy.string(),usage:J6t.UsageInfo$inboundSchema.optional(),choices:Sy.array(G6t.CompletionResponseStreamChoice$inboundSchema)});qu.CompletionChunk$outboundSchema=Sy.object({id:Sy.string(),object:Sy.string().optional(),created:Sy.number().int().optional(),model:Sy.string(),usage:J6t.UsageInfo$outboundSchema.optional(),choices:Sy.array(G6t.CompletionResponseStreamChoice$outboundSchema)});var K6t;(function(t){t.inboundSchema=qu.CompletionChunk$inboundSchema,t.outboundSchema=qu.CompletionChunk$outboundSchema})(K6t||(qu.CompletionChunk$=K6t={}));function dbn(t){return JSON.stringify(qu.CompletionChunk$outboundSchema.parse(t))}function fbn(t){return(0,cbn.safeParse)(t,e=>qu.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var X6t=v(Hu=>{"use strict";var pbn=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]}),mbn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hbn=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)&&pbn(e,t,r);return mbn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.CompletionEvent$=Hu.CompletionEvent$outboundSchema=Hu.CompletionEvent$inboundSchema=void 0;Hu.completionEventToJSON=ybn;Hu.completionEventFromJSON=bbn;var gG=hbn(Ie()),gbn=we(),Y6t=aBe();Hu.CompletionEvent$inboundSchema=gG.object({data:gG.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:gG.ZodIssueCode.custom,message:`malformed json: ${r}`}),gG.NEVER}}).pipe(Y6t.CompletionChunk$inboundSchema)});Hu.CompletionEvent$outboundSchema=gG.object({data:Y6t.CompletionChunk$outboundSchema});var Z6t;(function(t){t.inboundSchema=Hu.CompletionEvent$inboundSchema,t.outboundSchema=Hu.CompletionEvent$outboundSchema})(Z6t||(Hu.CompletionEvent$=Z6t={}));function ybn(t){return JSON.stringify(Hu.CompletionEvent$outboundSchema.parse(t))}function bbn(t){return(0,gbn.safeParse)(t,e=>Hu.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var e8t=v(Vu=>{"use strict";var _bn=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]}),vbn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wbn=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)&&_bn(e,t,r);return vbn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.DeleteFileOut$=Vu.DeleteFileOut$outboundSchema=Vu.DeleteFileOut$inboundSchema=void 0;Vu.deleteFileOutToJSON=Sbn;Vu.deleteFileOutFromJSON=Cbn;var CR=wbn(Ie()),xbn=we();Vu.DeleteFileOut$inboundSchema=CR.object({id:CR.string(),object:CR.string(),deleted:CR.boolean()});Vu.DeleteFileOut$outboundSchema=CR.object({id:CR.string(),object:CR.string(),deleted:CR.boolean()});var Q6t;(function(t){t.inboundSchema=Vu.DeleteFileOut$inboundSchema,t.outboundSchema=Vu.DeleteFileOut$outboundSchema})(Q6t||(Vu.DeleteFileOut$=Q6t={}));function Sbn(t){return JSON.stringify(Vu.DeleteFileOut$outboundSchema.parse(t))}function Cbn(t){return(0,xbn.safeParse)(t,e=>Vu.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var r8t=v(Wu=>{"use strict";var Obn=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]}),Pbn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ebn=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)&&Obn(e,t,r);return Pbn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.DeleteModelOut$=Wu.DeleteModelOut$outboundSchema=Wu.DeleteModelOut$inboundSchema=void 0;Wu.deleteModelOutToJSON=Abn;Wu.deleteModelOutFromJSON=Ibn;var OR=Ebn(Ie()),Tbn=we();Wu.DeleteModelOut$inboundSchema=OR.object({id:OR.string(),object:OR.string().default("model"),deleted:OR.boolean().default(!0)});Wu.DeleteModelOut$outboundSchema=OR.object({id:OR.string(),object:OR.string().default("model"),deleted:OR.boolean().default(!0)});var t8t;(function(t){t.inboundSchema=Wu.DeleteModelOut$inboundSchema,t.outboundSchema=Wu.DeleteModelOut$outboundSchema})(t8t||(Wu.DeleteModelOut$=t8t={}));function Abn(t){return JSON.stringify(Wu.DeleteModelOut$outboundSchema.parse(t))}function Ibn(t){return(0,Tbn.safeParse)(t,e=>Wu.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var sBe=v(Ku=>{"use strict";var Mbn=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]}),Rbn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nbn=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)&&Mbn(e,t,r);return Rbn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.EventOut$=Ku.EventOut$outboundSchema=Ku.EventOut$inboundSchema=void 0;Ku.eventOutToJSON=Dbn;Ku.eventOutFromJSON=Lbn;var Cy=Nbn(Ie()),o8t=We(),jbn=we();Ku.EventOut$inboundSchema=Cy.object({name:Cy.string(),data:Cy.nullable(Cy.record(Cy.any())).optional(),created_at:Cy.number().int()}).transform(t=>(0,o8t.remap)(t,{created_at:"createdAt"}));Ku.EventOut$outboundSchema=Cy.object({name:Cy.string(),data:Cy.nullable(Cy.record(Cy.any())).optional(),createdAt:Cy.number().int()}).transform(t=>(0,o8t.remap)(t,{createdAt:"created_at"}));var n8t;(function(t){t.inboundSchema=Ku.EventOut$inboundSchema,t.outboundSchema=Ku.EventOut$outboundSchema})(n8t||(Ku.EventOut$=n8t={}));function Dbn(t){return JSON.stringify(Ku.EventOut$outboundSchema.parse(t))}function Lbn(t){return(0,jbn.safeParse)(t,e=>Ku.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var pfe=v(Wo=>{"use strict";var Fbn=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]}),kbn=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$bn=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)&&Fbn(e,t,r);return kbn(e,t),e};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.GithubRepositoryOut$=Wo.GithubRepositoryOut$outboundSchema=Wo.GithubRepositoryOut$inboundSchema=Wo.GithubRepositoryOutType$=Wo.GithubRepositoryOutType$outboundSchema=Wo.GithubRepositoryOutType$inboundSchema=Wo.GithubRepositoryOutType=void 0;Wo.githubRepositoryOutToJSON=Bbn;Wo.githubRepositoryOutFromJSON=Ubn;var Td=$bn(Ie()),s8t=We(),zbn=we();Wo.GithubRepositoryOutType={Github:"github"};Wo.GithubRepositoryOutType$inboundSchema=Td.nativeEnum(Wo.GithubRepositoryOutType);Wo.GithubRepositoryOutType$outboundSchema=Wo.GithubRepositoryOutType$inboundSchema;var i8t;(function(t){t.inboundSchema=Wo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Wo.GithubRepositoryOutType$outboundSchema})(i8t||(Wo.GithubRepositoryOutType$=i8t={}));Wo.GithubRepositoryOut$inboundSchema=Td.object({type:Td.literal("github").default("github"),name:Td.string(),owner:Td.string(),ref:Td.nullable(Td.string()).optional(),weight:Td.number().default(1),commit_id:Td.string()}).transform(t=>(0,s8t.remap)(t,{commit_id:"commitId"}));Wo.GithubRepositoryOut$outboundSchema=Td.object({type:Td.literal("github").default("github"),name:Td.string(),owner:Td.string(),ref:Td.nullable(Td.string()).optional(),weight:Td.number().default(1),commitId:Td.string()}).transform(t=>(0,s8t.remap)(t,{commitId:"commit_id"}));var a8t;(function(t){t.inboundSchema=Wo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Wo.GithubRepositoryOut$outboundSchema})(a8t||(Wo.GithubRepositoryOut$=a8t={}));function Bbn(t){return JSON.stringify(Wo.GithubRepositoryOut$outboundSchema.parse(t))}function Ubn(t){return(0,zbn.safeParse)(t,e=>Wo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var mfe=v(Gu=>{"use strict";var qbn=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]}),Hbn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vbn=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)&&qbn(e,t,r);return Hbn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.JobMetadataOut$=Gu.JobMetadataOut$outboundSchema=Gu.JobMetadataOut$inboundSchema=void 0;Gu.jobMetadataOutToJSON=Kbn;Gu.jobMetadataOutFromJSON=Gbn;var Ci=Vbn(Ie()),l8t=We(),Wbn=we();Gu.JobMetadataOut$inboundSchema=Ci.object({expected_duration_seconds:Ci.nullable(Ci.number().int()).optional(),cost:Ci.nullable(Ci.number()).optional(),cost_currency:Ci.nullable(Ci.string()).optional(),train_tokens_per_step:Ci.nullable(Ci.number().int()).optional(),train_tokens:Ci.nullable(Ci.number().int()).optional(),data_tokens:Ci.nullable(Ci.number().int()).optional(),estimated_start_time:Ci.nullable(Ci.number().int()).optional()}).transform(t=>(0,l8t.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Gu.JobMetadataOut$outboundSchema=Ci.object({expectedDurationSeconds:Ci.nullable(Ci.number().int()).optional(),cost:Ci.nullable(Ci.number()).optional(),costCurrency:Ci.nullable(Ci.string()).optional(),trainTokensPerStep:Ci.nullable(Ci.number().int()).optional(),trainTokens:Ci.nullable(Ci.number().int()).optional(),dataTokens:Ci.nullable(Ci.number().int()).optional(),estimatedStartTime:Ci.nullable(Ci.number().int()).optional()}).transform(t=>(0,l8t.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 u8t;(function(t){t.inboundSchema=Gu.JobMetadataOut$inboundSchema,t.outboundSchema=Gu.JobMetadataOut$outboundSchema})(u8t||(Gu.JobMetadataOut$=u8t={}));function Kbn(t){return JSON.stringify(Gu.JobMetadataOut$outboundSchema.parse(t))}function Gbn(t){return(0,Wbn.safeParse)(t,e=>Gu.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var hfe=v(Ju=>{"use strict";var Jbn=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]}),Zbn=Ju&&Ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ybn=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)&&Jbn(e,t,r);return Zbn(e,t),e};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.TrainingParameters$=Ju.TrainingParameters$outboundSchema=Ju.TrainingParameters$inboundSchema=void 0;Ju.trainingParametersToJSON=Qbn;Ju.trainingParametersFromJSON=e_n;var ki=Ybn(Ie()),d8t=We(),Xbn=we();Ju.TrainingParameters$inboundSchema=ki.object({training_steps:ki.nullable(ki.number().int()).optional(),learning_rate:ki.number().default(1e-4),weight_decay:ki.nullable(ki.number()).optional(),warmup_fraction:ki.nullable(ki.number()).optional(),epochs:ki.nullable(ki.number()).optional(),fim_ratio:ki.nullable(ki.number()).optional(),seq_len:ki.nullable(ki.number().int()).optional()}).transform(t=>(0,d8t.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Ju.TrainingParameters$outboundSchema=ki.object({trainingSteps:ki.nullable(ki.number().int()).optional(),learningRate:ki.number().default(1e-4),weightDecay:ki.nullable(ki.number()).optional(),warmupFraction:ki.nullable(ki.number()).optional(),epochs:ki.nullable(ki.number()).optional(),fimRatio:ki.nullable(ki.number()).optional(),seqLen:ki.nullable(ki.number().int()).optional()}).transform(t=>(0,d8t.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var c8t;(function(t){t.inboundSchema=Ju.TrainingParameters$inboundSchema,t.outboundSchema=Ju.TrainingParameters$outboundSchema})(c8t||(Ju.TrainingParameters$=c8t={}));function Qbn(t){return JSON.stringify(Ju.TrainingParameters$outboundSchema.parse(t))}function e_n(t){return(0,Xbn.safeParse)(t,e=>Ju.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var gfe=v(Ko=>{"use strict";var t_n=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]}),r_n=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n_n=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)&&t_n(e,t,r);return r_n(e,t),e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.WandbIntegrationOut$=Ko.WandbIntegrationOut$outboundSchema=Ko.WandbIntegrationOut$inboundSchema=Ko.WandbIntegrationOutType$=Ko.WandbIntegrationOutType$outboundSchema=Ko.WandbIntegrationOutType$inboundSchema=Ko.WandbIntegrationOutType=void 0;Ko.wandbIntegrationOutToJSON=i_n;Ko.wandbIntegrationOutFromJSON=a_n;var wp=n_n(Ie()),m8t=We(),o_n=we();Ko.WandbIntegrationOutType={Wandb:"wandb"};Ko.WandbIntegrationOutType$inboundSchema=wp.nativeEnum(Ko.WandbIntegrationOutType);Ko.WandbIntegrationOutType$outboundSchema=Ko.WandbIntegrationOutType$inboundSchema;var f8t;(function(t){t.inboundSchema=Ko.WandbIntegrationOutType$inboundSchema,t.outboundSchema=Ko.WandbIntegrationOutType$outboundSchema})(f8t||(Ko.WandbIntegrationOutType$=f8t={}));Ko.WandbIntegrationOut$inboundSchema=wp.object({type:wp.literal("wandb").default("wandb"),project:wp.string(),name:wp.nullable(wp.string()).optional(),run_name:wp.nullable(wp.string()).optional()}).transform(t=>(0,m8t.remap)(t,{run_name:"runName"}));Ko.WandbIntegrationOut$outboundSchema=wp.object({type:wp.literal("wandb").default("wandb"),project:wp.string(),name:wp.nullable(wp.string()).optional(),runName:wp.nullable(wp.string()).optional()}).transform(t=>(0,m8t.remap)(t,{runName:"run_name"}));var p8t;(function(t){t.inboundSchema=Ko.WandbIntegrationOut$inboundSchema,t.outboundSchema=Ko.WandbIntegrationOut$outboundSchema})(p8t||(Ko.WandbIntegrationOut$=p8t={}));function i_n(t){return JSON.stringify(Ko.WandbIntegrationOut$outboundSchema.parse(t))}function a_n(t){return(0,o_n.safeParse)(t,e=>Ko.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var O8t=v(vt=>{"use strict";var s_n=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]}),u_n=vt&&vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l_n=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)&&s_n(e,t,r);return u_n(e,t),e};Object.defineProperty(vt,"__esModule",{value:!0});vt.DetailedJobOut$=vt.DetailedJobOut$outboundSchema=vt.DetailedJobOut$inboundSchema=vt.DetailedJobOutRepositories$=vt.DetailedJobOutRepositories$outboundSchema=vt.DetailedJobOutRepositories$inboundSchema=vt.DetailedJobOutIntegrations$=vt.DetailedJobOutIntegrations$outboundSchema=vt.DetailedJobOutIntegrations$inboundSchema=vt.DetailedJobOutObject$=vt.DetailedJobOutObject$outboundSchema=vt.DetailedJobOutObject$inboundSchema=vt.DetailedJobOutStatus$=vt.DetailedJobOutStatus$outboundSchema=vt.DetailedJobOutStatus$inboundSchema=vt.DetailedJobOutObject=vt.DetailedJobOutStatus=void 0;vt.detailedJobOutIntegrationsToJSON=c_n;vt.detailedJobOutIntegrationsFromJSON=d_n;vt.detailedJobOutRepositoriesToJSON=f_n;vt.detailedJobOutRepositoriesFromJSON=p_n;vt.detailedJobOutToJSON=m_n;vt.detailedJobOutFromJSON=h_n;var pr=l_n(Ie()),v8t=We(),uBe=we(),w8t=rBe(),x8t=sBe(),yfe=pfe(),S8t=mfe(),C8t=hfe(),bfe=gfe();vt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};vt.DetailedJobOutObject={Job:"job"};vt.DetailedJobOutStatus$inboundSchema=pr.nativeEnum(vt.DetailedJobOutStatus);vt.DetailedJobOutStatus$outboundSchema=vt.DetailedJobOutStatus$inboundSchema;var h8t;(function(t){t.inboundSchema=vt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=vt.DetailedJobOutStatus$outboundSchema})(h8t||(vt.DetailedJobOutStatus$=h8t={}));vt.DetailedJobOutObject$inboundSchema=pr.nativeEnum(vt.DetailedJobOutObject);vt.DetailedJobOutObject$outboundSchema=vt.DetailedJobOutObject$inboundSchema;var g8t;(function(t){t.inboundSchema=vt.DetailedJobOutObject$inboundSchema,t.outboundSchema=vt.DetailedJobOutObject$outboundSchema})(g8t||(vt.DetailedJobOutObject$=g8t={}));vt.DetailedJobOutIntegrations$inboundSchema=bfe.WandbIntegrationOut$inboundSchema;vt.DetailedJobOutIntegrations$outboundSchema=bfe.WandbIntegrationOut$outboundSchema;var y8t;(function(t){t.inboundSchema=vt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=vt.DetailedJobOutIntegrations$outboundSchema})(y8t||(vt.DetailedJobOutIntegrations$=y8t={}));function c_n(t){return JSON.stringify(vt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function d_n(t){return(0,uBe.safeParse)(t,e=>vt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}vt.DetailedJobOutRepositories$inboundSchema=yfe.GithubRepositoryOut$inboundSchema;vt.DetailedJobOutRepositories$outboundSchema=yfe.GithubRepositoryOut$outboundSchema;var b8t;(function(t){t.inboundSchema=vt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=vt.DetailedJobOutRepositories$outboundSchema})(b8t||(vt.DetailedJobOutRepositories$=b8t={}));function f_n(t){return JSON.stringify(vt.DetailedJobOutRepositories$outboundSchema.parse(t))}function p_n(t){return(0,uBe.safeParse)(t,e=>vt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}vt.DetailedJobOut$inboundSchema=pr.object({id:pr.string(),auto_start:pr.boolean(),hyperparameters:C8t.TrainingParameters$inboundSchema,model:pr.string(),status:vt.DetailedJobOutStatus$inboundSchema,job_type:pr.string(),created_at:pr.number().int(),modified_at:pr.number().int(),training_files:pr.array(pr.string()),validation_files:pr.nullable(pr.array(pr.string())).optional(),object:pr.literal("job").default("job"),fine_tuned_model:pr.nullable(pr.string()).optional(),suffix:pr.nullable(pr.string()).optional(),integrations:pr.nullable(pr.array(bfe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:pr.nullable(pr.number().int()).optional(),repositories:pr.array(yfe.GithubRepositoryOut$inboundSchema).optional(),metadata:pr.nullable(S8t.JobMetadataOut$inboundSchema).optional(),events:pr.array(x8t.EventOut$inboundSchema).optional(),checkpoints:pr.array(w8t.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,v8t.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));vt.DetailedJobOut$outboundSchema=pr.object({id:pr.string(),autoStart:pr.boolean(),hyperparameters:C8t.TrainingParameters$outboundSchema,model:pr.string(),status:vt.DetailedJobOutStatus$outboundSchema,jobType:pr.string(),createdAt:pr.number().int(),modifiedAt:pr.number().int(),trainingFiles:pr.array(pr.string()),validationFiles:pr.nullable(pr.array(pr.string())).optional(),object:pr.literal("job").default("job"),fineTunedModel:pr.nullable(pr.string()).optional(),suffix:pr.nullable(pr.string()).optional(),integrations:pr.nullable(pr.array(bfe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:pr.nullable(pr.number().int()).optional(),repositories:pr.array(yfe.GithubRepositoryOut$outboundSchema).optional(),metadata:pr.nullable(S8t.JobMetadataOut$outboundSchema).optional(),events:pr.array(x8t.EventOut$outboundSchema).optional(),checkpoints:pr.array(w8t.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,v8t.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 _8t;(function(t){t.inboundSchema=vt.DetailedJobOut$inboundSchema,t.outboundSchema=vt.DetailedJobOut$outboundSchema})(_8t||(vt.DetailedJobOut$=_8t={}));function m_n(t){return JSON.stringify(vt.DetailedJobOut$outboundSchema.parse(t))}function h_n(t){return(0,uBe.safeParse)(t,e=>vt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var I8t=v(Go=>{"use strict";var g_n=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]}),y_n=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b_n=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)&&g_n(e,t,r);return y_n(e,t),e};Object.defineProperty(Go,"__esModule",{value:!0});Go.EmbeddingRequest$=Go.EmbeddingRequest$outboundSchema=Go.EmbeddingRequest$inboundSchema=Go.Inputs$=Go.Inputs$outboundSchema=Go.Inputs$inboundSchema=void 0;Go.inputsToJSON=__n;Go.inputsFromJSON=v_n;Go.embeddingRequestToJSON=w_n;Go.embeddingRequestFromJSON=x_n;var Ba=b_n(Ie()),T8t=We(),A8t=we();Go.Inputs$inboundSchema=Ba.union([Ba.string(),Ba.array(Ba.string())]);Go.Inputs$outboundSchema=Ba.union([Ba.string(),Ba.array(Ba.string())]);var P8t;(function(t){t.inboundSchema=Go.Inputs$inboundSchema,t.outboundSchema=Go.Inputs$outboundSchema})(P8t||(Go.Inputs$=P8t={}));function __n(t){return JSON.stringify(Go.Inputs$outboundSchema.parse(t))}function v_n(t){return(0,A8t.safeParse)(t,e=>Go.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}Go.EmbeddingRequest$inboundSchema=Ba.object({input:Ba.union([Ba.string(),Ba.array(Ba.string())]),model:Ba.string().default("mistral-embed"),encoding_format:Ba.nullable(Ba.string()).optional()}).transform(t=>(0,T8t.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));Go.EmbeddingRequest$outboundSchema=Ba.object({inputs:Ba.union([Ba.string(),Ba.array(Ba.string())]),model:Ba.string().default("mistral-embed"),encodingFormat:Ba.nullable(Ba.string()).optional()}).transform(t=>(0,T8t.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var E8t;(function(t){t.inboundSchema=Go.EmbeddingRequest$inboundSchema,t.outboundSchema=Go.EmbeddingRequest$outboundSchema})(E8t||(Go.EmbeddingRequest$=E8t={}));function w_n(t){return JSON.stringify(Go.EmbeddingRequest$outboundSchema.parse(t))}function x_n(t){return(0,A8t.safeParse)(t,e=>Go.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var lBe=v(Zu=>{"use strict";var S_n=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]}),C_n=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O_n=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)&&S_n(e,t,r);return C_n(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.EmbeddingResponseData$=Zu.EmbeddingResponseData$outboundSchema=Zu.EmbeddingResponseData$inboundSchema=void 0;Zu.embeddingResponseDataToJSON=E_n;Zu.embeddingResponseDataFromJSON=T_n;var WC=O_n(Ie()),P_n=we();Zu.EmbeddingResponseData$inboundSchema=WC.object({object:WC.string().optional(),embedding:WC.array(WC.number()).optional(),index:WC.number().int().optional()});Zu.EmbeddingResponseData$outboundSchema=WC.object({object:WC.string().optional(),embedding:WC.array(WC.number()).optional(),index:WC.number().int().optional()});var M8t;(function(t){t.inboundSchema=Zu.EmbeddingResponseData$inboundSchema,t.outboundSchema=Zu.EmbeddingResponseData$outboundSchema})(M8t||(Zu.EmbeddingResponseData$=M8t={}));function E_n(t){return JSON.stringify(Zu.EmbeddingResponseData$outboundSchema.parse(t))}function T_n(t){return(0,P_n.safeParse)(t,e=>Zu.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var D8t=v(Yu=>{"use strict";var A_n=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]}),I_n=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M_n=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)&&A_n(e,t,r);return I_n(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.EmbeddingResponse$=Yu.EmbeddingResponse$outboundSchema=Yu.EmbeddingResponse$inboundSchema=void 0;Yu.embeddingResponseToJSON=N_n;Yu.embeddingResponseFromJSON=j_n;var KC=M_n(Ie()),R_n=we(),N8t=lBe(),j8t=A4();Yu.EmbeddingResponse$inboundSchema=KC.object({id:KC.string(),object:KC.string(),model:KC.string(),usage:j8t.UsageInfo$inboundSchema,data:KC.array(N8t.EmbeddingResponseData$inboundSchema)});Yu.EmbeddingResponse$outboundSchema=KC.object({id:KC.string(),object:KC.string(),model:KC.string(),usage:j8t.UsageInfo$outboundSchema,data:KC.array(N8t.EmbeddingResponseData$outboundSchema)});var R8t;(function(t){t.inboundSchema=Yu.EmbeddingResponse$inboundSchema,t.outboundSchema=Yu.EmbeddingResponse$outboundSchema})(R8t||(Yu.EmbeddingResponse$=R8t={}));function N_n(t){return JSON.stringify(Yu.EmbeddingResponse$outboundSchema.parse(t))}function j_n(t){return(0,R_n.safeParse)(t,e=>Yu.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var yG=v(Xu=>{"use strict";var D_n=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]}),L_n=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F_n=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)&&D_n(e,t,r);return L_n(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.FilePurpose$=Xu.FilePurpose$outboundSchema=Xu.FilePurpose$inboundSchema=Xu.FilePurpose=void 0;var TF=F_n(Ie()),k_n=vR();Xu.FilePurpose={FineTune:"fine-tune",Batch:"batch"};Xu.FilePurpose$inboundSchema=TF.union([TF.nativeEnum(Xu.FilePurpose),TF.string().transform(k_n.catchUnrecognizedEnum)]);Xu.FilePurpose$outboundSchema=TF.union([TF.nativeEnum(Xu.FilePurpose),TF.string().and(TF.custom())]);var L8t;(function(t){t.inboundSchema=Xu.FilePurpose$inboundSchema,t.outboundSchema=Xu.FilePurpose$outboundSchema})(L8t||(Xu.FilePurpose$=L8t={}))});var bG=v(Qu=>{"use strict";var $_n=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]}),z_n=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B_n=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)&&$_n(e,t,r);return z_n(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.SampleType$=Qu.SampleType$outboundSchema=Qu.SampleType$inboundSchema=Qu.SampleType=void 0;var AF=B_n(Ie()),U_n=vR();Qu.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Qu.SampleType$inboundSchema=AF.union([AF.nativeEnum(Qu.SampleType),AF.string().transform(U_n.catchUnrecognizedEnum)]);Qu.SampleType$outboundSchema=AF.union([AF.nativeEnum(Qu.SampleType),AF.string().and(AF.custom())]);var F8t;(function(t){t.inboundSchema=Qu.SampleType$inboundSchema,t.outboundSchema=Qu.SampleType$outboundSchema})(F8t||(Qu.SampleType$=F8t={}))});var _G=v(el=>{"use strict";var q_n=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]}),H_n=el&&el.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V_n=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)&&q_n(e,t,r);return H_n(e,t),e};Object.defineProperty(el,"__esModule",{value:!0});el.Source$=el.Source$outboundSchema=el.Source$inboundSchema=el.Source=void 0;var IF=V_n(Ie()),W_n=vR();el.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};el.Source$inboundSchema=IF.union([IF.nativeEnum(el.Source),IF.string().transform(W_n.catchUnrecognizedEnum)]);el.Source$outboundSchema=IF.union([IF.nativeEnum(el.Source),IF.string().and(IF.custom())]);var k8t;(function(t){t.inboundSchema=el.Source$inboundSchema,t.outboundSchema=el.Source$outboundSchema})(k8t||(el.Source$=k8t={}))});var cBe=v(tl=>{"use strict";var K_n=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]}),G_n=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J_n=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)&&K_n(e,t,r);return G_n(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.FileSchema$=tl.FileSchema$outboundSchema=tl.FileSchema$inboundSchema=void 0;tl.fileSchemaToJSON=Y_n;tl.fileSchemaFromJSON=X_n;var Df=J_n(Ie()),z8t=We(),Z_n=we(),B8t=yG(),U8t=bG(),q8t=_G();tl.FileSchema$inboundSchema=Df.object({id:Df.string(),object:Df.string(),bytes:Df.number().int(),created_at:Df.number().int(),filename:Df.string(),purpose:B8t.FilePurpose$inboundSchema,sample_type:U8t.SampleType$inboundSchema,num_lines:Df.nullable(Df.number().int()).optional(),source:q8t.Source$inboundSchema}).transform(t=>(0,z8t.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));tl.FileSchema$outboundSchema=Df.object({id:Df.string(),object:Df.string(),sizeBytes:Df.number().int(),createdAt:Df.number().int(),filename:Df.string(),purpose:B8t.FilePurpose$outboundSchema,sampleType:U8t.SampleType$outboundSchema,numLines:Df.nullable(Df.number().int()).optional(),source:q8t.Source$outboundSchema}).transform(t=>(0,z8t.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var $8t;(function(t){t.inboundSchema=tl.FileSchema$inboundSchema,t.outboundSchema=tl.FileSchema$outboundSchema})($8t||(tl.FileSchema$=$8t={}));function Y_n(t){return JSON.stringify(tl.FileSchema$outboundSchema.parse(t))}function X_n(t){return(0,Z_n.safeParse)(t,e=>tl.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var V8t=v(rl=>{"use strict";var Q_n=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]}),evn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tvn=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)&&Q_n(e,t,r);return evn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.FileSignedURL$=rl.FileSignedURL$outboundSchema=rl.FileSignedURL$inboundSchema=void 0;rl.fileSignedURLToJSON=nvn;rl.fileSignedURLFromJSON=ovn;var _fe=tvn(Ie()),rvn=we();rl.FileSignedURL$inboundSchema=_fe.object({url:_fe.string()});rl.FileSignedURL$outboundSchema=_fe.object({url:_fe.string()});var H8t;(function(t){t.inboundSchema=rl.FileSignedURL$inboundSchema,t.outboundSchema=rl.FileSignedURL$outboundSchema})(H8t||(rl.FileSignedURL$=H8t={}));function nvn(t){return JSON.stringify(rl.FileSignedURL$outboundSchema.parse(t))}function ovn(t){return(0,rvn.safeParse)(t,e=>rl.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var Z8t=v(Jo=>{"use strict";var ivn=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]}),avn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),svn=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)&&ivn(e,t,r);return avn(e,t),e};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.FIMCompletionRequest$=Jo.FIMCompletionRequest$outboundSchema=Jo.FIMCompletionRequest$inboundSchema=Jo.FIMCompletionRequestStop$=Jo.FIMCompletionRequestStop$outboundSchema=Jo.FIMCompletionRequestStop$inboundSchema=void 0;Jo.fimCompletionRequestStopToJSON=uvn;Jo.fimCompletionRequestStopFromJSON=lvn;Jo.fimCompletionRequestToJSON=cvn;Jo.fimCompletionRequestFromJSON=dvn;var Pr=svn(Ie()),G8t=We(),J8t=we();Jo.FIMCompletionRequestStop$inboundSchema=Pr.union([Pr.string(),Pr.array(Pr.string())]);Jo.FIMCompletionRequestStop$outboundSchema=Pr.union([Pr.string(),Pr.array(Pr.string())]);var W8t;(function(t){t.inboundSchema=Jo.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=Jo.FIMCompletionRequestStop$outboundSchema})(W8t||(Jo.FIMCompletionRequestStop$=W8t={}));function uvn(t){return JSON.stringify(Jo.FIMCompletionRequestStop$outboundSchema.parse(t))}function lvn(t){return(0,J8t.safeParse)(t,e=>Jo.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}Jo.FIMCompletionRequest$inboundSchema=Pr.object({model:Pr.nullable(Pr.string()),temperature:Pr.nullable(Pr.number()).optional(),top_p:Pr.number().default(1),max_tokens:Pr.nullable(Pr.number().int()).optional(),stream:Pr.boolean().default(!1),stop:Pr.union([Pr.string(),Pr.array(Pr.string())]).optional(),random_seed:Pr.nullable(Pr.number().int()).optional(),prompt:Pr.string(),suffix:Pr.nullable(Pr.string()).optional(),min_tokens:Pr.nullable(Pr.number().int()).optional()}).transform(t=>(0,G8t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Jo.FIMCompletionRequest$outboundSchema=Pr.object({model:Pr.nullable(Pr.string()),temperature:Pr.nullable(Pr.number()).optional(),topP:Pr.number().default(1),maxTokens:Pr.nullable(Pr.number().int()).optional(),stream:Pr.boolean().default(!1),stop:Pr.union([Pr.string(),Pr.array(Pr.string())]).optional(),randomSeed:Pr.nullable(Pr.number().int()).optional(),prompt:Pr.string(),suffix:Pr.nullable(Pr.string()).optional(),minTokens:Pr.nullable(Pr.number().int()).optional()}).transform(t=>(0,G8t.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var K8t;(function(t){t.inboundSchema=Jo.FIMCompletionRequest$inboundSchema,t.outboundSchema=Jo.FIMCompletionRequest$outboundSchema})(K8t||(Jo.FIMCompletionRequest$=K8t={}));function cvn(t){return JSON.stringify(Jo.FIMCompletionRequest$outboundSchema.parse(t))}function dvn(t){return(0,J8t.safeParse)(t,e=>Jo.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var eVt=v(nl=>{"use strict";var fvn=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]}),pvn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mvn=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)&&fvn(e,t,r);return pvn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.FIMCompletionResponse$=nl.FIMCompletionResponse$outboundSchema=nl.FIMCompletionResponse$inboundSchema=void 0;nl.fimCompletionResponseToJSON=gvn;nl.fimCompletionResponseFromJSON=yvn;var Oy=mvn(Ie()),hvn=we(),X8t=Yde(),Q8t=A4();nl.FIMCompletionResponse$inboundSchema=Oy.object({id:Oy.string(),object:Oy.string(),model:Oy.string(),usage:Q8t.UsageInfo$inboundSchema,created:Oy.number().int().optional(),choices:Oy.array(X8t.ChatCompletionChoice$inboundSchema).optional()});nl.FIMCompletionResponse$outboundSchema=Oy.object({id:Oy.string(),object:Oy.string(),model:Oy.string(),usage:Q8t.UsageInfo$outboundSchema,created:Oy.number().int().optional(),choices:Oy.array(X8t.ChatCompletionChoice$outboundSchema).optional()});var Y8t;(function(t){t.inboundSchema=nl.FIMCompletionResponse$inboundSchema,t.outboundSchema=nl.FIMCompletionResponse$outboundSchema})(Y8t||(nl.FIMCompletionResponse$=Y8t={}));function gvn(t){return JSON.stringify(nl.FIMCompletionResponse$outboundSchema.parse(t))}function yvn(t){return(0,hvn.safeParse)(t,e=>nl.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var iVt=v(Zo=>{"use strict";var bvn=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]}),_vn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vvn=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)&&bvn(e,t,r);return _vn(e,t),e};Object.defineProperty(Zo,"__esModule",{value:!0});Zo.FIMCompletionStreamRequest$=Zo.FIMCompletionStreamRequest$outboundSchema=Zo.FIMCompletionStreamRequest$inboundSchema=Zo.FIMCompletionStreamRequestStop$=Zo.FIMCompletionStreamRequestStop$outboundSchema=Zo.FIMCompletionStreamRequestStop$inboundSchema=void 0;Zo.fimCompletionStreamRequestStopToJSON=wvn;Zo.fimCompletionStreamRequestStopFromJSON=xvn;Zo.fimCompletionStreamRequestToJSON=Svn;Zo.fimCompletionStreamRequestFromJSON=Cvn;var Er=vvn(Ie()),nVt=We(),oVt=we();Zo.FIMCompletionStreamRequestStop$inboundSchema=Er.union([Er.string(),Er.array(Er.string())]);Zo.FIMCompletionStreamRequestStop$outboundSchema=Er.union([Er.string(),Er.array(Er.string())]);var tVt;(function(t){t.inboundSchema=Zo.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Zo.FIMCompletionStreamRequestStop$outboundSchema})(tVt||(Zo.FIMCompletionStreamRequestStop$=tVt={}));function wvn(t){return JSON.stringify(Zo.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function xvn(t){return(0,oVt.safeParse)(t,e=>Zo.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}Zo.FIMCompletionStreamRequest$inboundSchema=Er.object({model:Er.nullable(Er.string()),temperature:Er.nullable(Er.number()).optional(),top_p:Er.number().default(1),max_tokens:Er.nullable(Er.number().int()).optional(),stream:Er.boolean().default(!0),stop:Er.union([Er.string(),Er.array(Er.string())]).optional(),random_seed:Er.nullable(Er.number().int()).optional(),prompt:Er.string(),suffix:Er.nullable(Er.string()).optional(),min_tokens:Er.nullable(Er.number().int()).optional()}).transform(t=>(0,nVt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Zo.FIMCompletionStreamRequest$outboundSchema=Er.object({model:Er.nullable(Er.string()),temperature:Er.nullable(Er.number()).optional(),topP:Er.number().default(1),maxTokens:Er.nullable(Er.number().int()).optional(),stream:Er.boolean().default(!0),stop:Er.union([Er.string(),Er.array(Er.string())]).optional(),randomSeed:Er.nullable(Er.number().int()).optional(),prompt:Er.string(),suffix:Er.nullable(Er.string()).optional(),minTokens:Er.nullable(Er.number().int()).optional()}).transform(t=>(0,nVt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var rVt;(function(t){t.inboundSchema=Zo.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=Zo.FIMCompletionStreamRequest$outboundSchema})(rVt||(Zo.FIMCompletionStreamRequest$=rVt={}));function Svn(t){return JSON.stringify(Zo.FIMCompletionStreamRequest$outboundSchema.parse(t))}function Cvn(t){return(0,oVt.safeParse)(t,e=>Zo.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var dBe=v(ol=>{"use strict";var Ovn=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]}),Pvn=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Evn=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)&&Ovn(e,t,r);return Pvn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.FTModelCapabilitiesOut$=ol.FTModelCapabilitiesOut$outboundSchema=ol.FTModelCapabilitiesOut$inboundSchema=void 0;ol.ftModelCapabilitiesOutToJSON=Avn;ol.ftModelCapabilitiesOutFromJSON=Ivn;var GC=Evn(Ie()),sVt=We(),Tvn=we();ol.FTModelCapabilitiesOut$inboundSchema=GC.object({completion_chat:GC.boolean().default(!0),completion_fim:GC.boolean().default(!1),function_calling:GC.boolean().default(!1),fine_tuning:GC.boolean().default(!1)}).transform(t=>(0,sVt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));ol.FTModelCapabilitiesOut$outboundSchema=GC.object({completionChat:GC.boolean().default(!0),completionFim:GC.boolean().default(!1),functionCalling:GC.boolean().default(!1),fineTuning:GC.boolean().default(!1)}).transform(t=>(0,sVt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var aVt;(function(t){t.inboundSchema=ol.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=ol.FTModelCapabilitiesOut$outboundSchema})(aVt||(ol.FTModelCapabilitiesOut$=aVt={}));function Avn(t){return JSON.stringify(ol.FTModelCapabilitiesOut$outboundSchema.parse(t))}function Ivn(t){return(0,Tvn.safeParse)(t,e=>ol.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var fBe=v(Yo=>{"use strict";var Mvn=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]}),Rvn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nvn=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)&&Mvn(e,t,r);return Rvn(e,t),e};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.FTModelCard$=Yo.FTModelCard$outboundSchema=Yo.FTModelCard$inboundSchema=Yo.FTModelCardType$=Yo.FTModelCardType$outboundSchema=Yo.FTModelCardType$inboundSchema=Yo.FTModelCardType=void 0;Yo.ftModelCardToJSON=Dvn;Yo.ftModelCardFromJSON=Lvn;var gn=Nvn(Ie()),cVt=We(),jvn=we(),dVt=Jde();Yo.FTModelCardType={FineTuned:"fine-tuned"};Yo.FTModelCardType$inboundSchema=gn.nativeEnum(Yo.FTModelCardType);Yo.FTModelCardType$outboundSchema=Yo.FTModelCardType$inboundSchema;var uVt;(function(t){t.inboundSchema=Yo.FTModelCardType$inboundSchema,t.outboundSchema=Yo.FTModelCardType$outboundSchema})(uVt||(Yo.FTModelCardType$=uVt={}));Yo.FTModelCard$inboundSchema=gn.object({id:gn.string(),object:gn.string().default("model"),created:gn.number().int().optional(),owned_by:gn.string().default("mistralai"),capabilities:dVt.ModelCapabilities$inboundSchema,name:gn.nullable(gn.string()).optional(),description:gn.nullable(gn.string()).optional(),max_context_length:gn.number().int().default(32768),aliases:gn.array(gn.string()).optional(),deprecation:gn.nullable(gn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:gn.nullable(gn.number()).optional(),type:gn.literal("fine-tuned").default("fine-tuned"),job:gn.string(),root:gn.string(),archived:gn.boolean().default(!1)}).transform(t=>(0,cVt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Yo.FTModelCard$outboundSchema=gn.object({id:gn.string(),object:gn.string().default("model"),created:gn.number().int().optional(),ownedBy:gn.string().default("mistralai"),capabilities:dVt.ModelCapabilities$outboundSchema,name:gn.nullable(gn.string()).optional(),description:gn.nullable(gn.string()).optional(),maxContextLength:gn.number().int().default(32768),aliases:gn.array(gn.string()).optional(),deprecation:gn.nullable(gn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:gn.nullable(gn.number()).optional(),type:gn.literal("fine-tuned").default("fine-tuned"),job:gn.string(),root:gn.string(),archived:gn.boolean().default(!1)}).transform(t=>(0,cVt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var lVt;(function(t){t.inboundSchema=Yo.FTModelCard$inboundSchema,t.outboundSchema=Yo.FTModelCard$outboundSchema})(lVt||(Yo.FTModelCard$=lVt={}));function Dvn(t){return JSON.stringify(Yo.FTModelCard$outboundSchema.parse(t))}function Lvn(t){return(0,jvn.safeParse)(t,e=>Yo.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var gVt=v(Xo=>{"use strict";var Fvn=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]}),kvn=Xo&&Xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$vn=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)&&Fvn(e,t,r);return kvn(e,t),e};Object.defineProperty(Xo,"__esModule",{value:!0});Xo.FTModelOut$=Xo.FTModelOut$outboundSchema=Xo.FTModelOut$inboundSchema=Xo.FTModelOutObject$=Xo.FTModelOutObject$outboundSchema=Xo.FTModelOutObject$inboundSchema=Xo.FTModelOutObject=void 0;Xo.ftModelOutToJSON=Bvn;Xo.ftModelOutFromJSON=Uvn;var bi=$vn(Ie()),mVt=We(),zvn=we(),hVt=dBe();Xo.FTModelOutObject={Model:"model"};Xo.FTModelOutObject$inboundSchema=bi.nativeEnum(Xo.FTModelOutObject);Xo.FTModelOutObject$outboundSchema=Xo.FTModelOutObject$inboundSchema;var fVt;(function(t){t.inboundSchema=Xo.FTModelOutObject$inboundSchema,t.outboundSchema=Xo.FTModelOutObject$outboundSchema})(fVt||(Xo.FTModelOutObject$=fVt={}));Xo.FTModelOut$inboundSchema=bi.object({id:bi.string(),object:bi.literal("model").default("model"),created:bi.number().int(),owned_by:bi.string(),root:bi.string(),archived:bi.boolean(),name:bi.nullable(bi.string()).optional(),description:bi.nullable(bi.string()).optional(),capabilities:hVt.FTModelCapabilitiesOut$inboundSchema,max_context_length:bi.number().int().default(32768),aliases:bi.array(bi.string()).optional(),job:bi.string()}).transform(t=>(0,mVt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));Xo.FTModelOut$outboundSchema=bi.object({id:bi.string(),object:bi.literal("model").default("model"),created:bi.number().int(),ownedBy:bi.string(),root:bi.string(),archived:bi.boolean(),name:bi.nullable(bi.string()).optional(),description:bi.nullable(bi.string()).optional(),capabilities:hVt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:bi.number().int().default(32768),aliases:bi.array(bi.string()).optional(),job:bi.string()}).transform(t=>(0,mVt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var pVt;(function(t){t.inboundSchema=Xo.FTModelOut$inboundSchema,t.outboundSchema=Xo.FTModelOut$outboundSchema})(pVt||(Xo.FTModelOut$=pVt={}));function Bvn(t){return JSON.stringify(Xo.FTModelOut$outboundSchema.parse(t))}function Uvn(t){return(0,zvn.safeParse)(t,e=>Xo.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var pBe=v(Qo=>{"use strict";var qvn=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]}),Hvn=Qo&&Qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vvn=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)&&qvn(e,t,r);return Hvn(e,t),e};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.GithubRepositoryIn$=Qo.GithubRepositoryIn$outboundSchema=Qo.GithubRepositoryIn$inboundSchema=Qo.GithubRepositoryInType$=Qo.GithubRepositoryInType$outboundSchema=Qo.GithubRepositoryInType$inboundSchema=Qo.GithubRepositoryInType=void 0;Qo.githubRepositoryInToJSON=Kvn;Qo.githubRepositoryInFromJSON=Gvn;var Ad=Vvn(Ie()),Wvn=we();Qo.GithubRepositoryInType={Github:"github"};Qo.GithubRepositoryInType$inboundSchema=Ad.nativeEnum(Qo.GithubRepositoryInType);Qo.GithubRepositoryInType$outboundSchema=Qo.GithubRepositoryInType$inboundSchema;var yVt;(function(t){t.inboundSchema=Qo.GithubRepositoryInType$inboundSchema,t.outboundSchema=Qo.GithubRepositoryInType$outboundSchema})(yVt||(Qo.GithubRepositoryInType$=yVt={}));Qo.GithubRepositoryIn$inboundSchema=Ad.object({type:Ad.literal("github").default("github"),name:Ad.string(),owner:Ad.string(),ref:Ad.nullable(Ad.string()).optional(),weight:Ad.number().default(1),token:Ad.string()});Qo.GithubRepositoryIn$outboundSchema=Ad.object({type:Ad.literal("github").default("github"),name:Ad.string(),owner:Ad.string(),ref:Ad.nullable(Ad.string()).optional(),weight:Ad.number().default(1),token:Ad.string()});var bVt;(function(t){t.inboundSchema=Qo.GithubRepositoryIn$inboundSchema,t.outboundSchema=Qo.GithubRepositoryIn$outboundSchema})(bVt||(Qo.GithubRepositoryIn$=bVt={}));function Kvn(t){return JSON.stringify(Qo.GithubRepositoryIn$outboundSchema.parse(t))}function Gvn(t){return(0,Wvn.safeParse)(t,e=>Qo.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var mBe=v(il=>{"use strict";var Jvn=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]}),Zvn=il&&il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yvn=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)&&Jvn(e,t,r);return Zvn(e,t),e};Object.defineProperty(il,"__esModule",{value:!0});il.TrainingFile$=il.TrainingFile$outboundSchema=il.TrainingFile$inboundSchema=void 0;il.trainingFileToJSON=Qvn;il.trainingFileFromJSON=ewn;var M4=Yvn(Ie()),vVt=We(),Xvn=we();il.TrainingFile$inboundSchema=M4.object({file_id:M4.string(),weight:M4.number().default(1)}).transform(t=>(0,vVt.remap)(t,{file_id:"fileId"}));il.TrainingFile$outboundSchema=M4.object({fileId:M4.string(),weight:M4.number().default(1)}).transform(t=>(0,vVt.remap)(t,{fileId:"file_id"}));var _Vt;(function(t){t.inboundSchema=il.TrainingFile$inboundSchema,t.outboundSchema=il.TrainingFile$outboundSchema})(_Vt||(il.TrainingFile$=_Vt={}));function Qvn(t){return JSON.stringify(il.TrainingFile$outboundSchema.parse(t))}function ewn(t){return(0,Xvn.safeParse)(t,e=>il.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var hBe=v(al=>{"use strict";var twn=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]}),rwn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nwn=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)&&twn(e,t,r);return rwn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.TrainingParametersIn$=al.TrainingParametersIn$outboundSchema=al.TrainingParametersIn$inboundSchema=void 0;al.trainingParametersInToJSON=iwn;al.trainingParametersInFromJSON=awn;var $i=nwn(Ie()),xVt=We(),own=we();al.TrainingParametersIn$inboundSchema=$i.object({training_steps:$i.nullable($i.number().int()).optional(),learning_rate:$i.number().default(1e-4),weight_decay:$i.nullable($i.number()).optional(),warmup_fraction:$i.nullable($i.number()).optional(),epochs:$i.nullable($i.number()).optional(),fim_ratio:$i.nullable($i.number()).optional(),seq_len:$i.nullable($i.number().int()).optional()}).transform(t=>(0,xVt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));al.TrainingParametersIn$outboundSchema=$i.object({trainingSteps:$i.nullable($i.number().int()).optional(),learningRate:$i.number().default(1e-4),weightDecay:$i.nullable($i.number()).optional(),warmupFraction:$i.nullable($i.number()).optional(),epochs:$i.nullable($i.number()).optional(),fimRatio:$i.nullable($i.number()).optional(),seqLen:$i.nullable($i.number().int()).optional()}).transform(t=>(0,xVt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var wVt;(function(t){t.inboundSchema=al.TrainingParametersIn$inboundSchema,t.outboundSchema=al.TrainingParametersIn$outboundSchema})(wVt||(al.TrainingParametersIn$=wVt={}));function iwn(t){return JSON.stringify(al.TrainingParametersIn$outboundSchema.parse(t))}function awn(t){return(0,own.safeParse)(t,e=>al.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var gBe=v(ei=>{"use strict";var swn=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]}),uwn=ei&&ei.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lwn=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)&&swn(e,t,r);return uwn(e,t),e};Object.defineProperty(ei,"__esModule",{value:!0});ei.WandbIntegration$=ei.WandbIntegration$outboundSchema=ei.WandbIntegration$inboundSchema=ei.WandbIntegrationType$=ei.WandbIntegrationType$outboundSchema=ei.WandbIntegrationType$inboundSchema=ei.WandbIntegrationType=void 0;ei.wandbIntegrationToJSON=dwn;ei.wandbIntegrationFromJSON=fwn;var Id=lwn(Ie()),OVt=We(),cwn=we();ei.WandbIntegrationType={Wandb:"wandb"};ei.WandbIntegrationType$inboundSchema=Id.nativeEnum(ei.WandbIntegrationType);ei.WandbIntegrationType$outboundSchema=ei.WandbIntegrationType$inboundSchema;var SVt;(function(t){t.inboundSchema=ei.WandbIntegrationType$inboundSchema,t.outboundSchema=ei.WandbIntegrationType$outboundSchema})(SVt||(ei.WandbIntegrationType$=SVt={}));ei.WandbIntegration$inboundSchema=Id.object({type:Id.literal("wandb").default("wandb"),project:Id.string(),name:Id.nullable(Id.string()).optional(),api_key:Id.string(),run_name:Id.nullable(Id.string()).optional()}).transform(t=>(0,OVt.remap)(t,{api_key:"apiKey",run_name:"runName"}));ei.WandbIntegration$outboundSchema=Id.object({type:Id.literal("wandb").default("wandb"),project:Id.string(),name:Id.nullable(Id.string()).optional(),apiKey:Id.string(),runName:Id.nullable(Id.string()).optional()}).transform(t=>(0,OVt.remap)(t,{apiKey:"api_key",runName:"run_name"}));var CVt;(function(t){t.inboundSchema=ei.WandbIntegration$inboundSchema,t.outboundSchema=ei.WandbIntegration$outboundSchema})(CVt||(ei.WandbIntegration$=CVt={}));function dwn(t){return JSON.stringify(ei.WandbIntegration$outboundSchema.parse(t))}function fwn(t){return(0,cwn.safeParse)(t,e=>ei.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var RVt=v(Gr=>{"use strict";var pwn=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]}),mwn=Gr&&Gr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hwn=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)&&pwn(e,t,r);return mwn(e,t),e};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.JobIn$=Gr.JobIn$outboundSchema=Gr.JobIn$inboundSchema=Gr.JobInRepositories$=Gr.JobInRepositories$outboundSchema=Gr.JobInRepositories$inboundSchema=Gr.JobInIntegrations$=Gr.JobInIntegrations$outboundSchema=Gr.JobInIntegrations$inboundSchema=void 0;Gr.jobInIntegrationsToJSON=gwn;Gr.jobInIntegrationsFromJSON=ywn;Gr.jobInRepositoriesToJSON=bwn;Gr.jobInRepositoriesFromJSON=_wn;Gr.jobInToJSON=vwn;Gr.jobInFromJSON=wwn;var Ua=hwn(Ie()),AVt=We(),yBe=we(),vfe=pBe(),IVt=mBe(),MVt=hBe(),wfe=gBe();Gr.JobInIntegrations$inboundSchema=wfe.WandbIntegration$inboundSchema;Gr.JobInIntegrations$outboundSchema=wfe.WandbIntegration$outboundSchema;var PVt;(function(t){t.inboundSchema=Gr.JobInIntegrations$inboundSchema,t.outboundSchema=Gr.JobInIntegrations$outboundSchema})(PVt||(Gr.JobInIntegrations$=PVt={}));function gwn(t){return JSON.stringify(Gr.JobInIntegrations$outboundSchema.parse(t))}function ywn(t){return(0,yBe.safeParse)(t,e=>Gr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Gr.JobInRepositories$inboundSchema=vfe.GithubRepositoryIn$inboundSchema;Gr.JobInRepositories$outboundSchema=vfe.GithubRepositoryIn$outboundSchema;var EVt;(function(t){t.inboundSchema=Gr.JobInRepositories$inboundSchema,t.outboundSchema=Gr.JobInRepositories$outboundSchema})(EVt||(Gr.JobInRepositories$=EVt={}));function bwn(t){return JSON.stringify(Gr.JobInRepositories$outboundSchema.parse(t))}function _wn(t){return(0,yBe.safeParse)(t,e=>Gr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Gr.JobIn$inboundSchema=Ua.object({model:Ua.string(),training_files:Ua.array(IVt.TrainingFile$inboundSchema).optional(),validation_files:Ua.nullable(Ua.array(Ua.string())).optional(),hyperparameters:MVt.TrainingParametersIn$inboundSchema,suffix:Ua.nullable(Ua.string()).optional(),integrations:Ua.nullable(Ua.array(wfe.WandbIntegration$inboundSchema)).optional(),repositories:Ua.array(vfe.GithubRepositoryIn$inboundSchema).optional(),auto_start:Ua.boolean().optional()}).transform(t=>(0,AVt.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));Gr.JobIn$outboundSchema=Ua.object({model:Ua.string(),trainingFiles:Ua.array(IVt.TrainingFile$outboundSchema).optional(),validationFiles:Ua.nullable(Ua.array(Ua.string())).optional(),hyperparameters:MVt.TrainingParametersIn$outboundSchema,suffix:Ua.nullable(Ua.string()).optional(),integrations:Ua.nullable(Ua.array(wfe.WandbIntegration$outboundSchema)).optional(),repositories:Ua.array(vfe.GithubRepositoryIn$outboundSchema).optional(),autoStart:Ua.boolean().optional()}).transform(t=>(0,AVt.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var TVt;(function(t){t.inboundSchema=Gr.JobIn$inboundSchema,t.outboundSchema=Gr.JobIn$outboundSchema})(TVt||(Gr.JobIn$=TVt={}));function vwn(t){return JSON.stringify(Gr.JobIn$outboundSchema.parse(t))}function wwn(t){return(0,yBe.safeParse)(t,e=>Gr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var _Be=v(wt=>{"use strict";var xwn=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]}),Swn=wt&&wt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cwn=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)&&xwn(e,t,r);return Swn(e,t),e};Object.defineProperty(wt,"__esModule",{value:!0});wt.JobOut$=wt.JobOut$outboundSchema=wt.JobOut$inboundSchema=wt.Repositories$=wt.Repositories$outboundSchema=wt.Repositories$inboundSchema=wt.Integrations$=wt.Integrations$outboundSchema=wt.Integrations$inboundSchema=wt.ObjectT$=wt.ObjectT$outboundSchema=wt.ObjectT$inboundSchema=wt.Status$=wt.Status$outboundSchema=wt.Status$inboundSchema=wt.ObjectT=wt.Status=void 0;wt.integrationsToJSON=Own;wt.integrationsFromJSON=Pwn;wt.repositoriesToJSON=Ewn;wt.repositoriesFromJSON=Twn;wt.jobOutToJSON=Awn;wt.jobOutFromJSON=Iwn;var Tr=Cwn(Ie()),kVt=We(),bBe=we(),xfe=pfe(),$Vt=mfe(),zVt=hfe(),Sfe=gfe();wt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};wt.ObjectT={Job:"job"};wt.Status$inboundSchema=Tr.nativeEnum(wt.Status);wt.Status$outboundSchema=wt.Status$inboundSchema;var NVt;(function(t){t.inboundSchema=wt.Status$inboundSchema,t.outboundSchema=wt.Status$outboundSchema})(NVt||(wt.Status$=NVt={}));wt.ObjectT$inboundSchema=Tr.nativeEnum(wt.ObjectT);wt.ObjectT$outboundSchema=wt.ObjectT$inboundSchema;var jVt;(function(t){t.inboundSchema=wt.ObjectT$inboundSchema,t.outboundSchema=wt.ObjectT$outboundSchema})(jVt||(wt.ObjectT$=jVt={}));wt.Integrations$inboundSchema=Sfe.WandbIntegrationOut$inboundSchema;wt.Integrations$outboundSchema=Sfe.WandbIntegrationOut$outboundSchema;var DVt;(function(t){t.inboundSchema=wt.Integrations$inboundSchema,t.outboundSchema=wt.Integrations$outboundSchema})(DVt||(wt.Integrations$=DVt={}));function Own(t){return JSON.stringify(wt.Integrations$outboundSchema.parse(t))}function Pwn(t){return(0,bBe.safeParse)(t,e=>wt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}wt.Repositories$inboundSchema=xfe.GithubRepositoryOut$inboundSchema;wt.Repositories$outboundSchema=xfe.GithubRepositoryOut$outboundSchema;var LVt;(function(t){t.inboundSchema=wt.Repositories$inboundSchema,t.outboundSchema=wt.Repositories$outboundSchema})(LVt||(wt.Repositories$=LVt={}));function Ewn(t){return JSON.stringify(wt.Repositories$outboundSchema.parse(t))}function Twn(t){return(0,bBe.safeParse)(t,e=>wt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}wt.JobOut$inboundSchema=Tr.object({id:Tr.string(),auto_start:Tr.boolean(),hyperparameters:zVt.TrainingParameters$inboundSchema,model:Tr.string(),status:wt.Status$inboundSchema,job_type:Tr.string(),created_at:Tr.number().int(),modified_at:Tr.number().int(),training_files:Tr.array(Tr.string()),validation_files:Tr.nullable(Tr.array(Tr.string())).optional(),object:Tr.literal("job").default("job"),fine_tuned_model:Tr.nullable(Tr.string()).optional(),suffix:Tr.nullable(Tr.string()).optional(),integrations:Tr.nullable(Tr.array(Sfe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Tr.nullable(Tr.number().int()).optional(),repositories:Tr.array(xfe.GithubRepositoryOut$inboundSchema).optional(),metadata:Tr.nullable($Vt.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,kVt.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));wt.JobOut$outboundSchema=Tr.object({id:Tr.string(),autoStart:Tr.boolean(),hyperparameters:zVt.TrainingParameters$outboundSchema,model:Tr.string(),status:wt.Status$outboundSchema,jobType:Tr.string(),createdAt:Tr.number().int(),modifiedAt:Tr.number().int(),trainingFiles:Tr.array(Tr.string()),validationFiles:Tr.nullable(Tr.array(Tr.string())).optional(),object:Tr.literal("job").default("job"),fineTunedModel:Tr.nullable(Tr.string()).optional(),suffix:Tr.nullable(Tr.string()).optional(),integrations:Tr.nullable(Tr.array(Sfe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Tr.nullable(Tr.number().int()).optional(),repositories:Tr.array(xfe.GithubRepositoryOut$outboundSchema).optional(),metadata:Tr.nullable($Vt.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,kVt.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 FVt;(function(t){t.inboundSchema=wt.JobOut$inboundSchema,t.outboundSchema=wt.JobOut$outboundSchema})(FVt||(wt.JobOut$=FVt={}));function Awn(t){return JSON.stringify(wt.JobOut$outboundSchema.parse(t))}function Iwn(t){return(0,bBe.safeParse)(t,e=>wt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var HVt=v(ti=>{"use strict";var Mwn=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]}),Rwn=ti&&ti.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nwn=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)&&Mwn(e,t,r);return Rwn(e,t),e};Object.defineProperty(ti,"__esModule",{value:!0});ti.JobsOut$=ti.JobsOut$outboundSchema=ti.JobsOut$inboundSchema=ti.JobsOutObject$=ti.JobsOutObject$outboundSchema=ti.JobsOutObject$inboundSchema=ti.JobsOutObject=void 0;ti.jobsOutToJSON=Dwn;ti.jobsOutFromJSON=Lwn;var RE=Nwn(Ie()),jwn=we(),qVt=_Be();ti.JobsOutObject={List:"list"};ti.JobsOutObject$inboundSchema=RE.nativeEnum(ti.JobsOutObject);ti.JobsOutObject$outboundSchema=ti.JobsOutObject$inboundSchema;var BVt;(function(t){t.inboundSchema=ti.JobsOutObject$inboundSchema,t.outboundSchema=ti.JobsOutObject$outboundSchema})(BVt||(ti.JobsOutObject$=BVt={}));ti.JobsOut$inboundSchema=RE.object({data:RE.array(qVt.JobOut$inboundSchema).optional(),object:RE.literal("list").default("list"),total:RE.number().int()});ti.JobsOut$outboundSchema=RE.object({data:RE.array(qVt.JobOut$outboundSchema).optional(),object:RE.literal("list").default("list"),total:RE.number().int()});var UVt;(function(t){t.inboundSchema=ti.JobsOut$inboundSchema,t.outboundSchema=ti.JobsOut$outboundSchema})(UVt||(ti.JobsOut$=UVt={}));function Dwn(t){return JSON.stringify(ti.JobsOut$outboundSchema.parse(t))}function Lwn(t){return(0,jwn.safeParse)(t,e=>ti.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var GVt=v(ri=>{"use strict";var Fwn=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]}),kwn=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$wn=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)&&Fwn(e,t,r);return kwn(e,t),e};Object.defineProperty(ri,"__esModule",{value:!0});ri.LegacyJobMetadataOut$=ri.LegacyJobMetadataOut$outboundSchema=ri.LegacyJobMetadataOut$inboundSchema=ri.LegacyJobMetadataOutObject$=ri.LegacyJobMetadataOutObject$outboundSchema=ri.LegacyJobMetadataOutObject$inboundSchema=ri.LegacyJobMetadataOutObject=void 0;ri.legacyJobMetadataOutToJSON=Bwn;ri.legacyJobMetadataOutFromJSON=Uwn;var Wr=$wn(Ie()),KVt=We(),zwn=we();ri.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};ri.LegacyJobMetadataOutObject$inboundSchema=Wr.nativeEnum(ri.LegacyJobMetadataOutObject);ri.LegacyJobMetadataOutObject$outboundSchema=ri.LegacyJobMetadataOutObject$inboundSchema;var VVt;(function(t){t.inboundSchema=ri.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=ri.LegacyJobMetadataOutObject$outboundSchema})(VVt||(ri.LegacyJobMetadataOutObject$=VVt={}));ri.LegacyJobMetadataOut$inboundSchema=Wr.object({expected_duration_seconds:Wr.nullable(Wr.number().int()).optional(),cost:Wr.nullable(Wr.number()).optional(),cost_currency:Wr.nullable(Wr.string()).optional(),train_tokens_per_step:Wr.nullable(Wr.number().int()).optional(),train_tokens:Wr.nullable(Wr.number().int()).optional(),data_tokens:Wr.nullable(Wr.number().int()).optional(),estimated_start_time:Wr.nullable(Wr.number().int()).optional(),deprecated:Wr.boolean().default(!0),details:Wr.string(),epochs:Wr.nullable(Wr.number()).optional(),training_steps:Wr.nullable(Wr.number().int()).optional(),object:Wr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,KVt.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"}));ri.LegacyJobMetadataOut$outboundSchema=Wr.object({expectedDurationSeconds:Wr.nullable(Wr.number().int()).optional(),cost:Wr.nullable(Wr.number()).optional(),costCurrency:Wr.nullable(Wr.string()).optional(),trainTokensPerStep:Wr.nullable(Wr.number().int()).optional(),trainTokens:Wr.nullable(Wr.number().int()).optional(),dataTokens:Wr.nullable(Wr.number().int()).optional(),estimatedStartTime:Wr.nullable(Wr.number().int()).optional(),deprecated:Wr.boolean().default(!0),details:Wr.string(),epochs:Wr.nullable(Wr.number()).optional(),trainingSteps:Wr.nullable(Wr.number().int()).optional(),object:Wr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,KVt.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 WVt;(function(t){t.inboundSchema=ri.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=ri.LegacyJobMetadataOut$outboundSchema})(WVt||(ri.LegacyJobMetadataOut$=WVt={}));function Bwn(t){return JSON.stringify(ri.LegacyJobMetadataOut$outboundSchema.parse(t))}function Uwn(t){return(0,zwn.safeParse)(t,e=>ri.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var YVt=v(sl=>{"use strict";var qwn=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]}),Hwn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vwn=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)&&qwn(e,t,r);return Hwn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.ListFilesOut$=sl.ListFilesOut$outboundSchema=sl.ListFilesOut$inboundSchema=void 0;sl.listFilesOutToJSON=Kwn;sl.listFilesOutFromJSON=Gwn;var PR=Vwn(Ie()),Wwn=we(),ZVt=cBe();sl.ListFilesOut$inboundSchema=PR.object({data:PR.array(ZVt.FileSchema$inboundSchema),object:PR.string(),total:PR.number().int()});sl.ListFilesOut$outboundSchema=PR.object({data:PR.array(ZVt.FileSchema$outboundSchema),object:PR.string(),total:PR.number().int()});var JVt;(function(t){t.inboundSchema=sl.ListFilesOut$inboundSchema,t.outboundSchema=sl.ListFilesOut$outboundSchema})(JVt||(sl.ListFilesOut$=JVt={}));function Kwn(t){return JSON.stringify(sl.ListFilesOut$outboundSchema.parse(t))}function Gwn(t){return(0,Wwn.safeParse)(t,e=>sl.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var t5t=v(ni=>{"use strict";var Jwn=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]}),Zwn=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ywn=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)&&Jwn(e,t,r);return Zwn(e,t),e};Object.defineProperty(ni,"__esModule",{value:!0});ni.ModelList$=ni.ModelList$outboundSchema=ni.ModelList$inboundSchema=ni.Data$=ni.Data$outboundSchema=ni.Data$inboundSchema=void 0;ni.dataToJSON=Xwn;ni.dataFromJSON=Qwn;ni.modelListToJSON=e0n;ni.modelListFromJSON=t0n;var ra=Ywn(Ie()),e5t=we(),Cfe=Yze(),Ofe=fBe();ni.Data$inboundSchema=ra.union([Cfe.BaseModelCard$inboundSchema.and(ra.object({type:ra.literal("base")}).transform(t=>({type:t.type}))),Ofe.FTModelCard$inboundSchema.and(ra.object({type:ra.literal("fine-tuned")}).transform(t=>({type:t.type})))]);ni.Data$outboundSchema=ra.union([Cfe.BaseModelCard$outboundSchema.and(ra.object({type:ra.literal("base")}).transform(t=>({type:t.type}))),Ofe.FTModelCard$outboundSchema.and(ra.object({type:ra.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var XVt;(function(t){t.inboundSchema=ni.Data$inboundSchema,t.outboundSchema=ni.Data$outboundSchema})(XVt||(ni.Data$=XVt={}));function Xwn(t){return JSON.stringify(ni.Data$outboundSchema.parse(t))}function Qwn(t){return(0,e5t.safeParse)(t,e=>ni.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}ni.ModelList$inboundSchema=ra.object({object:ra.string().default("list"),data:ra.array(ra.union([Cfe.BaseModelCard$inboundSchema.and(ra.object({type:ra.literal("base")}).transform(t=>({type:t.type}))),Ofe.FTModelCard$inboundSchema.and(ra.object({type:ra.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});ni.ModelList$outboundSchema=ra.object({object:ra.string().default("list"),data:ra.array(ra.union([Cfe.BaseModelCard$outboundSchema.and(ra.object({type:ra.literal("base")}).transform(t=>({type:t.type}))),Ofe.FTModelCard$outboundSchema.and(ra.object({type:ra.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var QVt;(function(t){t.inboundSchema=ni.ModelList$inboundSchema,t.outboundSchema=ni.ModelList$outboundSchema})(QVt||(ni.ModelList$=QVt={}));function e0n(t){return JSON.stringify(ni.ModelList$outboundSchema.parse(t))}function t0n(t){return(0,e5t.safeParse)(t,e=>ni.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var s5t=v(ul=>{"use strict";var r0n=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]}),n0n=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o0n=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)&&r0n(e,t,r);return n0n(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.RetrieveFileOut$=ul.RetrieveFileOut$outboundSchema=ul.RetrieveFileOut$inboundSchema=void 0;ul.retrieveFileOutToJSON=a0n;ul.retrieveFileOutFromJSON=s0n;var kc=o0n(Ie()),n5t=We(),i0n=we(),o5t=yG(),i5t=bG(),a5t=_G();ul.RetrieveFileOut$inboundSchema=kc.object({id:kc.string(),object:kc.string(),bytes:kc.number().int(),created_at:kc.number().int(),filename:kc.string(),purpose:o5t.FilePurpose$inboundSchema,sample_type:i5t.SampleType$inboundSchema,num_lines:kc.nullable(kc.number().int()).optional(),source:a5t.Source$inboundSchema,deleted:kc.boolean()}).transform(t=>(0,n5t.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));ul.RetrieveFileOut$outboundSchema=kc.object({id:kc.string(),object:kc.string(),sizeBytes:kc.number().int(),createdAt:kc.number().int(),filename:kc.string(),purpose:o5t.FilePurpose$outboundSchema,sampleType:i5t.SampleType$outboundSchema,numLines:kc.nullable(kc.number().int()).optional(),source:a5t.Source$outboundSchema,deleted:kc.boolean()}).transform(t=>(0,n5t.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var r5t;(function(t){t.inboundSchema=ul.RetrieveFileOut$inboundSchema,t.outboundSchema=ul.RetrieveFileOut$outboundSchema})(r5t||(ul.RetrieveFileOut$=r5t={}));function a0n(t){return JSON.stringify(ul.RetrieveFileOut$outboundSchema.parse(t))}function s0n(t){return(0,i0n.safeParse)(t,e=>ul.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var c5t=v(ll=>{"use strict";var u0n=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]}),l0n=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c0n=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)&&u0n(e,t,r);return l0n(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.Security$=ll.Security$outboundSchema=ll.Security$inboundSchema=void 0;ll.securityToJSON=f0n;ll.securityFromJSON=p0n;var Pfe=c0n(Ie()),l5t=We(),d0n=we();ll.Security$inboundSchema=Pfe.object({ApiKey:Pfe.string().optional()}).transform(t=>(0,l5t.remap)(t,{ApiKey:"apiKey"}));ll.Security$outboundSchema=Pfe.object({apiKey:Pfe.string().optional()}).transform(t=>(0,l5t.remap)(t,{apiKey:"ApiKey"}));var u5t;(function(t){t.inboundSchema=ll.Security$inboundSchema,t.outboundSchema=ll.Security$outboundSchema})(u5t||(ll.Security$=u5t={}));function f0n(t){return JSON.stringify(ll.Security$outboundSchema.parse(t))}function p0n(t){return(0,d0n.safeParse)(t,e=>ll.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var p5t=v(oi=>{"use strict";var m0n=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]}),h0n=oi&&oi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g0n=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)&&m0n(e,t,r);return h0n(e,t),e};Object.defineProperty(oi,"__esModule",{value:!0});oi.UnarchiveFTModelOut$=oi.UnarchiveFTModelOut$outboundSchema=oi.UnarchiveFTModelOut$inboundSchema=oi.UnarchiveFTModelOutObject$=oi.UnarchiveFTModelOutObject$outboundSchema=oi.UnarchiveFTModelOutObject$inboundSchema=oi.UnarchiveFTModelOutObject=void 0;oi.unarchiveFTModelOutToJSON=b0n;oi.unarchiveFTModelOutFromJSON=_0n;var NE=g0n(Ie()),y0n=we();oi.UnarchiveFTModelOutObject={Model:"model"};oi.UnarchiveFTModelOutObject$inboundSchema=NE.nativeEnum(oi.UnarchiveFTModelOutObject);oi.UnarchiveFTModelOutObject$outboundSchema=oi.UnarchiveFTModelOutObject$inboundSchema;var d5t;(function(t){t.inboundSchema=oi.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=oi.UnarchiveFTModelOutObject$outboundSchema})(d5t||(oi.UnarchiveFTModelOutObject$=d5t={}));oi.UnarchiveFTModelOut$inboundSchema=NE.object({id:NE.string(),object:NE.literal("model").default("model"),archived:NE.boolean().default(!1)});oi.UnarchiveFTModelOut$outboundSchema=NE.object({id:NE.string(),object:NE.literal("model").default("model"),archived:NE.boolean().default(!1)});var f5t;(function(t){t.inboundSchema=oi.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=oi.UnarchiveFTModelOut$outboundSchema})(f5t||(oi.UnarchiveFTModelOut$=f5t={}));function b0n(t){return JSON.stringify(oi.UnarchiveFTModelOut$outboundSchema.parse(t))}function _0n(t){return(0,y0n.safeParse)(t,e=>oi.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var h5t=v(cl=>{"use strict";var v0n=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]}),w0n=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x0n=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)&&v0n(e,t,r);return w0n(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.UpdateFTModelIn$=cl.UpdateFTModelIn$outboundSchema=cl.UpdateFTModelIn$inboundSchema=void 0;cl.updateFTModelInToJSON=C0n;cl.updateFTModelInFromJSON=O0n;var JC=x0n(Ie()),S0n=we();cl.UpdateFTModelIn$inboundSchema=JC.object({name:JC.nullable(JC.string()).optional(),description:JC.nullable(JC.string()).optional()});cl.UpdateFTModelIn$outboundSchema=JC.object({name:JC.nullable(JC.string()).optional(),description:JC.nullable(JC.string()).optional()});var m5t;(function(t){t.inboundSchema=cl.UpdateFTModelIn$inboundSchema,t.outboundSchema=cl.UpdateFTModelIn$outboundSchema})(m5t||(cl.UpdateFTModelIn$=m5t={}));function C0n(t){return JSON.stringify(cl.UpdateFTModelIn$outboundSchema.parse(t))}function O0n(t){return(0,S0n.safeParse)(t,e=>cl.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var w5t=v(dl=>{"use strict";var P0n=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]}),E0n=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T0n=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)&&P0n(e,t,r);return E0n(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.UploadFileOut$=dl.UploadFileOut$outboundSchema=dl.UploadFileOut$inboundSchema=void 0;dl.uploadFileOutToJSON=I0n;dl.uploadFileOutFromJSON=M0n;var Lf=T0n(Ie()),y5t=We(),A0n=we(),b5t=yG(),_5t=bG(),v5t=_G();dl.UploadFileOut$inboundSchema=Lf.object({id:Lf.string(),object:Lf.string(),bytes:Lf.number().int(),created_at:Lf.number().int(),filename:Lf.string(),purpose:b5t.FilePurpose$inboundSchema,sample_type:_5t.SampleType$inboundSchema,num_lines:Lf.nullable(Lf.number().int()).optional(),source:v5t.Source$inboundSchema}).transform(t=>(0,y5t.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));dl.UploadFileOut$outboundSchema=Lf.object({id:Lf.string(),object:Lf.string(),sizeBytes:Lf.number().int(),createdAt:Lf.number().int(),filename:Lf.string(),purpose:b5t.FilePurpose$outboundSchema,sampleType:_5t.SampleType$outboundSchema,numLines:Lf.nullable(Lf.number().int()).optional(),source:v5t.Source$outboundSchema}).transform(t=>(0,y5t.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var g5t;(function(t){t.inboundSchema=dl.UploadFileOut$inboundSchema,t.outboundSchema=dl.UploadFileOut$outboundSchema})(g5t||(dl.UploadFileOut$=g5t={}));function I0n(t){return JSON.stringify(dl.UploadFileOut$outboundSchema.parse(t))}function M0n(t){return(0,A0n.safeParse)(t,e=>dl.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var O5t=v(ii=>{"use strict";var R0n=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]}),N0n=ii&&ii.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j0n=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)&&R0n(e,t,r);return N0n(e,t),e};Object.defineProperty(ii,"__esModule",{value:!0});ii.ValidationError$=ii.ValidationError$outboundSchema=ii.ValidationError$inboundSchema=ii.Loc$=ii.Loc$outboundSchema=ii.Loc$inboundSchema=void 0;ii.locToJSON=D0n;ii.locFromJSON=L0n;ii.validationErrorToJSON=F0n;ii.validationErrorFromJSON=k0n;var fl=j0n(Ie()),C5t=we();ii.Loc$inboundSchema=fl.union([fl.string(),fl.number().int()]);ii.Loc$outboundSchema=fl.union([fl.string(),fl.number().int()]);var x5t;(function(t){t.inboundSchema=ii.Loc$inboundSchema,t.outboundSchema=ii.Loc$outboundSchema})(x5t||(ii.Loc$=x5t={}));function D0n(t){return JSON.stringify(ii.Loc$outboundSchema.parse(t))}function L0n(t){return(0,C5t.safeParse)(t,e=>ii.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}ii.ValidationError$inboundSchema=fl.object({loc:fl.array(fl.union([fl.string(),fl.number().int()])),msg:fl.string(),type:fl.string()});ii.ValidationError$outboundSchema=fl.object({loc:fl.array(fl.union([fl.string(),fl.number().int()])),msg:fl.string(),type:fl.string()});var S5t;(function(t){t.inboundSchema=ii.ValidationError$inboundSchema,t.outboundSchema=ii.ValidationError$outboundSchema})(S5t||(ii.ValidationError$=S5t={}));function F0n(t){return JSON.stringify(ii.ValidationError$outboundSchema.parse(t))}function k0n(t){return(0,C5t.safeParse)(t,e=>ii.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var Jn=v(Je=>{"use strict";var $0n=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]}),tt=Je&&Je.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$0n(e,t,r)};Object.defineProperty(Je,"__esModule",{value:!0});tt(uHt(),Je);tt(yHt(),Je);tt(Zze(),Je);tt(wHt(),Je);tt(wR(),Je);tt(Yze(),Je);tt(Xze(),Je);tt(RHt(),Je);tt(eBe(),Je);tt(UHt(),Je);tt(Qze(),Je);tt(GHt(),Je);tt(Yde(),Je);tt(s6t(),Je);tt(p6t(),Je);tt(x6t(),Je);tt(rBe(),Je);tt(nBe(),Je);tt(j6t(),Je);tt(F6t(),Je);tt(aBe(),Je);tt(X6t(),Je);tt(iBe(),Je);tt(w4(),Je);tt(e8t(),Je);tt(r8t(),Je);tt(oBe(),Je);tt(O8t(),Je);tt(I8t(),Je);tt(D8t(),Je);tt(lBe(),Je);tt(sBe(),Je);tt(yG(),Je);tt(cBe(),Je);tt(V8t(),Je);tt(Z8t(),Je);tt(eVt(),Je);tt(iVt(),Je);tt(dBe(),Je);tt(fBe(),Je);tt(gVt(),Je);tt(Gze(),Je);tt(Hze(),Je);tt(Jze(),Je);tt(pBe(),Je);tt(pfe(),Je);tt(Bze(),Je);tt(Uze(),Je);tt(RVt(),Je);tt(mfe(),Je);tt(_Be(),Je);tt(HVt(),Je);tt(Wze(),Je);tt(GVt(),Je);tt(YVt(),Je);tt(tBe(),Je);tt(Jde(),Je);tt(t5t(),Je);tt(S4(),Je);tt(qze(),Je);tt(C4(),Je);tt(Kze(),Je);tt(s5t(),Je);tt(bG(),Je);tt(c5t(),Je);tt(_G(),Je);tt(CF(),Je);tt(Ede(),Je);tt(O4(),Je);tt(Tde(),Je);tt(P4(),Je);tt(E4(),Je);tt(OF(),Je);tt(hG(),Je);tt(mBe(),Je);tt(hfe(),Je);tt(hBe(),Je);tt(p5t(),Je);tt(h5t(),Je);tt(w5t(),Je);tt(A4(),Je);tt(PF(),Je);tt(O5t(),Je);tt(gBe(),Je);tt(gfe(),Je)});var A5t=v($c=>{"use strict";var z0n=$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]}),B0n=$c&&$c.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E5t=$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)&&z0n(e,t,r);return B0n(e,t),e};Object.defineProperty($c,"__esModule",{value:!0});$c.HTTPValidationError$=$c.HTTPValidationError$outboundSchema=$c.HTTPValidationError$inboundSchema=$c.HTTPValidationError=void 0;var vG=E5t(Ie()),T5t=E5t(Jn()),wG=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"}};$c.HTTPValidationError=wG;$c.HTTPValidationError$inboundSchema=vG.object({detail:vG.array(T5t.ValidationError$inboundSchema).optional()}).transform(t=>new wG(t));$c.HTTPValidationError$outboundSchema=vG.instanceof(wG).transform(t=>t.data$).pipe(vG.object({detail:vG.array(T5t.ValidationError$outboundSchema).optional()}));var P5t;(function(t){t.inboundSchema=$c.HTTPValidationError$inboundSchema,t.outboundSchema=$c.HTTPValidationError$outboundSchema})(P5t||($c.HTTPValidationError$=P5t={}))});var kh=v(ZC=>{"use strict";var U0n=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]}),Efe=ZC&&ZC.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&U0n(e,t,r)};Object.defineProperty(ZC,"__esModule",{value:!0});Efe(fze(),ZC);Efe(A5t(),ZC);Efe(jze(),ZC);Efe($ze(),ZC)});var R5t=v(jE=>{"use strict";var q0n=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]}),H0n=jE&&jE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vBe=jE&&jE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q0n(e,t,r);return H0n(e,t),e};Object.defineProperty(jE,"__esModule",{value:!0});jE.agentsComplete=Z0n;var V0n=hi(),xG=vBe(gi()),W0n=We(),K0n=we(),I5t=yi(),G0n=Fo(),M5t=vBe(Jn()),J0n=vBe(kh());async function Z0n(t,e,r){let n=(0,K0n.safeParse)(e,y=>M5t.AgentsCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,V0n.encodeJSON)("body",o,{explode:!0}),a=(0,G0n.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,W0n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,I5t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,I5t.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await xG.match(xG.json(200,M5t.ChatCompletionResponse$inboundSchema),xG.jsonErr(422,J0n.HTTPValidationError$inboundSchema),xG.fail("4XX"),xG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var D5t=v(DE=>{"use strict";var Y0n=DE&&DE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=DE&&DE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tfe=DE&&DE.__importStar||function(t){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(DE,"__esModule",{value:!0});DE.agentsStream=axn;var Q0n=Tfe(Ie()),exn=hi(),txn=fG(),SG=Tfe(gi()),rxn=We(),nxn=we(),N5t=yi(),oxn=Fo(),j5t=Tfe(Jn()),ixn=Tfe(kh());async function axn(t,e,r){let n=(0,nxn.safeParse)(e,y=>j5t.AgentsCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,exn.encodeJSON)("body",o,{explode:!0}),a=(0,oxn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,rxn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,N5t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,N5t.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await SG.match(SG.sse(200,Q0n.instanceof(ReadableStream).transform(y=>new txn.EventStream({stream:y,decoder(x){return j5t.CompletionEvent$inboundSchema.parse(x)}})),{sseSentinel:"[DONE]"}),SG.jsonErr(422,ixn.HTTPValidationError$inboundSchema),SG.fail("4XX"),SG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var F5t=v(Afe=>{"use strict";Object.defineProperty(Afe,"__esModule",{value:!0});Afe.Agents=void 0;var sxn=R5t(),uxn=D5t(),lxn=Lh(),L5t=dy(),wBe=class extends lxn.ClientSDK{async complete(e,r){return(0,L5t.unwrapAsync)((0,sxn.agentsComplete)(this,e,r))}async stream(e,r){return(0,L5t.unwrapAsync)((0,uxn.agentsStream)(this,e,r))}};Afe.Agents=wBe});var z5t=v(pl=>{"use strict";var cxn=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]}),dxn=pl&&pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fxn=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)&&cxn(e,t,r);return dxn(e,t),e};Object.defineProperty(pl,"__esModule",{value:!0});pl.DeleteModelV1ModelsModelIdDeleteRequest$=pl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=pl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;pl.deleteModelV1ModelsModelIdDeleteRequestToJSON=mxn;pl.deleteModelV1ModelsModelIdDeleteRequestFromJSON=hxn;var Ife=fxn(Ie()),$5t=We(),pxn=we();pl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=Ife.object({model_id:Ife.string()}).transform(t=>(0,$5t.remap)(t,{model_id:"modelId"}));pl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Ife.object({modelId:Ife.string()}).transform(t=>(0,$5t.remap)(t,{modelId:"model_id"}));var k5t;(function(t){t.inboundSchema=pl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=pl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(k5t||(pl.DeleteModelV1ModelsModelIdDeleteRequest$=k5t={}));function mxn(t){return JSON.stringify(pl.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function hxn(t){return(0,pxn.safeParse)(t,e=>pl.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var q5t=v(ml=>{"use strict";var gxn=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]}),yxn=ml&&ml.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bxn=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)&&gxn(e,t,r);return yxn(e,t),e};Object.defineProperty(ml,"__esModule",{value:!0});ml.FilesApiRoutesDeleteFileRequest$=ml.FilesApiRoutesDeleteFileRequest$outboundSchema=ml.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;ml.filesApiRoutesDeleteFileRequestToJSON=vxn;ml.filesApiRoutesDeleteFileRequestFromJSON=wxn;var Mfe=bxn(Ie()),U5t=We(),_xn=we();ml.FilesApiRoutesDeleteFileRequest$inboundSchema=Mfe.object({file_id:Mfe.string()}).transform(t=>(0,U5t.remap)(t,{file_id:"fileId"}));ml.FilesApiRoutesDeleteFileRequest$outboundSchema=Mfe.object({fileId:Mfe.string()}).transform(t=>(0,U5t.remap)(t,{fileId:"file_id"}));var B5t;(function(t){t.inboundSchema=ml.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=ml.FilesApiRoutesDeleteFileRequest$outboundSchema})(B5t||(ml.FilesApiRoutesDeleteFileRequest$=B5t={}));function vxn(t){return JSON.stringify(ml.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function wxn(t){return(0,_xn.safeParse)(t,e=>ml.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var W5t=v(hl=>{"use strict";var xxn=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]}),Sxn=hl&&hl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cxn=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)&&xxn(e,t,r);return Sxn(e,t),e};Object.defineProperty(hl,"__esModule",{value:!0});hl.FilesApiRoutesDownloadFileRequest$=hl.FilesApiRoutesDownloadFileRequest$outboundSchema=hl.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;hl.filesApiRoutesDownloadFileRequestToJSON=Pxn;hl.filesApiRoutesDownloadFileRequestFromJSON=Exn;var Rfe=Cxn(Ie()),V5t=We(),Oxn=we();hl.FilesApiRoutesDownloadFileRequest$inboundSchema=Rfe.object({file_id:Rfe.string()}).transform(t=>(0,V5t.remap)(t,{file_id:"fileId"}));hl.FilesApiRoutesDownloadFileRequest$outboundSchema=Rfe.object({fileId:Rfe.string()}).transform(t=>(0,V5t.remap)(t,{fileId:"file_id"}));var H5t;(function(t){t.inboundSchema=hl.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=hl.FilesApiRoutesDownloadFileRequest$outboundSchema})(H5t||(hl.FilesApiRoutesDownloadFileRequest$=H5t={}));function Pxn(t){return JSON.stringify(hl.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function Exn(t){return(0,Oxn.safeParse)(t,e=>hl.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var J5t=v(gl=>{"use strict";var Txn=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]}),Axn=gl&&gl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ixn=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)&&Txn(e,t,r);return Axn(e,t),e};Object.defineProperty(gl,"__esModule",{value:!0});gl.FilesApiRoutesGetSignedUrlRequest$=gl.FilesApiRoutesGetSignedUrlRequest$outboundSchema=gl.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;gl.filesApiRoutesGetSignedUrlRequestToJSON=Rxn;gl.filesApiRoutesGetSignedUrlRequestFromJSON=Nxn;var R4=Ixn(Ie()),G5t=We(),Mxn=we();gl.FilesApiRoutesGetSignedUrlRequest$inboundSchema=R4.object({file_id:R4.string(),expiry:R4.number().int().default(24)}).transform(t=>(0,G5t.remap)(t,{file_id:"fileId"}));gl.FilesApiRoutesGetSignedUrlRequest$outboundSchema=R4.object({fileId:R4.string(),expiry:R4.number().int().default(24)}).transform(t=>(0,G5t.remap)(t,{fileId:"file_id"}));var K5t;(function(t){t.inboundSchema=gl.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=gl.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(K5t||(gl.FilesApiRoutesGetSignedUrlRequest$=K5t={}));function Rxn(t){return JSON.stringify(gl.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function Nxn(t){return(0,Mxn.safeParse)(t,e=>gl.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var Q5t=v(bl=>{"use strict";var jxn=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]}),Dxn=bl&&bl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5t=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)&&jxn(e,t,r);return Dxn(e,t),e};Object.defineProperty(bl,"__esModule",{value:!0});bl.FilesApiRoutesListFilesRequest$=bl.FilesApiRoutesListFilesRequest$outboundSchema=bl.FilesApiRoutesListFilesRequest$inboundSchema=void 0;bl.filesApiRoutesListFilesRequestToJSON=Fxn;bl.filesApiRoutesListFilesRequestFromJSON=kxn;var yl=Y5t(Ie()),X5t=We(),Lxn=we(),N4=Y5t(Jn());bl.FilesApiRoutesListFilesRequest$inboundSchema=yl.object({page:yl.number().int().default(0),page_size:yl.number().int().default(100),sample_type:yl.nullable(yl.array(N4.SampleType$inboundSchema)).optional(),source:yl.nullable(yl.array(N4.Source$inboundSchema)).optional(),search:yl.nullable(yl.string()).optional(),purpose:yl.nullable(N4.FilePurpose$inboundSchema).optional()}).transform(t=>(0,X5t.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));bl.FilesApiRoutesListFilesRequest$outboundSchema=yl.object({page:yl.number().int().default(0),pageSize:yl.number().int().default(100),sampleType:yl.nullable(yl.array(N4.SampleType$outboundSchema)).optional(),source:yl.nullable(yl.array(N4.Source$outboundSchema)).optional(),search:yl.nullable(yl.string()).optional(),purpose:yl.nullable(N4.FilePurpose$outboundSchema).optional()}).transform(t=>(0,X5t.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var Z5t;(function(t){t.inboundSchema=bl.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=bl.FilesApiRoutesListFilesRequest$outboundSchema})(Z5t||(bl.FilesApiRoutesListFilesRequest$=Z5t={}));function Fxn(t){return JSON.stringify(bl.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function kxn(t){return(0,Lxn.safeParse)(t,e=>bl.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var r9t=v(_l=>{"use strict";var $xn=_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]}),zxn=_l&&_l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bxn=_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)&&$xn(e,t,r);return zxn(e,t),e};Object.defineProperty(_l,"__esModule",{value:!0});_l.FilesApiRoutesRetrieveFileRequest$=_l.FilesApiRoutesRetrieveFileRequest$outboundSchema=_l.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;_l.filesApiRoutesRetrieveFileRequestToJSON=qxn;_l.filesApiRoutesRetrieveFileRequestFromJSON=Hxn;var Nfe=Bxn(Ie()),t9t=We(),Uxn=we();_l.FilesApiRoutesRetrieveFileRequest$inboundSchema=Nfe.object({file_id:Nfe.string()}).transform(t=>(0,t9t.remap)(t,{file_id:"fileId"}));_l.FilesApiRoutesRetrieveFileRequest$outboundSchema=Nfe.object({fileId:Nfe.string()}).transform(t=>(0,t9t.remap)(t,{fileId:"file_id"}));var e9t;(function(t){t.inboundSchema=_l.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=_l.FilesApiRoutesRetrieveFileRequest$outboundSchema})(e9t||(_l.FilesApiRoutesRetrieveFileRequest$=e9t={}));function qxn(t){return JSON.stringify(_l.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function Hxn(t){return(0,Uxn.safeParse)(t,e=>_l.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var xBe=v(i_=>{"use strict";var Vxn=i_&&i_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=i_&&i_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kxn=i_&&i_.__importStar||function(t){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(i_,"__esModule",{value:!0});i_.blobLikeSchema=void 0;i_.isBlobLike=n9t;var Gxn=Kxn(Ie());i_.blobLikeSchema=Gxn.custom(n9t,{message:"expected a Blob, File or Blob-like object",fatal:!0});function n9t(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 l9t=v(Co=>{"use strict";var Jxn=Co&&Co.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zxn=Co&&Co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a9t=Co&&Co.__importStar||function(t){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 Zxn(e,t),e};Object.defineProperty(Co,"__esModule",{value:!0});Co.FilesApiRoutesUploadFileMultiPartBodyParams$=Co.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Co.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=Co.FileT$=Co.FileT$outboundSchema=Co.FileT$inboundSchema=void 0;Co.fileToJSON=Xxn;Co.fileFromJSON=Qxn;Co.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=eSn;Co.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=tSn;var zc=a9t(Ie()),s9t=we(),Yxn=xBe(),u9t=a9t(Jn());Co.FileT$inboundSchema=zc.object({fileName:zc.string(),content:zc.union([zc.instanceof(ReadableStream),zc.instanceof(Blob),zc.instanceof(ArrayBuffer),zc.instanceof(Uint8Array)])});Co.FileT$outboundSchema=zc.object({fileName:zc.string(),content:zc.union([zc.instanceof(ReadableStream),zc.instanceof(Blob),zc.instanceof(ArrayBuffer),zc.instanceof(Uint8Array)])});var o9t;(function(t){t.inboundSchema=Co.FileT$inboundSchema,t.outboundSchema=Co.FileT$outboundSchema})(o9t||(Co.FileT$=o9t={}));function Xxn(t){return JSON.stringify(Co.FileT$outboundSchema.parse(t))}function Qxn(t){return(0,s9t.safeParse)(t,e=>Co.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}Co.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=zc.object({file:zc.lazy(()=>Co.FileT$inboundSchema),purpose:u9t.FilePurpose$inboundSchema.optional()});Co.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=zc.object({file:zc.lazy(()=>Co.FileT$outboundSchema).or(Yxn.blobLikeSchema),purpose:u9t.FilePurpose$outboundSchema.optional()});var i9t;(function(t){t.inboundSchema=Co.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=Co.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(i9t||(Co.FilesApiRoutesUploadFileMultiPartBodyParams$=i9t={}));function eSn(t){return JSON.stringify(Co.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function tSn(t){return(0,s9t.safeParse)(t,e=>Co.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var f9t=v(vl=>{"use strict";var rSn=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]}),nSn=vl&&vl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oSn=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)&&rSn(e,t,r);return nSn(e,t),e};Object.defineProperty(vl,"__esModule",{value:!0});vl.JobsApiRoutesBatchCancelBatchJobRequest$=vl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=vl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;vl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=aSn;vl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=sSn;var jfe=oSn(Ie()),d9t=We(),iSn=we();vl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=jfe.object({job_id:jfe.string()}).transform(t=>(0,d9t.remap)(t,{job_id:"jobId"}));vl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=jfe.object({jobId:jfe.string()}).transform(t=>(0,d9t.remap)(t,{jobId:"job_id"}));var c9t;(function(t){t.inboundSchema=vl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=vl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(c9t||(vl.JobsApiRoutesBatchCancelBatchJobRequest$=c9t={}));function aSn(t){return JSON.stringify(vl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function sSn(t){return(0,iSn.safeParse)(t,e=>vl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var h9t=v(wl=>{"use strict";var uSn=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]}),lSn=wl&&wl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cSn=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)&&uSn(e,t,r);return lSn(e,t),e};Object.defineProperty(wl,"__esModule",{value:!0});wl.JobsApiRoutesBatchGetBatchJobRequest$=wl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=wl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;wl.jobsApiRoutesBatchGetBatchJobRequestToJSON=fSn;wl.jobsApiRoutesBatchGetBatchJobRequestFromJSON=pSn;var Dfe=cSn(Ie()),m9t=We(),dSn=we();wl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=Dfe.object({job_id:Dfe.string()}).transform(t=>(0,m9t.remap)(t,{job_id:"jobId"}));wl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Dfe.object({jobId:Dfe.string()}).transform(t=>(0,m9t.remap)(t,{jobId:"job_id"}));var p9t;(function(t){t.inboundSchema=wl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=wl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(p9t||(wl.JobsApiRoutesBatchGetBatchJobRequest$=p9t={}));function fSn(t){return JSON.stringify(wl.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function pSn(t){return(0,dSn.safeParse)(t,e=>wl.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var v9t=v(xl=>{"use strict";var mSn=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]}),hSn=xl&&xl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y9t=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)&&mSn(e,t,r);return hSn(e,t),e};Object.defineProperty(xl,"__esModule",{value:!0});xl.JobsApiRoutesBatchGetBatchJobsRequest$=xl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=xl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;xl.jobsApiRoutesBatchGetBatchJobsRequestToJSON=ySn;xl.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=bSn;var qa=y9t(Ie()),b9t=We(),gSn=we(),_9t=y9t(Jn());xl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=qa.object({page:qa.number().int().default(0),page_size:qa.number().int().default(100),model:qa.nullable(qa.string()).optional(),metadata:qa.nullable(qa.record(qa.any())).optional(),created_after:qa.nullable(qa.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:qa.boolean().default(!1),status:qa.nullable(_9t.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,b9t.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));xl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=qa.object({page:qa.number().int().default(0),pageSize:qa.number().int().default(100),model:qa.nullable(qa.string()).optional(),metadata:qa.nullable(qa.record(qa.any())).optional(),createdAfter:qa.nullable(qa.date().transform(t=>t.toISOString())).optional(),createdByMe:qa.boolean().default(!1),status:qa.nullable(_9t.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,b9t.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var g9t;(function(t){t.inboundSchema=xl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=xl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(g9t||(xl.JobsApiRoutesBatchGetBatchJobsRequest$=g9t={}));function ySn(t){return JSON.stringify(xl.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function bSn(t){return(0,gSn.safeParse)(t,e=>xl.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var S9t=v(Sl=>{"use strict";var _Sn=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]}),vSn=Sl&&Sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wSn=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)&&_Sn(e,t,r);return vSn(e,t),e};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Sl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=SSn;Sl.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=CSn;var Lfe=wSn(Ie()),x9t=We(),xSn=we();Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=Lfe.object({model_id:Lfe.string()}).transform(t=>(0,x9t.remap)(t,{model_id:"modelId"}));Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Lfe.object({modelId:Lfe.string()}).transform(t=>(0,x9t.remap)(t,{modelId:"model_id"}));var w9t;(function(t){t.inboundSchema=Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(w9t||(Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=w9t={}));function SSn(t){return JSON.stringify(Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function CSn(t){return(0,xSn.safeParse)(t,e=>Sl.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var P9t=v(Cl=>{"use strict";var OSn=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]}),PSn=Cl&&Cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ESn=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)&&OSn(e,t,r);return PSn(e,t),e};Object.defineProperty(Cl,"__esModule",{value:!0});Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Cl.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=ASn;Cl.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=ISn;var Ffe=ESn(Ie()),O9t=We(),TSn=we();Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=Ffe.object({job_id:Ffe.string()}).transform(t=>(0,O9t.remap)(t,{job_id:"jobId"}));Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Ffe.object({jobId:Ffe.string()}).transform(t=>(0,O9t.remap)(t,{jobId:"job_id"}));var C9t;(function(t){t.inboundSchema=Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(C9t||(Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=C9t={}));function ASn(t){return JSON.stringify(Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function ISn(t){return(0,TSn.safeParse)(t,e=>Cl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var I9t=v(Ol=>{"use strict";var MSn=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]}),RSn=Ol&&Ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T9t=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)&&MSn(e,t,r);return RSn(e,t),e};Object.defineProperty(Ol,"__esModule",{value:!0});Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Ol.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=jSn;Ol.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=DSn;var A9t=T9t(Ie()),NSn=we(),kfe=T9t(Jn());Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=A9t.union([kfe.LegacyJobMetadataOut$inboundSchema,kfe.JobOut$inboundSchema]);Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=A9t.union([kfe.LegacyJobMetadataOut$outboundSchema,kfe.JobOut$outboundSchema]);var E9t;(function(t){t.inboundSchema=Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(E9t||(Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=E9t={}));function jSn(t){return JSON.stringify(Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function DSn(t){return(0,NSn.safeParse)(t,e=>Ol.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var N9t=v(Pl=>{"use strict";var LSn=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]}),FSn=Pl&&Pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kSn=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)&&LSn(e,t,r);return FSn(e,t),e};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Pl.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=zSn;Pl.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=BSn;var $fe=kSn(Ie()),R9t=We(),$Sn=we();Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=$fe.object({job_id:$fe.string()}).transform(t=>(0,R9t.remap)(t,{job_id:"jobId"}));Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=$fe.object({jobId:$fe.string()}).transform(t=>(0,R9t.remap)(t,{jobId:"job_id"}));var M9t;(function(t){t.inboundSchema=Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(M9t||(Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$=M9t={}));function zSn(t){return JSON.stringify(Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function BSn(t){return(0,$Sn.safeParse)(t,e=>Pl.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var F9t=v(Oo=>{"use strict";var USn=Oo&&Oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Oo&&Oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HSn=Oo&&Oo.__importStar||function(t){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(Oo,"__esModule",{value:!0});Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Oo.Status$=Oo.Status$outboundSchema=Oo.Status$inboundSchema=Oo.Status=void 0;Oo.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=WSn;Oo.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=KSn;var _i=HSn(Ie()),L9t=We(),VSn=we();Oo.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Oo.Status$inboundSchema=_i.nativeEnum(Oo.Status);Oo.Status$outboundSchema=Oo.Status$inboundSchema;var j9t;(function(t){t.inboundSchema=Oo.Status$inboundSchema,t.outboundSchema=Oo.Status$outboundSchema})(j9t||(Oo.Status$=j9t={}));Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=_i.object({page:_i.number().int().default(0),page_size:_i.number().int().default(100),model:_i.nullable(_i.string()).optional(),created_after:_i.nullable(_i.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:_i.boolean().default(!1),status:_i.nullable(Oo.Status$inboundSchema).optional(),wandb_project:_i.nullable(_i.string()).optional(),wandb_name:_i.nullable(_i.string()).optional(),suffix:_i.nullable(_i.string()).optional()}).transform(t=>(0,L9t.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=_i.object({page:_i.number().int().default(0),pageSize:_i.number().int().default(100),model:_i.nullable(_i.string()).optional(),createdAfter:_i.nullable(_i.date().transform(t=>t.toISOString())).optional(),createdByMe:_i.boolean().default(!1),status:_i.nullable(Oo.Status$outboundSchema).optional(),wandbProject:_i.nullable(_i.string()).optional(),wandbName:_i.nullable(_i.string()).optional(),suffix:_i.nullable(_i.string()).optional()}).transform(t=>(0,L9t.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var D9t;(function(t){t.inboundSchema=Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(D9t||(Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=D9t={}));function WSn(t){return JSON.stringify(Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function KSn(t){return(0,VSn.safeParse)(t,e=>Oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var z9t=v(El=>{"use strict";var GSn=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]}),JSn=El&&El.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZSn=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)&&GSn(e,t,r);return JSn(e,t),e};Object.defineProperty(El,"__esModule",{value:!0});El.JobsApiRoutesFineTuningStartFineTuningJobRequest$=El.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=El.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;El.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=XSn;El.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=QSn;var zfe=ZSn(Ie()),$9t=We(),YSn=we();El.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=zfe.object({job_id:zfe.string()}).transform(t=>(0,$9t.remap)(t,{job_id:"jobId"}));El.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=zfe.object({jobId:zfe.string()}).transform(t=>(0,$9t.remap)(t,{jobId:"job_id"}));var k9t;(function(t){t.inboundSchema=El.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=El.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(k9t||(El.JobsApiRoutesFineTuningStartFineTuningJobRequest$=k9t={}));function XSn(t){return JSON.stringify(El.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function QSn(t){return(0,YSn.safeParse)(t,e=>El.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var q9t=v(Tl=>{"use strict";var eCn=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]}),tCn=Tl&&Tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rCn=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)&&eCn(e,t,r);return tCn(e,t),e};Object.defineProperty(Tl,"__esModule",{value:!0});Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Tl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=oCn;Tl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=iCn;var Bfe=rCn(Ie()),U9t=We(),nCn=we();Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=Bfe.object({model_id:Bfe.string()}).transform(t=>(0,U9t.remap)(t,{model_id:"modelId"}));Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Bfe.object({modelId:Bfe.string()}).transform(t=>(0,U9t.remap)(t,{modelId:"model_id"}));var B9t;(function(t){t.inboundSchema=Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(B9t||(Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=B9t={}));function oCn(t){return JSON.stringify(Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function iCn(t){return(0,nCn.safeParse)(t,e=>Tl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var G9t=v(Al=>{"use strict";var aCn=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]}),sCn=Al&&Al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V9t=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)&&aCn(e,t,r);return sCn(e,t),e};Object.defineProperty(Al,"__esModule",{value:!0});Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Al.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=lCn;Al.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=cCn;var Ufe=V9t(Ie()),W9t=We(),uCn=we(),K9t=V9t(Jn());Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=Ufe.object({model_id:Ufe.string(),UpdateFTModelIn:K9t.UpdateFTModelIn$inboundSchema}).transform(t=>(0,W9t.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Ufe.object({modelId:Ufe.string(),updateFTModelIn:K9t.UpdateFTModelIn$outboundSchema}).transform(t=>(0,W9t.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var H9t;(function(t){t.inboundSchema=Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(H9t||(Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=H9t={}));function lCn(t){return JSON.stringify(Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function cCn(t){return(0,uCn.safeParse)(t,e=>Al.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var eWt=v(ai=>{"use strict";var dCn=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]}),fCn=ai&&ai.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y9t=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)&&dCn(e,t,r);return fCn(e,t),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=ai.RetrieveModelV1ModelsModelIdGetRequest$=ai.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=ai.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;ai.retrieveModelV1ModelsModelIdGetRequestToJSON=pCn;ai.retrieveModelV1ModelsModelIdGetRequestFromJSON=mCn;ai.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=hCn;ai.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=gCn;var Tm=Y9t(Ie()),X9t=We(),Q9t=we(),qfe=Y9t(Jn());ai.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=Tm.object({model_id:Tm.string()}).transform(t=>(0,X9t.remap)(t,{model_id:"modelId"}));ai.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Tm.object({modelId:Tm.string()}).transform(t=>(0,X9t.remap)(t,{modelId:"model_id"}));var J9t;(function(t){t.inboundSchema=ai.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=ai.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(J9t||(ai.RetrieveModelV1ModelsModelIdGetRequest$=J9t={}));function pCn(t){return JSON.stringify(ai.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function mCn(t){return(0,Q9t.safeParse)(t,e=>ai.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Tm.union([qfe.BaseModelCard$inboundSchema.and(Tm.object({type:Tm.literal("base")}).transform(t=>({type:t.type}))),qfe.FTModelCard$inboundSchema.and(Tm.object({type:Tm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Tm.union([qfe.BaseModelCard$outboundSchema.and(Tm.object({type:Tm.literal("base")}).transform(t=>({type:t.type}))),qfe.FTModelCard$outboundSchema.and(Tm.object({type:Tm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var Z9t;(function(t){t.inboundSchema=ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(Z9t||(ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Z9t={}));function hCn(t){return JSON.stringify(ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function gCn(t){return(0,Q9t.safeParse)(t,e=>ai.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Il=v(Ca=>{"use strict";var yCn=Ca&&Ca.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ic=Ca&&Ca.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yCn(e,t,r)};Object.defineProperty(Ca,"__esModule",{value:!0});ic(z5t(),Ca);ic(q5t(),Ca);ic(W5t(),Ca);ic(J5t(),Ca);ic(Q5t(),Ca);ic(r9t(),Ca);ic(l9t(),Ca);ic(f9t(),Ca);ic(h9t(),Ca);ic(v9t(),Ca);ic(S9t(),Ca);ic(P9t(),Ca);ic(I9t(),Ca);ic(N9t(),Ca);ic(F9t(),Ca);ic(z9t(),Ca);ic(q9t(),Ca);ic(G9t(),Ca);ic(eWt(),Ca)});var rWt=v(LE=>{"use strict";var bCn=LE&&LE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Cn=LE&&LE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SBe=LE&&LE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bCn(e,t,r);return _Cn(e,t),e};Object.defineProperty(LE,"__esModule",{value:!0});LE.batchJobsCancel=PCn;var vCn=hi(),Hfe=SBe(gi()),wCn=We(),xCn=we(),tWt=yi(),SCn=Fo(),CCn=SBe(Jn()),OCn=SBe(Il());async function PCn(t,e,r){let n=(0,xCn.safeParse)(e,y=>OCn.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,vCn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,SCn.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,wCn.compactMap)({Accept:"application/json"})),l=await(0,tWt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,tWt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Hfe.match(Hfe.json(200,CCn.BatchJobOut$inboundSchema),Hfe.fail("4XX"),Hfe.fail("5XX"))(b);return g.ok,g}});var aWt=v(FE=>{"use strict";var ECn=FE&&FE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=FE&&FE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iWt=FE&&FE.__importStar||function(t){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(FE,"__esModule",{value:!0});FE.batchJobsCreate=NCn;var ACn=hi(),Vfe=iWt(gi()),ICn=We(),MCn=we(),nWt=yi(),RCn=Fo(),oWt=iWt(Jn());async function NCn(t,e,r){let n=(0,MCn.safeParse)(e,g=>oWt.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,ACn.encodeJSON)("body",o,{explode:!0}),a=(0,RCn.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,ICn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,nWt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,nWt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Vfe.match(Vfe.json(200,oWt.BatchJobOut$inboundSchema),Vfe.fail("4XX"),Vfe.fail("5XX"))(h);return b.ok,b}});var uWt=v(kE=>{"use strict";var jCn=kE&&kE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=kE&&kE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CBe=kE&&kE.__importStar||function(t){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(kE,"__esModule",{value:!0});kE.batchJobsGet=UCn;var LCn=hi(),Wfe=CBe(gi()),FCn=We(),kCn=we(),sWt=yi(),$Cn=Fo(),zCn=CBe(Jn()),BCn=CBe(Il());async function UCn(t,e,r){let n=(0,kCn.safeParse)(e,y=>BCn.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,LCn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,$Cn.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,FCn.compactMap)({Accept:"application/json"})),l=await(0,sWt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,sWt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Wfe.match(Wfe.json(200,zCn.BatchJobOut$inboundSchema),Wfe.fail("4XX"),Wfe.fail("5XX"))(b);return g.ok,g}});var cWt=v($E=>{"use strict";var qCn=$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]}),HCn=$E&&$E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OBe=$E&&$E.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qCn(e,t,r);return HCn(e,t),e};Object.defineProperty($E,"__esModule",{value:!0});$E.batchJobsList=YCn;var VCn=hi(),Kfe=OBe(gi()),WCn=We(),KCn=we(),lWt=yi(),GCn=Fo(),JCn=OBe(Jn()),ZCn=OBe(Il());async function YCn(t,e,r){let n=(0,KCn.safeParse)(e,y=>ZCn.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,GCn.pathToFunc)("/v1/batch/jobs")(),s=(0,VCn.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,WCn.compactMap)({Accept:"application/json"})),l=await(0,lWt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,lWt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Kfe.match(Kfe.json(200,JCn.BatchJobsOut$inboundSchema),Kfe.fail("4XX"),Kfe.fail("5XX"))(b);return g.ok,g}});var dWt=v(Jfe=>{"use strict";Object.defineProperty(Jfe,"__esModule",{value:!0});Jfe.MistralJobs=void 0;var XCn=rWt(),QCn=aWt(),eOn=uWt(),tOn=cWt(),rOn=Lh(),Gfe=dy(),PBe=class extends rOn.ClientSDK{async list(e,r){return(0,Gfe.unwrapAsync)((0,tOn.batchJobsList)(this,e,r))}async create(e,r){return(0,Gfe.unwrapAsync)((0,QCn.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Gfe.unwrapAsync)((0,eOn.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Gfe.unwrapAsync)((0,XCn.batchJobsCancel)(this,e,r))}};Jfe.MistralJobs=PBe});var fWt=v(Zfe=>{"use strict";Object.defineProperty(Zfe,"__esModule",{value:!0});Zfe.Batch=void 0;var nOn=Lh(),oOn=dWt(),EBe=class extends nOn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new oOn.MistralJobs(this._options))}};Zfe.Batch=EBe});var hWt=v(zE=>{"use strict";var iOn=zE&&zE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aOn=zE&&zE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TBe=zE&&zE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iOn(e,t,r);return aOn(e,t),e};Object.defineProperty(zE,"__esModule",{value:!0});zE.chatComplete=fOn;var sOn=hi(),CG=TBe(gi()),uOn=We(),lOn=we(),pWt=yi(),cOn=Fo(),mWt=TBe(Jn()),dOn=TBe(kh());async function fOn(t,e,r){let n=(0,lOn.safeParse)(e,y=>mWt.ChatCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,sOn.encodeJSON)("body",o,{explode:!0}),a=(0,cOn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,uOn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,pWt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,pWt.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await CG.match(CG.json(200,mWt.ChatCompletionResponse$inboundSchema),CG.jsonErr(422,dOn.HTTPValidationError$inboundSchema),CG.fail("4XX"),CG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var bWt=v(BE=>{"use strict";var pOn=BE&&BE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mOn=BE&&BE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yfe=BE&&BE.__importStar||function(t){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 mOn(e,t),e};Object.defineProperty(BE,"__esModule",{value:!0});BE.chatStream=xOn;var hOn=Yfe(Ie()),gOn=hi(),yOn=fG(),OG=Yfe(gi()),bOn=We(),_On=we(),gWt=yi(),vOn=Fo(),yWt=Yfe(Jn()),wOn=Yfe(kh());async function xOn(t,e,r){let n=(0,_On.safeParse)(e,y=>yWt.ChatCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,gOn.encodeJSON)("body",o,{explode:!0}),a=(0,vOn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,bOn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,gWt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,gWt.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await OG.match(OG.sse(200,hOn.instanceof(ReadableStream).transform(y=>new yOn.EventStream({stream:y,decoder(x){return yWt.CompletionEvent$inboundSchema.parse(x)}})),{sseSentinel:"[DONE]"}),OG.jsonErr(422,wOn.HTTPValidationError$inboundSchema),OG.fail("4XX"),OG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Xfe=v(YC=>{"use strict";Object.defineProperty(YC,"__esModule",{value:!0});YC.getDefaultOptions=YC.defaultOptions=YC.ignoreOverride=void 0;YC.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");YC.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 SOn=t=>typeof t=="string"?{...YC.defaultOptions,name:t}:{...YC.defaultOptions,...t};YC.getDefaultOptions=SOn});var ABe=v(Qfe=>{"use strict";Object.defineProperty(Qfe,"__esModule",{value:!0});Qfe.getRefs=void 0;var COn=Xfe(),OOn=t=>{let e=(0,COn.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}]))}};Qfe.getRefs=OOn});var ER=v(j4=>{"use strict";Object.defineProperty(j4,"__esModule",{value:!0});j4.setResponseValueAndErrors=j4.addErrorMessage=void 0;function _Wt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}j4.addErrorMessage=_Wt;function POn(t,e,r,n,o){t[e]=r,_Wt(t,e,n,o)}j4.setResponseValueAndErrors=POn});var IBe=v(epe=>{"use strict";Object.defineProperty(epe,"__esModule",{value:!0});epe.parseAnyDef=void 0;function EOn(){return{}}epe.parseAnyDef=EOn});var MBe=v(rpe=>{"use strict";Object.defineProperty(rpe,"__esModule",{value:!0});rpe.parseArrayDef=void 0;var TOn=Ie(),tpe=ER(),AOn=Ml();function IOn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==TOn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,AOn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,tpe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,tpe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,tpe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,tpe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}rpe.parseArrayDef=IOn});var RBe=v(npe=>{"use strict";Object.defineProperty(npe,"__esModule",{value:!0});npe.parseBigintDef=void 0;var MF=ER();function MOn(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,MF.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,MF.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,MF.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,MF.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,MF.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,MF.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,MF.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}npe.parseBigintDef=MOn});var NBe=v(ope=>{"use strict";Object.defineProperty(ope,"__esModule",{value:!0});ope.parseBooleanDef=void 0;function ROn(){return{type:"boolean"}}ope.parseBooleanDef=ROn});var ape=v(ipe=>{"use strict";Object.defineProperty(ipe,"__esModule",{value:!0});ipe.parseBrandedDef=void 0;var NOn=Ml();function jOn(t,e){return(0,NOn.parseDef)(t.type._def,e)}ipe.parseBrandedDef=jOn});var jBe=v(spe=>{"use strict";Object.defineProperty(spe,"__esModule",{value:!0});spe.parseCatchDef=void 0;var DOn=Ml(),LOn=(t,e)=>(0,DOn.parseDef)(t.innerType._def,e);spe.parseCatchDef=LOn});var DBe=v(upe=>{"use strict";Object.defineProperty(upe,"__esModule",{value:!0});upe.parseDateDef=void 0;var vWt=ER();function wWt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>wWt(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 FOn(t,e)}}upe.parseDateDef=wWt;var FOn=(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,vWt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,vWt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var LBe=v(lpe=>{"use strict";Object.defineProperty(lpe,"__esModule",{value:!0});lpe.parseDefaultDef=void 0;var kOn=Ml();function $On(t,e){return{...(0,kOn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}lpe.parseDefaultDef=$On});var FBe=v(cpe=>{"use strict";Object.defineProperty(cpe,"__esModule",{value:!0});cpe.parseEffectsDef=void 0;var zOn=Ml();function BOn(t,e){return e.effectStrategy==="input"?(0,zOn.parseDef)(t.schema._def,e):{}}cpe.parseEffectsDef=BOn});var kBe=v(dpe=>{"use strict";Object.defineProperty(dpe,"__esModule",{value:!0});dpe.parseEnumDef=void 0;function UOn(t){return{type:"string",enum:Array.from(t.values)}}dpe.parseEnumDef=UOn});var $Be=v(fpe=>{"use strict";Object.defineProperty(fpe,"__esModule",{value:!0});fpe.parseIntersectionDef=void 0;var xWt=Ml(),qOn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function HOn(t,e){let r=[(0,xWt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,xWt.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(qOn(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}fpe.parseIntersectionDef=HOn});var zBe=v(ppe=>{"use strict";Object.defineProperty(ppe,"__esModule",{value:!0});ppe.parseLiteralDef=void 0;function VOn(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}}ppe.parseLiteralDef=VOn});var mpe=v(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.parseStringDef=Md.zodPatterns=void 0;var RF=ER(),BBe;Md.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:()=>(BBe===void 0&&(BBe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),BBe),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 WOn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,RF.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,RF.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":a_(r,"email",n.message,e);break;case"format:idn-email":a_(r,"idn-email",n.message,e);break;case"pattern:zod":xp(r,Md.zodPatterns.email,n.message,e);break}break;case"url":a_(r,"uri",n.message,e);break;case"uuid":a_(r,"uuid",n.message,e);break;case"regex":xp(r,n.regex,n.message,e);break;case"cuid":xp(r,Md.zodPatterns.cuid,n.message,e);break;case"cuid2":xp(r,Md.zodPatterns.cuid2,n.message,e);break;case"startsWith":xp(r,RegExp(`^${UBe(n.value,e)}`),n.message,e);break;case"endsWith":xp(r,RegExp(`${UBe(n.value,e)}$`),n.message,e);break;case"datetime":a_(r,"date-time",n.message,e);break;case"date":a_(r,"date",n.message,e);break;case"time":a_(r,"time",n.message,e);break;case"duration":a_(r,"duration",n.message,e);break;case"length":(0,RF.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,RF.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{xp(r,RegExp(UBe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&a_(r,"ipv4",n.message,e),n.version!=="v4"&&a_(r,"ipv6",n.message,e);break}case"base64url":xp(r,Md.zodPatterns.base64url,n.message,e);break;case"jwt":xp(r,Md.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&xp(r,Md.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&xp(r,Md.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":xp(r,Md.zodPatterns.emoji(),n.message,e);break;case"ulid":{xp(r,Md.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{a_(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,RF.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{xp(r,Md.zodPatterns.base64,n.message,e);break}}break}case"nanoid":xp(r,Md.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Md.parseStringDef=WOn;function UBe(t,e){return e.patternStrategy==="escape"?GOn(t):t}var KOn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function GOn(t){let e="";for(let r=0;r<t.length;r++)KOn.has(t[r])||(e+="\\"),e+=t[r];return e}function 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}}})):(0,RF.setResponseValueAndErrors)(t,"format",e,r,n)}function xp(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:SWt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,RF.setResponseValueAndErrors)(t,"pattern",SWt(e,n),r,n)}function SWt(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 gpe=v(hpe=>{"use strict";Object.defineProperty(hpe,"__esModule",{value:!0});hpe.parseRecordDef=void 0;var PG=Ie(),CWt=Ml(),JOn=mpe(),ZOn=ape();function YOn(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===PG.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,CWt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,CWt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===PG.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,JOn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===PG.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===PG.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===PG.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,ZOn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}hpe.parseRecordDef=YOn});var qBe=v(ype=>{"use strict";Object.defineProperty(ype,"__esModule",{value:!0});ype.parseMapDef=void 0;var OWt=Ml(),XOn=gpe();function QOn(t,e){if(e.mapStrategy==="record")return(0,XOn.parseRecordDef)(t,e);let r=(0,OWt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,OWt.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}}}ype.parseMapDef=QOn});var HBe=v(bpe=>{"use strict";Object.defineProperty(bpe,"__esModule",{value:!0});bpe.parseNativeEnumDef=void 0;function ePn(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}}bpe.parseNativeEnumDef=ePn});var VBe=v(_pe=>{"use strict";Object.defineProperty(_pe,"__esModule",{value:!0});_pe.parseNeverDef=void 0;function tPn(){return{not:{}}}_pe.parseNeverDef=tPn});var WBe=v(vpe=>{"use strict";Object.defineProperty(vpe,"__esModule",{value:!0});vpe.parseNullDef=void 0;function rPn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}vpe.parseNullDef=rPn});var wpe=v(TR=>{"use strict";Object.defineProperty(TR,"__esModule",{value:!0});TR.parseUnionDef=TR.primitiveMappings=void 0;var nPn=Ml();TR.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function oPn(t,e){if(e.target==="openApi3")return PWt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in TR.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=TR.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 PWt(t,e)}TR.parseUnionDef=oPn;var PWt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,nPn.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 KBe=v(xpe=>{"use strict";Object.defineProperty(xpe,"__esModule",{value:!0});xpe.parseNullableDef=void 0;var EWt=Ml(),TWt=wpe();function iPn(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:TWt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[TWt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,EWt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,EWt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}xpe.parseNullableDef=iPn});var GBe=v(Spe=>{"use strict";Object.defineProperty(Spe,"__esModule",{value:!0});Spe.parseNumberDef=void 0;var AR=ER();function aPn(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,AR.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,AR.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,AR.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,AR.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,AR.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,AR.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,AR.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,AR.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Spe.parseNumberDef=aPn});var ZBe=v(Cpe=>{"use strict";Object.defineProperty(Cpe,"__esModule",{value:!0});Cpe.parseObjectDef=void 0;var sPn=Ie(),JBe=Ml();function uPn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,JBe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,JBe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function lPn(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 sPn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,JBe.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:uPn(t,e)};return n.required.length||delete n.required,n}Cpe.parseObjectDef=lPn});var YBe=v(Ope=>{"use strict";Object.defineProperty(Ope,"__esModule",{value:!0});Ope.parseOptionalDef=void 0;var AWt=Ml(),cPn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,AWt.parseDef)(t.innerType._def,e);let r=(0,AWt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};Ope.parseOptionalDef=cPn});var XBe=v(Epe=>{"use strict";Object.defineProperty(Epe,"__esModule",{value:!0});Epe.parsePipelineDef=void 0;var Ppe=Ml(),dPn=(t,e)=>{if(e.pipeStrategy==="input")return(0,Ppe.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,Ppe.parseDef)(t.out._def,e);let r=(0,Ppe.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,Ppe.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};Epe.parsePipelineDef=dPn});var QBe=v(Tpe=>{"use strict";Object.defineProperty(Tpe,"__esModule",{value:!0});Tpe.parsePromiseDef=void 0;var fPn=Ml();function pPn(t,e){return(0,fPn.parseDef)(t.type._def,e)}Tpe.parsePromiseDef=pPn});var eUe=v(Ape=>{"use strict";Object.defineProperty(Ape,"__esModule",{value:!0});Ape.parseSetDef=void 0;var IWt=ER(),mPn=Ml();function hPn(t,e){let n={type:"array",uniqueItems:!0,items:(0,mPn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,IWt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,IWt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}Ape.parseSetDef=hPn});var rUe=v(Ipe=>{"use strict";Object.defineProperty(Ipe,"__esModule",{value:!0});Ipe.parseTupleDef=void 0;var tUe=Ml();function gPn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,tUe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,tUe.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,tUe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}Ipe.parseTupleDef=gPn});var nUe=v(Mpe=>{"use strict";Object.defineProperty(Mpe,"__esModule",{value:!0});Mpe.parseUndefinedDef=void 0;function yPn(){return{not:{}}}Mpe.parseUndefinedDef=yPn});var oUe=v(Rpe=>{"use strict";Object.defineProperty(Rpe,"__esModule",{value:!0});Rpe.parseUnknownDef=void 0;function bPn(){return{}}Rpe.parseUnknownDef=bPn});var iUe=v(Npe=>{"use strict";Object.defineProperty(Npe,"__esModule",{value:!0});Npe.parseReadonlyDef=void 0;var _Pn=Ml(),vPn=(t,e)=>(0,_Pn.parseDef)(t.innerType._def,e);Npe.parseReadonlyDef=vPn});var Ml=v(jpe=>{"use strict";Object.defineProperty(jpe,"__esModule",{value:!0});jpe.parseDef=void 0;var Zn=Ie(),wPn=IBe(),xPn=MBe(),SPn=RBe(),CPn=NBe(),OPn=ape(),PPn=jBe(),EPn=DBe(),TPn=LBe(),APn=FBe(),IPn=kBe(),MPn=$Be(),RPn=zBe(),NPn=qBe(),jPn=HBe(),DPn=VBe(),LPn=WBe(),FPn=KBe(),kPn=GBe(),$Pn=ZBe(),zPn=YBe(),BPn=XBe(),UPn=QBe(),qPn=gpe(),HPn=eUe(),VPn=mpe(),WPn=rUe(),KPn=nUe(),GPn=wpe(),JPn=oUe(),ZPn=iUe(),YPn=Xfe();function MWt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==YPn.ignoreOverride)return a}if(n&&!r){let a=XPn(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=eEn(t,t.typeName,e);return i&&tEn(t,e,i),o.jsonSchema=i,i}jpe.parseDef=MWt;var XPn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:QPn(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}},QPn=(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("/")},eEn=(t,e,r)=>{switch(e){case Zn.ZodFirstPartyTypeKind.ZodString:return(0,VPn.parseStringDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodNumber:return(0,kPn.parseNumberDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodObject:return(0,$Pn.parseObjectDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodBigInt:return(0,SPn.parseBigintDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodBoolean:return(0,CPn.parseBooleanDef)();case Zn.ZodFirstPartyTypeKind.ZodDate:return(0,EPn.parseDateDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodUndefined:return(0,KPn.parseUndefinedDef)();case Zn.ZodFirstPartyTypeKind.ZodNull:return(0,LPn.parseNullDef)(r);case Zn.ZodFirstPartyTypeKind.ZodArray:return(0,xPn.parseArrayDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodUnion:case Zn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,GPn.parseUnionDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodIntersection:return(0,MPn.parseIntersectionDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodTuple:return(0,WPn.parseTupleDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodRecord:return(0,qPn.parseRecordDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodLiteral:return(0,RPn.parseLiteralDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodEnum:return(0,IPn.parseEnumDef)(t);case Zn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,jPn.parseNativeEnumDef)(t);case Zn.ZodFirstPartyTypeKind.ZodNullable:return(0,FPn.parseNullableDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodOptional:return(0,zPn.parseOptionalDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodMap:return(0,NPn.parseMapDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodSet:return(0,HPn.parseSetDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodLazy:return MWt(t.getter()._def,r);case Zn.ZodFirstPartyTypeKind.ZodPromise:return(0,UPn.parsePromiseDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodNaN:case Zn.ZodFirstPartyTypeKind.ZodNever:return(0,DPn.parseNeverDef)();case Zn.ZodFirstPartyTypeKind.ZodEffects:return(0,APn.parseEffectsDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodAny:return(0,wPn.parseAnyDef)();case Zn.ZodFirstPartyTypeKind.ZodUnknown:return(0,JPn.parseUnknownDef)();case Zn.ZodFirstPartyTypeKind.ZodDefault:return(0,TPn.parseDefaultDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodBranded:return(0,OPn.parseBrandedDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodReadonly:return(0,ZPn.parseReadonlyDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodCatch:return(0,PPn.parseCatchDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodPipeline:return(0,BPn.parsePipelineDef)(t,r);case Zn.ZodFirstPartyTypeKind.ZodFunction:case Zn.ZodFirstPartyTypeKind.ZodVoid:case Zn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},tEn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var aUe=v(Dpe=>{"use strict";Object.defineProperty(Dpe,"__esModule",{value:!0});Dpe.zodToJsonSchema=void 0;var RWt=Ml(),rEn=ABe(),nEn=(t,e)=>{let r=(0,rEn.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,RWt.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,RWt.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};Dpe.zodToJsonSchema=nEn});var NWt=v(dn=>{"use strict";var oEn=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),so=dn&&dn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oEn(e,t,r)};Object.defineProperty(dn,"__esModule",{value:!0});so(Xfe(),dn);so(ABe(),dn);so(ER(),dn);so(Ml(),dn);so(IBe(),dn);so(MBe(),dn);so(RBe(),dn);so(NBe(),dn);so(ape(),dn);so(jBe(),dn);so(DBe(),dn);so(LBe(),dn);so(FBe(),dn);so(kBe(),dn);so($Be(),dn);so(zBe(),dn);so(qBe(),dn);so(HBe(),dn);so(VBe(),dn);so(WBe(),dn);so(KBe(),dn);so(GBe(),dn);so(ZBe(),dn);so(YBe(),dn);so(XBe(),dn);so(QBe(),dn);so(iUe(),dn);so(gpe(),dn);so(eUe(),dn);so(mpe(),dn);so(rUe(),dn);so(nUe(),dn);so(wpe(),dn);so(oUe(),dn);so(aUe(),dn);var iEn=aUe();dn.default=iEn.zodToJsonSchema});var DWt=v(EG=>{"use strict";Object.defineProperty(EG,"__esModule",{value:!0});EG.transformToChatCompletionRequest=sEn;EG.convertToParsedChatCompletionResponse=uEn;EG.responseFormatFromZodObject=jWt;var aEn=NWt();function sEn(t){let{responseFormat:e,...r}=t,n=jWt(e);return{...r,responseFormat:n}}function uEn(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 jWt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,aEn.zodToJsonSchema)(t),strict:!0}}}});var kWt=v(Fpe=>{"use strict";Object.defineProperty(Fpe,"__esModule",{value:!0});Fpe.Chat=void 0;var LWt=hWt(),FWt=bWt(),lEn=Lh(),Lpe=dy(),sUe=DWt(),uUe=class extends lEn.ClientSDK{async parse(e,r){let n=(0,sUe.transformToChatCompletionRequest)(e),o=await(0,Lpe.unwrapAsync)((0,LWt.chatComplete)(this,n,r));return(0,sUe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,sUe.transformToChatCompletionRequest)(e);return(0,Lpe.unwrapAsync)((0,FWt.chatStream)(this,n,r))}async complete(e,r){return(0,Lpe.unwrapAsync)((0,LWt.chatComplete)(this,e,r))}async stream(e,r){return(0,Lpe.unwrapAsync)((0,FWt.chatStream)(this,e,r))}};Fpe.Chat=uUe});var BWt=v(UE=>{"use strict";var cEn=UE&&UE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=UE&&UE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lUe=UE&&UE.__importStar||function(t){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 dEn(e,t),e};Object.defineProperty(UE,"__esModule",{value:!0});UE.classifiersModerate=yEn;var fEn=hi(),TG=lUe(gi()),pEn=We(),mEn=we(),$Wt=yi(),hEn=Fo(),zWt=lUe(Jn()),gEn=lUe(kh());async function yEn(t,e,r){let n=(0,mEn.safeParse)(e,y=>zWt.ClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,fEn.encodeJSON)("body",o,{explode:!0}),a=(0,hEn.pathToFunc)("/v1/moderations")(),s=new Headers((0,pEn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,$Wt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,$Wt.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await TG.match(TG.json(200,zWt.ClassificationResponse$inboundSchema),TG.jsonErr(422,gEn.HTTPValidationError$inboundSchema),TG.fail("4XX"),TG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var HWt=v(qE=>{"use strict";var bEn=qE&&qE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_En=qE&&qE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cUe=qE&&qE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bEn(e,t,r);return _En(e,t),e};Object.defineProperty(qE,"__esModule",{value:!0});qE.classifiersModerateChat=OEn;var vEn=hi(),AG=cUe(gi()),wEn=We(),xEn=we(),UWt=yi(),SEn=Fo(),qWt=cUe(Jn()),CEn=cUe(kh());async function OEn(t,e,r){let n=(0,xEn.safeParse)(e,y=>qWt.ChatClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,vEn.encodeJSON)("body",o,{explode:!0}),a=(0,SEn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,wEn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,UWt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,UWt.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await AG.match(AG.json(200,qWt.ClassificationResponse$inboundSchema),AG.jsonErr(422,CEn.HTTPValidationError$inboundSchema),AG.fail("4XX"),AG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var WWt=v(kpe=>{"use strict";Object.defineProperty(kpe,"__esModule",{value:!0});kpe.Classifiers=void 0;var PEn=BWt(),EEn=HWt(),TEn=Lh(),VWt=dy(),dUe=class extends TEn.ClientSDK{async moderate(e,r){return(0,VWt.unwrapAsync)((0,PEn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,VWt.unwrapAsync)((0,EEn.classifiersModerateChat)(this,e,r))}};kpe.Classifiers=dUe});var JWt=v(HE=>{"use strict";var AEn=HE&&HE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=HE&&HE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fUe=HE&&HE.__importStar||function(t){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(HE,"__esModule",{value:!0});HE.embeddingsCreate=LEn;var MEn=hi(),IG=fUe(gi()),REn=We(),NEn=we(),KWt=yi(),jEn=Fo(),GWt=fUe(Jn()),DEn=fUe(kh());async function LEn(t,e,r){let n=(0,NEn.safeParse)(e,y=>GWt.EmbeddingRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,MEn.encodeJSON)("body",o,{explode:!0}),a=(0,jEn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,REn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,KWt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,KWt.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await IG.match(IG.json(200,GWt.EmbeddingResponse$inboundSchema),IG.jsonErr(422,DEn.HTTPValidationError$inboundSchema),IG.fail("4XX"),IG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var ZWt=v($pe=>{"use strict";Object.defineProperty($pe,"__esModule",{value:!0});$pe.Embeddings=void 0;var FEn=JWt(),kEn=Lh(),$En=dy(),pUe=class extends kEn.ClientSDK{async create(e,r){return(0,$En.unwrapAsync)((0,FEn.embeddingsCreate)(this,e,r))}};$pe.Embeddings=pUe});var XWt=v(VE=>{"use strict";var zEn=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]}),BEn=VE&&VE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mUe=VE&&VE.__importStar||function(t){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 BEn(e,t),e};Object.defineProperty(VE,"__esModule",{value:!0});VE.filesDelete=GEn;var UEn=hi(),zpe=mUe(gi()),qEn=We(),HEn=we(),YWt=yi(),VEn=Fo(),WEn=mUe(Jn()),KEn=mUe(Il());async function GEn(t,e,r){let n=(0,HEn.safeParse)(e,y=>KEn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,UEn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,VEn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,qEn.compactMap)({Accept:"application/json"})),l=await(0,YWt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,YWt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await zpe.match(zpe.json(200,WEn.DeleteFileOut$inboundSchema),zpe.fail("4XX"),zpe.fail("5XX"))(b);return g.ok,g}});var eKt=v(WE=>{"use strict";var JEn=WE&&WE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZEn=WE&&WE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hUe=WE&&WE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JEn(e,t,r);return ZEn(e,t),e};Object.defineProperty(WE,"__esModule",{value:!0});WE.filesDownload=nTn;var YEn=hUe(Ie()),XEn=hi(),Bpe=hUe(gi()),QEn=We(),eTn=we(),QWt=yi(),tTn=Fo(),rTn=hUe(Il());async function nTn(t,e,r){let n=(0,eTn.safeParse)(e,y=>rTn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,XEn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,tTn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,QEn.compactMap)({Accept:"application/octet-stream"})),l=await(0,QWt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,QWt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Bpe.match(Bpe.stream(200,YEn.instanceof(ReadableStream)),Bpe.fail("4XX"),Bpe.fail("5XX"))(b);return g.ok,g}});var nKt=v(KE=>{"use strict";var oTn=KE&&KE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=KE&&KE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gUe=KE&&KE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oTn(e,t,r);return iTn(e,t),e};Object.defineProperty(KE,"__esModule",{value:!0});KE.filesGetSignedUrl=dTn;var tKt=hi(),Upe=gUe(gi()),aTn=We(),sTn=we(),rKt=yi(),uTn=Fo(),lTn=gUe(Jn()),cTn=gUe(Il());async function dTn(t,e,r){let n=(0,sTn.safeParse)(e,x=>cTn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(x),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,tKt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,uTn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,tKt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,aTn.compactMap)({Accept:"application/json"})),c=await(0,rKt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,rKt.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},m=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return m;let h=m.value,b=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!b.ok)return b;let g=b.value,[y]=await Upe.match(Upe.json(200,lTn.FileSignedURL$inboundSchema),Upe.fail("4XX"),Upe.fail("5XX"))(g);return y.ok,y}});var iKt=v(GE=>{"use strict";var fTn=GE&&GE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pTn=GE&&GE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yUe=GE&&GE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fTn(e,t,r);return pTn(e,t),e};Object.defineProperty(GE,"__esModule",{value:!0});GE.filesList=vTn;var mTn=hi(),qpe=yUe(gi()),hTn=We(),gTn=we(),oKt=yi(),yTn=Fo(),bTn=yUe(Jn()),_Tn=yUe(Il());async function vTn(t,e,r){let n=(0,gTn.safeParse)(e,y=>_Tn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,yTn.pathToFunc)("/v1/files")(),s=(0,mTn.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,hTn.compactMap)({Accept:"application/json"})),l=await(0,oKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,oKt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await qpe.match(qpe.json(200,bTn.ListFilesOut$inboundSchema),qpe.fail("4XX"),qpe.fail("5XX"))(b);return g.ok,g}});var sKt=v(JE=>{"use strict";var wTn=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]}),xTn=JE&&JE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bUe=JE&&JE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wTn(e,t,r);return xTn(e,t),e};Object.defineProperty(JE,"__esModule",{value:!0});JE.filesRetrieve=ATn;var STn=hi(),Hpe=bUe(gi()),CTn=We(),OTn=we(),aKt=yi(),PTn=Fo(),ETn=bUe(Jn()),TTn=bUe(Il());async function ATn(t,e,r){let n=(0,OTn.safeParse)(e,y=>TTn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,STn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,PTn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,CTn.compactMap)({Accept:"application/json"})),l=await(0,aKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,aKt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Hpe.match(Hpe.json(200,ETn.RetrieveFileOut$inboundSchema),Hpe.fail("4XX"),Hpe.fail("5XX"))(b);return g.ok,g}});var uKt=v(_Ue=>{"use strict";Object.defineProperty(_Ue,"__esModule",{value:!0});_Ue.isReadableStream=ITn;function ITn(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 cKt=v(ZE=>{"use strict";var MTn=ZE&&ZE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RTn=ZE&&ZE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vUe=ZE&&ZE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MTn(e,t,r);return RTn(e,t),e};Object.defineProperty(ZE,"__esModule",{value:!0});ZE.filesUpload=BTn;var Vpe=hi(),NTn=rze(),Wpe=vUe(gi()),jTn=We(),DTn=we(),lKt=yi(),LTn=Fo(),FTn=vUe(Jn()),kTn=vUe(Il()),$Tn=xBe(),zTn=uKt();async function BTn(t,e,r){let n=(0,DTn.safeParse)(e,g=>kTn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,$Tn.isBlobLike)(o.file))(0,Vpe.appendForm)(i,"file",o.file);else if((0,zTn.isReadableStream)(o.file.content)){let g=await(0,NTn.readableStreamToArrayBuffer)(o.file.content),y=new Blob([g],{type:"application/octet-stream"});(0,Vpe.appendForm)(i,"file",y)}else(0,Vpe.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,Vpe.appendForm)(i,"purpose",o.purpose);let a=(0,LTn.pathToFunc)("/v1/files")(),s=new Headers((0,jTn.compactMap)({Accept:"application/json"})),u=await(0,lKt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,lKt.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Wpe.match(Wpe.json(200,FTn.UploadFileOut$inboundSchema),Wpe.fail("4XX"),Wpe.fail("5XX"))(h);return b.ok,b}});var dKt=v(Kpe=>{"use strict";Object.defineProperty(Kpe,"__esModule",{value:!0});Kpe.Files=void 0;var UTn=XWt(),qTn=eKt(),HTn=nKt(),VTn=iKt(),WTn=sKt(),KTn=cKt(),GTn=Lh(),D4=dy(),wUe=class extends GTn.ClientSDK{async upload(e,r){return(0,D4.unwrapAsync)((0,KTn.filesUpload)(this,e,r))}async list(e,r){return(0,D4.unwrapAsync)((0,VTn.filesList)(this,e,r))}async retrieve(e,r){return(0,D4.unwrapAsync)((0,WTn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,D4.unwrapAsync)((0,UTn.filesDelete)(this,e,r))}async download(e,r){return(0,D4.unwrapAsync)((0,qTn.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,D4.unwrapAsync)((0,HTn.filesGetSignedUrl)(this,e,r))}};Kpe.Files=wUe});var mKt=v(YE=>{"use strict";var JTn=YE&&YE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=YE&&YE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xUe=YE&&YE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JTn(e,t,r);return ZTn(e,t),e};Object.defineProperty(YE,"__esModule",{value:!0});YE.fimComplete=rAn;var YTn=hi(),MG=xUe(gi()),XTn=We(),QTn=we(),fKt=yi(),eAn=Fo(),pKt=xUe(Jn()),tAn=xUe(kh());async function rAn(t,e,r){let n=(0,QTn.safeParse)(e,y=>pKt.FIMCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,YTn.encodeJSON)("body",o,{explode:!0}),a=(0,eAn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,XTn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,fKt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,fKt.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await MG.match(MG.json(200,pKt.FIMCompletionResponse$inboundSchema),MG.jsonErr(422,tAn.HTTPValidationError$inboundSchema),MG.fail("4XX"),MG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var yKt=v(XE=>{"use strict";var nAn=XE&&XE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=XE&&XE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gpe=XE&&XE.__importStar||function(t){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(XE,"__esModule",{value:!0});XE.fimStream=fAn;var iAn=Gpe(Ie()),aAn=hi(),sAn=fG(),RG=Gpe(gi()),uAn=We(),lAn=we(),hKt=yi(),cAn=Fo(),gKt=Gpe(Jn()),dAn=Gpe(kh());async function fAn(t,e,r){let n=(0,lAn.safeParse)(e,y=>gKt.FIMCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,aAn.encodeJSON)("body",o,{explode:!0}),a=(0,cAn.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,uAn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,hKt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,hKt.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await RG.match(RG.sse(200,iAn.instanceof(ReadableStream).transform(y=>new sAn.EventStream({stream:y,decoder(x){return gKt.CompletionEvent$inboundSchema.parse(x)}})),{sseSentinel:"[DONE]"}),RG.jsonErr(422,dAn.HTTPValidationError$inboundSchema),RG.fail("4XX"),RG.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var _Kt=v(Jpe=>{"use strict";Object.defineProperty(Jpe,"__esModule",{value:!0});Jpe.Fim=void 0;var pAn=mKt(),mAn=yKt(),hAn=Lh(),bKt=dy(),SUe=class extends hAn.ClientSDK{async complete(e,r){return(0,bKt.unwrapAsync)((0,pAn.fimComplete)(this,e,r))}async stream(e,r){return(0,bKt.unwrapAsync)((0,mAn.fimStream)(this,e,r))}};Jpe.Fim=SUe});var wKt=v(QE=>{"use strict";var gAn=QE&&QE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yAn=QE&&QE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CUe=QE&&QE.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gAn(e,t,r);return yAn(e,t),e};Object.defineProperty(QE,"__esModule",{value:!0});QE.fineTuningJobsCancel=CAn;var bAn=hi(),Zpe=CUe(gi()),_An=We(),vAn=we(),vKt=yi(),wAn=Fo(),xAn=CUe(Jn()),SAn=CUe(Il());async function CAn(t,e,r){let n=(0,vAn.safeParse)(e,y=>SAn.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,bAn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,wAn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,_An.compactMap)({Accept:"application/json"})),l=await(0,vKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Zpe.match(Zpe.json(200,xAn.DetailedJobOut$inboundSchema),Zpe.fail("4XX"),Zpe.fail("5XX"))(b);return g.ok,g}});var SKt=v(eT=>{"use strict";var OAn=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]}),PAn=eT&&eT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OUe=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)&&OAn(e,t,r);return PAn(e,t),e};Object.defineProperty(eT,"__esModule",{value:!0});eT.fineTuningJobsCreate=NAn;var EAn=hi(),Ype=OUe(gi()),TAn=We(),AAn=we(),xKt=yi(),IAn=Fo(),MAn=OUe(Jn()),RAn=OUe(Il());async function NAn(t,e,r){let n=(0,AAn.safeParse)(e,g=>MAn.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,EAn.encodeJSON)("body",o,{explode:!0}),a=(0,IAn.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,TAn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,xKt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,xKt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Ype.match(Ype.json(200,RAn.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Ype.fail("4XX"),Ype.fail("5XX"))(h);return b.ok,b}});var OKt=v(tT=>{"use strict";var jAn=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]}),DAn=tT&&tT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PUe=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)&&jAn(e,t,r);return DAn(e,t),e};Object.defineProperty(tT,"__esModule",{value:!0});tT.fineTuningJobsGet=UAn;var LAn=hi(),Xpe=PUe(gi()),FAn=We(),kAn=we(),CKt=yi(),$An=Fo(),zAn=PUe(Jn()),BAn=PUe(Il());async function UAn(t,e,r){let n=(0,kAn.safeParse)(e,y=>BAn.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,LAn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,$An.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,FAn.compactMap)({Accept:"application/json"})),l=await(0,CKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,CKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Xpe.match(Xpe.json(200,zAn.DetailedJobOut$inboundSchema),Xpe.fail("4XX"),Xpe.fail("5XX"))(b);return g.ok,g}});var EKt=v(rT=>{"use strict";var qAn=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]}),HAn=rT&&rT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EUe=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)&&qAn(e,t,r);return HAn(e,t),e};Object.defineProperty(rT,"__esModule",{value:!0});rT.fineTuningJobsList=YAn;var VAn=hi(),Qpe=EUe(gi()),WAn=We(),KAn=we(),PKt=yi(),GAn=Fo(),JAn=EUe(Jn()),ZAn=EUe(Il());async function YAn(t,e,r){let n=(0,KAn.safeParse)(e,y=>ZAn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,GAn.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,VAn.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,WAn.compactMap)({Accept:"application/json"})),l=await(0,PKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,PKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Qpe.match(Qpe.json(200,JAn.JobsOut$inboundSchema),Qpe.fail("4XX"),Qpe.fail("5XX"))(b);return g.ok,g}});var AKt=v(nT=>{"use strict";var XAn=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]}),QAn=nT&&nT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TUe=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)&&XAn(e,t,r);return QAn(e,t),e};Object.defineProperty(nT,"__esModule",{value:!0});nT.fineTuningJobsStart=aIn;var eIn=hi(),eme=TUe(gi()),tIn=We(),rIn=we(),TKt=yi(),nIn=Fo(),oIn=TUe(Jn()),iIn=TUe(Il());async function aIn(t,e,r){let n=(0,rIn.safeParse)(e,y=>iIn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,eIn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,nIn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,tIn.compactMap)({Accept:"application/json"})),l=await(0,TKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,TKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await eme.match(eme.json(200,oIn.DetailedJobOut$inboundSchema),eme.fail("4XX"),eme.fail("5XX"))(b);return g.ok,g}});var IKt=v(tme=>{"use strict";Object.defineProperty(tme,"__esModule",{value:!0});tme.Jobs=void 0;var sIn=wKt(),uIn=SKt(),lIn=OKt(),cIn=EKt(),dIn=AKt(),fIn=Lh(),NG=dy(),AUe=class extends fIn.ClientSDK{async list(e,r){return(0,NG.unwrapAsync)((0,cIn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,NG.unwrapAsync)((0,uIn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,NG.unwrapAsync)((0,lIn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,NG.unwrapAsync)((0,sIn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,NG.unwrapAsync)((0,dIn.fineTuningJobsStart)(this,e,r))}};tme.Jobs=AUe});var MKt=v(rme=>{"use strict";Object.defineProperty(rme,"__esModule",{value:!0});rme.FineTuning=void 0;var pIn=Lh(),mIn=IKt(),IUe=class extends pIn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new mIn.Jobs(this._options))}};rme.FineTuning=IUe});var NKt=v(oT=>{"use strict";var hIn=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]}),gIn=oT&&oT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MUe=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)&&hIn(e,t,r);return gIn(e,t),e};Object.defineProperty(oT,"__esModule",{value:!0});oT.modelsArchive=SIn;var yIn=hi(),nme=MUe(gi()),bIn=We(),_In=we(),RKt=yi(),vIn=Fo(),wIn=MUe(Jn()),xIn=MUe(Il());async function SIn(t,e,r){let n=(0,_In.safeParse)(e,y=>xIn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,yIn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,vIn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,bIn.compactMap)({Accept:"application/json"})),l=await(0,RKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,RKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await nme.match(nme.json(200,wIn.ArchiveFTModelOut$inboundSchema),nme.fail("4XX"),nme.fail("5XX"))(b);return g.ok,g}});var DKt=v(iT=>{"use strict";var CIn=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]}),OIn=iT&&iT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ome=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)&&CIn(e,t,r);return OIn(e,t),e};Object.defineProperty(iT,"__esModule",{value:!0});iT.modelsDelete=NIn;var PIn=hi(),jG=ome(gi()),EIn=We(),TIn=we(),jKt=yi(),AIn=Fo(),IIn=ome(Jn()),MIn=ome(kh()),RIn=ome(Il());async function NIn(t,e,r){let n=(0,TIn.safeParse)(e,x=>RIn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(x),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,PIn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,AIn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,EIn.compactMap)({Accept:"application/json"})),l=await(0,jKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,jKt.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[y]=await jG.match(jG.json(200,IIn.DeleteModelOut$inboundSchema),jG.jsonErr(422,MIn.HTTPValidationError$inboundSchema),jG.fail("4XX"),jG.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var FKt=v(aT=>{"use strict";var jIn=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]}),DIn=aT&&aT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RUe=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)&&jIn(e,t,r);return DIn(e,t),e};Object.defineProperty(aT,"__esModule",{value:!0});aT.modelsList=zIn;var DG=RUe(gi()),LIn=We(),LKt=yi(),FIn=Fo(),kIn=RUe(Jn()),$In=RUe(kh());async function zIn(t,e){let r=(0,FIn.pathToFunc)("/v1/models")(),n=new Headers((0,LIn.compactMap)({Accept:"application/json"})),o=await(0,LKt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,LKt.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 DG.match(DG.json(200,kIn.ModelList$inboundSchema),DG.jsonErr(422,$In.HTTPValidationError$inboundSchema),DG.fail("4XX"),DG.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var zKt=v(sT=>{"use strict";var BIn=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]}),UIn=sT&&sT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NUe=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)&&BIn(e,t,r);return UIn(e,t),e};Object.defineProperty(sT,"__esModule",{value:!0});sT.modelsRetrieve=GIn;var qIn=hi(),LG=NUe(gi()),HIn=We(),VIn=we(),kKt=yi(),WIn=Fo(),KIn=NUe(kh()),$Kt=NUe(Il());async function GIn(t,e,r){let n=(0,VIn.safeParse)(e,x=>$Kt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(x),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,qIn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,WIn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,HIn.compactMap)({Accept:"application/json"})),l=await(0,kKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kKt.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[y]=await LG.match(LG.json(200,$Kt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),LG.jsonErr(422,KIn.HTTPValidationError$inboundSchema),LG.fail("4XX"),LG.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var UKt=v(uT=>{"use strict";var JIn=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]}),ZIn=uT&&uT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jUe=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)&&JIn(e,t,r);return ZIn(e,t),e};Object.defineProperty(uT,"__esModule",{value:!0});uT.modelsUnarchive=nMn;var YIn=hi(),ime=jUe(gi()),XIn=We(),QIn=we(),BKt=yi(),eMn=Fo(),tMn=jUe(Jn()),rMn=jUe(Il());async function nMn(t,e,r){let n=(0,QIn.safeParse)(e,y=>rMn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,YIn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,eMn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,XIn.compactMap)({Accept:"application/json"})),l=await(0,BKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,BKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await ime.match(ime.json(200,tMn.UnarchiveFTModelOut$inboundSchema),ime.fail("4XX"),ime.fail("5XX"))(b);return g.ok,g}});var VKt=v(lT=>{"use strict";var oMn=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]}),iMn=lT&&lT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DUe=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)&&oMn(e,t,r);return iMn(e,t),e};Object.defineProperty(lT,"__esModule",{value:!0});lT.modelsUpdate=dMn;var qKt=hi(),ame=DUe(gi()),aMn=We(),sMn=we(),HKt=yi(),uMn=Fo(),lMn=DUe(Jn()),cMn=DUe(Il());async function dMn(t,e,r){let n=(0,sMn.safeParse)(e,y=>cMn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,qKt.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,qKt.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,uMn.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,aMn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,HKt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,HKt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await ame.match(ame.json(200,lMn.FTModelOut$inboundSchema),ame.fail("4XX"),ame.fail("5XX"))(b);return g.ok,g}});var WKt=v(sme=>{"use strict";Object.defineProperty(sme,"__esModule",{value:!0});sme.Models=void 0;var fMn=NKt(),pMn=DKt(),mMn=FKt(),hMn=zKt(),gMn=UKt(),yMn=VKt(),bMn=Lh(),L4=dy(),LUe=class extends bMn.ClientSDK{async list(e){return(0,L4.unwrapAsync)((0,mMn.modelsList)(this,e))}async retrieve(e,r){return(0,L4.unwrapAsync)((0,hMn.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,L4.unwrapAsync)((0,pMn.modelsDelete)(this,e,r))}async update(e,r){return(0,L4.unwrapAsync)((0,yMn.modelsUpdate)(this,e,r))}async archive(e,r){return(0,L4.unwrapAsync)((0,fMn.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,L4.unwrapAsync)((0,gMn.modelsUnarchive)(this,e,r))}};sme.Models=LUe});var KKt=v(ume=>{"use strict";Object.defineProperty(ume,"__esModule",{value:!0});ume.Mistral=void 0;var _Mn=Lh(),vMn=F5t(),wMn=fWt(),xMn=kWt(),SMn=WWt(),CMn=ZWt(),OMn=dKt(),PMn=_Kt(),EMn=MKt(),TMn=WKt(),FUe=class extends _Mn.ClientSDK{get models(){return this._models??(this._models=new TMn.Models(this._options))}get files(){return this._files??(this._files=new OMn.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new EMn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new wMn.Batch(this._options))}get chat(){return this._chat??(this._chat=new xMn.Chat(this._options))}get fim(){return this._fim??(this._fim=new PMn.Fim(this._options))}get agents(){return this._agents??(this._agents=new vMn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new CMn.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new SMn.Classifiers(this._options))}};ume.Mistral=FUe});var ZKt=v(Am=>{"use strict";var GKt=Am&&Am.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AMn=Am&&Am.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JKt=Am&&Am.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GKt(e,t,r)},IMn=Am&&Am.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GKt(e,t,r);return AMn(e,t),e};Object.defineProperty(Am,"__esModule",{value:!0});Am.files=void 0;JKt(ide(),Am);Am.files=IMn(rze());JKt(KKt(),Am)});var lGt=w(()=>{QT()});var cGt=w(()=>{Of();lGt();Jp();bh()});var dGt=w(()=>{eb()});var GUe=w(()=>{bh();sA();Jp();cGt();dGt()});var fGt={};Qd(fGt,{AutocompleteCache:()=>VG});var VG,JUe=w(()=>{Tn();VG=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()}),J(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),J("[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 yXt=v((GRi,gXt)=>{"use strict";var MDn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";gXt.exports=MDn});var wXt=v((JRi,vXt)=>{"use strict";var RDn=yXt();function bXt(){}function _Xt(){}_Xt.resetWarningCache=bXt;vXt.exports=function(){function t(n,o,i,a,s,u){if(u!==RDn){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:_Xt,resetWarningCache:bXt};return r.PropTypes=r,r}});var SXt=v((XRi,xXt)=>{xXt.exports=wXt()();var ZRi,YRi});var AXt=v(W2e=>{"use strict";W2e.__esModule=!0;W2e.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 iqn={};Qd(iqn,{default:()=>aye});module.exports=dc(iqn);Gg();Us();Tn();var V$t=F(Iq()),Nq=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)||(J("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,V$t.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return J("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){J("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 J("Cache miss for file:",e),null}catch(r){return fe("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),J("Cached file content:",e)}catch(n){fe("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),J("Removed file from cache:",e))}catch(r){fe("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);J("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing file cache:",e)}}};Tn();Qg();er();var J$t=F(Iq()),Yue=require("obsidian"),Z$t=F(lFe()),bM=class bM{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.handleFileEvent=e=>{e instanceof Yue.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ae().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=Tf({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});gu(e,i,a)&&(await this.invalidateMarkdownContext(o),J(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){fe("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,Z$t.default)(e=>{this.handleFileChange(e)},bM.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=Nq.getInstance(),this.initializeEventListeners()}static getInstance(){return bM.instance||(bM.instance=new bM),bM.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)}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)||(J("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,J$t.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return J("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){J("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 J("Cache miss for project:",e.name),null}catch(r){return fe("Error reading from project context cache:",r),null}}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(J("Memory cache hit for project:",e.name),n):(J("Memory cache miss for project:",e.name),null)}catch(r){return fe("Error reading from project context memory cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);J("Caching context for project:",e.name),this.memoryCache.set(n,r),await this.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("Error writing to project context cache:",n)}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!1}}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);J("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);J(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){fe("Error clearing project context cache:",e)}}async clearForProject(e){try{J(`[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){J(`[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++):dg(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}J(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else J(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),J(`[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),J(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):J(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),J(`[clearForProject] Completed for project: ${e.name}`)}catch(r){fe(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){let n=await this.get(e);n&&(n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},J(`Flagged Web/YouTube contexts for full reload for project ${e.name}`)),await this.set(e,n),await this.cleanupProjectFileReferences(e),J(`Invalidated markdown context for project ${e.name}`))}async updateMarkdownContext(e,r){let n=await this.get(e)||this.createEmptyCache();n.markdownContext=r,n.markdownNeedsReload=!1,await this.set(e,n),J(`Updated markdown context for project ${e.name}`)}async clearMarkdownContext(e){let r=await this.get(e);r&&(r.markdownContext="",r.markdownNeedsReload=!0,await this.set(e,r))}async getFileContext(e,r){try{if(!r||typeof r!="string")return fe("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 dg(`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"?(dg(`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 fe(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){try{let o=await this.get(e)||this.createEmptyCache();o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof Yue.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},await this.set(e,o),J(`Added/updated file context for ${r} in project ${e.name}`)}catch(o){fe(`Error setting file context for ${r}:`,o)}}async removeFileContext(e,r){try{let n=await this.get(e);if(n&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.set(e,n),await this.fileCache.remove(o),J(`Removed file context for ${r} in project ${e.name}`)}}catch(n){fe(`Error removing file context for ${r}:`,n)}}async cleanupProjectFileReferences(e){try{let r=await this.get(e);if(!r||!r.fileContexts)return;let{inclusions:n,exclusions:o}=Tf({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 Yue.TFile)||!gu(u,n,o)?i++:a[s]=r.fileContexts[s]}i>0&&(r.fileContexts=a,await this.set(e,r),J(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`))}catch(r){fe(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{J(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=Tf({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(gu(s,n,o)){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&&J(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),J(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){fe(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}async removeWebUrl(e,r){let n=await this.get(e);n?.webContexts?.[r]&&(delete n.webContexts[r],await this.set(e,n),J(`Removed web context for URL ${r} in project ${e.name}`))}async updateWebUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.webContexts||(o.webContexts={}),o.webContexts[r]=n,await this.set(e,o),J(`Updated web context for URL ${r} in project ${e.name}`)}async removeYoutubeUrl(e,r){let n=await this.get(e);n?.youtubeContexts?.[r]&&(delete n.youtubeContexts[r],await this.set(e,n),J(`Removed YouTube context for URL ${r} in project ${e.name}`))}async updateYoutubeUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,await this.set(e,o),J(`Updated YouTube context for URL ${r} in project ${e.name}`)}};bM.DEBOUNCE_DELAY=5e3;var zb=bM;td();Ur();Tn();Tn();on();var iL=require("obsidian"),PC=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 fe(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await ou(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?(fe(`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 iL.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(fe(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(fe(`File with image extension not found in vault: ${e}.`),!1)}else return n&&fe(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return fe(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return fe(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return fe(`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 fe(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return fe("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await ou(e,{method:"GET",headers:{}});if(!r.ok)return fe(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return fe(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return fe(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return fe("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 iL.TFile))return fe(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return fe(`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 fe(`Invalid MIME type: ${a}, path: ${n}`),null;let u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return fe("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 iL.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 iL.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}}:(fe(`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 fe(i),new Error(i)}return o}};PC.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],PC.MAX_IMAGE_SIZE=3*1024*1024,PC.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var aL=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 fe("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await PC.isImageUrl(e,n))return null;let o=await PC.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return fe(`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){fe("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 PC.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return fe(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new iL.Notice(`Failed to process images:
|
||
${e.join(`
|
||
`)}`)}};Gg();on();var _M=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Wi.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=>!IGe(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){return console.error(`Error processing URL ${e}:`,r),{response:e,elapsed_time_ms:0}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await PC.isImageUrl(s,app.vault))return o.push(s),null;if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response})}return this.mentions.get(s)});return(await Promise.all(i)).forEach(s=>{s?.processed&&(n+=`
|
||
|
||
Content from ${s.original}:
|
||
${s.processed}`)}),{urlContext:n,imageUrls:o}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};Qg();er();Tn();var Y$t=F(Iq()),Xue=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)||(J("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,Y$t.MD5)(r).toString();return J("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)){J("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return J("Cache miss for PDF:",e.path),null}catch(r){return fe("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);J("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("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);J("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing PDF cache:",e)}}};Tn();function sL(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 X$t(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var tzt=require("obsidian");var Q$t=require("obsidian");var ele,ezt,Que=class{constructor(e){this.vault=e;y6e(this,ele)}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 Q$t.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];b6e(this,ele,ezt).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}};ele=new WeakSet,ezt=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 cFe=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},tle=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=Xue.getInstance()}async parseFile(e,r){try{J("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return J("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);J("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 fe(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){J("Clearing PDF cache"),await this.pdfCache.clear()}},dFe=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{J("Parsing Canvas file:",e.path);let n=new Que(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return fe(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},jq=class jq{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=zb.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){jq.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(J(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw fe("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getFileContext(this.currentProject,e.path);if(n)return J(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;J(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);J(`[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),J(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw fe(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),sL(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-jq.lastRateLimitNoticeTime<6e4)return;jq.lastRateLimitNoticeTime=r;let n=X$t(e);new tzt.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(){J("Cache clearing is now handled at the project level")}};jq.lastRateLimitNoticeTime=0;var Y9=jq,vM=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new cFe),this.registerParser(new Y9(e,o)),n||this.registerParser(new tle(e)),this.registerParser(new dFe)}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 tle&&await e.clearCache()}};on();var HG=require("obsidian");Gg();Us();td();Ur();Us();on();async function rle(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 rb(async()=>{let i=await Ec.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return wN(i.content)})}Ur();Gg();Tn();Gg();XD();Tn();OC();er();on();Kue();sA();QT();sf();j_();var nle=class extends jn{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,_n(r))}async getRelevantDocuments(e,r){let n=_n(aN(r)),i=await(await ru.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}}};H9();Hue();var EC=class extends nle{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Gp.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 rb(async()=>{let o=tb(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return ae().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,b)=>{let g=b.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return m&&(d=(await Wi.getInstance().rerank(r,c.map(b=>b.pageContent.slice(0,3e3)))).response.data.map(b=>({...c[b.index],metadata:{...c[b.index].metadata,rerank_score:b.relevance_score}}))),ae().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
|
||
Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(`
|
||
Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),o=await rb(()=>Ec.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?wN(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await wa.getInstance().getDb(),a=await nE.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new oE({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 wa.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&&(ae().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);J("==== Daily note date range: ====",d[0],d[d.length-1]);let f=tb(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(x=>({...x,metadata:{...x.metadata,includeInContext:!0}}));J("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let b=(await xd(a,s)).hits.map(x=>new oE({pageContent:x.document.content,metadata:{...x.document.metadata,score:x.score,path:x.document.path,mtime:x.document.mtime,ctime:x.document.ctime,title:x.document.title,id:x.document.id,embeddingModel:x.document.embeddingModel,tags:x.document.tags,extension:x.document.extension,created_at:x.document.created_at,nchars:x.document.nchars}})),g=[...m,...b];return Array.from(new Set(g.map(x=>x.metadata.id))).map(x=>g.find(S=>S.metadata.id===x)).filter(x=>x!==void 0)}ae().debug&&console.log(`==== Orama Search Params: ====
|
||
`,s);let u=await xd(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 oE({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 mu.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}}))}};er();var fFe=require("obsidian"),rzt=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""}},Dq=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 fFe.Notice(n.message):new fFe.Notice("An error occurred while executing the tool. Check console for details."),null}}};on();var hUt=require("obsidian");Us();eE();Qf();Qg();function Ann(t){return"children"in t&&"path"in t}function Inn(t){return"path"in t&&!("children"in t)}function Mnn(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function pFe(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=Tf();for(let u of t.children)if(Inn(u)){if(gu(u,i,a)){e&&r.push(u.name);let l=Mnn(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(Ann(u)){let l=pFe(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 nzt=t=>Ch(async()=>{let e=pFe(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=pFe(t,!1);return r+JSON.stringify(o)}return r+n},{name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:rn.void()});Ur();BA();Gg();OC();er();eE();Qf();var mFe=Ch(async({timeRange:t,query:e,salientTerms:r})=>{if(await wa.getInstance().isIndexEmpty())throw new Hr(zY);let o=t!==void 0,i=ae().maxSourceChunks<owe?owe:ae().maxSourceChunks;ae().debug&&console.log("returnAll:",o);let u=(await new EC({minSimilarityScore:o?0:.1,maxK:o?1e3:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:kGe,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e)).map(l=>({title:l.metadata.title,content:l.pageContent,path:l.metadata.path,score:l.metadata.score,rerank_score:l.metadata.rerank_score,includeInContext:l.metadata.includeInContext}));return JSON.stringify(u)},{name:"localSearch",description:"Search for notes based on the time range and query",schema:rn.object({timeRange:rn.object({startTime:rn.any(),endTime:rn.any()}).optional(),query:rn.string().describe("The search query"),salientTerms:rn.array(rn.string()).describe("List of salient terms extracted from the query")})}),ozt=Ch(async()=>{try{let t=await wa.getInstance().indexVaultToVectorStore();return`Please report whether the indexing was successful.
|
||
If success is true, just say it is successful. If 0 files is indexed, say there are no new files to index.`+JSON.stringify({success:!0,message:t===0?"No new files to index.":`Indexed ${t} files in the vault.`})}catch(t){return console.error("Error indexing vault:",t),JSON.stringify({success:!1,message:"An error occurred while indexing the vault."})}},{name:"indexVault",description:"Index the vault to the Copilot index"}),hFe=Ch(async({query:t,chatHistory:e})=>{try{let r=await rle(t,e),n=await Wi.getInstance().webSearch(r),o=n.response.citations||[],i=o.length>0?`
|
||
|
||
Sources:
|
||
`+o.map((a,s)=>`[${s+1}] ${a}`).join(`
|
||
`):"";return`Here are the web search results. Please provide a response based on this information and include source citations listed at the end of your response under the heading '#### Sources' as a list of markdown links. For each URL, create a descriptive title based on the domain and path and return it in the markdown format '- [title](url)':
|
||
|
||
`+n.response.choices[0].message.content+i}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}},{name:"webSearch",description:"Search the web for information",schema:rn.object({query:rn.string().describe("The search query"),chatHistory:rn.array(rn.object({role:rn.enum(["user","assistant"]),content:rn.string()})).describe("Previous conversation turns")})});eE();var uzt=F(izt(),1),X9=F(wM(),1);var go;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(go||(go={}));var yu;(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"})(yu||(yu={}));var Oh;(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"})(Oh||(Oh={}));function azt(t,e){e=e.add(1,"day"),uL(t,e),Lq(t,e)}function Bb(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function ole(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",go.AM):t.assign("meridiem",go.PM)}function uL(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function Lq(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var vFe=F(wM(),1);var Rnn={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=>szt(t,Oh.MARCH,yu.SUNDAY,2),dstEnd:t=>szt(t,Oh.OCTOBER,yu.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=>xM(t,Oh.MARCH,yu.SUNDAY,2,2),dstEnd:t=>xM(t,Oh.NOVEMBER,yu.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=>xM(t,Oh.MARCH,yu.SUNDAY,2,2),dstEnd:t=>xM(t,Oh.NOVEMBER,yu.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=>xM(t,Oh.MARCH,yu.SUNDAY,2,2),dstEnd:t=>xM(t,Oh.NOVEMBER,yu.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=>xM(t,Oh.MARCH,yu.SUNDAY,2,2),dstEnd:t=>xM(t,Oh.NOVEMBER,yu.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};function xM(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 szt(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 ile(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??Rnn[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,vFe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,vFe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}X9.default.extend(uzt.default);var SM=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=ile(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}},yo=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,X9.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,X9.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,X9.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?(ole(o,n),Bb(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(Lq(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}},iE=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 yo(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 wFe(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function Nnn(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function Sd(t){return`(?:${Nnn(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var lzt=F(wM(),1);function ale(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function CM(t,e,r){let n=(0,lzt.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 CFe={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},OFe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},ey={...OFe,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},xFe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},SFe={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},dzt={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"},Q9={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",...dzt},fzt=`(?:${Sd(xFe)}|[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)?)`;function jnn(t){let e=t.toLowerCase();return xFe[e]!==void 0?xFe[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)}var Fq=`(?:${Sd(SFe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function kq(t){let e=t.toLowerCase();return SFe[e]!==void 0?SFe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var OM="(?:[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])";function PM(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 ale(e)}var pzt=`(${fzt})\\s{0,3}(${Sd(Q9)})`,czt=new RegExp(pzt,"i"),Dnn=`(${fzt})\\s{0,3}(${Sd(dzt)})`,mzt="\\s{0,5},?(?:\\s*and)?\\s{0,5}",aE=wFe("(?:(?:about|around)\\s{0,3})?",pzt,mzt),EM=wFe("(?:(?:about|around)\\s{0,3})?",Dnn,mzt);function ty(t){let e={},r=t,n=czt.exec(r);for(;n;)Lnn(e,n),r=r.substring(n[0].length).trim(),n=czt.exec(r);return Object.keys(e).length==0?null:e}function Lnn(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=jnn(e[1]),n=Q9[e[2].toLowerCase()];t[n]=r}var xi=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 Fnn=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${aE})(?=\\W|$)`,"i"),knn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${aE})(?=\\W|$)`,"i"),$nn=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${EM})(?=\\W|$)`,"i"),eW=class extends xi{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?$nn:e.option.forwardDate?Fnn:knn}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=ty(r[1]);return n?yo.createRelativeFromReference(e.reference,n):null}};var znn=new RegExp(`(?:on\\s{0,3})?(${Fq})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${Fq}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${Sd(ey)})(?:(?:-|/|,?\\s{0,3})(${OM}(?!\\w)))?(?=\\W|$)`,"i"),hzt=1,gzt=2,Bnn=3,yzt=4,tW=class extends xi{innerPattern(){return znn}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=ey[r[Bnn].toLowerCase()],i=kq(r[hzt]);if(i>31)return r.index=r.index+r[hzt].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[yzt]){let a=PM(r[yzt]);n.start.assign("year",a)}else{let a=CM(e.refDate,i,o);n.start.imply("year",a)}if(r[gzt]){let a=kq(r[gzt]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var Unn=new RegExp(`(${Sd(ey)})(?:-|/|\\s*,?\\s*)(${Fq})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Fq})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${OM}))?(?=\\W|$)(?!\\:\\d)`,"i"),qnn=1,bzt=2,PFe=3,EFe=4,rW=class extends xi{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return Unn}innerExtract(e,r){let n=ey[r[qnn].toLowerCase()],o=kq(r[bzt]);if(o>31||this.shouldSkipYearLikeDate&&!r[PFe]&&!r[EFe]&&r[bzt].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[EFe]){let u=PM(r[EFe]);i.assign("year",u)}else{let u=CM(e.refDate,o,n);i.imply("year",u)}if(!r[PFe])return i;let a=kq(r[PFe]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var Hnn=new RegExp(`((?:in)\\s*)?(${Sd(ey)})\\s*(?:[,-]?\\s*(${OM})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Vnn=1,Wnn=2,_zt=3,nW=class extends xi{innerPattern(){return Hnn}innerExtract(e,r){let n=r[Wnn].toLowerCase();if(r[0].length<=3&&!OFe[n])return null;let o=e.createParsingResult(r.index+(r[Vnn]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=ey[n];if(o.start.assign("month",i),r[_zt]){let a=PM(r[_zt]);o.start.assign("year",a)}else{let a=CM(e.refDate,1,i);o.start.imply("year",a)}return o}};var Knn=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Sd(ey)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Gnn=1,Jnn=2,vzt=3,Znn=4,oW=class extends xi{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return Knn}innerExtract(e,r){let n=parseInt(r[Gnn]),o=parseInt(r[Znn]),i=r[vzt]?parseInt(r[vzt]):ey[r[Jnn].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 Ynn=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),Xnn=1,Qnn=2,iW=class extends xi{innerPattern(){return Ynn}innerExtract(e,r){let n=parseInt(r[Qnn]),o=parseInt(r[Xnn]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function eon(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 ton(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 wzt=2,$q=3,sle=4,ule=5,aW=6,lle=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[wzt]);if(s>100){if(this.strictMode||r[$q]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[$q]!=null){if(r[$q].length==1&&!r[aW])return null;i=parseInt(r[$q])}if(i>=60)return null;if(s>12&&(a=go.PM),r[aW]!=null){if(s>12)return null;let u=r[aW][0].toLowerCase();u=="a"&&(a=go.AM,s==12&&(s=0)),u=="p"&&(a=go.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",go.AM):o.imply("meridiem",go.PM),r[ule]!=null){let u=parseInt(r[ule].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[sle]!=null){let u=parseInt(r[sle]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[ule]!=null){let u=parseInt(r[ule].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[sle]!=null){let u=parseInt(r[sle]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[wzt]),a=0,s=-1;if(r[$q]!=null?a=parseInt(r[$q]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=go.PM),r[aW]!=null){if(i>12)return null;let u=r[aW][0].toLowerCase();u=="a"&&(s=go.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=go.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==go.AM?(n.start.imply("meridiem",go.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",go.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",go.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",go.PM)):i>12?o.imply("meridiem",go.PM):i<=12&&o.imply("meridiem",go.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=eon(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=ton(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var sW=class extends lle{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",go.PM)):o<6&&n.assign("meridiem",go.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",go.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",go.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function TM(t){let e={};for(let r in t)e[r]=-t[r];return e}function xzt(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 ron=new RegExp(`(${aE})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),non=new RegExp(`(${EM})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),uW=class extends xi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?non:ron}innerExtract(e,r){let n=ty(r[1]);if(!n)return null;let o=TM(n);return yo.createRelativeFromReference(e.reference,o)}};var oon=new RegExp(`(${aE})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),ion=new RegExp(`(${EM})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),aon=1,lW=class extends xi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?ion:oon}innerExtract(e,r){let n=ty(r[aon]);return n?yo.createRelativeFromReference(e.reference,n):null}};var cle=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},ry=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 cW=class extends ry{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 dW=class extends cW{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function TFe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=Szt(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=Szt(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?Bb(s,u):uL(s,u)}r.end=s}return r}function Szt(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")==go.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 fW=class extends ry{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()?TFe(r,n):TFe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var zq=class extends fW{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var son=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),pW=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=son.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=ile(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 uon=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),lon=1,con=2,don=3,mW=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=uon.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[con]),s=parseInt(i[don]||"0"),u=a*60+s;u>14*60||(i[lon]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var AM=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 Czt=F(wM(),1);var hW=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,Czt.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),uL(n.start,o),n.end&&n.end.isOnlyTime()&&(uL(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),uL(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 gW=class extends cle{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 fon=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"),pon=1,mon=2,hon=3,Ozt=4,gon=5,Pzt=6,Ezt=7,yon=8,Tzt=9,Azt=10,yW=class extends xi{innerPattern(){return fon}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[pon]),month:parseInt(r[mon]),day:parseInt(r[hon])});if(r[Ozt]!=null&&(n.assign("hour",parseInt(r[Ozt])),n.assign("minute",parseInt(r[gon])),r[Pzt]!=null&&n.assign("second",parseInt(r[Pzt])),r[Ezt]!=null&&n.assign("millisecond",parseInt(r[Ezt])),r[yon]!=null)){let o=0;if(r[Tzt]){let i=parseInt(r[Tzt]),a=0;r[Azt]!=null&&(a=parseInt(r[Azt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var bW=class extends ry{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 Izt(t,e=!1){return t.parsers.unshift(new yW),t.refiners.unshift(new bW),t.refiners.unshift(new mW),t.refiners.unshift(new AM),t.refiners.push(new pW),t.refiners.push(new AM),t.refiners.push(new hW),t.refiners.push(new gW(e)),t}var qzt=F(wM(),1);var Bq=F(wM(),1);function Mzt(t){let e=(0,Bq.default)(t.instant),r=new yo(t,{});return Bb(r,e),ole(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function Rzt(t){let e=(0,Bq.default)(t.instant),r=new yo(t,{});return Bb(r,e),Lq(r,e),r.addTag("casualReference/today"),r}function Nzt(t){return bon(t,1).addTag("casualReference/yesterday")}function bon(t,e){return Dzt(t,-e)}function jzt(t){return Dzt(t,1).addTag("casualReference/tomorrow")}function Dzt(t,e){let r=(0,Bq.default)(t.instant),n=new yo(t,{});return r=r.add(e,"day"),Bb(n,r),Lq(n,r),n}function Lzt(t,e=22){let r=(0,Bq.default)(t.instant),n=new yo(t,{});return Bb(n,r),n.imply("hour",e),n.imply("meridiem",go.PM),n.addTag("casualReference/tonight"),n}function Fzt(t,e=20){let r=new yo(t,{});return r.imply("meridiem",go.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function kzt(t){let e=new yo(t,{}),r=(0,Bq.default)(t.instant);return r.hour()>2&&azt(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function $zt(t,e=6){let r=new yo(t,{});return r.imply("meridiem",go.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function zzt(t,e=15){let r=new yo(t,{});return r.imply("meridiem",go.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function Bzt(t){let e=new yo(t,{});return e.imply("meridiem",go.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var _on=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,_W=class extends xi{innerPattern(e){return _on}innerExtract(e,r){let n=(0,qzt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=Mzt(e.reference);break;case"today":i=Rzt(e.reference);break;case"yesterday":i=Nzt(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=jzt(e.reference);break;case"tonight":i=Lzt(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),Bb(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var von=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,vW=class extends xi{innerPattern(){return von}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=zzt(e.reference);break;case"evening":case"night":n=Fzt(e.reference);break;case"midnight":n=kzt(e.reference);break;case"morning":n=$zt(e.reference);break;case"noon":case"midday":n=Bzt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function Hzt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=won(n,e,r),i=new yo(t);return i=xzt(i,{day:o}),i.assign("weekday",e),i}function won(t,e,r){let n=t.getDay();switch(r){case"this":return dle(t,e);case"last":return Vzt(t,e);case"next":return n==yu.SUNDAY?e==yu.SUNDAY?7:e:n==yu.SATURDAY?e==yu.SATURDAY?7:e==yu.SUNDAY?8:1+e:e<n&&e!=yu.SUNDAY?dle(t,e):dle(t,e)+7}return xon(t,e)}function xon(t,e){let r=Vzt(t,e),n=dle(t,e);return n<-r?n:r}function dle(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function Vzt(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var Son=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Sd(CFe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),Con=1,Oon=2,Pon=3,wW=class extends xi{innerPattern(){return Son}innerExtract(e,r){let n=r[Oon].toLowerCase(),o=CFe[n],i=r[Con],a=r[Pon],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"),Hzt(e.reference,o,u)}};var Wzt=F(wM(),1);var Eon=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Sd(Q9)})(?=\\s*)(?=\\W|$)`,"i"),Ton=1,Aon=2,xW=class extends xi{innerPattern(){return Eon}innerExtract(e,r){let n=r[Ton].toLowerCase(),o=r[Aon].toLowerCase(),i=Q9[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,yo.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,yo.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,Wzt.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 Ion=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"),Mon=1,Ron=5,Kzt=2,Gzt=3,AFe=4,SW=class{constructor(e){this.groupNumberMonth=e?Gzt:Kzt,this.groupNumberDay=e?Kzt:Gzt}pattern(){return Ion}extract(e,r){let n=r.index+r[Mon].length,o=r.index+r[0].length-r[Ron].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[AFe]&&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[AFe]){let l=parseInt(r[AFe]),c=ale(l);a.start.assign("year",c)}else{let l=CM(e.refDate,u,s);a.start.imply("year",l)}return a}};var Non=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${aE})(?=\\W|$)`,"i"),jon=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${EM})(?=\\W|$)`,"i"),CW=class extends xi{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?Non:jon}innerExtract(e,r){let n=r[1].toLowerCase(),o=ty(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=TM(o);break}return yo.createRelativeFromReference(e.reference,o)}};function Don(t){return t.text.match(/^[+-]/i)!=null}function Jzt(t){return t.text.match(/^-/i)!=null}var OW=class extends ry{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?Don(n)||Jzt(n):!1}mergeResults(e,r,n,o){let i=ty(n.text);Jzt(n)&&(i=TM(i));let a=yo.createRelativeFromReference(new SM(r.start.date()),i);return new iE(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function Zzt(t){return t.text.match(/\s+(before|from)$/i)!=null}function Lon(t){return t.text.match(/\s+(after|since)$/i)!=null}var PW=class extends ry{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!Zzt(r)&&!Lon(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=ty(r.text);Zzt(r)&&(o=TM(o));let i=yo.createRelativeFromReference(new SM(n.start.date()),o);return new iE(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var Fon=new RegExp(`^\\s*(${OM})`,"i"),kon=1,EW=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=Fon.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=PM(i[kon]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var lL=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new _W),r.parsers.push(new vW),r.parsers.push(new nW),r.parsers.push(new xW),r.parsers.push(new CW),r}createConfiguration(e=!0,r=!1){let n=Izt({parsers:[new SW(r),new eW(e),new tW,new rW(r),new wW,new iW,new sW(e),new uW(e),new lW(e)],refiners:[new zq]},e);return n.parsers.unshift(new oW(e)),n.refiners.unshift(new PW),n.refiners.unshift(new OW),n.refiners.unshift(new AM),n.refiners.push(new zq),n.refiners.push(new EW),n.refiners.push(new dW),n}};var Uq=class t{constructor(e){this.defaultConfig=new lL,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 IFe(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 iE?c=l:l instanceof yo?(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}},IFe=class{constructor(e,r,n){this.text=e,this.reference=new SM(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof yo?e:new yo(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 iE(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 MFe=new lL,Yzt=new Uq(MFe.createCasualConfiguration(!1)),$on=new Uq(MFe.createConfiguration(!0,!1)),Uti=new Uq(MFe.createCasualConfiguration(!0));var Bon=Yzt;function RFe(t,e,r){return Bon.parse(t,e,r)}var sE=class extends Error{},fle=class extends sE{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},ple=class extends sE{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},mle=class extends sE{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Ub=class extends sE{},qq=class extends sE{constructor(e){super(`Invalid unit ${e}`)}},Ms=class extends sE{},qb=class extends sE{constructor(){super("Zone is an abstract class")}};var ft="numeric",Hb="short",Ph="long",IM={year:ft,month:ft,day:ft},TW={year:ft,month:Hb,day:ft},NFe={year:ft,month:Hb,day:ft,weekday:Hb},AW={year:ft,month:Ph,day:ft},IW={year:ft,month:Ph,day:ft,weekday:Ph},MW={hour:ft,minute:ft},RW={hour:ft,minute:ft,second:ft},NW={hour:ft,minute:ft,second:ft,timeZoneName:Hb},jW={hour:ft,minute:ft,second:ft,timeZoneName:Ph},DW={hour:ft,minute:ft,hourCycle:"h23"},LW={hour:ft,minute:ft,second:ft,hourCycle:"h23"},FW={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:Hb},kW={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:Ph},$W={year:ft,month:ft,day:ft,hour:ft,minute:ft},zW={year:ft,month:ft,day:ft,hour:ft,minute:ft,second:ft},BW={year:ft,month:Hb,day:ft,hour:ft,minute:ft},UW={year:ft,month:Hb,day:ft,hour:ft,minute:ft,second:ft},jFe={year:ft,month:Hb,day:ft,weekday:Hb,hour:ft,minute:ft},qW={year:ft,month:Ph,day:ft,hour:ft,minute:ft,timeZoneName:Hb},HW={year:ft,month:Ph,day:ft,hour:ft,minute:ft,second:ft,timeZoneName:Hb},VW={year:ft,month:Ph,day:ft,weekday:Ph,hour:ft,minute:ft,timeZoneName:Ph},WW={year:ft,month:Ph,day:ft,weekday:Ph,hour:ft,minute:ft,second:ft,timeZoneName:Ph};var vm=class{get type(){throw new qb}get name(){throw new qb}get ianaName(){return this.name}get isUniversal(){throw new qb}offsetName(e,r){throw new qb}formatOffset(e,r){throw new qb}offset(e){throw new qb}equals(e){throw new qb}get isValid(){throw new qb}};var DFe=null,MM=class t extends vm{static get instance(){return DFe===null&&(DFe=new t),DFe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return gle(e,r,n)}formatOffset(e,r){return RM(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var ble={};function qon(t){return ble[t]||(ble[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"})),ble[t]}var Hon={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Von(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 Won(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=Hon[i];i==="era"?n[s]=a:fr(s)||(n[s]=parseInt(a,10))}return n}var yle={},Af=class t extends vm{static create(e){return yle[e]||(yle[e]=new t(e)),yle[e]}static resetCache(){yle={},ble={}}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 gle(e,r,n,this.name)}formatOffset(e,r){return RM(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=qon(this.name),[o,i,a,s,u,l,c]=n.formatToParts?Won(n,r):Von(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=Hq({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,m=p%1e3;return p-=m>=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var Xzt={};function Kon(t,e={}){let r=JSON.stringify([t,e]),n=Xzt[r];return n||(n=new Intl.ListFormat(t,e),Xzt[r]=n),n}var LFe={};function FFe(t,e={}){let r=JSON.stringify([t,e]),n=LFe[r];return n||(n=new Intl.DateTimeFormat(t,e),LFe[r]=n),n}var kFe={};function Gon(t,e={}){let r=JSON.stringify([t,e]),n=kFe[r];return n||(n=new Intl.NumberFormat(t,e),kFe[r]=n),n}var $Fe={};function Jon(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=$Fe[o];return i||(i=new Intl.RelativeTimeFormat(t,e),$Fe[o]=i),i}var KW=null;function Zon(){return KW||(KW=new Intl.DateTimeFormat().resolvedOptions().locale,KW)}var Qzt={};function Yon(t){let e=Qzt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Qzt[t]=e}return e}function Xon(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=FFe(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=FFe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function Qon(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function ein(t){let e=[];for(let r=1;r<=12;r++){let n=sn.utc(2009,r,1);e.push(t(n))}return e}function tin(t){let e=[];for(let r=1;r<=7;r++){let n=sn.utc(2016,11,13+r);e.push(t(n))}return e}function _le(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function rin(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 zFe=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=Gon(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):Vq(e,3);return ss(r,this.padTo)}}},BFe=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&&Af.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=FFe(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()}},UFe=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&vle()&&(this.rtf=Jon(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):eBt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},nin={firstDay:1,minimalDays:4,weekend:[6,7]},Lo=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||Do.defaultLocale,s=a||(i?"en-US":Zon()),u=r||Do.defaultNumberingSystem,l=n||Do.defaultOutputCalendar,c=GW(o)||Do.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){KW=null,LFe={},kFe={},$Fe={}}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]=Xon(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=Qon(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=rin(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,GW(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 _le(this,e,qFe,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=ein(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return _le(this,e,HFe,()=>{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]=tin(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return _le(this,void 0,()=>VFe,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[sn.utc(2016,11,13,9),sn.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return _le(this,e,WFe,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[sn.utc(-40,1,1),sn.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 zFe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new BFe(e,this.intl,r)}relFormatter(e={}){return new UFe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Kon(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:wle()?Yon(this.locale):nin}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 GFe=null,Tc=class t extends vm{static get utcInstance(){return GFe===null&&(GFe=new t(0)),GFe}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(cL(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${RM(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${RM(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return RM(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 Wq=class extends vm{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 Vb(t,e){let r;if(fr(t)||t===null)return e;if(t instanceof vm)return t;if(tBt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?MM.instance:n==="utc"||n==="gmt"?Tc.utcInstance:Tc.parseSpecifier(n)||Af.create(t)}else return Wb(t)?Tc.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new Wq(t)}var JFe={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"},rBt={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]},oin=JFe.hanidec.replace(/[\[|\]]/g,"").split("");function nBt(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(JFe.hanidec)!==-1)e+=oin.indexOf(t[r]);else for(let o in rBt){let[i,a]=rBt[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var Kq={};function oBt(){Kq={}}function ny({numberingSystem:t},e=""){let r=t||"latn";return Kq[r]||(Kq[r]={}),Kq[r][e]||(Kq[r][e]=new RegExp(`${JFe[r]}${e}`)),Kq[r][e]}var iBt=()=>Date.now(),aBt="system",sBt=null,uBt=null,lBt=null,cBt=60,dBt,fBt=null,Do=class{static get now(){return iBt}static set now(e){iBt=e}static set defaultZone(e){aBt=e}static get defaultZone(){return Vb(aBt,MM.instance)}static get defaultLocale(){return sBt}static set defaultLocale(e){sBt=e}static get defaultNumberingSystem(){return uBt}static set defaultNumberingSystem(e){uBt=e}static get defaultOutputCalendar(){return lBt}static set defaultOutputCalendar(e){lBt=e}static get defaultWeekSettings(){return fBt}static set defaultWeekSettings(e){fBt=GW(e)}static get twoDigitCutoffYear(){return cBt}static set twoDigitCutoffYear(e){cBt=e%100}static get throwOnInvalid(){return dBt}static set throwOnInvalid(e){dBt=e}static resetCaches(){Lo.resetCache(),Af.resetCache(),sn.resetCache(),oBt()}};var Ac=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var pBt=[0,31,59,90,120,151,181,212,243,273,304,334],mBt=[0,31,60,91,121,152,182,213,244,274,305,335];function oy(t,e){return new Ac("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function xle(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 hBt(t,e,r){return r+(fL(t)?mBt:pBt)[e-1]}function gBt(t,e){let r=fL(t)?mBt:pBt,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Sle(t,e){return(t-e+7)%7+1}function JW(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=hBt(n,o,i),s=Sle(xle(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=dL(l,e,r)):u>dL(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...YW(t)}}function ZFe(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Sle(xle(n,1,e),r),s=NM(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=NM(l)):u>s?(l=n+1,u-=NM(n)):l=n;let{month:c,day:d}=gBt(l,u);return{year:l,month:c,day:d,...YW(t)}}function Cle(t){let{year:e,month:r,day:n}=t,o=hBt(e,r,n);return{year:e,ordinal:o,...YW(t)}}function YFe(t){let{year:e,ordinal:r}=t,{month:n,day:o}=gBt(e,r);return{year:e,month:n,day:o,...YW(t)}}function XFe(t,e){if(!fr(t.localWeekday)||!fr(t.localWeekNumber)||!fr(t.localWeekYear)){if(!fr(t.weekday)||!fr(t.weekNumber)||!fr(t.weekYear))throw new Ub("Cannot mix locale-based week fields with ISO-based week fields");return fr(t.localWeekday)||(t.weekday=t.localWeekday),fr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),fr(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 yBt(t,e=4,r=1){let n=ZW(t.weekYear),o=Eh(t.weekNumber,1,dL(t.weekYear,e,r)),i=Eh(t.weekday,1,7);return n?o?i?!1:oy("weekday",t.weekday):oy("week",t.weekNumber):oy("weekYear",t.weekYear)}function bBt(t){let e=ZW(t.year),r=Eh(t.ordinal,1,NM(t.year));return e?r?!1:oy("ordinal",t.ordinal):oy("year",t.year)}function QFe(t){let e=ZW(t.year),r=Eh(t.month,1,12),n=Eh(t.day,1,Gq(t.year,t.month));return e?r?n?!1:oy("day",t.day):oy("month",t.month):oy("year",t.year)}function eke(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=Eh(e,0,23)||e===24&&r===0&&n===0&&o===0,a=Eh(r,0,59),s=Eh(n,0,59),u=Eh(o,0,999);return i?a?s?u?!1:oy("millisecond",o):oy("second",n):oy("minute",r):oy("hour",e)}function fr(t){return typeof t>"u"}function Wb(t){return typeof t=="number"}function ZW(t){return typeof t=="number"&&t%1===0}function tBt(t){return typeof t=="string"}function vBt(t){return Object.prototype.toString.call(t)==="[object Date]"}function vle(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function wle(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function wBt(t){return Array.isArray(t)?t:[t]}function tke(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 xBt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function jM(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function GW(t){if(t==null)return null;if(typeof t!="object")throw new Ms("Week settings must be an object");if(!Eh(t.firstDay,1,7)||!Eh(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Eh(e,1,7)))throw new Ms("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Eh(t,e,r){return ZW(t)&&t>=e&&t<=r}function iin(t,e){return t-e*Math.floor(t/e)}function ss(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function uE(t){if(!(fr(t)||t===null||t===""))return parseInt(t,10)}function DM(t){if(!(fr(t)||t===null||t===""))return parseFloat(t)}function XW(t){if(!(fr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Vq(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function fL(t){return t%4===0&&(t%100!==0||t%400===0)}function NM(t){return fL(t)?366:365}function Gq(t,e){let r=iin(e-1,12)+1,n=t+(e-r)/12;return r===2?fL(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Hq(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 _Bt(t,e,r){return-Sle(xle(t,1,e),r)+e-1}function dL(t,e=4,r=1){let n=_Bt(t,e,r),o=_Bt(t+1,e,r);return(NM(t)-n+o)/7}function QW(t){return t>99?t:t>Do.twoDigitCutoffYear?1900+t:2e3+t}function gle(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 cL(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 rke(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ms(`Invalid unit value ${t}`);return e}function Jq(t,e){let r={};for(let n in t)if(jM(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=rke(o)}return r}function RM(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),o=t>=0?"+":"-";switch(e){case"short":return`${o}${ss(r,2)}:${ss(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${ss(r,2)}${ss(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function YW(t){return xBt(t,["hour","minute","second","millisecond"])}var ain=["January","February","March","April","May","June","July","August","September","October","November","December"],nke=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sin=["J","F","M","A","M","J","J","A","S","O","N","D"];function qFe(t){switch(t){case"narrow":return[...sin];case"short":return[...nke];case"long":return[...ain];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}}var oke=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ike=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],uin=["M","T","W","T","F","S","S"];function HFe(t){switch(t){case"narrow":return[...uin];case"short":return[...ike];case"long":return[...oke];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var VFe=["AM","PM"],lin=["Before Christ","Anno Domini"],cin=["BC","AD"],din=["B","A"];function WFe(t){switch(t){case"narrow":return[...din];case"short":return[...cin];case"long":return[...lin];default:return null}}function SBt(t){return VFe[t.hour<12?0:1]}function CBt(t,e){return HFe(e)[t.weekday-1]}function OBt(t,e){return qFe(e)[t.month-1]}function PBt(t,e){return WFe(e)[t.year<0?0:1]}function eBt(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}`}function EBt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var fin={D:IM,DD:TW,DDD:AW,DDDD:IW,t:MW,tt:RW,ttt:NW,tttt:jW,T:DW,TT:LW,TTT:FW,TTTT:kW,f:$W,ff:BW,fff:qW,ffff:VW,F:zW,FF:UW,FFF:HW,FFFF:WW},Ic=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 fin[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return ss(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?SBt(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?OBt(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?CBt(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?PBt(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 EBt(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 EBt(i,o(s))}};var ABt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Yq(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Xq(...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 Qq(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 IBt(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=uE(e[r+o]);return[n,null,r+o]}}var MBt=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,pin=`(?:${MBt.source}?(?:\\[(${ABt.source})\\])?)?`,ake=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,RBt=RegExp(`${ake.source}${pin}`),ske=RegExp(`(?:T${RBt.source})?`),min=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hin=/(\d{4})-?W(\d\d)(?:-?(\d))?/,gin=/(\d{4})-?(\d{3})/,yin=IBt("weekYear","weekNumber","weekDay"),bin=IBt("year","ordinal"),_in=/(\d{4})-(\d\d)-(\d\d)/,NBt=RegExp(`${ake.source} ?(?:${MBt.source}|(${ABt.source}))?`),vin=RegExp(`(?: ${NBt.source})?`);function Zq(t,e,r){let n=t[e];return fr(n)?r:uE(n)}function win(t,e){return[{year:Zq(t,e),month:Zq(t,e+1,1),day:Zq(t,e+2,1)},null,e+3]}function e2(t,e){return[{hours:Zq(t,e,0),minutes:Zq(t,e+1,0),seconds:Zq(t,e+2,0),milliseconds:XW(t[e+3])},null,e+4]}function eK(t,e){let r=!t[e]&&!t[e+1],n=cL(t[e+1],t[e+2]),o=r?null:Tc.instance(n);return[{},o,e+3]}function tK(t,e){let r=t[e]?Af.create(t[e]):null;return[{},r,e+1]}var xin=RegExp(`^T?${ake.source}$`),Sin=/^-?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)?)?)$/;function Cin(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,m=!1)=>p!==void 0&&(m||p&&c)?-p:p;return[{years:f(DM(r)),months:f(DM(n)),weeks:f(DM(o)),days:f(DM(i)),hours:f(DM(a)),minutes:f(DM(s)),seconds:f(DM(u),u==="-0"),milliseconds:f(XW(l),d)}]}var Oin={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 uke(t,e,r,n,o,i,a){let s={year:e.length===2?QW(uE(e)):uE(e),month:nke.indexOf(r)+1,day:uE(n),hour:uE(o),minute:uE(i)};return a&&(s.second=uE(a)),t&&(s.weekday=t.length>3?oke.indexOf(t)+1:ike.indexOf(t)+1),s}var Pin=/^(?:(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)))$/;function Ein(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=uke(e,o,n,r,i,a,s),p;return u?p=Oin[u]:l?p=0:p=cL(c,d),[f,new Tc(p)]}function Tin(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Ain=/^(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$/,Iin=/^(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$/,Min=/^(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})$/;function TBt(t){let[,e,r,n,o,i,a,s]=t;return[uke(e,o,n,r,i,a,s),Tc.utcInstance]}function Rin(t){let[,e,r,n,o,i,a,s]=t;return[uke(e,s,r,n,o,i,a),Tc.utcInstance]}var Nin=Yq(min,ske),jin=Yq(hin,ske),Din=Yq(gin,ske),Lin=Yq(RBt),jBt=Xq(win,e2,eK,tK),Fin=Xq(yin,e2,eK,tK),kin=Xq(bin,e2,eK,tK),$in=Xq(e2,eK,tK);function DBt(t){return Qq(t,[Nin,jBt],[jin,Fin],[Din,kin],[Lin,$in])}function LBt(t){return Qq(Tin(t),[Pin,Ein])}function FBt(t){return Qq(t,[Ain,TBt],[Iin,TBt],[Min,Rin])}function kBt(t){return Qq(t,[Sin,Cin])}var zin=Xq(e2);function $Bt(t){return Qq(t,[xin,zin])}var Bin=Yq(_in,vin),Uin=Yq(NBt),qin=Xq(e2,eK,tK);function zBt(t){return Qq(t,[Bin,jBt],[Uin,qin])}var BBt="Invalid Duration",qBt={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}},Hin={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},...qBt},iy=146097/400,t2=146097/4800,Vin={years:{quarters:4,months:12,weeks:iy/7,days:iy,hours:iy*24,minutes:iy*24*60,seconds:iy*24*60*60,milliseconds:iy*24*60*60*1e3},quarters:{months:3,weeks:iy/28,days:iy/4,hours:iy*24/4,minutes:iy*24*60/4,seconds:iy*24*60*60/4,milliseconds:iy*24*60*60*1e3/4},months:{weeks:t2/7,days:t2,hours:t2*24,minutes:t2*24*60,seconds:t2*24*60*60,milliseconds:t2*24*60*60*1e3},...qBt},pL=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Win=pL.slice(0).reverse();function LM(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 us(n)}function HBt(t,e){let r=e.milliseconds??0;for(let n of Win.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function UBt(t,e){let r=HBt(t,e)<0?-1:1;pL.reduceRight((n,o)=>{if(fr(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),pL.reduce((n,o)=>{if(fr(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function Kin(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var us=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?Vin:Hin;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Lo.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 Ms(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Jq(e,t.normalizeUnit),loc:Lo.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Wb(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Ms(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=kBt(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]=$Bt(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 Ms("need to specify a reason the Duration is invalid");let n=e instanceof Ac?e:new Ac(e,r);if(Do.throwOnInvalid)throw new mle(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 qq(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?Ic.create(this.loc,n).formatDurationFromString(this,e):BBt}toHuman(e={}){if(!this.isValid)return BBt;let r=pL.map(n=>{let o=this.values[n];return fr(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+=Vq(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},sn.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?HBt(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 pL)(jM(r.values,o)||jM(this.values,o))&&(n[o]=r.get(o)+this.get(o));return LM(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]=rke(e(this.values[n],n));return LM(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Jq(e,t.normalizeUnit)};return LM(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 LM(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return UBt(this.matrix,e),LM(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Kin(this.normalize().shiftToAll().toObject());return LM(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 pL)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;Wb(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else Wb(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 UBt(this.matrix,r),LM(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 LM(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 pL)if(!r(this.values[n],e.values[n]))return!1;return!0}};var r2="Invalid Interval";function Gin(t,e){return!t||!t.isValid?lE.invalid("missing or invalid start"):!e||!e.isValid?lE.invalid("missing or invalid end"):e<t?lE.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 lE=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 Ms("need to specify a reason the Interval is invalid");let n=e instanceof Ac?e:new Ac(e,r);if(Do.throwOnInvalid)throw new ple(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=n2(e),o=n2(r),i=Gin(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=us.fromDurationLike(r),o=n2(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=us.fromDurationLike(r),o=n2(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=sn.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=sn.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=us.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=us.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(n2).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=us.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()})`:r2}[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=IM,r={}){return this.isValid?Ic.create(this.s.loc.clone(r),e).formatInterval(this):r2}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:r2}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:r2}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:r2}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:r2}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):us.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var cE=class{static hasDST(e=Do.defaultZone){let r=sn.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return Af.isValidZone(e)}static normalizeZone(e){return Vb(e,Do.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Lo.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Lo.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Lo.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Lo.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Lo.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Lo.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Lo.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Lo.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Lo.create(r,null,"gregory").eras(e)}static features(){return{relative:vle(),localeWeek:wle()}}};function VBt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(us.fromMillis(n).as("days"))}function Jin(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=VBt(u,l);return(c-c%7)/7}],["days",VBt]],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 WBt(t,e,r,n){let[o,i,a,s]=Jin(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=us.fromObject(i,n);return l.length>0?us.fromMillis(u,n).shiftTo(...l).plus(c):c}var Zin="missing Intl.DateTimeFormat.formatToParts support";function mi(t,e=r=>r){return{regex:t,deser:([r])=>e(nBt(r))}}var Yin="\xA0",JBt=`[ ${Yin}]`,ZBt=new RegExp(JBt,"g");function Xin(t){return t.replace(/\./g,"\\.?").replace(ZBt,JBt)}function KBt(t){return t.replace(/\./g,"").replace(ZBt," ").toLowerCase()}function Kb(t,e){return t===null?null:{regex:RegExp(t.map(Xin).join("|")),deser:([r])=>t.findIndex(n=>KBt(r)===KBt(n))+e}}function GBt(t,e){return{regex:t,deser:([,r,n])=>cL(r,n),groups:e}}function Ole(t){return{regex:t,deser:([e])=>e}}function Qin(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ean(t,e){let r=ny(e),n=ny(e,"{2}"),o=ny(e,"{3}"),i=ny(e,"{4}"),a=ny(e,"{6}"),s=ny(e,"{1,2}"),u=ny(e,"{1,3}"),l=ny(e,"{1,6}"),c=ny(e,"{1,9}"),d=ny(e,"{2,4}"),f=ny(e,"{4,6}"),p=b=>({regex:RegExp(Qin(b.val)),deser:([g])=>g,literal:!0}),h=(b=>{if(t.literal)return p(b);switch(b.val){case"G":return Kb(e.eras("short"),0);case"GG":return Kb(e.eras("long"),0);case"y":return mi(l);case"yy":return mi(d,QW);case"yyyy":return mi(i);case"yyyyy":return mi(f);case"yyyyyy":return mi(a);case"M":return mi(s);case"MM":return mi(n);case"MMM":return Kb(e.months("short",!0),1);case"MMMM":return Kb(e.months("long",!0),1);case"L":return mi(s);case"LL":return mi(n);case"LLL":return Kb(e.months("short",!1),1);case"LLLL":return Kb(e.months("long",!1),1);case"d":return mi(s);case"dd":return mi(n);case"o":return mi(u);case"ooo":return mi(o);case"HH":return mi(n);case"H":return mi(s);case"hh":return mi(n);case"h":return mi(s);case"mm":return mi(n);case"m":return mi(s);case"q":return mi(s);case"qq":return mi(n);case"s":return mi(s);case"ss":return mi(n);case"S":return mi(u);case"SSS":return mi(o);case"u":return Ole(c);case"uu":return Ole(s);case"uuu":return mi(r);case"a":return Kb(e.meridiems(),0);case"kkkk":return mi(i);case"kk":return mi(d,QW);case"W":return mi(s);case"WW":return mi(n);case"E":case"c":return mi(r);case"EEE":return Kb(e.weekdays("short",!1),1);case"EEEE":return Kb(e.weekdays("long",!1),1);case"ccc":return Kb(e.weekdays("short",!0),1);case"cccc":return Kb(e.weekdays("long",!0),1);case"Z":case"ZZ":return GBt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return GBt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Ole(/[a-z_+-/]{1,256}?/i);case" ":return Ole(/[^\S\n\r]/);default:return p(b)}})(t)||{invalidReason:Zin};return h.token=t,h}var tan={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"}};function ran(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=tan[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function nan(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function oan(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(jM(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 ian(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 fr(t.z)||(r=Af.create(t.z)),fr(t.Z)||(r||(r=new Tc(t.Z)),n=t.Z),fr(t.q)||(t.M=(t.q-1)*3+1),fr(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),fr(t.u)||(t.S=XW(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var lke=null;function aan(){return lke||(lke=sn.fromMillis(1555555555555)),lke}function san(t,e){if(t.literal)return t;let r=Ic.macroTokenToFormatOpts(t.val),n=fke(r,e);return n==null||n.includes(void 0)?t:n}function cke(t,e){return Array.prototype.concat(...t.map(r=>san(r,e)))}var rK=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=cke(Ic.parseFormat(r),e),this.units=this.tokens.map(n=>ean(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=nan(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=oan(e,this.regex,this.handlers),[o,i,a]=n?ian(n):[null,null,void 0];if(jM(n,"a")&&jM(n,"H"))throw new Ub("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 dke(t,e,r){return new rK(t,r).explainFromTokens(e)}function YBt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=dke(t,e,r);return[n,o,i,a]}function fke(t,e){if(!t)return null;let n=Ic.create(e,t).dtFormatter(aan()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>ran(a,t,i))}var pke="Invalid DateTime",XBt=864e13;function nK(t){return new Ac("unsupported zone",`the zone "${t.name}" is not supported`)}function mke(t){return t.weekData===null&&(t.weekData=JW(t.c)),t.weekData}function hke(t){return t.localWeekData===null&&(t.localWeekData=JW(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function mL(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new sn({...r,...e,old:r})}function iUt(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 Ple(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 Tle(t,e,r){return iUt(Hq(t),e,r)}function QBt(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,Gq(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=us.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=Hq(i),[u,l]=iUt(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function o2(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=sn.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return sn.invalid(new Ac("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Ele(t,e,r=!0){return t.isValid?Ic.create(Lo.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function gke(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=ss(t.c.year,r?6:4),e?(n+="-",n+=ss(t.c.month),n+="-",n+=ss(t.c.day)):(n+=ss(t.c.month),n+=ss(t.c.day)),n}function eUt(t,e,r,n,o,i){let a=ss(t.c.hour);return e?(a+=":",a+=ss(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=ss(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=ss(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=ss(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=ss(Math.trunc(-t.o/60)),a+=":",a+=ss(Math.trunc(-t.o%60))):(a+="+",a+=ss(Math.trunc(t.o/60)),a+=":",a+=ss(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var aUt={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},uan={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},lan={ordinal:1,hour:0,minute:0,second:0,millisecond:0},sUt=["year","month","day","hour","minute","second","millisecond"],can=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],dan=["year","ordinal","hour","minute","second","millisecond"];function fan(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 qq(t);return e}function tUt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return fan(t)}}function pan(t){return Ile[t]||(Ale===void 0&&(Ale=Do.now()),Ile[t]=t.offset(Ale)),Ile[t]}function rUt(t,e){let r=Vb(e.zone,Do.defaultZone);if(!r.isValid)return sn.invalid(nK(r));let n=Lo.fromObject(e),o,i;if(fr(t.year))o=Do.now();else{for(let u of sUt)fr(t[u])&&(t[u]=aUt[u]);let a=QFe(t)||eke(t);if(a)return sn.invalid(a);let s=pan(r);[o,i]=Tle(t,s,r)}return new sn({ts:o,zone:r,loc:n,o:i})}function nUt(t,e,r){let n=fr(r.round)?!0:r.round,o=(a,s)=>(a=Vq(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 oUt(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]}var Ale,Ile={},sn=class t{constructor(e){let r=e.zone||Do.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Ac("invalid input"):null)||(r.isValid?null:nK(r));this.ts=fr(e.ts)?Do.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=Wb(e.o)&&!e.old?e.o:r.offset(this.ts);o=Ple(this.ts,s),n=Number.isNaN(o.year)?new Ac("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||Lo.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]=oUt(arguments),[n,o,i,a,s,u,l]=r;return rUt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=oUt(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Tc.utcInstance,rUt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=vBt(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=Vb(r.zone,Do.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:Lo.fromObject(r)}):t.invalid(nK(o))}static fromMillis(e,r={}){if(Wb(e))return e<-XBt||e>XBt?t.invalid("Timestamp out of range"):new t({ts:e,zone:Vb(r.zone,Do.defaultZone),loc:Lo.fromObject(r)});throw new Ms(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(Wb(e))return new t({ts:e*1e3,zone:Vb(r.zone,Do.defaultZone),loc:Lo.fromObject(r)});throw new Ms("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Vb(r.zone,Do.defaultZone);if(!n.isValid)return t.invalid(nK(n));let o=Lo.fromObject(r),i=Jq(e,tUt),{minDaysInFirstWeek:a,startOfWeek:s}=XFe(i,o),u=Do.now(),l=fr(r.specificOffset)?n.offset(u):r.specificOffset,c=!fr(i.ordinal),d=!fr(i.year),f=!fr(i.month)||!fr(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new Ub("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new Ub("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,b,g,y=Ple(u,l);h?(b=can,g=uan,y=JW(y,a,s)):c?(b=dan,g=lan,y=Cle(y)):(b=sUt,g=aUt);let x=!1;for(let R of b){let N=i[R];fr(N)?x?i[R]=g[R]:i[R]=y[R]:x=!0}let S=h?yBt(i,a,s):c?bBt(i):QFe(i),O=S||eke(i);if(O)return t.invalid(O);let E=h?ZFe(i,a,s):c?YFe(i):i,[P,A]=Tle(E,l,n),I=new t({ts:P,zone:n,o:A,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]=DBt(e);return o2(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=LBt(e);return o2(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=FBt(e);return o2(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(fr(e)||fr(r))throw new Ms("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=Lo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=YBt(a,e,r);return c?t.invalid(c):o2(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]=zBt(e);return o2(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Ms("need to specify a reason the DateTime is invalid");let n=e instanceof Ac?e:new Ac(e,r);if(Do.throwOnInvalid)throw new fle(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=fke(e,Lo.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return cke(Ic.parseFormat(e),Lo.fromObject(r)).map(o=>o.val).join("")}static resetCache(){Ale=void 0,Ile={}}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?mke(this).weekYear:NaN}get weekNumber(){return this.isValid?mke(this).weekNumber:NaN}get weekday(){return this.isValid?mke(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?hke(this).weekday:NaN}get localWeekNumber(){return this.isValid?hke(this).weekNumber:NaN}get localWeekYear(){return this.isValid?hke(this).weekYear:NaN}get ordinal(){return this.isValid?Cle(this.c).ordinal:NaN}get monthShort(){return this.isValid?cE.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?cE.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?cE.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?cE.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=Hq(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=Ple(u,a),d=Ple(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[mL(this,{ts:u}),mL(this,{ts:l})]:[this]}get isInLeapYear(){return fL(this.year)}get daysInMonth(){return Gq(this.year,this.month)}get daysInYear(){return this.isValid?NM(this.year):NaN}get weeksInWeekYear(){return this.isValid?dL(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?dL(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=Ic.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Tc.instance(e),r)}toLocal(){return this.setZone(Do.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=Vb(e,Do.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]=Tle(a,i,e)}return mL(this,{ts:o,zone:e})}else return t.invalid(nK(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return mL(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Jq(e,tUt),{minDaysInFirstWeek:n,startOfWeek:o}=XFe(r,this.loc),i=!fr(r.weekYear)||!fr(r.weekNumber)||!fr(r.weekday),a=!fr(r.ordinal),s=!fr(r.year),u=!fr(r.month)||!fr(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new Ub("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new Ub("Can't mix ordinal dates with month/day");let d;i?d=ZFe({...JW(this.c,n,o),...r},n,o):fr(r.ordinal)?(d={...this.toObject(),...r},fr(r.day)&&(d.day=Math.min(Gq(d.year,d.month),d.day))):d=YFe({...Cle(this.c),...r});let[f,p]=Tle(d,this.o,this.zone);return mL(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=us.fromDurationLike(e);return mL(this,QBt(this,r))}minus(e){if(!this.isValid)return this;let r=us.fromDurationLike(e).negate();return mL(this,QBt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=us.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?Ic.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):pke}toLocaleString(e=IM,r={}){return this.isValid?Ic.create(this.loc.clone(r),e).formatDateTime(this):pke}toLocaleParts(e={}){return this.isValid?Ic.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=gke(this,a);return s+="T",s+=eUt(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?gke(this,e==="extended"):null}toISOWeekDate(){return Ele(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":"")+eUt(this,a==="extended",r,e,n,i):null}toRFC2822(){return Ele(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ele(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?gke(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")),Ele(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():pke}[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 us.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=wBt(r).map(us.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=WBt(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?lE.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),nUt(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?nUt(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 Ms("min requires all arguments be DateTimes");return tke(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ms("max requires all arguments be DateTimes");return tke(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=Lo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return dke(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=Lo.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new rK(i,e)}static fromFormatParser(e,r,n={}){if(fr(e)||fr(r))throw new Ms("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=Lo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Ms(`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):o2(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return IM}static get DATE_MED(){return TW}static get DATE_MED_WITH_WEEKDAY(){return NFe}static get DATE_FULL(){return AW}static get DATE_HUGE(){return IW}static get TIME_SIMPLE(){return MW}static get TIME_WITH_SECONDS(){return RW}static get TIME_WITH_SHORT_OFFSET(){return NW}static get TIME_WITH_LONG_OFFSET(){return jW}static get TIME_24_SIMPLE(){return DW}static get TIME_24_WITH_SECONDS(){return LW}static get TIME_24_WITH_SHORT_OFFSET(){return FW}static get TIME_24_WITH_LONG_OFFSET(){return kW}static get DATETIME_SHORT(){return $W}static get DATETIME_SHORT_WITH_SECONDS(){return zW}static get DATETIME_MED(){return BW}static get DATETIME_MED_WITH_SECONDS(){return UW}static get DATETIME_MED_WITH_WEEKDAY(){return jFe}static get DATETIME_FULL(){return qW}static get DATETIME_FULL_WITH_SECONDS(){return HW}static get DATETIME_HUGE(){return VW}static get DATETIME_HUGE_WITH_SECONDS(){return WW}};function n2(t){if(sn.isDateTime(t))return t;if(t&&t.valueOf&&Wb(t.valueOf()))return sn.fromJSDate(t);if(t&&typeof t=="object")return sn.fromObject(t);throw new Ms(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var uUt=require("obsidian");Qf();async function man(){let t=new Date,e=t.getTimezoneOffset(),r=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(t.getTime()),isoString:t.toISOString(),userLocaleString:t.toLocaleString(),localDateString:t.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-e,timezone:r}}var lUt=Ch(async()=>man(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:rn.object({})}),cUt={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};function han(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 gan(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 yan(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=RFe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=sn.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 ban(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=cUt[r[1]],o=e.year;n>e.month&&o--;let i=sn.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 _an(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=sn.fromObject({year:n,month:1,day:1}),i=sn.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 van(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=sn.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 wan(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=cUt[r[1].toLowerCase()],o=parseInt(r[2]),i=sn.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 xan(t){let e=sn.now(),r=t.toLowerCase().replace("@vault","").trim(),n=han(r,e)||gan(r,e)||yan(r,e)||ban(r,e)||wan(r,e)||van(r,e)||_an(r,e);if(n)return{startTime:oK(n.start),endTime:oK(n.end)};let o=RFe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=sn.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?sn.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:oK(i),endTime:oK(a)}}console.warn(`Unable to parse time expression: ${t}`)}function oK(t){let e=t.toJSDate(),r=e.getTimezoneOffset(),n=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(e).find(o=>o.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:e.toLocaleString(),localDateString:e.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-r,timezone:n}}var dUt=Ch(async({timeExpression:t})=>xan(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:rn.object({timeExpression:rn.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function San(t){let e=t.toString().length===10?t*1e3:t,r=sn.fromMillis(e);return oK(r)}var fUt=Ch(async({epoch:t})=>San(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:rn.object({epoch:rn.number().describe("Unix timestamp in seconds or milliseconds")})});function Can(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 Oan(t="25min"){let e=Can(t);return new Promise(r=>{setTimeout(()=>{new uUt.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var yke=Ch(async({interval:t="25min"})=>(Oan(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:rn.object({interval:rn.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});Gg();eE();Qf();var Mle=Ch(async({url:t})=>{try{let e=await Wi.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."})}},{name:"youtubeTranscription",description:"Get the transcript of a YouTube video",schema:rn.object({url:rn.string().describe("The YouTube video URL"),brevilabsClient:rn.any().describe("The BrevilabsClient instance")})});on();Gg();var iK=["@vault","@composer","@websearch","@youtube","@pomodoro"],hL=class{static initTools(e){this.tools.length===0&&(this.tools=[lUt,fUt,dUt,mFe,ozt,yke,hFe,Mle,nzt(e.getRoot())])}static async analyzeIntent(e){try{let r=await Wi.getInstance().broca(e,EN());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 Dq.callTool(u,l)),u.name=="getFileTree"&&EN())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")&&(a.length>0||i)){let u=this.removeAtCommands(e);r.push({tool:mFe,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await Ec.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=vN(c);r.push({tool:hFe,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:yke,args:{interval:l}})}let s=MGe(e);for(let u of s)r.some(c=>c.tool.name===Mle.name&&c.args.url===u)||r.push({tool:Mle,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!iK.includes(r.toLowerCase())).join(" ").trim()}};hL.tools=[];var aK=class{constructor(e){this.updateCurrentAiMessage=e;this.hasOpenThinkBlock=!1;this.fullResponse=""}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),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),this.fullResponse+=e.additional_kwargs.reasoning_content,!0):!1}processChunk(e){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.updateCurrentAiMessage(this.fullResponse)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}},sK=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a){return e&&!(n.signal.aborted&&n.signal.reason==="new-chat")?(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:e}),o({message:e,sender:mg,isVisible:!0,timestamp:Bs(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i(""),J(`==== Chat Memory ====
|
||
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(s=>s.content)),J(`==== Final AI Response ====
|
||
`,e),e}async handleError(e,r,n){let o=ci(e);fe("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}`,fe(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:mg,isVisible:!0,timestamp:Bs(new Date)})}else new hUt.Notice(s),fe(i)}},Rle=class extends sK{async run(e,r,n,o,i){let a=new aK(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=vN(l),d=[],f=q_(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:$Y(p),content:f});for(let h of c)d.push({role:h.role,content:h.content});d.push({role:"user",content:e.message}),J(`==== Final Request to AI ====
|
||
`,d);let m=await rb(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let h of m){if(r.signal.aborted){J("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(h)}}catch(u){u.name==="AbortError"||r.signal.aborted?J("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)}},Nle=class extends sK{async run(e,r,n,o,i){let a=new aK(n);try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(zY,e,r,o,n);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=vN(c),f=e.message;d.length>0&&(f=e.message);let m=await new EC({minSimilarityScore:.01,maxK:ae().maxSourceChunks,salientTerms:[]}).getRelevantDocuments(f);this.chainManager.storeRetrieverDocuments(m);let h=m.map(E=>E.pageContent).join(`
|
||
|
||
`),b=[],g=q_(),y=`
|
||
|
||
Answer the question with as detailed as possible based only on the following context:
|
||
`+h,x=g+y,S=this.chainManager.chatModelManager.getChatModel();x&&b.push({role:$Y(S),content:x});for(let E of d)b.push({role:E.role,content:E.content});b.push({role:"user",content:e.message}),J(`==== Final Request to AI ====
|
||
`,b);let O=await rb(()=>this.chainManager.chatModelManager.getChatModel().stream(b,{signal:r.signal}));for await(let E of O){if(r.signal.aborted){J("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(E)}}catch(u){u.name==="AbortError"||r.signal.aborted?J("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=AGe(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
|
||
`);e+=`
|
||
|
||
#### Sources:
|
||
|
||
`+n}return e}},uK=class extends sK{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=Qve(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 aL.processUrlBatch(e,r,this.chainManager.app.vault);return aL.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await aL.processChatImageBatch(e,r,this.chainManager.app.vault);return aL.showFailedImagesNotice(r),n}async extractEmbeddedImages(e){let r=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g;return[...e.matchAll(r)].map(i=>i[1])}async buildMessageContent(e,r){let n=[],o=[],i=ae(),a=[],s=r.context?.urls;if(s&&s.length>0&&a.push({urls:s,type:"context"}),i.passMarkdownImages){let d=await this.extractEmbeddedImages(e);d.length>0&&a.push({urls:d,type:"embedded"})}for(let d of a){let f=await this.processImageUrls(d.urls);o.push(...f.successfulImages),n.push(...f.failureDescriptions)}let u=r.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);o.push(...d.successfulImages),n.push(...d.failureDescriptions)}let l=e;n.length>0&&(l=`${e}
|
||
|
||
Note:
|
||
${n.join(`
|
||
`)}
|
||
`);let c=[{type:"text",text:l}];return o.length>0&&c.push(...o),c}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")}async streamMultimodalResponse(e,r,n,o){let a=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),s=vN(a),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:$Y(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.`});for(let g of s)u.push({role:g.role,content:g.content});let d=this.chainManager.chatModelManager.getChatModel(),p=this.isMultimodalModel(d)?await this.buildMessageContent(e,r):e;u.push({role:"user",content:p});let m=p instanceof Array?p[0].text:p;J("Enhanced user message: ",m),J(`==== Final Request to AI ====
|
||
`,u);let h=new aK(o),b=await rb(()=>this.chainManager.chatModelManager.getChatModel().stream(u,{signal:n.signal}));for await(let g of b){if(n.signal.aborted){J("CopilotPlus multimodal stream iteration aborted",{reason:n.signal.reason});break}h.processChunk(g)}return h.close()}async run(e,r,n,o,i){let{updateLoadingMessage:a}=i,s="",u=[],l="",c=d=>{l=d,n(d)};try{if(this.isYoutubeOnlyMessage(e.message)){let x=Qve(e.message),S="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(x)try{let O=await Wi.getInstance().youtube4llm(x);return O.response.transcript?this.handleResponse(O.response.transcript,e,r,o,n):this.handleResponse(S,e,r,o,n)}catch(O){return fe("Error processing YouTube video:",O),this.handleResponse(S,e,r,o,n)}}J("==== Step 1: Analyzing intent ====");let d,f=e.originalMessage||e.message;try{d=await hL.analyzeIntent(f)}catch(x){return this.handleResponse(CGe(x),e,r,o,n)}let p=e.message.split(" ").filter(x=>!iK.includes(x.toLowerCase())).join(" ").trim(),m=await this.executeToolCalls(d,a),h=m.find(x=>x.tool==="localSearch"&&x.output&&x.output.length>0),g=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),y=vN(g);if(h){J("==== Step 2: Processing local search results ====");let x=JSON.parse(h.output);J("==== Step 3: Condensing Question ====");let S=await rle(p,y);J("Condensed standalone question: ",S),J("==== Step 4: Preparing context ====");let O=this.getTimeExpression(d),E=this.prepareLocalSearchResult(x,O),P=m.filter(R=>R.tool==="getCurrentTime"),A=this.prepareEnhancedUserMessage(S,P);J(E),J("==== Step 5: Invoking QA Chain ====");let I=await this.chainManager.promptManager.getQAPrompt({question:A,context:E,systemMessage:""});s=await this.streamMultimodalResponse(I,e,r,c),u=this.getSources(x)}else{let x=this.prepareEnhancedUserMessage(p,m);J("No local search results. Using standard LLM Chain."),s=await this.streamMultimodalResponse(x,e,r,c)}}catch(d){a?.(K_.DEFAULT),d.name==="AbortError"||r.signal.aborted?J("CopilotPlus stream aborted by user",{reason:r.signal.reason}):await this.handleError(d,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)?(dg("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){dg("Invalid document structure:",n);continue}let o=r.get(n.title),i=n&&"rerank_score"in n,a=i?n.rerank_score:n.score;(!o||a>(o.score??0))&&r.set(n.title,{title:n.title,score:a,isReranked:i})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r){let n=[];for(let o of e){J(`==== Step 2: Calling tool: ${o.tool.name} ====`),o.tool.name==="localSearch"?r?.(K_.READING_FILES):o.tool.name==="webSearch"?r?.(K_.SEARCHING_WEB):o.tool.name==="getFileTree"&&r?.(K_.READING_FILE_TREE);let i=await Dq.callTool(o.tool,o.args);n.push({tool:o.tool.name,output:i})}return n}prepareEnhancedUserMessage(e,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=`
|
||
|
||
# Additional context:
|
||
|
||
`+o.map(i=>`<${i.tool}>
|
||
${typeof i.output!="string"?JSON.stringify(i.output):i.output}
|
||
</${i.tool}>`).join(`
|
||
|
||
`))}return`${e}${n}`}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),i=n;if(o>iwe){let s=iwe/o;J("Truncating documents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content.slice(0,Math.floor(u.content.length*s))}))}let a=i.map(s=>`Note in Vault: ${s.content}`).join(`
|
||
|
||
`);return r?`Local Search Result for ${r}:
|
||
${a}`:`Local Search Result:
|
||
${a}`}async getSystemPrompt(){return q_()}},jle=class extends uK{async getSystemPrompt(){let e=q_(),r=iu();if(!r)return e;let n=await Ec.instance.getProjectContext(r.id);return e=`${e}
|
||
|
||
<project_system_prompt>
|
||
${r.systemPrompt}
|
||
</project_system_prompt>`,n&&(e=`${e}
|
||
|
||
<project_context>
|
||
${n}
|
||
</project_context>`),e}};Tn();er();on();sA();var hme=require("obsidian");Us();Ur();CN();Tn();er();on();a9();var gL="0.39.0";var gUt=!1,yL,bke,Pan,Ean,Tan,yUt,Aan,Dle,_ke,bUt,vke,Lle,_Ut;function vUt(t,e={auto:!1}){if(gUt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(yL)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${yL}'\``);gUt=e.auto,yL=t.kind,bke=t.fetch,Pan=t.Request,Ean=t.Response,Tan=t.Headers,yUt=t.FormData,Aan=t.Blob,Dle=t.File,_ke=t.ReadableStream,bUt=t.getMultipartRequestOptions,vke=t.getDefaultAgent,Lle=t.fileFromPath,_Ut=t.isFsReadStream}var Fle=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function wUt({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 Fle(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}}yL||vUt(wUt(),{auto:!0});var Dr=class extends Error{},Mc=class t extends Dr{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 FM({message:n,cause:kle(r)});let i=r;return e===400?new lK(e,i,n,o):e===401?new cK(e,i,n,o):e===403?new dK(e,i,n,o):e===404?new fK(e,i,n,o):e===409?new pK(e,i,n,o):e===422?new mK(e,i,n,o):e===429?new hK(e,i,n,o):e>=500?new gK(e,i,n,o):new t(e,i,n,o)}},Cd=class extends Mc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},FM=class extends Mc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},i2=class extends FM{constructor({message:e}={}){super({message:e??"Request timed out."})}},lK=class extends Mc{},cK=class extends Mc{},dK=class extends Mc{},fK=class extends Mc{},pK=class extends Mc{},mK=class extends Mc{},hK=class extends Mc{},gK=class extends Mc{};var $le=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},bL=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)},Th,dE=class{constructor(){Th.set(this,void 0),this.buffer=new Uint8Array,$le(this,Th,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=Ran(this.buffer,bL(this,Th,"f")))!=null;){if(i.carriage&&bL(this,Th,"f")==null){$le(this,Th,i.index,"f");continue}if(bL(this,Th,"f")!=null&&(i.index!==bL(this,Th,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,bL(this,Th,"f")-1))),this.buffer=this.buffer.slice(bL(this,Th,"f")),$le(this,Th,null,"f");continue}let a=bL(this,Th,"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),$le(this,Th,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 Dr(`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 Dr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Dr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
||
`):[]}};Th=new WeakMap;dE.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);dE.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ran(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 xUt(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}function yK(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 TC=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 Nan(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 Mc.generate(void 0,`SSE Error: ${a.data}`,a.data,xke(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 dE,s=yK(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 _ke({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?.()}})}};async function*Nan(t,e){if(!t.body)throw e.abort(),new Dr("Attempted to iterate over a response with no body");let r=new wke,n=new dE,o=yK(t.body);for await(let i of jan(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*jan(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=xUt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var wke=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]=Dan(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function Dan(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Lan=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",Fan=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&bK(t),bK=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";async function SUt(t,e,r){if(t=await t,Fan(t))return t;if(Lan(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=bK(o)?[await o.arrayBuffer()]:[o];return new Dle(i,e,r)}let n=await kan(t);if(e||(e=zan(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Dle(n,e,r)}async function kan(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(bK(t))e.push(await t.arrayBuffer());else if(Ban(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${$an(t)}`);return e}function $an(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function zan(t){return Ske(t.name)||Ske(t.filename)||Ske(t.path)?.split(/[\\/]/).pop()}var Ske=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Ban=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Cke=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var qan=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},Han=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)},zle;async function TUt(t){let{response:e}=t;if(t.options.stream)return a2("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):TC.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 a2("response",e.status,e.url,e.headers,i),AUt(i,e)}let o=await e.text();return a2("response",e.status,e.url,e.headers,o),o}function AUt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var Ule=class t extends Promise{constructor(e,r=TUt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>AUt(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)}},qle=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Oke("maxRetries",r),this.timeout=Oke("timeout",n),this.httpAgent=o,this.fetch=i??bke}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Gan(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Qan()}`}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&&bK(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:Cke(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&&Oke("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??vke(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 EUt(i,a),EUt(i,r),Cke(e.body)&&yL!=="node"&&delete i["content-type"],Ble(a,"x-stainless-retry-count")===void 0&&Ble(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Ble(a,"x-stainless-timeout")===void 0&&Ble(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 Dr("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 Mc.generate(e,r,n,o)}request(e,r=null){return new Ule(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}),a2("request",a,n,i.headers),n.signal?.aborted)throw new Cd;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(kle);if(l instanceof Error){if(n.signal?.aborted)throw new Cd;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new i2:new FM({cause:l})}let c=xke(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return a2(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>kle(b).message),f=Jan(d),p=f?void 0:d;throw a2(`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 Pke(this,n,e)}buildURL(e,r){let n=Yan(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return _K(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 Dr(`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 Xan(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 ${gL}`}},Hle=class{constructor(e,r,n,o){zle.set(this,void 0),qan(this,zle,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 Dr("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 Han(this,zle,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(zle=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Pke=class extends Ule{constructor(e,r,n){super(r,async o=>new n(e,o.response,await TUt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},xke=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),Van={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},ay=t=>typeof t=="object"&&t!==null&&!_K(t)&&Object.keys(t).every(e=>IUt(Van,e)),Wan=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gL,"X-Stainless-OS":OUt(Deno.build.os),"X-Stainless-Arch":CUt(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":gL,"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":gL,"X-Stainless-OS":OUt(process.platform),"X-Stainless-Arch":CUt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Kan();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gL,"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":gL,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Kan(){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 CUt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",OUt=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"),PUt,Gan=()=>PUt??(PUt=Wan()),Jan=t=>{try{return JSON.parse(t)}catch{return}},Zan=/^[a-z][a-z0-9+.-]*:/i,Yan=t=>Zan.test(t),Xan=t=>new Promise(e=>setTimeout(e,t)),Oke=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Dr(`${t} must be an integer`);if(e<0)throw new Dr(`${t} must be a positive integer`);return e},kle=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))};var Vle=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function _K(t){if(!t)return!0;for(let e in t)return!1;return!0}function IUt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function EUt(t,e){for(let r in e){if(!IUt(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 a2(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var Qan=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),MUt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",esn=t=>typeof t?.get=="function";var Ble=(t,e)=>{let r=e.toLowerCase();if(esn(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 AC=class extends Hle{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 Rc=class{constructor(e){this._client=e}};var _L=class extends Rc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return ay(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",s2,{query:e,...r})}},s2=class extends AC{};_L.BetaModelInfosPage=s2;var u2=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new dE;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 Dr("Attempted to iterate over a response with no body");return new t(yK(e.body),r)}};var vL=class extends Rc{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(ay(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(ay(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",l2,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(ay(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(ay(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(ay(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new Dr(`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)=>u2.fromResponse(s.response,s.controller))}},l2=class extends AC{};vL.BetaMessageBatchesPage=l2;var osn=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},c2=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),c2(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),c2(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),c2(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),c2(t);break;case"delimiter":return t=t.slice(0,t.length-1),c2(t);break}return t},isn=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},asn=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},Wle=t=>JSON.parse(asn(isn(c2(osn(t)))));var If=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},In=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)},sy,kM,vK,Kle,wK,xK,Gle,SK,fE,CK,Jle,Zle,d2,Yle,Xle,Eke,RUt,Tke,Ake,Ike,Mke,NUt,jUt="__json_buf",Qle=class t{constructor(){sy.add(this),this.messages=[],this.receivedMessages=[],kM.set(this,void 0),this.controller=new AbortController,vK.set(this,void 0),Kle.set(this,()=>{}),wK.set(this,()=>{}),xK.set(this,void 0),Gle.set(this,()=>{}),SK.set(this,()=>{}),fE.set(this,{}),CK.set(this,!1),Jle.set(this,!1),Zle.set(this,!1),d2.set(this,!1),Yle.set(this,void 0),Xle.set(this,void 0),Tke.set(this,e=>{if(If(this,Jle,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Cd),e instanceof Cd)return If(this,Zle,!0,"f"),this._emit("abort",e);if(e instanceof Dr)return this._emit("error",e);if(e instanceof Error){let r=new Dr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Dr(String(e)))}),If(this,vK,new Promise((e,r)=>{If(this,Kle,e,"f"),If(this,wK,r,"f")}),"f"),If(this,xK,new Promise((e,r)=>{If(this,Gle,e,"f"),If(this,SK,r,"f")}),"f"),In(this,vK,"f").catch(()=>{}),In(this,xK,"f").catch(()=>{})}get response(){return In(this,Yle,"f")}get request_id(){return In(this,Xle,"f")}async withResponse(){let e=await In(this,vK,"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")},In(this,Tke,"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())),In(this,sy,"m",Ake).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)In(this,sy,"m",Ike).call(this,s);if(a.controller.signal?.aborted)throw new Cd;In(this,sy,"m",Mke).call(this)}_connected(e){this.ended||(If(this,Yle,e,"f"),If(this,Xle,e?.headers.get("request-id"),"f"),In(this,Kle,"f").call(this,e),this._emit("connect"))}get ended(){return In(this,CK,"f")}get errored(){return In(this,Jle,"f")}get aborted(){return In(this,Zle,"f")}abort(){this.controller.abort()}on(e,r){return(In(this,fE,"f")[e]||(In(this,fE,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=In(this,fE,"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(In(this,fE,"f")[e]||(In(this,fE,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{If(this,d2,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){If(this,d2,!0,"f"),await In(this,xK,"f")}get currentMessage(){return In(this,kM,"f")}async finalMessage(){return await this.done(),In(this,sy,"m",Eke).call(this)}async finalText(){return await this.done(),In(this,sy,"m",RUt).call(this)}_emit(e,...r){if(In(this,CK,"f"))return;e==="end"&&(If(this,CK,!0,"f"),In(this,Gle,"f").call(this));let n=In(this,fE,"f")[e];if(n&&(In(this,fE,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!In(this,d2,"f")&&!n?.length&&Promise.reject(o),In(this,wK,"f").call(this,o),In(this,SK,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!In(this,d2,"f")&&!n?.length&&Promise.reject(o),In(this,wK,"f").call(this,o),In(this,SK,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",In(this,sy,"m",Eke).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),In(this,sy,"m",Ake).call(this),this._connected(null);let o=TC.fromReadableStream(e,this.controller);for await(let i of o)In(this,sy,"m",Ike).call(this,i);if(o.controller.signal?.aborted)throw new Cd;In(this,sy,"m",Mke).call(this)}[(kM=new WeakMap,vK=new WeakMap,Kle=new WeakMap,wK=new WeakMap,xK=new WeakMap,Gle=new WeakMap,SK=new WeakMap,fE=new WeakMap,CK=new WeakMap,Jle=new WeakMap,Zle=new WeakMap,d2=new WeakMap,Yle=new WeakMap,Xle=new WeakMap,Tke=new WeakMap,sy=new WeakSet,Eke=function(){if(this.receivedMessages.length===0)throw new Dr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},RUt=function(){if(this.receivedMessages.length===0)throw new Dr("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 Dr("stream ended without producing a content block with type=text");return r.join(" ")},Ake=function(){this.ended||If(this,kM,void 0,"f")},Ike=function(r){if(this.ended)return;let n=In(this,sy,"m",NUt).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":{If(this,kM,n,"f");break}case"content_block_start":case"message_delta":break}},Mke=function(){if(this.ended)throw new Dr("stream has ended, this shouldn't happen");let r=In(this,kM,"f");if(!r)throw new Dr("request ended without sending any chunks");return If(this,kM,void 0,"f"),r},NUt=function(r){let n=In(this,kM,"f");if(r.type==="message_start"){if(n)throw new Dr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Dr(`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[jUt]||"";i+=r.delta.partial_json,Object.defineProperty(o,jUt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=Wle(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 TC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var DUt={"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"},$M=class extends Rc{constructor(){super(...arguments),this.batches=new vL(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in DUt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${DUt[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 Qle.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}})}};$M.Batches=vL;$M.BetaMessageBatchesPage=l2;var IC=class extends Rc{constructor(){super(...arguments),this.models=new _L(this._client),this.messages=new $M(this._client)}};IC.Models=_L;IC.BetaModelInfosPage=s2;IC.Messages=$M;var wL=class extends Rc{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};var xL=class extends Rc{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 ay(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",f2,{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 Dr(`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)=>u2.fromResponse(i.response,i.controller))}},f2=class extends AC{};xL.MessageBatchesPage=f2;var Mf=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},Mn=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)},uy,zM,OK,ece,PK,EK,tce,TK,pE,AK,rce,nce,p2,oce,ice,Rke,LUt,Nke,jke,Dke,Lke,FUt,kUt="__json_buf",ace=class t{constructor(){uy.add(this),this.messages=[],this.receivedMessages=[],zM.set(this,void 0),this.controller=new AbortController,OK.set(this,void 0),ece.set(this,()=>{}),PK.set(this,()=>{}),EK.set(this,void 0),tce.set(this,()=>{}),TK.set(this,()=>{}),pE.set(this,{}),AK.set(this,!1),rce.set(this,!1),nce.set(this,!1),p2.set(this,!1),oce.set(this,void 0),ice.set(this,void 0),Nke.set(this,e=>{if(Mf(this,rce,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Cd),e instanceof Cd)return Mf(this,nce,!0,"f"),this._emit("abort",e);if(e instanceof Dr)return this._emit("error",e);if(e instanceof Error){let r=new Dr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Dr(String(e)))}),Mf(this,OK,new Promise((e,r)=>{Mf(this,ece,e,"f"),Mf(this,PK,r,"f")}),"f"),Mf(this,EK,new Promise((e,r)=>{Mf(this,tce,e,"f"),Mf(this,TK,r,"f")}),"f"),Mn(this,OK,"f").catch(()=>{}),Mn(this,EK,"f").catch(()=>{})}get response(){return Mn(this,oce,"f")}get request_id(){return Mn(this,ice,"f")}async withResponse(){let e=await Mn(this,OK,"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")},Mn(this,Nke,"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())),Mn(this,uy,"m",jke).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)Mn(this,uy,"m",Dke).call(this,s);if(a.controller.signal?.aborted)throw new Cd;Mn(this,uy,"m",Lke).call(this)}_connected(e){this.ended||(Mf(this,oce,e,"f"),Mf(this,ice,e?.headers.get("request-id"),"f"),Mn(this,ece,"f").call(this,e),this._emit("connect"))}get ended(){return Mn(this,AK,"f")}get errored(){return Mn(this,rce,"f")}get aborted(){return Mn(this,nce,"f")}abort(){this.controller.abort()}on(e,r){return(Mn(this,pE,"f")[e]||(Mn(this,pE,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Mn(this,pE,"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(Mn(this,pE,"f")[e]||(Mn(this,pE,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Mf(this,p2,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Mf(this,p2,!0,"f"),await Mn(this,EK,"f")}get currentMessage(){return Mn(this,zM,"f")}async finalMessage(){return await this.done(),Mn(this,uy,"m",Rke).call(this)}async finalText(){return await this.done(),Mn(this,uy,"m",LUt).call(this)}_emit(e,...r){if(Mn(this,AK,"f"))return;e==="end"&&(Mf(this,AK,!0,"f"),Mn(this,tce,"f").call(this));let n=Mn(this,pE,"f")[e];if(n&&(Mn(this,pE,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Mn(this,p2,"f")&&!n?.length&&Promise.reject(o),Mn(this,PK,"f").call(this,o),Mn(this,TK,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Mn(this,p2,"f")&&!n?.length&&Promise.reject(o),Mn(this,PK,"f").call(this,o),Mn(this,TK,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Mn(this,uy,"m",Rke).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Mn(this,uy,"m",jke).call(this),this._connected(null);let o=TC.fromReadableStream(e,this.controller);for await(let i of o)Mn(this,uy,"m",Dke).call(this,i);if(o.controller.signal?.aborted)throw new Cd;Mn(this,uy,"m",Lke).call(this)}[(zM=new WeakMap,OK=new WeakMap,ece=new WeakMap,PK=new WeakMap,EK=new WeakMap,tce=new WeakMap,TK=new WeakMap,pE=new WeakMap,AK=new WeakMap,rce=new WeakMap,nce=new WeakMap,p2=new WeakMap,oce=new WeakMap,ice=new WeakMap,Nke=new WeakMap,uy=new WeakSet,Rke=function(){if(this.receivedMessages.length===0)throw new Dr("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},LUt=function(){if(this.receivedMessages.length===0)throw new Dr("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 Dr("stream ended without producing a content block with type=text");return r.join(" ")},jke=function(){this.ended||Mf(this,zM,void 0,"f")},Dke=function(r){if(this.ended)return;let n=Mn(this,uy,"m",FUt).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":{Mf(this,zM,n,"f");break}case"content_block_start":case"message_delta":break}},Lke=function(){if(this.ended)throw new Dr("stream has ended, this shouldn't happen");let r=Mn(this,zM,"f");if(!r)throw new Dr("request ended without sending any chunks");return Mf(this,zM,void 0,"f"),r},FUt=function(r){let n=Mn(this,zM,"f");if(r.type==="message_start"){if(n)throw new Dr(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Dr(`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[kUt]||"";i+=r.delta.partial_json,Object.defineProperty(o,kUt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=Wle(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 TC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var mE=class extends Rc{constructor(){super(...arguments),this.batches=new xL(this._client)}create(e,r){return e.model in $Ut&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${$Ut[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 ace.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},$Ut={"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"};mE.Batches=xL;mE.MessageBatchesPage=f2;var BM=class extends Rc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return ay(e)?this.list({},e):this._client.getAPIList("/v1/models",SL,{query:e,...r})}},SL=class extends AC{};BM.ModelInfosPage=SL;var zUt,Si=class extends qle{constructor({baseURL:e=Vle("ANTHROPIC_BASE_URL"),apiKey:r=Vle("ANTHROPIC_API_KEY")??null,authToken:n=Vle("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&MUt())throw new Dr(`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 wL(this),this.messages=new mE(this),this.models=new BM(this),this.beta=new IC(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&&!_K(r)?r:n!=null&&!_K(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};zUt=Si;Si.Anthropic=zUt;Si.HUMAN_PROMPT=`
|
||
|
||
Human:`;Si.AI_PROMPT=`
|
||
|
||
Assistant:`;Si.DEFAULT_TIMEOUT=6e5;Si.AnthropicError=Dr;Si.APIError=Mc;Si.APIConnectionError=FM;Si.APIConnectionTimeoutError=i2;Si.APIUserAbortError=Cd;Si.NotFoundError=fK;Si.ConflictError=pK;Si.RateLimitError=hK;Si.BadRequestError=lK;Si.AuthenticationError=cK;Si.InternalServerError=gK;Si.PermissionDeniedError=dK;Si.UnprocessableEntityError=mK;Si.toFile=SUt;Si.fileFromPath=Lle;Si.Completions=wL;Si.Messages=mE;Si.Models=BM;Si.ModelInfosPage=SL;Si.Beta=IC;var{HUMAN_PROMPT:oai,AI_PROMPT:iai}=Si;As();Of();Kn();iC();bh();ug();Jp();CD();_h();eb();var IK=class extends cN{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 Km(`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 Km(`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)?Fke(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 Fke(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}function BUt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}As();function UUt(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}function qUt(t){let e=Xk({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 csn(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 $s({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new $s({content:[{type:"tool_result",content:kke(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function HUt(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}}var dsn={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=Xk({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 kke(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(Jy(o))return SH(o,dsn);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=qUt(o.image_url):a=qUt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(UUt(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 sce(t){let e=csn(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(Di(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(HUt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(HUt)]};{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:kke(i.content)}}}else return{role:a,content:kke(i.content)}});return{messages:fsn(o),system:r}}function fsn(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}As();function VUt(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 yr({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 yr({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 yr({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 yr({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 yr({content:[{index:t.index,...r,type:"thinking"}]})}:{chunk:new yr({content:[{index:t.index,...r,type:"text"}]})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new yr({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 yr({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 yr({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 yr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}]})}}}}return null}function WUt(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 En({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=Fke(t);return[{text:"",message:new En({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}function uce(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}function $ke(t){let e;return t.status===400&&t.message.includes("tool")?e=uce(t,"INVALID_TOOL_RESULTS"):t.status===401?e=uce(t,"MODEL_AUTHENTICATION"):t.status===404?e=uce(t,"MODEL_NOT_FOUND"):t.status===429?e=uce(t,"MODEL_RATE_LIMIT"):e=t,e}function psn(t){return!!(t.tools&&t.tools.length>0)}function msn(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 hsn(t){return!!(t.thinking&&t.thinking.type==="enabled")}function gsn(t){return"input_schema"in t}function ysn(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 zke=class extends du{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??ct("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 Si(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(gsn(r))return r;if(gd(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Cc(r))return{name:r.name,description:r.description,input_schema:k_(r.schema)?Ga(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=BUt(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=sce(e),a={...o,...i,stream:!0},s=!psn(a)&&!msn(a)&&!hsn(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=VUt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=ysn(f),m=new eo({message:new yr({content:f.content,additional_kwargs:f.additional_kwargs,tool_call_chunks:f.tool_call_chunks,usage_metadata:c?f.usage_metadata:void 0,response_metadata:f.response_metadata,id:f.id}),text:p??""});yield m,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:m})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...sce(e)},n),{content:i,...a}=o,s=WUt(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 $ke(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 $ke(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(k_(n)){let m=Ga(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new IK({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(m=n,s=n.name):m={name:s,description:n.description??"",input_schema:n},l=[m],u=new IK({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let m="Anthropic structured output relies on forced tool calling, which is not supported when `thinking` is enabled. This method will raise OutputParserException if tool calls are not generated. Consider disabling `thinking` or adjust your prompt to ensure the tool is called.";console.warn(m),c=this.bind({tools:l});let h=b=>{if(!b.tool_calls||b.tool_calls.length===0)throw new Error(m);return b};c=c.pipe(h)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Eo.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Eo.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Pi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},lce=class extends zke{};fNe();Kn();var cce="RFC3986",dce={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},KUt="RFC1738";var bsn=Array.isArray,MC=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var Bke=1024,GUt=(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+=Bke){let u=i.length>=Bke?i.slice(s,s+Bke):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===KUt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=MC[d];continue}if(d<2048){l[l.length]=MC[192|d>>6]+MC[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=MC[224|d>>12]+MC[128|d>>6&63]+MC[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=MC[240|d>>18]+MC[128|d>>12&63]+MC[128|d>>6&63]+MC[128|d&63]}a+=l.join("")}return a};function JUt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function Uke(t,e){if(bsn(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var _sn=Object.prototype.hasOwnProperty,ZUt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},RC=Array.isArray,vsn=Array.prototype.push,YUt=function(t,e){vsn.apply(t,RC(e)?e:[e])},wsn=Date.prototype.toISOString,rc={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:GUt,encodeValuesOnly:!1,format:cce,formatter:dce[cce],indices:!1,serializeDate(t){return wsn.call(t)},skipNulls:!1,strictNullHandling:!1};function xsn(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var qke={};function XUt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b,g){let y=t,x=g,S=0,O=!1;for(;(x=x.get(qke))!==void 0&&!O;){let R=x.get(t);if(S+=1,typeof R<"u"){if(R===S)throw new RangeError("Cyclic object value");O=!0}typeof x.get(qke)>"u"&&(S=0)}if(typeof l=="function"?y=l(e,y):y instanceof Date?y=f?.(y):r==="comma"&&RC(y)&&(y=Uke(y,function(R){return R instanceof Date?f?.(R):R})),y===null){if(i)return u&&!h?u(e,rc.encoder,b,"key",p):e;y=""}if(xsn(y)||JUt(y)){if(u){let R=h?e:u(e,rc.encoder,b,"key",p);return[m?.(R)+"="+m?.(u(y,rc.encoder,b,"value",p))]}return[m?.(e)+"="+m?.(String(y))]}let E=[];if(typeof y>"u")return E;let P;if(r==="comma"&&RC(y))h&&u&&(y=Uke(y,u)),P=[{value:y.length>0?y.join(",")||null:void 0}];else if(RC(l))P=l;else{let R=Object.keys(y);P=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&RC(y)&&y.length===1?A+"[]":A;if(o&&RC(y)&&y.length===0)return I+"[]";for(let R=0;R<P.length;++R){let N=P[R],j=typeof N=="object"&&typeof N.value<"u"?N.value:y[N];if(a&&j===null)continue;let $=d&&s?N.replace(/\./g,"%2E"):N,k=RC(y)?typeof r=="function"?r(I,$):I:I+(d?"."+$:"["+$+"]");g.set(t,S);let H=new WeakMap;H.set(qke,g),YUt(E,XUt(j,k,r,n,o,i,a,s,r==="comma"&&h&&RC(y)?null:u,l,c,d,f,p,m,h,b,H))}return E}function Ssn(t=rc){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||rc.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=cce;if(typeof t.format<"u"){if(!_sn.call(dce,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=dce[r],o=rc.filter;(typeof t.filter=="function"||RC(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in ZUt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=rc.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:rc.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:rc.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:rc.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:rc.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?rc.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:rc.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:rc.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:rc.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:rc.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:rc.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:rc.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:rc.strictNullHandling}}function Hke(t,e={}){let r=t,n=Ssn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):RC(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=ZUt[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||YUt(a,XUt(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 CL="4.95.1";var QUt=!1,OL,Vke,Osn,Psn,Esn,Wke,Tsn,fce,Kke,Gke,Jke,pce,Zke;function eqt(t,e={auto:!1}){if(QUt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(OL)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${OL}'\``);QUt=e.auto,OL=t.kind,Vke=t.fetch,Osn=t.Request,Psn=t.Response,Esn=t.Headers,Wke=t.FormData,Tsn=t.Blob,fce=t.File,Kke=t.ReadableStream,Gke=t.getMultipartRequestOptions,Jke=t.getDefaultAgent,pce=t.fileFromPath,Zke=t.isFsReadStream}var mce=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function tqt({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 mce(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 Yke=()=>{OL||eqt(tqt(),{auto:!0})};Yke();var Bt=class extends Error{},bu=class t extends Bt{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 hE({message:n,cause:hce(r)});let i=r?.error;return e===400?new m2(e,i,n,o):e===401?new h2(e,i,n,o):e===403?new g2(e,i,n,o):e===404?new y2(e,i,n,o):e===409?new b2(e,i,n,o):e===422?new _2(e,i,n,o):e===429?new v2(e,i,n,o):e>=500?new w2(e,i,n,o):new t(e,i,n,o)}},xa=class extends bu{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},hE=class extends bu{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Ah=class extends hE{constructor({message:e}={}){super({message:e??"Request timed out."})}},m2=class extends bu{},h2=class extends bu{},g2=class extends bu{},y2=class extends bu{},b2=class extends bu{},_2=class extends bu{},v2=class extends bu{},w2=class extends bu{},x2=class extends Bt{constructor(){super("Could not parse response content as the length limit was reached")}},S2=class extends Bt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};var gce=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},PL=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)},Ih,EL=class{constructor(){Ih.set(this,void 0),this.buffer=new Uint8Array,gce(this,Ih,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=Msn(this.buffer,PL(this,Ih,"f")))!=null;){if(i.carriage&&PL(this,Ih,"f")==null){gce(this,Ih,i.index,"f");continue}if(PL(this,Ih,"f")!=null&&(i.index!==PL(this,Ih,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,PL(this,Ih,"f")-1))),this.buffer=this.buffer.slice(PL(this,Ih,"f")),gce(this,Ih,null,"f");continue}let a=PL(this,Ih,"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),gce(this,Ih,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 Bt(`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 Bt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Bt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
||
`):[]}};Ih=new WeakMap;EL.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);EL.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Msn(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 rqt(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}function Xke(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 NC=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 Rsn(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 bu(void 0,s.error,void 0,e$e(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 bu(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 EL,s=Xke(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 Kke({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?.()}})}};async function*Rsn(t,e){if(!t.body)throw e.abort(),new Bt("Attempted to iterate over a response with no body");let r=new Qke,n=new EL,o=Xke(t.body);for await(let i of Nsn(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*Nsn(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=rqt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var Qke=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]=jsn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function jsn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var nqt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",oqt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&MK(t),MK=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",Dsn=t=>oqt(t)||nqt(t)||Zke(t);async function n$e(t,e,r){if(t=await t,oqt(t))return t;if(nqt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=MK(o)?[await o.arrayBuffer()]:[o];return new fce(i,e,r)}let n=await Lsn(t);if(e||(e=ksn(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new fce(n,e,r)}async function Lsn(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(MK(t))e.push(await t.arrayBuffer());else if($sn(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Fsn(t)}`);return e}function Fsn(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function ksn(t){return t$e(t.name)||t$e(t.filename)||t$e(t.path)?.split(/[\\/]/).pop()}var t$e=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},$sn=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",o$e=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var ly=async t=>{let e=await iqt(t.body);return Gke(e,t)},iqt=async t=>{let e=new Wke;return await Promise.all(Object.entries(t||{}).map(([r,n])=>r$e(e,r,n))),e};var r$e=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(Dsn(r)){let n=await n$e(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>r$e(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>r$e(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`)}};var Bsn=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},Usn=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)},yce;Yke();async function dqt(t){let{response:e}=t;if(t.options.stream)return gE("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):NC.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 gE("response",e.status,e.url,e.headers,a),fqt(a,e)}let i=await e.text();return gE("response",e.status,e.url,e.headers,i),i}function fqt(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 _ce=class t extends Promise{constructor(e,r=dqt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>fqt(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)}},vce=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=i$e("maxRetries",r),this.timeout=i$e("timeout",n),this.httpAgent=o,this.fetch=i??Vke}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Wsn(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Zsn()}`}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&&MK(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:o$e(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&&i$e("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??Jke(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 lqt(i,a),lqt(i,r),o$e(e.body)&&OL!=="node"&&delete i["content-type"],bce(a,"x-stainless-retry-count")===void 0&&bce(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),bce(a,"x-stainless-timeout")===void 0&&bce(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 bu.generate(e,r,n,o)}request(e,r=null){return new _ce(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}),gE("request",a,n,i.headers),n.signal?.aborted)throw new xa;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(hce);if(l instanceof Error){if(n.signal?.aborted)throw new xa;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Ah:new hE({cause:l})}let c=e$e(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return gE(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>hce(b).message),f=Ksn(d),p=f?void 0:d;throw gE(`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 a$e(this,n,e)}buildURL(e,r){let n=Jsn(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return pqt(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 Bt(`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 yE(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 ${CL}`}},RK=class{constructor(e,r,n,o){yce.set(this,void 0),Bsn(this,yce,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 Bt("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 Usn(this,yce,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(yce=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},a$e=class extends _ce{constructor(e,r,n){super(r,async o=>new n(e,o.response,await dqt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},e$e=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),qsn={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},un=t=>typeof t=="object"&&t!==null&&!pqt(t)&&Object.keys(t).every(e=>mqt(qsn,e)),Hsn=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":CL,"X-Stainless-OS":sqt(Deno.build.os),"X-Stainless-Arch":aqt(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":CL,"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":CL,"X-Stainless-OS":sqt(process.platform),"X-Stainless-Arch":aqt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Vsn();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":CL,"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":CL,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Vsn(){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 aqt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",sqt=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"),uqt,Wsn=()=>uqt??(uqt=Hsn()),Ksn=t=>{try{return JSON.parse(t)}catch{return}},Gsn=/^[a-z][a-z0-9+.-]*:/i,Jsn=t=>Gsn.test(t),yE=t=>new Promise(e=>setTimeout(e,t)),i$e=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Bt(`${t} must be an integer`);if(e<0)throw new Bt(`${t} must be a positive integer`);return e},hce=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)};var NK=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function pqt(t){if(!t)return!0;for(let e in t)return!1;return!0}function mqt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function lqt(t,e){for(let r in e){if(!mqt(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)}}var cqt=new Set(["authorization","api-key"]);function gE(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)cqt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)cqt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}var Zsn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),hqt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Ysn=t=>typeof t?.get=="function";var bce=(t,e)=>{let r=e.toLowerCase();if(Ysn(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 gqt=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))}};function jK(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var jC=class extends RK{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}},bo=class extends RK{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 it=class{constructor(e){this._client=e}};var C2=class extends it{list(e,r={},n){return un(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,wce,{query:r,...n})}};var qM=class extends it{constructor(){super(...arguments),this.messages=new C2(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 un(e)?this.list({},e):this._client.getAPIList("/chat/completions",HM,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},HM=class extends bo{},wce=class extends bo{};qM.ChatCompletionsPage=HM;qM.Messages=C2;var bE=class extends it{constructor(){super(...arguments),this.completions=new qM(this._client)}};bE.Completions=qM;bE.ChatCompletionsPage=HM;var O2=class extends it{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}};var P2=class extends it{create(e,r){return this._client.post("/audio/transcriptions",ly({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}};var E2=class extends it{create(e,r){return this._client.post("/audio/translations",ly({body:e,...r,__metadata:{model:e.model}}))}};var DC=class extends it{constructor(){super(...arguments),this.transcriptions=new P2(this._client),this.translations=new E2(this._client),this.speech=new O2(this._client)}};DC.Transcriptions=P2;DC.Translations=E2;DC.Speech=O2;var VM=class extends it{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 un(e)?this.list({},e):this._client.getAPIList("/batches",TL,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},TL=class extends bo{};VM.BatchesPage=TL;var AL=class extends it{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 un(e)?this.list({},e):this._client.getAPIList("/assistants",T2,{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}})}},T2=class extends bo{};AL.AssistantsPage=T2;function s$e(t){return typeof t.parse=="function"}var WM=t=>t?.role==="assistant",u$e=t=>t?.role==="function",l$e=t=>t?.role==="tool";var Gb=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},ls=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)},c$e,xce,Sce,DK,LK,Cce,FK,_E,kK,Oce,Pce,A2,yqt,KM=class{constructor(){c$e.add(this),this.controller=new AbortController,xce.set(this,void 0),Sce.set(this,()=>{}),DK.set(this,()=>{}),LK.set(this,void 0),Cce.set(this,()=>{}),FK.set(this,()=>{}),_E.set(this,{}),kK.set(this,!1),Oce.set(this,!1),Pce.set(this,!1),A2.set(this,!1),Gb(this,xce,new Promise((e,r)=>{Gb(this,Sce,e,"f"),Gb(this,DK,r,"f")}),"f"),Gb(this,LK,new Promise((e,r)=>{Gb(this,Cce,e,"f"),Gb(this,FK,r,"f")}),"f"),ls(this,xce,"f").catch(()=>{}),ls(this,LK,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},ls(this,c$e,"m",yqt).bind(this))},0)}_connected(){this.ended||(ls(this,Sce,"f").call(this),this._emit("connect"))}get ended(){return ls(this,kK,"f")}get errored(){return ls(this,Oce,"f")}get aborted(){return ls(this,Pce,"f")}abort(){this.controller.abort()}on(e,r){return(ls(this,_E,"f")[e]||(ls(this,_E,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=ls(this,_E,"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(ls(this,_E,"f")[e]||(ls(this,_E,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Gb(this,A2,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Gb(this,A2,!0,"f"),await ls(this,LK,"f")}_emit(e,...r){if(ls(this,kK,"f"))return;e==="end"&&(Gb(this,kK,!0,"f"),ls(this,Cce,"f").call(this));let n=ls(this,_E,"f")[e];if(n&&(ls(this,_E,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!ls(this,A2,"f")&&!n?.length&&Promise.reject(o),ls(this,DK,"f").call(this,o),ls(this,FK,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!ls(this,A2,"f")&&!n?.length&&Promise.reject(o),ls(this,DK,"f").call(this,o),ls(this,FK,"f").call(this,o),this._emit("end")}}_emitFinal(){}};xce=new WeakMap,Sce=new WeakMap,DK=new WeakMap,LK=new WeakMap,Cce=new WeakMap,FK=new WeakMap,_E=new WeakMap,kK=new WeakMap,Oce=new WeakMap,Pce=new WeakMap,A2=new WeakMap,c$e=new WeakSet,yqt=function(e){if(Gb(this,Oce,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new xa),e instanceof xa)return Gb(this,Pce,!0,"f"),this._emit("abort",e);if(e instanceof Bt)return this._emit("error",e);if(e instanceof Error){let r=new Bt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Bt(String(e)))};function bqt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function $K(t){return t?.$brand==="auto-parseable-response-format"}function _qt(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 IL(t){return t?.$brand==="auto-parseable-tool"}function vqt(t,e){return!e||!d$e(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}}))}:zK(t,e)}function zK(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new x2;if(n.finish_reason==="content_filter")throw new S2;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>iun(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?oun(e,n.message.content):null}}});return{...t,choices:r}}function oun(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 iun(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:IL(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function wqt(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return IL(r)||r?.function.strict||!1}function d$e(t){return $K(t.response_format)?!0:t.tools?.some(e=>IL(e)||e.type==="function"&&e.function.strict===!0)??!1}function xqt(t){for(let e of t??[]){if(e.type!=="function")throw new Bt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new Bt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var wm=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)},Rf,f$e,Ece,p$e,m$e,h$e,Cqt,g$e,Sqt=10,I2=class extends KM{constructor(){super(...arguments),Rf.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),(u$e(e)||l$e(e))&&e.content)this._emit("functionCallResult",e.content);else if(WM(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(WM(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 Bt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),wm(this,Rf,"m",f$e).call(this)}async finalMessage(){return await this.done(),wm(this,Rf,"m",Ece).call(this)}async finalFunctionCall(){return await this.done(),wm(this,Rf,"m",p$e).call(this)}async finalFunctionCallResult(){return await this.done(),wm(this,Rf,"m",m$e).call(this)}async totalUsage(){return await this.done(),wm(this,Rf,"m",h$e).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=wm(this,Rf,"m",Ece).call(this);r&&this._emit("finalMessage",r);let n=wm(this,Rf,"m",f$e).call(this);n&&this._emit("finalContent",n);let o=wm(this,Rf,"m",p$e).call(this);o&&this._emit("finalFunctionCall",o);let i=wm(this,Rf,"m",m$e).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",wm(this,Rf,"m",h$e).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),wm(this,Rf,"m",Cqt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(zK(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=Sqt}=n||{},c={};for(let f of r.functions)c[f.name||f.function.name]=f;let d=r.functions.map(f=>({name:f.name||f.function.name,parameters:f.parameters,description:f.description}));for(let f of r.messages)this._addMessage(f,!1);for(let f=0;f<l;++f){let m=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new Bt("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:b}=m.function_call,g=c[h];if(g){if(u&&u!==h){let O=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:O});continue}}else{let O=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(E=>JSON.stringify(E.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:O});continue}let y;try{y=s$e(g)?await g.parse(b):b}catch(O){this._addMessage({role:o,name:h,content:O instanceof Error?O.message:String(O)});continue}let x=await g.function(y,this),S=wm(this,Rf,"m",g$e).call(this,x);if(this._addMessage({role:o,name:h,content:S}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=Sqt}=n||{},c=r.tools.map(p=>{if(IL(p)){if(!p.$callback)throw new Bt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new Bt("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let b of h.tool_calls){if(b.type!=="function")continue;let g=b.id,{name:y,arguments:x}=b.function,S=d[y];if(S){if(u&&u!==y){let A=`Invalid tool_call: ${JSON.stringify(y)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}}else{let A=`Invalid tool_call: ${JSON.stringify(y)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}let O;try{O=s$e(S)?await S.parse(x):x}catch(A){let I=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:I});continue}let E=await S.function(O,this),P=wm(this,Rf,"m",g$e).call(this,E);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};Rf=new WeakSet,f$e=function(){return wm(this,Rf,"m",Ece).call(this).content??null},Ece=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(WM(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 Bt("stream ended without producing a ChatCompletionMessage with role=assistant")},p$e=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(WM(r)&&r?.function_call)return r.function_call;if(WM(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},m$e=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(u$e(r)&&r.content!=null||l$e(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}},h$e=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},Cqt=function(e){if(e.n!=null&&e.n>1)throw new Bt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},g$e=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var BK=class t extends I2{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),WM(e)&&e.content&&this._emit("content",e.content)}};var Nc={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},y$e=class extends Error{},b$e=class extends Error{};function aun(t,e=Nc.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return sun(t.trim(),e)}var sun=(t,e)=>{let r=t.length,n=0,o=f=>{throw new y$e(`${f} at position ${n}`)},i=f=>{throw new b$e(`${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"||Nc.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Nc.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Nc.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Nc.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Nc.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Nc.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(m){i(String(m))}else if(Nc.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&&Nc.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Nc.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Nc.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(Nc.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Nc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Nc.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&&!(Nc.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Nc.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;n<r&&`
|
||
\r `.includes(t[n]);)n++};return a()},_$e=t=>aun(t,Nc.ALL^Nc.NUM);var M2=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},Fi=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)},nc,vE,R2,GM,v$e,Tce,w$e,x$e,S$e,Ace,C$e,Oqt,N2=class t extends I2{constructor(e){super(),nc.add(this),vE.set(this,void 0),R2.set(this,void 0),GM.set(this,void 0),M2(this,vE,e,"f"),M2(this,R2,[],"f")}get currentChatCompletionSnapshot(){return Fi(this,GM,"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())),Fi(this,nc,"m",v$e).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)Fi(this,nc,"m",w$e).call(this,a);if(i.controller.signal?.aborted)throw new xa;return this._addChatCompletion(Fi(this,nc,"m",Ace).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Fi(this,nc,"m",v$e).call(this),this._connected();let o=NC.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Fi(this,nc,"m",Ace).call(this)),Fi(this,nc,"m",w$e).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new xa;return this._addChatCompletion(Fi(this,nc,"m",Ace).call(this))}[(vE=new WeakMap,R2=new WeakMap,GM=new WeakMap,nc=new WeakSet,v$e=function(){this.ended||M2(this,GM,void 0,"f")},Tce=function(r){let n=Fi(this,R2,"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},Fi(this,R2,"f")[r.index]=n,n)},w$e=function(r){if(this.ended)return;let n=Fi(this,nc,"m",Oqt).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=Fi(this,nc,"m",Tce).call(this,i);i.finish_reason&&(Fi(this,nc,"m",S$e).call(this,i),a.current_tool_call_index!=null&&Fi(this,nc,"m",x$e).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Fi(this,nc,"m",S$e).call(this,i),a.current_tool_call_index!=null&&Fi(this,nc,"m",x$e).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))}}},x$e=function(r,n){if(Fi(this,nc,"m",Tce).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=Fi(this,vE,"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:IL(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},S$e=function(r){let n=Fi(this,nc,"m",Tce).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Fi(this,nc,"m",C$e).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}))},Ace=function(){if(this.ended)throw new Bt("stream has ended, this shouldn't happen");let r=Fi(this,GM,"f");if(!r)throw new Bt("request ended without sending any chunks");return M2(this,GM,void 0,"f"),M2(this,R2,[],"f"),uun(r,Fi(this,vE,"f"))},C$e=function(){let r=Fi(this,vE,"f")?.response_format;return $K(r)?r:null},Oqt=function(r){var n,o,i,a;let s=Fi(this,GM,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=M2(this,GM,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...A}=p;Object.assign(h.logprobs,A),E&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...E)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,Fi(this,vE,"f")&&d$e(Fi(this,vE,"f")))){if(d==="length")throw new x2;if(d==="content_filter")throw new S2}if(Object.assign(h,m),!c)continue;let{content:b,refusal:g,function_call:y,role:x,tool_calls:S,...O}=c;if(Object.assign(h.message,O),g&&(h.message.refusal=(h.message.refusal||"")+g),x&&(h.message.role=x),y&&(h.message.function_call?(y.name&&(h.message.function_call.name=y.name),y.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=y.arguments)):h.message.function_call=y),b&&(h.message.content=(h.message.content||"")+b,!h.message.refusal&&Fi(this,nc,"m",C$e).call(this)&&(h.message.parsed=_$e(h.message.content))),S){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:E,id:P,type:A,function:I,...R}of S){let N=(a=h.message.tool_calls)[E]??(a[E]={});Object.assign(N,R),P&&(N.id=P),A&&(N.type=A),I&&(N.function??(N.function={name:I.name??"",arguments:""})),I?.name&&(N.function.name=I.name),I?.arguments&&(N.function.arguments+=I.arguments,wqt(Fi(this,vE,"f"),N)&&(N.function.parsed_arguments=_$e(N.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 NC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function uun(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 Bt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:b,...g}=l,y=l.role;if(!y)throw new Bt(`missing role for choice ${d}`);if(h){let{arguments:x,name:S}=h;if(x==null)throw new Bt(`missing function_call.arguments for choice ${d}`);if(!S)throw new Bt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:x,name:S},role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return b?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:y,content:m,refusal:l.refusal??null,tool_calls:b.map((x,S)=>{let{function:O,type:E,id:P,...A}=x,{arguments:I,name:R,...N}=O||{};if(P==null)throw new Bt(`missing choices[${d}].tool_calls[${S}].id
|
||
${Ice(t)}`);if(E==null)throw new Bt(`missing choices[${d}].tool_calls[${S}].type
|
||
${Ice(t)}`);if(R==null)throw new Bt(`missing choices[${d}].tool_calls[${S}].function.name
|
||
${Ice(t)}`);if(I==null)throw new Bt(`missing choices[${d}].tool_calls[${S}].function.arguments
|
||
${Ice(t)}`);return{...A,id:P,type:E,function:{...N,name:R,arguments:I}}})}}:{...p,message:{...g,content:m,role:y,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return vqt(u,e)}function Ice(t){return JSON.stringify(t)}var UK=class t extends N2{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 qK=class extends it{parse(e,r){return xqt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>zK(n,e))}runFunctions(e,r){return e.stream?UK.runFunctions(this._client,e,r):BK.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?UK.runTools(this._client,e,r):BK.runTools(this._client,e,r)}stream(e,r){return N2.createChatCompletion(this._client,e,r)}};var j2=class extends it{constructor(){super(...arguments),this.completions=new qK(this._client)}};(function(t){t.Completions=qK})(j2||(j2={}));var D2=class extends it{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var L2=class extends it{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var JM=class extends it{constructor(){super(...arguments),this.sessions=new D2(this._client),this.transcriptionSessions=new L2(this._client)}};JM.Sessions=D2;JM.TranscriptionSessions=L2;var tr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Mh=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},Od,O$e,LC,Mce,Jb,RL,F2,ML,jce,Rh,Rce,Nce,WK,HK,VK,Pqt,Eqt,Tqt,Aqt,Iqt,Mqt,Rqt,FC=class t extends KM{constructor(){super(...arguments),Od.add(this),O$e.set(this,[]),LC.set(this,{}),Mce.set(this,{}),Jb.set(this,void 0),RL.set(this,void 0),F2.set(this,void 0),ML.set(this,void 0),jce.set(this,void 0),Rh.set(this,void 0),Rce.set(this,void 0),Nce.set(this,void 0),WK.set(this,void 0)}[(O$e=new WeakMap,LC=new WeakMap,Mce=new WeakMap,Jb=new WeakMap,RL=new WeakMap,F2=new WeakMap,ML=new WeakMap,jce=new WeakMap,Rh=new WeakMap,Rce=new WeakMap,Nce=new WeakMap,WK=new WeakMap,Od=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=NC.fromReadableStream(e,this.controller);for await(let i of o)tr(this,Od,"m",HK).call(this,i);if(o.controller.signal?.aborted)throw new xa;return this._addRun(tr(this,Od,"m",VK).call(this))}toReadableStream(){return new NC(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o,i){let a=new t;return a._run(()=>a._runToolAssistantStream(e,r,n,o,{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(e,r,n,o,i){let a=i?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));let s={...o,stream:!0},u=await e.submitToolOutputs(r,n,s,{...i,signal:this.controller.signal});this._connected();for await(let l of u)tr(this,Od,"m",HK).call(this,l);if(u.controller.signal?.aborted)throw new xa;return this._addRun(tr(this,Od,"m",VK).call(this))}static createThreadAssistantStream(e,r,n){let o=new t;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new t;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return tr(this,Rce,"f")}currentRun(){return tr(this,Nce,"f")}currentMessageSnapshot(){return tr(this,Jb,"f")}currentRunStepSnapshot(){return tr(this,WK,"f")}async finalRunSteps(){return await this.done(),Object.values(tr(this,LC,"f"))}async finalMessages(){return await this.done(),Object.values(tr(this,Mce,"f"))}async finalRun(){if(await this.done(),!tr(this,RL,"f"))throw Error("Final run was not received.");return tr(this,RL,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let s of a)tr(this,Od,"m",HK).call(this,s);if(a.controller.signal?.aborted)throw new xa;return this._addRun(tr(this,Od,"m",VK).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.create(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)tr(this,Od,"m",HK).call(this,u);if(s.controller.signal?.aborted)throw new xa;return this._addRun(tr(this,Od,"m",VK).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(jK(i)&&jK(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(!jK(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)}};HK=function(e){if(!this.ended)switch(Mh(this,Rce,e,"f"),tr(this,Od,"m",Tqt).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":tr(this,Od,"m",Rqt).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":tr(this,Od,"m",Eqt).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":tr(this,Od,"m",Pqt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},VK=function(){if(this.ended)throw new Bt("stream has ended, this shouldn't happen");if(!tr(this,RL,"f"))throw Error("Final run has not been received");return tr(this,RL,"f")},Pqt=function(e){let[r,n]=tr(this,Od,"m",Iqt).call(this,e,tr(this,Jb,"f"));Mh(this,Jb,r,"f"),tr(this,Mce,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,a=r.content[o.index];if(a&&a.type=="text")this._emit("textDelta",i,a.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=tr(this,F2,"f")){if(tr(this,ML,"f"))switch(tr(this,ML,"f").type){case"text":this._emit("textDone",tr(this,ML,"f").text,tr(this,Jb,"f"));break;case"image_file":this._emit("imageFileDone",tr(this,ML,"f").image_file,tr(this,Jb,"f"));break}Mh(this,F2,o.index,"f")}Mh(this,ML,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(tr(this,F2,"f")!==void 0){let o=e.data.content[tr(this,F2,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,tr(this,Jb,"f"));break;case"text":this._emit("textDone",o.text,tr(this,Jb,"f"));break}}tr(this,Jb,"f")&&this._emit("messageDone",e.data),Mh(this,Jb,void 0,"f")}},Eqt=function(e){let r=tr(this,Od,"m",Aqt).call(this,e);switch(Mh(this,WK,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==tr(this,jce,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(tr(this,Rh,"f")&&this._emit("toolCallDone",tr(this,Rh,"f")),Mh(this,jce,i.index,"f"),Mh(this,Rh,r.step_details.tool_calls[i.index],"f"),tr(this,Rh,"f")&&this._emit("toolCallCreated",tr(this,Rh,"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":Mh(this,WK,void 0,"f"),e.data.step_details.type=="tool_calls"&&tr(this,Rh,"f")&&(this._emit("toolCallDone",tr(this,Rh,"f")),Mh(this,Rh,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},Tqt=function(e){tr(this,O$e,"f").push(e),this._emit("event",e)},Aqt=function(e){switch(e.event){case"thread.run.step.created":return tr(this,LC,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=tr(this,LC,"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=FC.accumulateDelta(r,n.delta);tr(this,LC,"f")[e.data.id]=o}return tr(this,LC,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":tr(this,LC,"f")[e.data.id]=e.data;break}if(tr(this,LC,"f")[e.data.id])return tr(this,LC,"f")[e.data.id];throw new Error("No snapshot available")},Iqt=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let a=r.content[i.index];r.content[i.index]=tr(this,Od,"m",Mqt).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")},Mqt=function(e,r){return FC.accumulateDelta(r,e)},Rqt=function(e){switch(Mh(this,Nce,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":Mh(this,RL,e.data,"f"),tr(this,Rh,"f")&&(this._emit("toolCallDone",tr(this,Rh,"f")),Mh(this,Rh,void 0,"f"));break;case"thread.run.cancelling":break}};var NL=class extends it{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 un(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,k2,{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}})}},k2=class extends bo{};NL.MessagesPage=k2;var jL=class extends it{retrieve(e,r,n,o={},i){return un(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 un(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,$2,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},$2=class extends bo{};jL.RunStepsPage=$2;var wE=class extends it{constructor(){super(...arguments),this.steps=new jL(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 un(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,z2,{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 FC.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 yE(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return FC.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 FC.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},z2=class extends bo{};wE.RunsPage=z2;wE.Steps=jL;wE.RunStepsPage=$2;var kC=class extends it{constructor(){super(...arguments),this.runs=new wE(this._client),this.messages=new NL(this._client)}create(e={},r){return un(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 FC.createThreadAssistantStream(e,this._client.beta.threads,r)}};kC.Runs=wE;kC.RunsPage=z2;kC.Messages=NL;kC.MessagesPage=k2;var Zb=class extends it{constructor(){super(...arguments),this.realtime=new JM(this._client),this.chat=new j2(this._client),this.assistants=new AL(this._client),this.threads=new kC(this._client)}};Zb.Realtime=JM;Zb.Assistants=AL;Zb.AssistantsPage=T2;Zb.Threads=kC;var DL=class extends it{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var LL=class extends it{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&gE("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(gE("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=gqt(u)}),a)))}};var FL=class extends it{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return un(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,B2,{query:n,...o})}},B2=class extends bo{};FL.OutputItemListResponsesPage=B2;var xE=class extends it{constructor(){super(...arguments),this.outputItems=new FL(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 un(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,U2,{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)}},U2=class extends bo{};xE.RunListResponsesPage=U2;xE.OutputItems=FL;xE.OutputItemListResponsesPage=B2;var $C=class extends it{constructor(){super(...arguments),this.runs=new xE(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 un(e)?this.list({},e):this._client.getAPIList("/evals",kL,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},kL=class extends bo{};$C.EvalListResponsesPage=kL;$C.Runs=xE;$C.RunListResponsesPage=U2;var ZM=class extends it{create(e,r){return this._client.post("/files",ly({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return un(e)?this.list({},e):this._client.getAPIList("/files",$L,{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 yE(r),a=await this.retrieve(e),Date.now()-i>n)throw new Ah({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},$L=class extends bo{};ZM.FileObjectsPage=$L;var zL=class extends it{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,q2,{body:r,method:"post",...n})}retrieve(e,r={},n){return un(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)}},q2=class extends jC{};zL.PermissionCreateResponsesPage=q2;var YM=class extends it{constructor(){super(...arguments),this.permissions=new zL(this._client)}};YM.Permissions=zL;YM.PermissionCreateResponsesPage=q2;var BL=class extends it{list(e,r={},n){return un(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,H2,{query:r,...n})}},H2=class extends bo{};BL.FineTuningJobCheckpointsPage=H2;var zC=class extends it{constructor(){super(...arguments),this.checkpoints=new BL(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 un(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",V2,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return un(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,W2,{query:r,...n})}},V2=class extends bo{},W2=class extends bo{};zC.FineTuningJobsPage=V2;zC.FineTuningJobEventsPage=W2;zC.Checkpoints=BL;zC.FineTuningJobCheckpointsPage=H2;var Yb=class extends it{constructor(){super(...arguments),this.jobs=new zC(this._client),this.checkpoints=new YM(this._client)}};Yb.Jobs=zC;Yb.FineTuningJobsPage=V2;Yb.FineTuningJobEventsPage=W2;Yb.Checkpoints=YM;var UL=class extends it{createVariation(e,r){return this._client.post("/images/variations",ly({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",ly({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}};var XM=class extends it{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",qL,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},qL=class extends jC{};XM.ModelsPage=qL;var HL=class extends it{create(e,r){return this._client.post("/moderations",{body:e,...r})}};function Nqt(t,e){return!e||!Oun(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)}:P$e(t,e)}function P$e(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Tun(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:Cun(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||E$e(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 Cun(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Oun(t){return!!$K(t.text?.format)}function Pun(t){return t?.$brand==="auto-parseable-tool"}function Eun(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Tun(t,e){let r=Eun(t.tools??[],e.name);return{...e,...e,parsed_arguments:Pun(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function E$e(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 K2=class extends it{list(e,r={},n){return un(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,Dce,{query:r,...n})}};var G2=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},QM=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)},J2,Lce,eR,Fce,jqt,Dqt,Lqt,Fqt,kce=class t extends KM{constructor(e){super(),J2.add(this),Lce.set(this,void 0),eR.set(this,void 0),Fce.set(this,void 0),G2(this,Lce,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())),QM(this,J2,"m",jqt).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)QM(this,J2,"m",Dqt).call(this,a);if(i.controller.signal?.aborted)throw new xa;return QM(this,J2,"m",Lqt).call(this)}[(Lce=new WeakMap,eR=new WeakMap,Fce=new WeakMap,J2=new WeakSet,jqt=function(){this.ended||G2(this,eR,void 0,"f")},Dqt=function(r){if(this.ended)return;let n=QM(this,J2,"m",Fqt).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 Bt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Bt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Bt(`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 Bt(`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}},Lqt=function(){if(this.ended)throw new Bt("stream has ended, this shouldn't happen");let r=QM(this,eR,"f");if(!r)throw new Bt("request ended without sending any events");G2(this,eR,void 0,"f");let n=Iun(r,QM(this,Lce,"f"));return G2(this,Fce,n,"f"),n},Fqt=function(r){let n=QM(this,eR,"f");if(!n){if(r.type!=="response.created")throw new Bt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=G2(this,eR,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 Bt(`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 Bt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Bt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Bt(`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 Bt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{G2(this,eR,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=QM(this,Fce,"f");if(!e)throw new Bt("stream ended without producing a ChatCompletion");return e}};function Iun(t,e){return Nqt(t,e)}var tR=class extends it{constructor(){super(...arguments),this.inputItems=new K2(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"&&E$e(n),n))}retrieve(e,r={},n){return un(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=>P$e(n,e))}stream(e,r){return kce.createResponse(this._client,e,r)}},Dce=class extends bo{};tR.InputItems=K2;var Z2=class extends it{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,ly({body:r,...n}))}};var rR=class extends it{constructor(){super(...arguments),this.parts=new Z2(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})}};rR.Parts=Z2;var kqt=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 nR=class extends it{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 un(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,oR,{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 yE(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`,Y2,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},oR=class extends bo{},Y2=class extends jC{};nR.VectorStoreFilesPage=oR;nR.FileContentResponsesPage=Y2;var X2=class extends it{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 un(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,oR,{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 yE(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await kqt(d),await this.createAndPoll(e,{file_ids:l})}};var Nh=class extends it{constructor(){super(...arguments),this.files=new nR(this._client),this.fileBatches=new X2(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 un(e)?this.list({},e):this._client.getAPIList("/vector_stores",VL,{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`,WL,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},VL=class extends bo{},WL=class extends jC{};Nh.VectorStoresPage=VL;Nh.VectorStoreSearchResponsesPage=WL;Nh.Files=nR;Nh.VectorStoreFilesPage=oR;Nh.FileContentResponsesPage=Y2;Nh.FileBatches=X2;var $qt,wr=class extends vce{constructor({baseURL:e=NK("OPENAI_BASE_URL"),apiKey:r=NK("OPENAI_API_KEY"),organization:n=NK("OPENAI_ORG_ID")??null,project:o=NK("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new Bt("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&&hqt())throw new Bt(`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 DL(this),this.chat=new bE(this),this.embeddings=new LL(this),this.files=new ZM(this),this.images=new UL(this),this.audio=new DC(this),this.moderations=new HL(this),this.models=new XM(this),this.fineTuning=new Yb(this),this.vectorStores=new Nh(this),this.beta=new Zb(this),this.batches=new VM(this),this.uploads=new rR(this),this.responses=new tR(this),this.evals=new $C(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 Hke(e,{arrayFormat:"brackets"})}};$qt=wr;wr.OpenAI=$qt;wr.DEFAULT_TIMEOUT=6e5;wr.OpenAIError=Bt;wr.APIError=bu;wr.APIConnectionError=hE;wr.APIConnectionTimeoutError=Ah;wr.APIUserAbortError=xa;wr.NotFoundError=y2;wr.ConflictError=b2;wr.RateLimitError=v2;wr.BadRequestError=m2;wr.AuthenticationError=h2;wr.InternalServerError=w2;wr.PermissionDeniedError=g2;wr.UnprocessableEntityError=_2;wr.toFile=n$e;wr.fileFromPath=pce;wr.Completions=DL;wr.Chat=bE;wr.ChatCompletionsPage=HM;wr.Embeddings=LL;wr.Files=ZM;wr.FileObjectsPage=$L;wr.Images=UL;wr.Audio=DC;wr.Moderations=HL;wr.Models=XM;wr.ModelsPage=qL;wr.FineTuning=Yb;wr.VectorStores=Nh;wr.VectorStoresPage=VL;wr.VectorStoreSearchResponsesPage=WL;wr.Beta=Zb;wr.Batches=VM;wr.BatchesPage=TL;wr.Uploads=rR;wr.Responses=tR;wr.Evals=$C;wr.EvalListResponsesPage=kL;As();Of();Kn();iC();bh();Jp();eb();yq();ug();var Bqt=Symbol("Let zodToJsonSchema decide on which parser to use"),zqt={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"},Uqt=t=>typeof t=="string"?{...zqt,basePath:["#"],definitions:{},name:t}:{...zqt,basePath:["#"],definitions:{},...t};var KK=t=>"_def"in t?t._def:t;function qqt(t){if(!t)return!0;for(let e in t)return!1;return!0}var Hqt=t=>{let e=Uqt(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])=>[KK(o),{def:KK(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function T$e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function io(t,e,r,n,o){t[e]=r,T$e(t,e,n,o)}Qf();function Vqt(){return{}}Qf();function Wqt(t,e){let r={type:"array"};return t.type?._def?.typeName!==re.ZodAny&&(r.items=xr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&io(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&io(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(io(r,"minItems",t.exactLength.value,t.exactLength.message,e),io(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Kqt(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?io(r,"minimum",n.value,n.message,e):io(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),io(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?io(r,"maximum",n.value,n.message,e):io(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),io(r,"maximum",n.value,n.message,e));break;case"multipleOf":io(r,"multipleOf",n.value,n.message,e);break}return r}function Gqt(){return{type:"boolean"}}function Jqt(t,e){return xr(t.type._def,e)}var Zqt=(t,e)=>xr(t.innerType._def,e);function A$e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>A$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 Dun(t,e)}}var Dun=(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":io(r,"minimum",n.value,n.message,e);break;case"max":io(r,"maximum",n.value,n.message,e);break}return r};function Yqt(t,e){return{...xr(t.innerType._def,e),default:t.defaultValue()}}function Xqt(t,e,r){return e.effectStrategy==="input"?xr(t.schema._def,e,r):{}}function Qqt(t){return{type:"string",enum:[...t.values]}}var Lun=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function e2t(t,e){let r=[xr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),xr(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(Lun(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}function t2t(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}}Qf();var I$e,KL={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:()=>(I$e===void 0&&(I$e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),I$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}$/};function $ce(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Fun(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":io(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":io(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":Xb(r,"email",o.message,e);break;case"format:idn-email":Xb(r,"idn-email",o.message,e);break;case"pattern:zod":Qb(r,KL.email,o.message,e);break}break;case"url":Xb(r,"uri",o.message,e);break;case"uuid":Xb(r,"uuid",o.message,e);break;case"regex":Qb(r,o.regex,o.message,e);break;case"cuid":Qb(r,KL.cuid,o.message,e);break;case"cuid2":Qb(r,KL.cuid2,o.message,e);break;case"startsWith":Qb(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Qb(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Xb(r,"date-time",o.message,e);break;case"date":Xb(r,"date",o.message,e);break;case"time":Xb(r,"time",o.message,e);break;case"duration":Xb(r,"duration",o.message,e);break;case"length":io(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),io(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Qb(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Xb(r,"ipv4",o.message,e),o.version!=="v4"&&Xb(r,"ipv6",o.message,e);break}case"emoji":Qb(r,KL.emoji,o.message,e);break;case"ulid":{Qb(r,KL.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Xb(r,"binary",o.message,e);break}case"contentEncoding:base64":{io(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Qb(r,KL.base64,o.message,e);break}}break}case"nanoid":Qb(r,KL.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var Fun=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Xb=(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}}})):io(t,"format",e,r,n)},Qb=(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:r2t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):io(t,"pattern",r2t(e,n),r,n)},r2t=(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 zce(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]:xr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:xr(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($ce(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}function n2t(t,e){if(e.mapStrategy==="record")return zce(t,e);let r=xr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=xr(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}}}function o2t(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}}function i2t(){return{not:{}}}function a2t(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var GK={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function u2t(t,e){if(e.target==="openApi3")return s2t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in GK&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=GK[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 s2t(t,e)}var s2t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>xr(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 l2t(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:GK[t.innerType._def.typeName],nullable:!0}:{type:[GK[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=xr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=xr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function c2t(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",T$e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?io(r,"minimum",n.value,n.message,e):io(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),io(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?io(r,"maximum",n.value,n.message,e):io(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),io(r,"maximum",n.value,n.message,e));break;case"multipleOf":io(r,"multipleOf",n.value,n.message,e);break}return r}function kun(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":xr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":xr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function d2t(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=xr(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:kun(t,e)};return r.required.length||delete r.required,r}var f2t=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return xr(t.innerType._def,e);let r=xr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};var p2t=(t,e)=>{if(e.pipeStrategy==="input")return xr(t.in._def,e);if(e.pipeStrategy==="output")return xr(t.out._def,e);let r=xr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=xr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function m2t(t,e){return xr(t.type._def,e)}function h2t(t,e){let n={type:"array",uniqueItems:!0,items:xr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&io(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&io(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function g2t(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>xr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:xr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>xr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function y2t(){return{not:{}}}function b2t(){return{}}var _2t=(t,e)=>xr(t.innerType._def,e);function xr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Bqt)return a}if(n&&!r){let a=$un(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=Uun(t,t.typeName,e,r);return i&&qun(t,e,i),o.jsonSchema=i,i}var $un=(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:zun(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}},zun=(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("/")},Uun=(t,e,r,n)=>{switch(e){case re.ZodString:return $ce(t,r);case re.ZodNumber:return c2t(t,r);case re.ZodObject:return d2t(t,r);case re.ZodBigInt:return Kqt(t,r);case re.ZodBoolean:return Gqt();case re.ZodDate:return A$e(t,r);case re.ZodUndefined:return y2t();case re.ZodNull:return a2t(r);case re.ZodArray:return Wqt(t,r);case re.ZodUnion:case re.ZodDiscriminatedUnion:return u2t(t,r);case re.ZodIntersection:return e2t(t,r);case re.ZodTuple:return g2t(t,r);case re.ZodRecord:return zce(t,r);case re.ZodLiteral:return t2t(t,r);case re.ZodEnum:return Qqt(t);case re.ZodNativeEnum:return o2t(t);case re.ZodNullable:return l2t(t,r);case re.ZodOptional:return f2t(t,r);case re.ZodMap:return n2t(t,r);case re.ZodSet:return h2t(t,r);case re.ZodLazy:return xr(t.getter()._def,r);case re.ZodPromise:return m2t(t,r);case re.ZodNaN:case re.ZodNever:return i2t();case re.ZodEffects:return Xqt(t,r,n);case re.ZodAny:return Vqt();case re.ZodUnknown:return b2t();case re.ZodDefault:return Yqt(t,r);case re.ZodBranded:return Jqt(t,r);case re.ZodReadonly:return _2t(t,r);case re.ZodCatch:return Zqt(t,r);case re.ZodPipeline:return p2t(t,r);case re.ZodFunction:case re.ZodVoid:case re.ZodSymbol:return;default:return(o=>{})(e)}},qun=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var v2t=(t,e)=>{let r=Hqt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=xr(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(qqt(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]=xr(KK(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};function w2t(t,e){return v2t(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Bce(t,e,r){return bqt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:w2t(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function Uce(t){return _qt({type:"function",function:{name:t.name,parameters:w2t(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))})}function GL(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}ug();_h();function JK(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}function JL(t){let e;return t.constructor.name===Ah.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===xa.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=JK(t,"INVALID_TOOL_RESULTS"):t.status===401?e=JK(t,"MODEL_AUTHENTICATION"):t.status===429?e=JK(t,"MODEL_RATE_LIMIT"):t.status===404?e=JK(t,"MODEL_NOT_FOUND"):e=t,e}function M$e(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 Hun(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function x2t(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(S2t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
|
||
`)}function S2t(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}: ${qce(o,e)},`):r.push(`${n}?: ${qce(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
|
||
`)}function qce(t,e){if(Hun(t))return t.anyOf.map(r=>qce(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["{",S2t(t,e+2),"}"].join(`
|
||
`);case"array":return t.items?`${qce(t.items,e)}[]`:"any[]";default:return""}}_h();function C2t(t,e){let r;if(Cc(t)){let n=Uce({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:GI(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function Vun(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 j$e(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(!ks.isInstance(t))throw new Error("Invalid generic chat message");return Vun(t)}default:throw new Error(`Unknown message type: ${e}`)}}function N$e(t,e){return t.flatMap(r=>{let n=j$e(r);n==="system"&&D$e(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=""),Di(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(_C),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})}var Q2="__openai_function_call_ids__";function O2t(t,e){return t.flatMap(r=>{let n=j$e(r);if(n==="system"&&D$e(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[Q2];if(Di(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 E2t(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(bm(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(_m(s,l))}i[Q2]??(i[Q2]={}),i[Q2][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 En({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function Wun(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[Q2]={[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=E2t(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 eo({text:e.map(u=>u.text).join(""),message:new yr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function R$e(t){return"type"in t&&t.type!=="function"}function Kun(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function P2t(t,e){return gd(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:C2t(t,e)}function D$e(t){return t?.startsWith("o1")||t?.startsWith("o3")}var ZK=class extends du{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??ct("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ct("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=>R$e(o)?o:P2t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Hce(e.json_schema.schema)?Bce(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=>R$e(l)?l:gd(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:Kun(e?.tool_choice)?e?.tool_choice:(()=>{let l=M$e(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=>P2t(s,{strict:n})):void 0,tool_choice:M$e(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),D$e(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(bm(u,{returnId:!0}))}catch(l){i.push(_m(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 En({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new ks(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 Yf({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 yr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new of({content:i,response_metadata:s}):o==="developer"?new of({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Um({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new sg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Zf({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:O2t(e,this.model),stream:!0},r);for await(let c of l){let d=Wun(c);d!=null&&(yield d)}return}let o=N$e(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new eo({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new eo({message:new yr({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=O2t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:E2t(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(R$e),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=N$e(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Di(b.message)&&(b.message.usage_metadata=o),b.message=new En(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=x2t(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(j$e(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 JL(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 JL(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 JL(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=GL(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new wr(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;Gun(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"}}),Hce(n)?u=Xc.fromZodSchema(n):u=new Qc;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}}}),Hce(n)){let f=Xc.fromZodSchema(n);u=tp.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Qc;else{let f=o??"extract";if(Hce(n)){let p=Ga(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 wd({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 wd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Eo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Eo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Pi.from([{raw:s},d])}};function Hce(t){return typeof t?.parse=="function"}function Gun(t){return t!==void 0&&typeof t.schema=="object"}Kn();bh();Of();Kn();bD();Wg();Kn();Kn();Kn();qP();Wg();Kn();eE();var L$e=class extends QP{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??ct("OPENAI_API_KEY"),n=e?.organization??ct("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new wr(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(L$e,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Vce=class extends ZK{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||ct("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)}};_Ne();ug();iC();As();Of();Kn();CD();var ZL="0.5.0";var T2t=!1,YL,F$e,Jun,Zun,Yun,k$e,Xun,Wce,$$e,z$e,B$e,Kce,U$e;function A2t(t,e={auto:!1}){if(T2t)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(YL)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${YL}'\``);T2t=e.auto,YL=t.kind,F$e=t.fetch,Jun=t.Request,Zun=t.Response,Yun=t.Headers,k$e=t.FormData,Xun=t.Blob,Wce=t.File,$$e=t.ReadableStream,z$e=t.getMultipartRequestOptions,B$e=t.getDefaultAgent,Kce=t.fileFromPath,U$e=t.isFsReadStream}var Gce=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function I2t({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 Gce(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}}YL||A2t(I2t(),{auto:!0});var q$e={};Qd(q$e,{APIConnectionError:()=>SE,APIConnectionTimeoutError:()=>XL,APIError:()=>oc,APIUserAbortError:()=>iR,AuthenticationError:()=>t4,BadRequestError:()=>e4,ConflictError:()=>o4,GroqError:()=>jc,InternalServerError:()=>s4,NotFoundError:()=>n4,PermissionDeniedError:()=>r4,RateLimitError:()=>a4,UnprocessableEntityError:()=>i4});var jc=class extends Error{},oc=class t extends jc{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 SE({cause:Jce(r)});let i=r;return e===400?new e4(e,i,n,o):e===401?new t4(e,i,n,o):e===403?new r4(e,i,n,o):e===404?new n4(e,i,n,o):e===409?new o4(e,i,n,o):e===422?new i4(e,i,n,o):e===429?new a4(e,i,n,o):e>=500?new s4(e,i,n,o):new t(e,i,n,o)}},iR=class extends oc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},SE=class extends oc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},XL=class extends SE{constructor({message:e}={}){super({message:e??"Request timed out."})}},e4=class extends oc{constructor(){super(...arguments),this.status=400}},t4=class extends oc{constructor(){super(...arguments),this.status=401}},r4=class extends oc{constructor(){super(...arguments),this.status=403}},n4=class extends oc{constructor(){super(...arguments),this.status=404}},o4=class extends oc{constructor(){super(...arguments),this.status=409}},i4=class extends oc{constructor(){super(...arguments),this.status=422}},a4=class extends oc{constructor(){super(...arguments),this.status=429}},s4=class extends oc{};var Zce=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new H$e;async function*i(){if(!e.body)throw r.abort(),new jc("Attempted to iterate over a response with no body");let s=new u4,u=M2t(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 oc(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 u4,s=M2t(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 $$e({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?.()}})}},H$e=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]=eln(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},u4=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 jc(`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 jc(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new jc("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}};u4.NEWLINE_CHARS=new Set([`
|
||
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);u4.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function eln(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function M2t(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 R2t=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",N2t=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Yce(t),Yce=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",tln=t=>N2t(t)||R2t(t)||U$e(t);async function K$e(t,e,r){if(t=await t,r??(r=N2t(t)?{lastModified:t.lastModified,type:t.type}:{}),R2t(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Wce([o],e,r)}let n=await rln(t);if(e||(e=oln(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Wce(n,e,r)}async function rln(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Yce(t))e.push(await t.arrayBuffer());else if(iln(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${nln(t)}`);return e}function nln(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function oln(t){return V$e(t.name)||V$e(t.filename)||V$e(t.path)?.split(/[\\/]/).pop()}var V$e=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},iln=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",G$e=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var YK=async t=>{let e=await j2t(t.body);return z$e(e,t)},j2t=async t=>{let e=new k$e;return await Promise.all(Object.entries(t||{}).map(([r,n])=>W$e(e,r,n))),e};var W$e=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(tln(r)){let n=await K$e(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>W$e(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>W$e(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`)}};var sln=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},uln=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)},Xce;async function z2t(t){let{response:e}=t;if(t.options.stream)return l4("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Zce.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 l4("response",e.status,e.url,e.headers,i),i}let o=await e.text();return l4("response",e.status,e.url,e.headers,o),o}var Qce=class t extends Promise{constructor(e,r=z2t){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)}},ede=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=J$e("maxRetries",r),this.timeout=J$e("timeout",n),this.httpAgent=o,this.fetch=i??F$e}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...fln(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${_ln()}`}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&&Yce(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:G$e(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&&J$e("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??B$e(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 $2t(o,i),$2t(o,r),G$e(e.body)&&YL!=="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 oc.generate(e,r,n,o)}request(e,r=null){return new Qce(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}),l4("request",i,n,o.headers),n.signal?.aborted)throw new iR;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Jce);if(u instanceof Error){if(n.signal?.aborted)throw new iR;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new XL:new SE({cause:u})}let l=lln(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return l4(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Jce(h).message),d=pln(c),f=d?void 0:c;throw l4(`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 Z$e(this,n,e)}buildURL(e,r){let n=hln(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return yln(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 jc(`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 gln(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 ${ZL}`}},D2t=class{constructor(e,r,n,o){Xce.set(this,void 0),sln(this,Xce,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 jc("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 uln(this,Xce,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Xce=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Z$e=class extends Qce{constructor(e,r,n){super(r,async o=>new n(e,o.response,await z2t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},lln=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var cln=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZL,"X-Stainless-OS":F2t(Deno.build.os),"X-Stainless-Arch":L2t(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":ZL,"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":ZL,"X-Stainless-OS":F2t(process.platform),"X-Stainless-Arch":L2t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=dln();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ZL,"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":ZL,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function dln(){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 L2t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",F2t=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"),k2t,fln=()=>k2t??(k2t=cln()),pln=t=>{try{return JSON.parse(t)}catch{return}},mln=new RegExp("^(?:[a-z]+:)?//","i"),hln=t=>mln.test(t),gln=t=>new Promise(e=>setTimeout(e,t)),J$e=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new jc(`${t} must be an integer`);if(e<0)throw new jc(`${t} must be a positive integer`);return e},Jce=t=>t instanceof Error?t:new Error(t);var Y$e=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function yln(t){if(!t)return!0;for(let e in t)return!1;return!0}function bln(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function $2t(t,e){for(let r in e){if(!bln(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 l4(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var _ln=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),B2t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var Dc=class{constructor(e){this._client=e}};var QL=class extends Dc{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",YK({body:e,...r}))}};QL||(QL={});var eF=class extends Dc{create(e,r){return this._client.post("/openai/v1/audio/translations",YK({body:e,...r}))}};eF||(eF={});var aR=class extends Dc{constructor(){super(...arguments),this.transcriptions=new QL(this._client),this.translations=new eF(this._client)}};(function(t){t.Transcriptions=QL,t.Translations=eF})(aR||(aR={}));var tF=class extends Dc{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};tF||(tF={});var sR=class extends Dc{constructor(){super(...arguments),this.completions=new tF(this._client)}};(function(t){t.Completions=tF})(sR||(sR={}));var uR=class extends Dc{};uR||(uR={});var lR=class extends Dc{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};lR||(lR={});var cR=class extends Dc{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)}};cR||(cR={});var U2t,Rs=class extends ede{constructor({baseURL:e=Y$e("GROQ_BASE_URL"),apiKey:r=Y$e("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new jc("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&&B2t())throw new jc(`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 uR(this),this.chat=new sR(this),this.embeddings=new lR(this),this.audio=new aR(this),this.models=new cR(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}`}}};U2t=Rs;Rs.Groq=U2t;Rs.GroqError=jc;Rs.APIError=oc;Rs.APIConnectionError=SE;Rs.APIConnectionTimeoutError=XL;Rs.APIUserAbortError=iR;Rs.NotFoundError=n4;Rs.ConflictError=o4;Rs.RateLimitError=a4;Rs.BadRequestError=e4;Rs.AuthenticationError=t4;Rs.InternalServerError=s4;Rs.PermissionDeniedError=r4;Rs.UnprocessableEntityError=i4;Rs.toFile=K$e;Rs.fileFromPath=Kce;var{GroqError:Fhi,APIError:khi,APIConnectionError:$hi,APIConnectionTimeoutError:zhi,APIUserAbortError:Bhi,NotFoundError:Uhi,ConflictError:qhi,RateLimitError:Hhi,BadRequestError:Vhi,AuthenticationError:Whi,InternalServerError:Khi,PermissionDeniedError:Ghi,UnprocessableEntityError:Jhi}=q$e;(function(t){t.Completions=uR,t.Chat=sR,t.Embeddings=lR,t.Audio=aR,t.Models=cR})(Rs||(Rs={}));var q2t=Rs;Jp();eb();yq();_h();function Oln(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 H2t(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:Oln(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 Di(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(_C):(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 Pln(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(bm(i,{returnId:!0}))}catch(a){o.push(_m(i,a.message))}return new En({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new ks(t.content||"",t.role??"unknown")}}function Eln(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 Tln(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 Yf({content:o})};if(n==="assistant"){let u=Eln(t.tool_calls,e);return{message:new yr({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 of({content:o})}:{message:new Zf({content:o,role:n})}}var tde=class extends du{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||ct("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 q2t({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=>oC(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=H2t(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}=Tln({...d.delta,role:s},d.index,c.x_groq);if(p){let h=p.filter(b=>u.every(g=>g.id!==b.id));u.push(...h),yield new eo({message:new yr({content:"",tool_call_chunks:h}),text:""})}let m=new eo({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield m,n?.handleLLMNewToken(m.text??"")}if(l&&("choices"in l&&delete l.choices,yield new eo({message:new yr({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=H2t(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:Pln(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"}}),k_(n)?u=Xc.fromZodSchema(n):u=new Qc;else if(k_(n)){let p=Ga(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new wd({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 wd({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=Eo.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=Eo.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Pi.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var Pd=[];for(rde=0;rde<256;++rde)Pd.push((rde+256).toString(16).slice(1));var rde;function V2t(t,e=0){return(Pd[t[e+0]]+Pd[t[e+1]]+Pd[t[e+2]]+Pd[t[e+3]]+"-"+Pd[t[e+4]]+Pd[t[e+5]]+"-"+Pd[t[e+6]]+Pd[t[e+7]]+"-"+Pd[t[e+8]]+Pd[t[e+9]]+"-"+Pd[t[e+10]]+Pd[t[e+11]]+Pd[t[e+12]]+Pd[t[e+13]]+Pd[t[e+14]]+Pd[t[e+15]]).toLowerCase()}var nde,Aln=new Uint8Array(16);function X$e(){if(!nde&&(nde=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nde))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nde(Aln)}var Iln=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Q$e={randomUUID:Iln};function Mln(t,e,r){if(Q$e.randomUUID&&!e&&!t)return Q$e.randomUUID();t=t||{};var n=t.random||(t.rng||X$e)();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 V2t(n)}var ode=Mln;var eGt=F(ZKt(),1),tGt=F(aG(),1);As();iC();Of();o$();Kn();eb();yq();Jp();ug();var MMn=/^[a-zA-Z0-9]{9}$/;function RMn(t){return MMn.test(t)}function NMn(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 jMn(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 kUe(t){if(RMn(t))return t;{let e=jMn(t),r=NMn(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function $Ue(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}):""}function YKt(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(Di(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:kUe(i.id??"")})).map(_C)};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:kUe(o.tool_call_id)}:Di(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function DMn(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=$Ue(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=bm(s,{returnId:!0});i.push({...u,id:u.id??ode().replace(/-/g,"")})}catch(u){a.push(_m(s,u.message))}return new En({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 $s({content:o})}}function LMn(t,e){if(!t.content&&!t.toolCalls)return e?new yr({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??ode().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=$Ue(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 Yf({content:o}):n==="assistant"?new yr({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 sg({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new Um({content:o,additional_kwargs:i}):new Zf({content:o,role:n})}function XKt(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:Ga(e.schema)}}})}var lme=class extends du{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??ct("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?XKt(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:XKt(e),...r})}async completionWithRetry(e,r){let n=new qm({maxRetries:this.maxRetries}),o=new eGt.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=YKt(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let m=this._streamResponseChunks(e,r,n),h={};for await(let g of m){let y=g.generationInfo?.completion??0;h[y]===void 0?h[y]=g:h[y]=h[y].concat(g)}return{generations:Object.entries(h).sort(([g],[y])=>parseInt(g,10)-parseInt(y,10)).map(([g,y])=>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 m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let b={text:h,message:DMn(m,l?.usage)};m.finishReason&&(b.generationInfo={finishReason:m.finishReason}),p.push(b)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=YKt(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=LMn(c,f?u.usage:null);if(p===null)continue;let m=c.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let h=new eo({message:p,text:m,generationInfo:d});yield h,n?.handleLLMNewToken(h.text??"",d,void 0,void 0,void 0,{chunk:h})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new tGt.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"}}),QKt(n)?u=Xc.fromZodSchema(n):u=new Qc;else{let f=o??"extract";if(QKt(n)){let p=Ga(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new wd({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 wd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Eo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Eo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Pi.from([{raw:s},d])}};function QKt(t){return typeof t?.parse=="function"}Kn();qP();Wg();bD();Of();Kn();Wg();NNe();jse();Kn();As();Of();Kn();iC();bh();Jp();eb();yq();ug();function NF(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}ug();_h();function FG(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}function jF(t){let e;return t.constructor.name===Ah.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===xa.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=FG(t,"INVALID_TOOL_RESULTS"):t.status===401?e=FG(t,"MODEL_AUTHENTICATION"):t.status===429?e=FG(t,"MODEL_RATE_LIMIT"):t.status===404?e=FG(t,"MODEL_NOT_FOUND"):e=t,e}function zUe(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 FMn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function rGt(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(nGt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
|
||
`)}function nGt(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}: ${cme(o,e)},`):r.push(`${n}?: ${cme(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
|
||
`)}function cme(t,e){if(FMn(t))return t.anyOf.map(r=>cme(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["{",nGt(t,e+2),"}"].join(`
|
||
`);case"array":return t.items?`${cme(t.items,e)}[]`:"any[]";default:return""}}_h();function oGt(t,e){let r;if(Cc(t)){let n=Uce({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:GI(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function kMn(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 qUe(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(!ks.isInstance(t))throw new Error("Invalid generic chat message");return kMn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function UUe(t,e){return t.flatMap(r=>{let n=qUe(r);n==="system"&&HUe(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=""),Di(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(_C),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})}var F4="__openai_function_call_ids__";function iGt(t,e){return t.flatMap(r=>{let n=qUe(r);if(n==="system"&&HUe(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[F4];if(Di(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 sGt(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(bm(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(_m(s,l))}i[F4]??(i[F4]={}),i[F4][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 En({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function $Mn(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[F4]={[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=sGt(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 eo({text:e.map(u=>u.text).join(""),message:new yr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function BUe(t){return"type"in t&&t.type!=="function"}function zMn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function aGt(t,e){return gd(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:oGt(t,e)}function HUe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var kG=class extends du{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??ct("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ct("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=>BUe(o)?o:aGt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&dme(e.json_schema.schema)?Bce(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=>BUe(l)?l:gd(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:zMn(e?.tool_choice)?e?.tool_choice:(()=>{let l=zUe(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=>aGt(s,{strict:n})):void 0,tool_choice:zUe(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),HUe(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(bm(u,{returnId:!0}))}catch(l){i.push(_m(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 En({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new ks(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 Yf({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 yr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new of({content:i,response_metadata:s}):o==="developer"?new of({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Um({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new sg({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Zf({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:iGt(e,this.model),stream:!0},r);for await(let c of l){let d=$Mn(c);d!=null&&(yield d)}return}let o=UUe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new eo({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new eo({message:new yr({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=iGt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:sGt(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(BUe),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=UUe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},Di(b.message)&&(b.message.usage_metadata=o),b.message=new En(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}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=rGt(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(qUe(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 jF(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 jF(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 jF(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=NF(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new wr(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;BMn(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"}}),dme(n)?u=Xc.fromZodSchema(n):u=new Qc;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}}}),dme(n)){let f=Xc.fromZodSchema(n);u=tp.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Qc;else{let f=o??"extract";if(dme(n)){let p=Ga(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 wd({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 wd({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Eo.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Eo.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Pi.from([{raw:s},d])}};function dme(t){return typeof t?.parse=="function"}function BMn(t){return t!==void 0&&typeof t.schema=="object"}Kn();bh();Of();Kn();bD();Wg();Kn();Kn();Kn();qP();Wg();Kn();eE();var VUe=class extends QP{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??ct("OPENAI_API_KEY"),n=e?.organization??ct("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new wr(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(VUe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var fme=class extends kG{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||ct("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 pme=require("obsidian"),UMn={openai:vC,"azure openai":vC,anthropic:lce,cohereai:vae,google:Eae,xai:fme,openrouterai:vC,ollama:Rae,"lm-studio":vC,groq:tde,"3rd party (openai-format)":vC,"copilot-plus":vC,mistralai:lme,deepseek:Vce},Bc=class Bc{constructor(){this.providerApiKeyMap={openai:()=>ae().openAIApiKey,google:()=>ae().googleApiKey,"azure openai":()=>ae().azureOpenAIApiKey,anthropic:()=>ae().anthropicApiKey,cohereai:()=>ae().cohereApiKey,openrouterai:()=>ae().openRouterAiApiKey,groq:()=>ae().groqApiKey,xai:()=>ae().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ae().plusLicenseKey,mistralai:()=>ae().mistralApiKey,deepseek:()=>ae().deepseekApiKey};this.buildModelMap(),Ma(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return Bc.instance||(Bc.instance=new Bc),Bc.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?Bc.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=ae(),n=e.name,o=ewe(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 po(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?ou:void 0,organization:await po(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await po(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?ou:void 0},...i&&{thinking:{type:"enabled",budget_tokens:1024}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await po(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 po(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?ou:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await po(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await po(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:_D.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:vD.BLOCK_NONE},{category:_D.HARM_CATEGORY_HATE_SPEECH,threshold:vD.BLOCK_NONE},{category:_D.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:vD.BLOCK_NONE},{category:_D.HARM_CATEGORY_HARASSMENT,threshold:vD.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await po(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await po(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?ou:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await po(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await po(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?ou:void 0}},"3rd party (openai-format)":{modelName:n,apiKey:await po(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?ou: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 po(r.plusLicenseKey),configuration:{baseURL:dA,fetch:e.enableCors?ou:void 0}},mistralai:{model:n,apiKey:await po(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await po(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||A$.deepseek.host,fetch:e.enableCors?ou: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=ae(),a=ewe(e),s=this.getTemperatureForModel(a,o||{},i),u={maxTokens:r,temperature:s};if((a.isOSeries||a.isGPT5)&&(u.reasoning={effort:o?.reasoningEffort||i.reasoningEffort||"low"},a.isGPT5)){let l=o?.verbosity||i.verbosity||"medium";u.verbosity=l,u.modelKwargs={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=ae().activeModels;Bc.modelMap={};let r=Bc.modelMap;(e??H_).forEach(o=>{if(o.enabled){if(!Object.values($O).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=Yr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=UMn[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(!Bc.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return Bc.chatModel}async setChatModel(e){let r=Yr(e);try{let n=await this.createModelInstance(e);Bc.chatModel=n}catch(n){fe(n),new pme.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=Yr(e),n=Bc.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let a=`API key is not provided for the model: ${r}.`;throw new pme.Notice(a),new Error(a)}let o=await this.getModelConfig(e);return new n.AIConstructor({...o})}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await rb(async()=>Bc.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return J("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!Bc.chatModel)return;let e=ZY();if(!e)return;Bc.modelMap[e]?.hasApiKey||(Bc.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};await new(this.getProviderConstructor(o))({...l,...c}).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 pme.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: `+ci(n)+`
|
||
with CORS Error: `+ci(o);throw new Error(i)}}}findModelByName(e){return ae().activeModels.find(n=>n.name===e)}};Bc.REASONING_MODEL_TEMPERATURE=1;var DF=Bc;er();As();var k4=class{},uGt=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},mme=(t,e)=>{let r=uGt(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},WUe=(t,e)=>{let r=uGt(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};Q1();lN();var KUe=class extends kp{addUserMessage(e){return this.addMessage(new $s(e))}addAIChatMessage(e){return this.addMessage(new En(e))}addAIMessage(e){return this.addMessage(new En(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},$4=class extends KUe{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 s_=class extends k4{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 $4,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(mme(e,this.inputKey)),await this.chatHistory.addAIChatMessage(WUe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};var $G=class extends s_{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]:Xf(r,this.humanPrefix,this.aiPrefix)}}};As();As();GUe();sA();As();var zG=class extends s_{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]:Xf(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};Kue();Mve();As();Q1();GUe();As();As();var BG=class t{constructor(){this.initMemory(),Ma(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ae().contextTurns;this.memory=new zG({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)}};er();sA();Us();var UG=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),Ma(()=>{this.initChatPrompt(),this.initQAPrompt()}),L$(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=q_(),r=iu();r&&EN()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Gp.fromMessages([aA.fromTemplate(n),new B_("history"),U_.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=Gp.fromMessages([aA.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 qG=class{constructor(e,r){this.retrievedDocuments=[];this.app=e,this.vectorStoreManager=r,this.memoryManager=BG.getInstance(),this.chatModelManager=DF.getInstance(),this.promptManager=UG.getInstance(),this.initialize(),Ma(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 hme.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!PGe(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",bg()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=bg(),o=iu();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:ZY();if(!i)throw new hme.Notice("No model key found"),new Error("No model key found");try{if(r){let a=LY(i,ae().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=H_[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ae().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new hme.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),J(`Setting model to ${i}`)}catch(a){fe(`createChainWithNewModel failed: ${a}`),J(`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=c6.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),ON("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new EC({minSimilarityScore:.01,maxK:ae().maxSourceChunks,salientTerms:[]});this.retrievalChain=c6.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:q_()},this.storeRetrieverDocuments.bind(this),ae().debug),ON("vault_qa"),ae().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=c6.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),ON("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=c6.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),ON("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=bg();switch(e){case"llm_chain":return new Rle(this);case"vault_qa":return new Nle(this);case"copilot_plus":return new uK(this);case"project":return new jle(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&await this.vectorStoreManager.indexVaultToVectorStore()}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||l6(u)){let c=Gp.fromMessages([new B_("history"),U_.fromTemplate("{input}")]);l6(u)&&(c=Gp.fromMessages([[Ei,q_()||""],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===Ei&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}};var Ec=class t{constructor(e,r,n){this.app=e,this.plugin=n,this.currentProjectId=null,this.chainMangerInstance=new qG(e,r),this.projectContextCache=zb.getInstance(),this.fileParserManager=new vM(Wi.getInstance(),this.app.vault,!0,null),pJe(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),mJe(async()=>{EN()||await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:ae().indexVaultToVectorStore==="ON MODE SWITCH"&&(bg()==="vault_qa"||bg()==="copilot_plus")})}),L$(async o=>{await this.switchProject(o)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){Ma(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,n){return t.instance||(t.instance=new t(e,r,n)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}getCurrentProjectId(){return this.currentProjectId}async switchProject(e){try{if(mA(!0),J("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 vM(Wi.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),J(`Switched to project: ${e.name}`)}catch(r){throw fe(`Failed to switch project: ${r}`),r}finally{mA(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e){try{if(!e.contextSource)return dg(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;J(`[loadProjectContext] Starting for project: ${e.name}`);let r=await this.projectContextCache.get(e),n=r||{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0};r?J(`[loadProjectContext] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${n.markdownNeedsReload}`):J(`[loadProjectContext] Project ${e.name}: No existing cache found, building fresh context.`);let[o]=await Promise.all([this.processMarkdownFiles(e,n),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);if(o.fileContexts){let i=Object.keys(o.fileContexts).length;if(J(`[loadProjectContext] Project ${e.name}: Checking ${i} fileContexts for non-markdown processing.`),i>0){this.fileParserManager=new vM(Wi.getInstance(),this.app.vault,!0,e);let a=0;for(let s in o.fileContexts){let u=this.app.vault.getAbstractFileByPath(s);if(u instanceof HG.TFile&&u.extension!=="md"&&this.fileParserManager.supportsExtension(u.extension))try{await this.projectContextCache.getFileContext(e,s)||(J(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${s}`),await this.fileParserManager.parseFile(u,this.app.vault),a++)}catch(l){if(fe(`[loadProjectContext] Project ${e.name}: Error parsing file ${s}:`,l),sL(l))throw l}}a>0&&J(`[loadProjectContext] Project ${e.name}: Processed and cached ${a} non-markdown files.`)}}return o.timestamp=Date.now(),await this.projectContextCache.set(e,o),J(`[loadProjectContext] Completed for project: ${e.name}.`),o}catch(r){throw fe(`[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),J(`Markdown configuration changed for project ${r.name}, marking for reload`));let u=e.contextSource?.webUrls||"",l=r.contextSource?.webUrls||"";if(u!==l){let f=u.split(`
|
||
`).filter(m=>m.trim()),p=l.split(`
|
||
`).filter(m=>m.trim());for(let m of f)p.includes(m)||await this.projectContextCache.removeWebUrl(r,m)}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(`
|
||
`).filter(m=>m.trim()),p=d.split(`
|
||
`).filter(m=>m.trim());for(let m of f)p.includes(m)||await this.projectContextCache.removeYoutubeUrl(r,m)}}catch(n){fe(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(xs)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ae().projectList.find(o=>o.id===e);if(!r)return dg(`[getProjectContext] Project not found for ID: ${e}`),null;J(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?J(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):J(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r);if(!o)return fe(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else J(`[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.getFileContext(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){J(`[processMarkdownFiles] Starting for project: ${e.name}`);let n=Object.keys(r.fileContexts||{}).length;if(e.contextSource?.inclusions||e.contextSource?.exclusions){r=await this.projectContextCache.updateProjectFilesFromPatterns(e,r);let o=Object.keys(r.fileContexts||{}).length;if(o>n&&J(`[processMarkdownFiles] Project ${e.name}: Added ${o-n} new file references via updateProjectFilesFromPatterns.`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){J(`[processMarkdownFiles] Project ${e.name}: Processing markdown content.`);let i=await this.processFileContext(e.contextSource.inclusions,e.contextSource.exclusions,e);r.markdownContext=i,r.markdownNeedsReload=!1,J(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else J(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`)}return J(`[processMarkdownFiles] Completed for project: ${e.name}. Total fileContexts: ${Object.keys(r.fileContexts||{}).length}`),r}async processFileContext(e,r,n){if(!e&&!r||!n)return"";let{inclusions:o,exclusions:i}=Tf({inclusions:e,exclusions:r,isProject:!0}),a=this.app.vault.getFiles().filter(u=>u.extension==="md"&&gu(u,o,i));J(`Found ${a.length} markdown files to process for project context`);let s=await Promise.all(a.map(async u=>{let l="",c="";try{let d=await this.app.vault.adapter.stat(u.path);c=`[[${u.basename}]]
|
||
path: ${u.path}
|
||
type: ${u.extension}
|
||
created: ${d?new Date(d.ctime).toISOString():"unknown"}
|
||
modified: ${d?new Date(d.mtime).toISOString():"unknown"}`,l=await this.app.vault.read(u),J(`Completed processing markdown file: ${u.path}`)}catch(d){fe(`Error processing file ${u.path}: ${d}`),l=`[Error: ${ci(d)}]`}return`${c}
|
||
|
||
${l}`}));return J("All markdown files processed for project context"),s.join(`
|
||
|
||
`)}async processWebUrls(e,r){J(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(J(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());J(`[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&&J(`[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){J(`[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.processWebUrlsContext(c);return d&&J(`[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&&dg(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),J(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){J(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(J(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());J(`[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&&J(`[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){J(`[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.processYoutubeUrlsContext(c);return d&&J(`[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&&dg(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),J(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlsContext(e){if(!e?.trim())return"";try{let r=_M.getInstance(),{urlContext:n}=await r.processUrls(e);return n||""}catch(r){return fe(`Failed to process web URLs: ${r}`),new HG.Notice(`Failed to process web URLs: ${ci(r)}`),""}}async processYoutubeUrlsContext(e){if(!e?.trim())return"";let n=e.split(`
|
||
`).filter(i=>i.trim()).map(async i=>{try{let a=await Wi.getInstance().youtube4llm(i);return a.response.transcript?`
|
||
|
||
YouTube transcript from ${i}:
|
||
${a.response.transcript}`:""}catch(a){return fe(`Failed to process YouTube URL ${i}: ${a}`),new HG.Notice(`Failed to process YouTube URL ${i}: ${ci(a)}`),""}});return(await Promise.all(n)).join("")}onunload(){this.projectContextCache.cleanup()}};Us();Ur();Tn();er();JUe();Ur();Gg();Tn();er();var Py=require("@codemirror/view"),cT=require("@codemirror/state");function pGt(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 WMn=Object.defineProperty,KMn=(t,e,r)=>e in t?WMn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z4=(t,e,r)=>(KMn(t,typeof e!="symbol"?e+"":e,r),r),gme=cT.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(eqe));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),eqe=cT.StateEffect.define();function GMn(t,e){let r=t.state.selection.main.head,n=[],o=Py.Decoration.widget({widget:new ZUe(e),side:1});return n.push(o.range(r)),Py.Decoration.set(n)}var ZUe=class extends Py.WidgetType{constructor(e){super(),z4(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}},YUe=t=>{let e=0;return Py.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:eqe.of({suggestion:i,doc:n})})}}})},XUe=class{constructor(){z4(this,"decorations"),this.decorations=Py.Decoration.none}update(e){var r;let n=(r=e.state.field(gme))==null?void 0:r.suggestion;if(!n){this.decorations=Py.Decoration.none;return}this.decorations=GMn(e.view,n.display_suggestion)}},mGt=Py.ViewPlugin.fromClass(XUe,{decorations:t=>t.decorations}),QUe=class{constructor(e,r){z4(this,"suggestFn"),z4(this,"keymap"),z4(this,"completionId"),z4(this,"run",n=>{var o,i;let a=(o=n.state.field(gme))==null?void 0:o.suggestion;return a?(n.dispatch({...JMn(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:eqe.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=cT.Prec.highest(Py.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function JMn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:cT.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:cT.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function hGt(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function ZMn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield hGt(r);return}for await(let n of r)yield hGt(n)}}function yme(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=ZMn(t.fetchFn),{debounced:o,force:i}=pGt(n,e);return{extension:r?[gme,YUe(o),mGt,new QUe(t.continue_suggesting?n:null,r).keymap]:[gme,YUe(o),mGt],force_fetch:i}}var iqe=require("obsidian");var tqe=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"))}},rqe=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}},nqe=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}},bme=class{constructor(){this.processors=[];this.processors.push(new nqe),this.processors.push(new tqe),this.processors.push(new rqe)}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}};d6();var gGt=require("obsidian");function yGt(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 bGt(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 gGt.TFile&&(r.push(i),r.length>=e))break}return r}Hue();er();var oqe=require("obsidian"),YMn=.4,XMn=20,_Gt=.7,_me=.3;async function QMn(t,e){let r=ae().debug,n=await nE.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 eRn(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);return t.forEach(n=>{n.forEach((o,i)=>{r[i]+=o/e})}),r}function tRn(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 rRn({db:t,filePath:e}){let r=ae().debug,n=await QMn(e,t),o=eRn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await nE.getDocsByEmbedding(t,o,{limit:XMn,similarity:YMn});return tRn(i,e)}function nRn(t){let e=new Map,n=yGt(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=bGt(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 oRn(t,e){let r=new Map,n=_Gt+_me;for(let[o,i]of t)r.set(o,i*_Gt/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=_me:(i.links||i.backlinks)&&(a=_me*.8),r.set(o,(r.get(o)??0)+a)}return r}async function wme({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof oqe.TFile))return[];let n=await rRn({db:t,filePath:e}),o=nRn(r),i=oRn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=vme(n.get(l)??0),f=vme(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 oqe.TFile?{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}}:null}).filter(s=>s!==null)}function vme(t){return t>.7?3:t>.55?2:1}OC();var vGt=require("obsidian"),iRn={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 aRn(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function wGt(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(iRn).some(n=>aRn(r,n)))return!0;return!1}function xGt(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 IR=class IR{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return IR.instance||(IR.instance=new IR),IR.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=await wa.getInstance().getDb(),o=(await wme({db:r,filePath:e.path})).slice(0,IR.MAX_RELEVANT_NOTES);this.cachedNoteTitles=o.map(a=>a.document.title);let i=await Promise.all(o.map(async a=>{let s=app.vault.getAbstractFileByPath(a.document.path);if(!(s instanceof vGt.TFile))return"";let u=await app.vault.cachedRead(s);if(!u)return"";let l=u.length>3e3?u.slice(0,3e3)+"...":u;return`[[${a.document.title}]]:
|
||
|
||
${l}`}));return this.currentNotePath=e.path,this.cachedNotes=i.join(`
|
||
|
||
`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};IR.MAX_RELEVANT_NOTES=3;var xme=IR;var LF=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 WG=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}};Tn();var SGt=require("obsidian");var KG=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new LF}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}`;fe(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 fe("[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 fe(`[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){fe(`[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 SGt.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")}};Tn();var u_=class u_{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...u_.DEFAULT_SETTINGS},this.performance={...u_.DEFAULT_PERFORMANCE},this.tokenizer=new LF,this.trie=new WG(this.performance.maxTrieSize),this.scanner=new KG(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return u_.instance||(u_.instance=new u_(e)),u_.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 fe("[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 fe("[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(),u_.instance=null}};u_.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},u_.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var FF=u_;Tn();var sRn=require("obsidian");var Sme=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=VG.getInstance(),this.client=Wi.getInstance(),this.postProcessor=new bme,this.wordCompletionManager=FF.getInstance(app.vault);let r=ae().autocompleteAcceptKey||hg.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=Ma(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ae().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){fe("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=yme({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(iqe.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){fe(`[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 wGt(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(iqe.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=xGt(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=ae();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(b=>b.word===c),m=f.some(b=>b.word.length-c.length>=2);if(p&&!m)return;let h=p?f.filter(b=>b.word!==c):f;if(h.length===0)return;try{let b=h.map(P=>P.word),g=o.slice(-1e3),y=a.slice(0,500),x,S,O;if(this.cacheEnabled&&(S=this.cache.generateWordKey(g,y,b),O=this.cache.get(S)),O)x=O;else{let P=this.client.wordcomplete(g,y,b);this.activeRequests.set(d,P),this.lastRequestTime=s,x=await P,this.cacheEnabled&&S&&this.cache.set(S,x),this.activeRequests.delete(d)}let E=x.response.selected_word;if(E&&E!==c){let P=this.generateCaseMatchedCompletion(E,c);P&&(yield{display_suggestion:P,complete_suggestion:P})}}catch(b){this.activeRequests.delete(d),fe("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",b);let g=h[0],y=this.generateCaseMatchedCompletion(g.word,c);y&&(yield{display_suggestion:y,complete_suggestion:y})}}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 xme.getInstance().getRelevantNotes(e.file));let m=e.file?.basename||"",h=m?`[[${m}]]:
|
||
|
||
${c}`:c,b,g,y;if(this.cacheEnabled&&(g=this.cache.generateSentenceKey(h,i,p),y=this.cache.get(g)),y)b=y;else{let O=this.client.autocomplete(h,i,p);this.activeRequests.set(d,O),this.lastRequestTime=s,b=await O,this.cacheEnabled&&g&&this.cache.set(g,b),this.activeRequests.delete(d)}let x=b.response.completion,S=this.detectContext(o);x=this.postProcessor.process(c,a,x,S),yield{display_suggestion:x,complete_suggestion:x}}catch(f){this.activeRequests.delete(d),fe("[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 Cme=class t{constructor(e){this.plugin=e;let r=ae();this.cmIntegration=Sme.getInstance({delay:hg.DELAY_MS,minTriggerLength:hg.MIN_TRIGGER_LENGTH,maxContextLength:hg.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=Ma((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){fe("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};Ur();on();I1();function CGt(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:Rp(),sender:n===Ei?Ei:mg,message:o.trim(),isVisible:!0,timestamp:i?Zve(i):null}),n=a.startsWith("**user**:")?Ei:mg,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:Rp(),sender:n===Ei?Ei:mg,message:o.trim(),isVisible:!0,timestamp:i?Zve(i):null}),r}async function OGt(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Ei){let o=t[r+1];o?.sender===mg&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}Us();td();var PGt=require("obsidian"),Ome=class extends PGt.Modal{constructor(r,n){super(r);this.placeholderText="Please enter your custom ad-hoc prompt here, press enter to send.";this.onSubmit=n}onOpen(){let{contentEl:r}=this,n=createFragment(i=>{i.createEl("strong",{text:"- {} represents the selected text (not required). "}),i.createEl("br"),i.createEl("strong",{text:"- {[[Note Title]]} represents a note. "}),i.createEl("br"),i.createEl("strong",{text:"- {activeNote} represents the active note. "}),i.createEl("br"),i.createEl("strong",{text:"- {FolderPath} represents a folder of notes. "}),i.createEl("br"),i.createEl("strong",{text:"- {#tag1, #tag2} represents ALL notes with ANY of the specified tags in their property (an OR operation). "}),i.createEl("br"),i.createEl("br"),i.appendText("Tip: turn on debug mode to show the processed prompt in the chat window."),i.createEl("br"),i.createEl("br")});r.appendChild(n);let o=r.createEl("textarea",{attr:{placeholder:this.placeholderText}});o.style.width="100%",o.style.height="100px",o.style.padding="10px",o.style.resize="vertical",o.addEventListener("input",i=>{this.result=i.target.value}),o.addEventListener("keydown",i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),this.close(),this.onSubmit(this.result))})}onClose(){let{contentEl:r}=this;r.empty()}};H9();var MR=require("obsidian"),Pme=class extends MR.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Debug: Search OramaDB"});let r=e.createEl("p");r.innerHTML='Enter a JSON search params object. Example:<br><pre>{<br> "term": "#tag",<br> "mode": "hybrid",<br> "limit": 10,<br> "includeVectors": true<br>}</pre>',this.searchInput=e.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Search",cls:"mod-cta"}).addEventListener("click",async()=>{try{let i=JSON.parse(this.searchInput.value);i.vector?.value&&!Array.isArray(i.vector.value)&&(i.vector.value=Object.values(i.vector.value));let a=await this.plugin.vectorStoreManager.getDb();if(!a){new MR.Notice("Database not found");return}let s=await xd(a,i),u=["## Search Parameters","```json",JSON.stringify(i,null,2),"```","","## Results",`Total hits: ${s.hits.length}`,"","### Hits","```json",JSON.stringify(s.hits,null,2),"```"].join(`
|
||
`),l="OramaDB-Debug-Search.md",c=this.app.vault.getAbstractFileByPath(l);c instanceof MR.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof MR.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new MR.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};on();var GG=require("obsidian"),Eme=class extends GG.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=e.createEl("textarea",{attr:{placeholder:`Enter note paths as markdown list:
|
||
- [[Note 1]]
|
||
- [[Note 2]]`,rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let o=this.searchInput.value,i=tb(o,this.app.vault).map(a=>a.path);if(i.length===0){new GG.Notice("No valid note paths found. Use format: - [[Note Name]]");return}try{let s=await(await this.plugin.vectorStoreManager.getDbOps()).getDocsJsonByPaths(i),u="CopilotDB-Search-Results.md",l=["## Searched Paths",...i.map(f=>`- [[${f}]]`),"","## Index Data","```json",JSON.stringify(s,null,2),"```"].join(`
|
||
`),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.vault.modify(c,l):await this.app.vault.create(u,l);let d=this.app.vault.getAbstractFileByPath(u);d&&await this.app.workspace.getLeaf().openFile(d),this.close()}catch(a){console.error("Error searching DB:",a),new GG.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var JG=require("obsidian"),Tme=class extends JG.Modal{constructor(r,n){super(r);this.filePaths="";this.onSubmit=n}onOpen(){let{contentEl:r}=this;r.createEl("h2",{text:"Remove Files from Copilot Index"});let n=r.createDiv({cls:"remove-files-container"});new JG.Setting(n).setName("File paths").setDesc("Paste the markdown list of file paths to remove from the index. You can get the list by running the command `List all indexed files`.").setClass("remove-files-setting").addTextArea(o=>o.setPlaceholder(`- [[path/to/file1.md]]
|
||
- [[path/to/file2.md]]`).setValue(this.filePaths).onChange(i=>{this.filePaths=i})),new JG.Setting(n).addButton(o=>o.setButtonText("Remove").setCta().onClick(()=>{let i=this.filePaths.split(`
|
||
`).map(a=>{let s=a.match(/\[\[(.*?)\]\]/);return s?s[1].trim():""}).filter(a=>a.length>0);this.onSubmit(i),this.close()})),r.createEl("style",{text:`
|
||
.remove-files-container {
|
||
width: 100%;
|
||
margin-top: 12px;
|
||
}
|
||
.remove-files-setting {
|
||
display: block;
|
||
}
|
||
.remove-files-setting .setting-item-control {
|
||
padding: 0;
|
||
}
|
||
.remove-files-setting textarea {
|
||
width: 100%;
|
||
height: 300px;
|
||
margin-top: 12px;
|
||
}
|
||
.remove-files-setting textarea::placeholder {
|
||
opacity: 0.5;
|
||
}
|
||
`})}onClose(){let{contentEl:r}=this;r.empty()}};Qg();er();var oa=require("obsidian");I1();Ur();var oJt=require("obsidian");di();var Ame=F(ee());$n();var si=Ame.forwardRef(({className:t,type:e,...r},n)=>Ame.createElement("input",{type:e,className:ve("!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}));si.displayName="Input";var Ime=F(ee());var RGt=F(ee(),1);var TGt=F(ee(),1),AGt=F(Cs(),1);var Rd=F(ee(),1);var EGt=F(ee(),1);function uRn(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function kF(...t){return e=>t.forEach(r=>uRn(r,e))}function zi(...t){return EGt.useCallback(kF(...t),t)}var B4=F(bt(),1),sqe=Rd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Rd.Children.toArray(r),i=o.find(cRn);if(i){let a=i.props.children,s=o.map(u=>u===i?Rd.Children.count(a)>1?Rd.Children.only(null):Rd.isValidElement(a)?a.props.children:null:u);return(0,B4.jsx)(aqe,{...n,ref:e,children:Rd.isValidElement(a)?Rd.cloneElement(a,void 0,s):null})}return(0,B4.jsx)(aqe,{...n,ref:e,children:r})});sqe.displayName="Slot";var aqe=Rd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Rd.isValidElement(r)){let o=fRn(r);return Rd.cloneElement(r,{...dRn(n,r.props),ref:e?kF(e,o):o})}return Rd.Children.count(r)>1?Rd.Children.only(null):null});aqe.displayName="SlotClone";var lRn=({children:t})=>(0,B4.jsx)(B4.Fragment,{children:t});function cRn(t){return Rd.isValidElement(t)&&t.type===lRn}function dRn(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 fRn(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 IGt=F(bt(),1),pRn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Po=pRn.reduce((t,e)=>{let r=TGt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?sqe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,IGt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function MGt(t,e){t&&AGt.flushSync(()=>t.dispatchEvent(e))}var NGt=F(bt(),1),mRn="Label",jGt=RGt.forwardRef((t,e)=>(0,NGt.jsx)(Po.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));jGt.displayName=mRn;var uqe=jGt;bQ();$n();var gRn=pz("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),Sp=Ime.forwardRef(({className:t,...e},r)=>Ime.createElement(uqe,{ref:r,className:ve(gRn(),t),...e}));Sp.displayName=uqe.displayName;var V4=F(ee());var $h=F(ee(),1);var LGt=F(ee(),1);function DGt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function lqe(...t){return e=>{let r=!1,n=t.map(o=>{let i=DGt(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():DGt(t[o],null)}}}}function FGt(...t){return LGt.useCallback(lqe(...t),t)}var Ey=F(ee(),1),cqe=F(bt(),1);function kGt(t,e){let r=Ey.createContext(e),n=i=>{let{children:a,...s}=i,u=Ey.useMemo(()=>s,Object.values(s));return(0,cqe.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=Ey.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 na(t,e=[]){let r=[];function n(i,a){let s=Ey.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=Ey.useMemo(()=>m,Object.values(m));return(0,cqe.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Ey.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>Ey.createContext(a));return function(s){let u=s?.[t]||i;return Ey.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,yRn(o,...e)]}function yRn(...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 Ey.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function dqe(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var RR=F(ee(),1);var U4=F(ee(),1);function Qr(t){let e=U4.useRef(t);return U4.useEffect(()=>{e.current=t}),U4.useMemo(()=>(...r)=>e.current?.(...r),[])}function Nd({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=bRn({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Qr(r),u=RR.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 bRn({defaultProp:t,onChange:e}){let r=RR.useState(t),[n]=r,o=RR.useRef(n),i=Qr(e);return RR.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var Mme=F(ee(),1);function q4(t){let e=Mme.useRef({value:t,previous:t});return Mme.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var zGt=F(ee(),1);var $Gt=F(ee(),1),uo=globalThis?.document?$Gt.useLayoutEffect:()=>{};function XC(t){let[e,r]=zGt.useState(void 0);return uo(()=>{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 Im=F(ee(),1);var UGt=F(ee(),1);function BGt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _Rn(...t){return e=>{let r=!1,n=t.map(o=>{let i=BGt(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():BGt(t[o],null)}}}}function qGt(...t){return UGt.useCallback(_Rn(...t),t)}var HGt=F(ee(),1);function vRn(t,e){return HGt.useReducer((r,n)=>e[r][n]??r,t)}var jd=t=>{let{present:e,children:r}=t,n=wRn(e),o=typeof r=="function"?r({present:n.isPresent}):Im.Children.only(r),i=qGt(n.ref,xRn(o));return typeof r=="function"||n.isPresent?Im.cloneElement(o,{ref:i}):null};jd.displayName="Presence";function wRn(t){let[e,r]=Im.useState(),n=Im.useRef({}),o=Im.useRef(t),i=Im.useRef("none"),a=t?"mounted":"unmounted",[s,u]=vRn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Im.useEffect(()=>{let l=Rme(n.current);i.current=s==="mounted"?l:"none"},[s]),uo(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Rme(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),uo(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Rme(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Rme(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:Im.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Rme(t){return t?.animationName||"none"}function xRn(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 VGt=F(ee(),1),ERn=F(Cs(),1);var Dd=F(ee(),1);var H4=F(bt(),1),pqe=Dd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Dd.Children.toArray(r),i=o.find(CRn);if(i){let a=i.props.children,s=o.map(u=>u===i?Dd.Children.count(a)>1?Dd.Children.only(null):Dd.isValidElement(a)?a.props.children:null:u);return(0,H4.jsx)(fqe,{...n,ref:e,children:Dd.isValidElement(a)?Dd.cloneElement(a,void 0,s):null})}return(0,H4.jsx)(fqe,{...n,ref:e,children:r})});pqe.displayName="Slot";var fqe=Dd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Dd.isValidElement(r)){let o=PRn(r);return Dd.cloneElement(r,{...ORn(n,r.props),ref:e?lqe(e,o):o})}return Dd.Children.count(r)>1?Dd.Children.only(null):null});fqe.displayName="SlotClone";var SRn=({children:t})=>(0,H4.jsx)(H4.Fragment,{children:t});function CRn(t){return Dd.isValidElement(t)&&t.type===SRn}function ORn(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 PRn(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 WGt=F(bt(),1),TRn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],mqe=TRn.reduce((t,e)=>{let r=VGt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?pqe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,WGt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var jR=F(bt(),1),hqe="Checkbox",[ARn,zPi]=na(hqe),[IRn,MRn]=ARn(hqe),KGt=$h.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]=$h.useState(null),m=FGt(e,S=>p(S)),h=$h.useRef(!1),b=f?c||!!f.closest("form"):!0,[g=!1,y]=Nd({prop:o,defaultProp:i,onChange:l}),x=$h.useRef(g);return $h.useEffect(()=>{let S=f?.form;if(S){let O=()=>y(x.current);return S.addEventListener("reset",O),()=>S.removeEventListener("reset",O)}},[f,y]),(0,jR.jsxs)(IRn,{scope:r,state:g,disabled:s,children:[(0,jR.jsx)(mqe.button,{type:"button",role:"checkbox","aria-checked":NR(g)?"mixed":g,"aria-required":a,"data-state":ZGt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:dqe(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:dqe(t.onClick,S=>{y(O=>NR(O)?!0:!O),b&&(h.current=S.isPropagationStopped(),h.current||S.stopPropagation())})}),b&&(0,jR.jsx)(RRn,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:NR(i)?!1:i})]})});KGt.displayName=hqe;var GGt="CheckboxIndicator",JGt=$h.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=MRn(GGt,r);return(0,jR.jsx)(jd,{present:n||NR(i.state)||i.state===!0,children:(0,jR.jsx)(mqe.span,{"data-state":ZGt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});JGt.displayName=GGt;var RRn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=$h.useRef(null),s=q4(r),u=XC(e);$h.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=NR(r),p.call(c,NR(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=$h.useRef(NR(r)?!1:r);return(0,jR.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 NR(t){return t==="indeterminate"}function ZGt(t){return NR(t)?"indeterminate":t?"checked":"unchecked"}var gqe=KGt,YGt=JGt;An();$n();var Ld=V4.forwardRef(({className:t,...e},r)=>V4.createElement(gqe,{ref:r,className:ve("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},V4.createElement(YGt,{className:ve("tw-flex tw-items-center tw-justify-center tw-text-current")},V4.createElement(gc,{className:"tw-size-4"}))));Ld.displayName=gqe.displayName;var Ty=F(ee());$n();var dT=Ty.forwardRef(({className:t,value:e,...r},n)=>{let o=Ty.useRef(null),i=Ty.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);Ty.useLayoutEffect(()=>{i()},[e,i]),Ty.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 Ty.createElement("textarea",{className:ve("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})});dT.displayName="Textarea";var ui=F(ee()),iJt=F(id());er();var QC=F(ee());on();An();Ur();var yqe=({capabilities:t=[],iconSize:e=16})=>QC.default.createElement(QC.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return QC.default.createElement(oP,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return QC.default.createElement(nP,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return QC.default.createElement(KN,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),bqe=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return QC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},QC.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&QC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},QC.default.createElement(yqe,{capabilities:t.capabilities,iconSize:e})))},Nme=t=>{let e=t.displayName||t.name,r=`(${op(t.provider)})`;return`${e} ${r}`},ZG=t=>{let e=t.displayName||t.name,r=`(${op(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}`};$n();An();Tn();var eO=F(ee());function XGt(){return eO.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},eO.default.createElement("li",null,eO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),eO.default.createElement("li",null,eO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),eO.default.createElement("li",null,eO.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),eO.default.createElement("li",null,eO.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 _qe="{copilot-selection}";var tO={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},fT="copilot-command-context-menu-enabled",pT="copilot-command-slash-enabled",rO="copilot-command-context-menu-order",mT="copilot-command-model-key",hT="copilot-command-last-used",QGt=[{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 W4=require("obsidian");er();a6();a6();var $F=S$(),zF=cg([]),vqe=new Set;function BF(t){vqe.add(t)}function UF(t){vqe.delete(t)}function YG(t){return vqe.has(t)}function XG(t){let e=$F.get(zF);$F.set(zF,e.filter(r=>r.title!==t))}function qF(t,e){let r=$F.get(zF),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],$F.set(zF,n)}function jme(t){$F.set(zF,t)}function eJt(){return o6(zF,{store:$F})}function Mm(){return $F.get(zF)}d6();on();Ur();function Dme(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 K4(t){return encodeURIComponent(t.toLowerCase())}function DR(){return(0,W4.normalizePath)(ae().customPromptsFolder)}function G4(t){return`${DR()}/${t}.md`}function J4(t){if(!(t instanceof W4.TFile)||t.extension!=="md")return!1;let e=DR();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function jRn(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}function tJt(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[rO]!=null}async function QG(t){let e=await app.vault.read(t),r=jRn(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[fT]??tO.showInContextMenu,i=n?.frontmatter?.[pT]??tO.showInSlashMenu,a=n?.frontmatter?.[hT]??tO.lastUsedMs,s=n?.frontmatter?.[rO]??tO.order,u=n?.frontmatter?.[mT]??tO.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function Lme(){let t=app.vault.getFiles().filter(r=>J4(r)),e=await Promise.all(t.map(QG));return jme(e),e}function eJ(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function DRn(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function LRn(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function rJt(t){switch(ae().promptSortStrategy){case"timestamp":return DRn(t);case"alphabetical":return LRn(t);case"manual":return eJ(t);default:return t}}async function wqe(t,e,r=!1){let o=(await tJ(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes("{selectedText}")||r)return o;let i=o.indexOf(_qe);return i===-1&&e.trim()?o+`
|
||
|
||
<selectedText>`+e+"</selectedText>":o.slice(0,i)+e+o.slice(i+_qe.length)}var FRn=/\{(?!copilot-selection\})([^}]+)\}/g;async function kRn(t,e,r){let n=new Map,o=new Set,i;for(;(i=FRn.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await E$(r,e);u&&(s.content=`## ${DY(r)}
|
||
|
||
${u}`,s.files.push(r))}else new W4.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await OGe(e,u),c=[];for(let d of l){let f=await E$(d,e);f&&(c.push(`## ${DY(d)}
|
||
|
||
${f}`),s.files.push(d))}s.content=c.join(`
|
||
|
||
`)}else{let u=TGe(a),l=await Jve(e,u),c=[];for(let d of l){let f=await E$(d,e);f&&(c.push(`## ${DY(d)}
|
||
|
||
${f}`),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 tJ(t,e,r,n){let o=ae(),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 kRn(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,"{selectedText}"),e?l+=`selectedText:
|
||
|
||
${e}`:n?(c=await E$(n,r),l+=`selectedText (entire active note):
|
||
|
||
${c}`,i.add(n)):l+=`selectedText:
|
||
|
||
(No selected text or active note available)`);for(let[f,p]of a.entries())f.toLowerCase()==="activenote"&&c!==null||(l?l+=`
|
||
|
||
${f}:
|
||
|
||
${p}`:l+=`${f}:
|
||
|
||
${p}`);let d=tb(u,r);for(let f of d)if(!i.has(f)){let p=await E$(f,r);if(p){let m=`<${f6}>
|
||
Title: [[${f.basename}]]
|
||
Path: ${f.path}
|
||
|
||
${p}
|
||
</${f6}>`;l&&(l+=`
|
||
|
||
`),l+=`${m}`,i.add(f)}}return{processedPrompt:l?`${u}
|
||
|
||
${l}`:`${u}
|
||
|
||
`,includedFiles:Array.from(i)}}function nJt(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 Fme(){let e=Mm().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function xqe(t,e){try{BF(t.path),await app.fileManager.processFrontMatter(t,r=>{r[fT]==null&&(r[fT]=e.showInContextMenu),r[pT]==null&&(r[pT]=e.showInSlashMenu),r[rO]==null&&(r[rO]=e.order),r[mT]==null&&(r[mT]=e.modelKey),r[hT]==null&&(r[hT]=e.lastUsedMs)})}finally{UF(t.path)}}function $Rn({commands:t,command:e,onConfirm:r,onCancel:n}){let i=Hn().activeModels.filter(f=>f.enabled).map(f=>({label:Nme(f),value:Yr(f)})),[a,s]=(0,ui.useState)(e),[u,l]=(0,ui.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=Dme(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 ui.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},ui.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ui.default.createElement(Sp,{htmlFor:"title"},"Name"),ui.default.createElement(si,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&ui.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),ui.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ui.default.createElement(Sp,{htmlFor:"content"},"Prompt"),ui.default.createElement(XGt,null),ui.default.createElement(dT,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&ui.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),ui.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ui.default.createElement(Sp,{htmlFor:"modelKey"},"Model (Optional)"),ui.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},ui.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(h=>h.value===p)){fe(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:ve("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")},ui.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>ui.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),ui.default.createElement("div",{className:ve("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")},ui.default.createElement(Xi,{className:"tw-size-4"})))),ui.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ui.default.createElement(Ld,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),ui.default.createElement(Sp,{htmlFor:"showInContextMenu"},"Show in context menu")),ui.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ui.default.createElement(Ld,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),ui.default.createElement(Sp,{htmlFor:"showInSlashMenu"},"Show in slash menu")),ui.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},ui.default.createElement(be,{variant:"secondary",onClick:n},"Cancel"),ui.default.createElement(be,{variant:"default",onClick:d},"Save")))}var HF=class extends oJt.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,iJt.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(ui.default.createElement($Rn,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var rJ=require("obsidian");BA();var Fd=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=G4(e.title);try{BF(o);let i=e.order;n.autoOrder&&(i=Fme()),e={...e,order:i};let a=DR();await app.vault.adapter.exists(a)||await app.vault.createFolder(a);let u=app.vault.getAbstractFileByPath(o);!u||!(u instanceof rJ.TFile)?u=await app.vault.create(o,e.content):await app.vault.modify(u,e.content),await app.fileManager.processFrontMatter(u,l=>{l[fT]=e.showInContextMenu,l[pT]=e.showInSlashMenu,l[rO]=e.order,l[mT]=e.modelKey,l[hT]=e.lastUsedMs}),n.skipStoreUpdate||qF(e,e.title)}finally{UF(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=G4(e.title),i=G4(r),a=e.title!==r;try{BF(o),a&&BF(i),n||qF(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new Hr("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof rJ.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(G4(e.title))),s instanceof rJ.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[fT]=e.showInContextMenu,u[pT]=e.showInSlashMenu,u[rO]=e.order,u[mT]=e.modelKey,u[hT]=e.lastUsedMs}))}finally{UF(o),a&&UF(i)}}async updateCommands(e){jme(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=G4(e.title);try{BF(r),XG(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof rJ.TFile&&await app.vault.delete(n)}finally{UF(r)}}};function kd(t,e,r){t.addCommand({id:e,name:awe[e],callback:r})}function aJt(t,e,r){t.addCommand({id:e,name:awe[e],editorCallback:r})}function Sqe(t,e,r){aJt(t,qr.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 oa.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),kd(t,qr.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await S$t(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new oa.Notice(`Total tokens in your vault: ${o}`)}catch(n){console.error("Error counting tokens: ",n),new oa.Notice("An error occurred while counting tokens.")}}),kd(t,qr.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),kd(t,qr.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),kd(t,qr.NEW_CHAT,()=>{t.newChat()}),kd(t,qr.APPLY_ADHOC_PROMPT,async()=>{new Ome(t.app,async o=>{try{t.processCustomPrompt(qr.APPLY_ADHOC_PROMPT,o)}catch(i){console.error(i),new oa.Notice("An error occurred.")}}).open()}),kd(t,qr.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),kd(t,qr.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.garbageCollectVectorStore();new oa.Notice(`${n} documents removed from Copilot index.`)}catch(n){console.error("Error garbage collecting the Copilot index:",n),new oa.Notice("An error occurred while garbage collecting the Copilot index.")}}),kd(t,qr.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore();new oa.Notice(`${n} vault files indexed to Copilot index.`)}catch(n){console.error("Error indexing vault to Copilot index:",n),new oa.Notice("An error occurred while indexing vault to Copilot index.")}}),kd(t,qr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore(!0);new oa.Notice(`${n} vault files re-indexed to Copilot index.`)}catch(n){console.error("Error re-indexing vault to Copilot index:",n),new oa.Notice("An error occurred while re-indexing vault to Copilot index.")}}),kd(t,qr.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),kd(t,qr.LIST_INDEXED_FILES,async()=>{try{let n=await t.vectorStoreManager.getIndexedFiles(),o=new Set(n),i=t.app.vault.getMarkdownFiles(),a=new Set,s=new Set,u=new Set,l=await t.vectorStoreManager.getDbOps();for(let h of i){let b=await t.app.vault.cachedRead(h);!b||b.trim().length===0?a.add(h.path):o.has(h.path)?await l.hasEmbeddings(h.path)||u.add(h.path):s.add(h.path)}if(n.length===0&&a.size===0&&s.size===0){new oa.Notice("No files found to list.");return}let c=["# Copilot Files Status",`- Indexed files: ${n.length}`,` - Files missing embeddings: ${u.size}`,`- Unindexed files: ${s.size}`,`- Empty files: ${a.size}`,"","## Indexed Files",...n.map(h=>{let b=u.has(h);return`- [[${h}]]${b?" *(embedding missing)*":""}`}),"","## Unindexed Files",...s.size>0?Array.from(s).sort().map(h=>`- [[${h}]]`):["No unindexed files found."],"","## Empty Files",...a.size>0?Array.from(a).sort().map(h=>`- [[${h}]]`):["No empty files found."]].join(`
|
||
`),f=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,p=t.app.vault.getAbstractFileByPath(f);p instanceof oa.TFile?await t.app.vault.modify(p,c):await t.app.vault.create(f,c);let m=t.app.vault.getAbstractFileByPath(f);m instanceof oa.TFile&&(await t.app.workspace.getLeaf().openFile(m),new oa.Notice(`Listed ${n.length} indexed files`))}catch(n){console.error("Error listing indexed files:",n),new oa.Notice("Failed to list indexed files.")}}),r.debug&&(kd(t,qr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new Eme(t.app,t).open()}),kd(t,qr.SEARCH_ORAMA_DB,()=>{new Pme(t.app,t).open()}),kd(t,qr.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new Tme(t.app,async n=>{let o=await t.vectorStoreManager.getDbOps();try{for(let i of n)await o.removeDocs(i);await o.saveDB(),new oa.Notice(`Successfully removed ${n.length} files from the index.`)}catch(i){console.error("Error removing files from index:",i),new oa.Notice("An error occurred while removing files from the index.")}}).open()})),kd(t,qr.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await zb.getInstance().clearAllCache(),await Nq.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(JUe(),fGt));o.getInstance().clear(),new oa.Notice("All Copilot caches cleared successfully")}catch(n){console.error("Error clearing Copilot caches:",n),new oa.Notice("Failed to clear Copilot caches")}}),kd(t,qr.TOGGLE_AUTOCOMPLETE,()=>{let o=!ae().enableAutocomplete;ht("enableAutocomplete",o),new oa.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),aJt(t,qr.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=bg();if(o!=="copilot_plus"&&o!=="project"){new oa.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new oa.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new oa.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new oa.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:Rp(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};gJe(c),t.activateView()}),kd(t,qr.ADD_CUSTOM_COMMAND,async()=>{let n=Mm(),o={...tO};new HF(t.app,n,o,async a=>{await Fd.getInstance().createCommand(a)}).open()})}Us();td();Us();td();di();var sJt=require("obsidian"),VF=F(ee()),uJt=F(id());function zRn({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return VF.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},VF.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),VF.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&VF.default.createElement(be,{variant:"secondary",onClick:r},o),n&&VF.default.createElement(be,{variant:"default",onClick:e},n)))}var $d=class extends sJt.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,uJt.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(VF.default.createElement(zRn,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};di();var Gi=F(ee());var ac=F(ee(),1);function nJ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var BRn=F(ee(),1);function lJt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function kme(...t){return e=>{let r=!1,n=t.map(o=>{let i=lJt(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():lJt(t[o],null)}}}}var cJt=F(ee(),1),WRn=F(Cs(),1);var zd=F(ee(),1);var Z4=F(bt(),1),Oqe=zd.forwardRef((t,e)=>{let{children:r,...n}=t,o=zd.Children.toArray(r),i=o.find(qRn);if(i){let a=i.props.children,s=o.map(u=>u===i?zd.Children.count(a)>1?zd.Children.only(null):zd.isValidElement(a)?a.props.children:null:u);return(0,Z4.jsx)(Cqe,{...n,ref:e,children:zd.isValidElement(a)?zd.cloneElement(a,void 0,s):null})}return(0,Z4.jsx)(Cqe,{...n,ref:e,children:r})});Oqe.displayName="Slot";var Cqe=zd.forwardRef((t,e)=>{let{children:r,...n}=t;if(zd.isValidElement(r)){let o=VRn(r);return zd.cloneElement(r,{...HRn(n,r.props),ref:e?kme(e,o):o})}return zd.Children.count(r)>1?zd.Children.only(null):null});Cqe.displayName="SlotClone";var URn=({children:t})=>(0,Z4.jsx)(Z4.Fragment,{children:t});function qRn(t){return zd.isValidElement(t)&&t.type===URn}function HRn(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 VRn(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 dJt=F(bt(),1),KRn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],fJt=KRn.reduce((t,e)=>{let r=cJt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Oqe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,dJt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Zt=F(ee(),1);function ia(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var FR=F(ee(),1);var mJt=F(ee(),1);function pJt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function oJ(...t){return e=>{let r=!1,n=t.map(o=>{let i=pJt(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():pJt(t[o],null)}}}}function Bd(...t){return mJt.useCallback(oJ(...t),t)}var Ud=F(ee(),1);var Y4=F(bt(),1),LR=Ud.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ud.Children.toArray(r),i=o.find(JRn);if(i){let a=i.props.children,s=o.map(u=>u===i?Ud.Children.count(a)>1?Ud.Children.only(null):Ud.isValidElement(a)?a.props.children:null:u);return(0,Y4.jsx)(Pqe,{...n,ref:e,children:Ud.isValidElement(a)?Ud.cloneElement(a,void 0,s):null})}return(0,Y4.jsx)(Pqe,{...n,ref:e,children:r})});LR.displayName="Slot";var Pqe=Ud.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ud.isValidElement(r)){let o=YRn(r);return Ud.cloneElement(r,{...ZRn(n,r.props),ref:e?oJ(e,o):o})}return Ud.Children.count(r)>1?Ud.Children.only(null):null});Pqe.displayName="SlotClone";var GRn=({children:t})=>(0,Y4.jsx)(Y4.Fragment,{children:t});function JRn(t){return Ud.isValidElement(t)&&t.type===GRn}function ZRn(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 YRn(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 $me=F(bt(),1);function hJt(t){let e=t+"CollectionProvider",[r,n]=na(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=FR.default.useRef(null),g=FR.default.useRef(new Map).current;return(0,$me.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=FR.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=Bd(m,g.collectionRef);return(0,$me.jsx)(LR,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=FR.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=FR.default.useRef(null),x=Bd(m,y),S=i(l,h);return FR.default.useEffect(()=>(S.itemMap.set(y,{ref:y,...g}),()=>void S.itemMap.delete(y))),(0,$me.jsx)(LR,{[c]:"",ref:x,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return FR.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,O)=>g.indexOf(S.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var zme=F(ee(),1),XRn=F(bt(),1),QRn=zme.createContext(void 0);function kR(t){let e=zme.useContext(QRn);return t||e||"ltr"}var ds=F(ee(),1);var gJt=F(ee(),1),yJt=F(Cs(),1);var bJt=F(bt(),1),e1n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Uc=e1n.reduce((t,e)=>{let r=gJt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?LR:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,bJt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Bme(t,e){t&&yJt.flushSync(()=>t.dispatchEvent(e))}var _Jt=F(ee(),1);function $R(t,e=globalThis?.document){let r=Qr(t);_Jt.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 Tqe=F(bt(),1),t1n="DismissableLayer",Eqe="dismissableLayer.update",r1n="dismissableLayer.pointerDownOutside",n1n="dismissableLayer.focusOutside",vJt,xJt=ds.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Aqe=ds.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=ds.useContext(xJt),[c,d]=ds.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=ds.useState({}),m=Bd(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=y>=g,O=a1n(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=s1n(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return $R(P=>{y===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),ds.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(vJt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),wJt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=vJt)}},[c,f,r,l]),ds.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),wJt())},[c,l]),ds.useEffect(()=>{let P=()=>p({});return document.addEventListener(Eqe,P),()=>document.removeEventListener(Eqe,P)},[]),(0,Tqe.jsx)(Uc.div,{...u,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:ia(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ia(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ia(t.onPointerDownCapture,O.onPointerDownCapture)})});Aqe.displayName=t1n;var o1n="DismissableLayerBranch",i1n=ds.forwardRef((t,e)=>{let r=ds.useContext(xJt),n=ds.useRef(null),o=Bd(e,n);return ds.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,Tqe.jsx)(Uc.div,{...t,ref:o})});i1n.displayName=o1n;function a1n(t,e=globalThis?.document){let r=Qr(t),n=ds.useRef(!1),o=ds.useRef(()=>{});return ds.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){SJt(r1n,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 s1n(t,e=globalThis?.document){let r=Qr(t),n=ds.useRef(!1);return ds.useEffect(()=>{let o=i=>{i.target&&!n.current&&SJt(n1n,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 wJt(){let t=new CustomEvent(Eqe);document.dispatchEvent(t)}function SJt(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?Bme(o,i):o.dispatchEvent(i)}var OJt=F(ee(),1),Iqe=0;function zR(){OJt.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??CJt()),document.body.insertAdjacentElement("beforeend",t[1]??CJt()),Iqe++,()=>{Iqe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Iqe--}},[])}function CJt(){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 Ay=F(ee(),1);var IJt=F(bt(),1),Mqe="focusScope.autoFocusOnMount",Rqe="focusScope.autoFocusOnUnmount",PJt={bubbles:!1,cancelable:!0},u1n="FocusScope",Nqe=Ay.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Ay.useState(null),l=Qr(o),c=Qr(i),d=Ay.useRef(null),f=Bd(e,h=>u(h)),p=Ay.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Ay.useEffect(()=>{if(n){let y=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:BR(d.current,{select:!0})},x=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||BR(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&BR(s)};var h=y,b=x,g=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);let O=new MutationObserver(S);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),O.disconnect()}}},[n,s,p.paused]),Ay.useEffect(()=>{if(s){TJt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(Mqe,PJt);s.addEventListener(Mqe,l),s.dispatchEvent(g),g.defaultPrevented||(l1n(m1n(MJt(s)),{select:!0}),document.activeElement===h&&BR(s))}return()=>{s.removeEventListener(Mqe,l),setTimeout(()=>{let g=new CustomEvent(Rqe,PJt);s.addEventListener(Rqe,c),s.dispatchEvent(g),g.defaultPrevented||BR(h??document.body,{select:!0}),s.removeEventListener(Rqe,c),TJt.remove(p)},0)}}},[s,l,c,p]);let m=Ay.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[x,S]=c1n(y);x&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&BR(x,{select:!0})):h.shiftKey&&g===x&&(h.preventDefault(),r&&BR(S,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,IJt.jsx)(Uc.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});Nqe.displayName=u1n;function l1n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(BR(n,{select:e}),document.activeElement!==r)return}function c1n(t){let e=MJt(t),r=EJt(e,t),n=EJt(e.reverse(),t);return[r,n]}function MJt(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 EJt(t,e){for(let r of t)if(!d1n(r,{upTo:e}))return r}function d1n(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 f1n(t){return t instanceof HTMLInputElement&&"select"in t}function BR(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&f1n(t)&&e&&t.select()}}var TJt=p1n();function p1n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=AJt(t,e),t.unshift(e)},remove(e){t=AJt(t,e),t[0]?.resume()}}}function AJt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function m1n(t){return t.filter(e=>e.tagName!=="A")}var Ume=F(ee(),1);var h1n=Ume.useId||(()=>{}),g1n=0;function Rl(t){let[e,r]=Ume.useState(h1n());return uo(()=>{t||r(n=>n??String(g1n++))},[t]),t||(e?`radix-${e}`:"")}var zh=F(ee(),1);var RJt=["top","right","bottom","left"];var nO=Math.min,Cp=Math.max,aJ=Math.round,sJ=Math.floor,l_=t=>({x:t,y:t}),y1n={left:"right",right:"left",bottom:"top",top:"bottom"},b1n={start:"end",end:"start"};function Hme(t,e,r){return Cp(t,nO(e,r))}function oO(t,e){return typeof t=="function"?t(e):t}function iO(t){return t.split("-")[0]}function WF(t){return t.split("-")[1]}function Vme(t){return t==="x"?"y":"x"}function Wme(t){return t==="y"?"height":"width"}function gT(t){return["top","bottom"].includes(iO(t))?"y":"x"}function Kme(t){return Vme(gT(t))}function NJt(t,e,r){r===void 0&&(r=!1);let n=WF(t),o=Kme(t),i=Wme(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=iJ(a)),[a,iJ(a)]}function jJt(t){let e=iJ(t);return[qme(t),e,qme(e)]}function qme(t){return t.replace(/start|end/g,e=>b1n[e])}function _1n(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 DJt(t,e,r,n){let o=WF(t),i=_1n(iO(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(qme)))),i}function iJ(t){return t.replace(/left|right|bottom|top/g,e=>y1n[e])}function v1n(t){return{top:0,right:0,bottom:0,left:0,...t}}function jqe(t){return typeof t!="number"?v1n(t):{top:t,right:t,bottom:t,left:t}}function KF(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 LJt(t,e,r){let{reference:n,floating:o}=t,i=gT(e),a=Kme(e),s=Wme(a),u=iO(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(WF(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var $Jt=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}=LJt(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:b,fn:g}=s[h],{x:y,y:x,data:S,reset:O}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=y??c,d=x??d,p={...p,[b]:{...p[b],...S}},O&&m<=50&&(m++,typeof O=="object"&&(O.placement&&(f=O.placement),O.rects&&(l=O.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:c,y:d}=LJt(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function X4(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}=oO(e,t),m=jqe(p),b=s[f?d==="floating"?"reference":"floating":d],g=KF(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(b)))==null||r?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),y=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),S=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},O=KF(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:x,strategy:u}):y);return{top:(g.top-O.top+m.top)/S.y,bottom:(O.bottom-g.bottom+m.bottom)/S.y,left:(g.left-O.left+m.left)/S.x,right:(O.right-g.right+m.right)/S.x}}var zJt=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}=oO(t,e)||{};if(l==null)return{};let d=jqe(c),f={x:r,y:n},p=Kme(o),m=Wme(p),h=await a.getDimensions(l),b=p==="y",g=b?"top":"left",y=b?"bottom":"right",x=b?"clientHeight":"clientWidth",S=i.reference[m]+i.reference[p]-f[p]-i.floating[m],O=f[p]-i.reference[p],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),P=E?E[x]:0;(!P||!await(a.isElement==null?void 0:a.isElement(E)))&&(P=s.floating[x]||i.floating[m]);let A=S/2-O/2,I=P/2-h[m]/2-1,R=nO(d[g],I),N=nO(d[y],I),j=R,$=P-h[m]-N,k=P/2-h[m]/2+A,H=Hme(j,k,$),V=!u.arrow&&WF(o)!=null&&k!==H&&i.reference[m]/2-(k<j?R:N)-h[m]/2<0,Q=V?k<j?k-j:k-$:0;return{[p]:f[p]+Q,data:{[p]:H,centerOffset:k-H-Q,...V&&{alignmentOffset:Q}},reset:V}}});var BJt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...b}=oO(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=iO(o),y=gT(s),x=iO(s)===s,S=await(u.isRTL==null?void 0:u.isRTL(l.floating)),O=f||(x||!h?[iJ(s)]:jJt(s)),E=m!=="none";!f&&E&&O.push(...DJt(s,h,m,S));let P=[s,...O],A=await X4(e,b),I=[],R=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(A[g]),d){let k=NJt(o,a,S);I.push(A[k[0]],A[k[1]])}if(R=[...R,{placement:o,overflows:I}],!I.every(k=>k<=0)){var N,j;let k=(((N=i.flip)==null?void 0:N.index)||0)+1,H=P[k];if(H)return{data:{index:k,overflows:R},reset:{placement:H}};let V=(j=R.filter(Q=>Q.overflows[0]<=0).sort((Q,Z)=>Q.overflows[1]-Z.overflows[1])[0])==null?void 0:j.placement;if(!V)switch(p){case"bestFit":{var $;let Q=($=R.filter(Z=>{if(E){let D=gT(Z.placement);return D===y||D==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((Z,D)=>Z[1]-D[1])[0])==null?void 0:$[0];Q&&(V=Q);break}case"initialPlacement":V=s;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function FJt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function kJt(t){return RJt.some(e=>t[e]>=0)}var UJt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=oO(t,e);switch(n){case"referenceHidden":{let i=await X4(e,{...o,elementContext:"reference"}),a=FJt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:kJt(a)}}}case"escaped":{let i=await X4(e,{...o,altBoundary:!0}),a=FJt(i,r.floating);return{data:{escapedOffsets:a,escaped:kJt(a)}}}default:return{}}}}};async function w1n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=iO(r),s=WF(r),u=gT(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=oO(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var qJt=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 w1n(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}}}}},HJt=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:b=>{let{x:g,y}=b;return{x:g,y}}},...u}=oO(t,e),l={x:r,y:n},c=await X4(e,u),d=gT(iO(o)),f=Vme(d),p=l[f],m=l[d];if(i){let b=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=p+c[b],x=p-c[g];p=Hme(y,p,x)}if(a){let b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",y=m+c[b],x=m-c[g];m=Hme(y,m,x)}let h=s.fn({...e,[f]:p,[d]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:i,[d]:a}}}}}},VJt=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}=oO(t,e),c={x:r,y:n},d=gT(o),f=Vme(d),p=c[f],m=c[d],h=oO(s,e),b=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let x=f==="y"?"height":"width",S=i.reference[f]-i.floating[x]+b.mainAxis,O=i.reference[f]+i.reference[x]-b.mainAxis;p<S?p=S:p>O&&(p=O)}if(l){var g,y;let x=f==="y"?"width":"height",S=["top","left"].includes(iO(o)),O=i.reference[d]-i.floating[x]+(S&&((g=a.offset)==null?void 0:g[d])||0)+(S?0:b.crossAxis),E=i.reference[d]+i.reference[x]+(S?0:((y=a.offset)==null?void 0:y[d])||0)-(S?b.crossAxis:0);m<O?m=O:m>E&&(m=E)}return{[f]:p,[d]:m}}}},WJt=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}=oO(t,e),c=await X4(e,l),d=iO(o),f=WF(o),p=gT(o)==="y",{width:m,height:h}=i.floating,b,g;d==="top"||d==="bottom"?(b=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,b=f==="end"?"top":"bottom");let y=h-c.top-c.bottom,x=m-c.left-c.right,S=nO(h-c[b],y),O=nO(m-c[g],x),E=!e.middlewareData.shift,P=S,A=O;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=x),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(P=y),E&&!f){let R=Cp(c.left,0),N=Cp(c.right,0),j=Cp(c.top,0),$=Cp(c.bottom,0);p?A=m-2*(R!==0||N!==0?R+N:Cp(c.left,c.right)):P=h-2*(j!==0||$!==0?j+$:Cp(c.top,c.bottom))}await u({...e,availableWidth:A,availableHeight:P});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function Gme(){return typeof window<"u"}function JF(t){return GJt(t)?(t.nodeName||"").toLowerCase():"#document"}function Rm(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function c_(t){var e;return(e=(GJt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function GJt(t){return Gme()?t instanceof Node||t instanceof Rm(t).Node:!1}function Iy(t){return Gme()?t instanceof Element||t instanceof Rm(t).Element:!1}function d_(t){return Gme()?t instanceof HTMLElement||t instanceof Rm(t).HTMLElement:!1}function KJt(t){return!Gme()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Rm(t).ShadowRoot}function Q4(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=My(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function JJt(t){return["table","td","th"].includes(JF(t))}function uJ(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Jme(t){let e=Zme(),r=Iy(t)?My(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 ZJt(t){let e=yT(t);for(;d_(e)&&!ZF(e);){if(Jme(e))return e;if(uJ(e))return null;e=yT(e)}return null}function Zme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ZF(t){return["html","body","#document"].includes(JF(t))}function My(t){return Rm(t).getComputedStyle(t)}function lJ(t){return Iy(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function yT(t){if(JF(t)==="html")return t;let e=t.assignedSlot||t.parentNode||KJt(t)&&t.host||c_(t);return KJt(e)?e.host:e}function YJt(t){let e=yT(t);return ZF(e)?t.ownerDocument?t.ownerDocument.body:t.body:d_(e)&&Q4(e)?e:YJt(e)}function GF(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=YJt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=Rm(o);if(i){let s=Yme(a);return e.concat(a,a.visualViewport||[],Q4(o)?o:[],s&&r?GF(s):[])}return e.concat(o,GF(o,[],r))}function Yme(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function e7t(t){let e=My(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=d_(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=aJ(r)!==i||aJ(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function Lqe(t){return Iy(t)?t:t.contextElement}function e3(t){let e=Lqe(t);if(!d_(e))return l_(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=e7t(e),a=(i?aJ(r.width):r.width)/n,s=(i?aJ(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var x1n=l_(0);function t7t(t){let e=Rm(t);return!Zme()||!e.visualViewport?x1n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function S1n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Rm(t)?!1:e}function YF(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=Lqe(t),a=l_(1);e&&(n?Iy(n)&&(a=e3(n)):a=e3(t));let s=S1n(i,r,n)?t7t(i):l_(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=Rm(i),p=n&&Iy(n)?Rm(n):n,m=f,h=Yme(m);for(;h&&n&&p!==m;){let b=e3(h),g=h.getBoundingClientRect(),y=My(h),x=g.left+(h.clientLeft+parseFloat(y.paddingLeft))*b.x,S=g.top+(h.clientTop+parseFloat(y.paddingTop))*b.y;u*=b.x,l*=b.y,c*=b.x,d*=b.y,u+=x,l+=S,m=Rm(h),h=Yme(m)}}return KF({width:c,height:d,x:u,y:l})}function Fqe(t,e){let r=lJ(t).scrollLeft;return e?e.left+r:YF(c_(t)).left+r}function r7t(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:Fqe(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function C1n(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=c_(n),s=e?uJ(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=l_(1),c=l_(0),d=d_(n);if((d||!d&&!i)&&((JF(n)!=="body"||Q4(a))&&(u=lJ(n)),d_(n))){let p=YF(n);l=e3(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?r7t(a,u,!0):l_(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 O1n(t){return Array.from(t.getClientRects())}function P1n(t){let e=c_(t),r=lJ(t),n=t.ownerDocument.body,o=Cp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Cp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+Fqe(t),s=-r.scrollTop;return My(n).direction==="rtl"&&(a+=Cp(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function E1n(t,e){let r=Rm(t),n=c_(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Zme();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function T1n(t,e){let r=YF(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=d_(t)?e3(t):l_(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 XJt(t,e,r){let n;if(e==="viewport")n=E1n(t,r);else if(e==="document")n=P1n(c_(t));else if(Iy(e))n=T1n(e,r);else{let o=t7t(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return KF(n)}function n7t(t,e){let r=yT(t);return r===e||!Iy(r)||ZF(r)?!1:My(r).position==="fixed"||n7t(r,e)}function A1n(t,e){let r=e.get(t);if(r)return r;let n=GF(t,[],!1).filter(s=>Iy(s)&&JF(s)!=="body"),o=null,i=My(t).position==="fixed",a=i?yT(t):t;for(;Iy(a)&&!ZF(a);){let s=My(a),u=Jme(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Q4(a)&&!u&&n7t(t,a))?n=n.filter(c=>c!==a):o=s,a=yT(a)}return e.set(t,n),n}function I1n(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?uJ(e)?[]:A1n(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=XJt(e,c,o);return l.top=Cp(d.top,l.top),l.right=nO(d.right,l.right),l.bottom=nO(d.bottom,l.bottom),l.left=Cp(d.left,l.left),l},XJt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function M1n(t){let{width:e,height:r}=e7t(t);return{width:e,height:r}}function R1n(t,e,r){let n=d_(e),o=c_(e),i=r==="fixed",a=YF(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=l_(0);if(n||!n&&!i)if((JF(e)!=="body"||Q4(o))&&(s=lJ(e)),n){let f=YF(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=Fqe(o));let l=o&&!n&&!i?r7t(o,s):l_(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 Dqe(t){return My(t).position==="static"}function QJt(t,e){if(!d_(t)||My(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return c_(t)===r&&(r=r.ownerDocument.body),r}function o7t(t,e){let r=Rm(t);if(uJ(t))return r;if(!d_(t)){let o=yT(t);for(;o&&!ZF(o);){if(Iy(o)&&!Dqe(o))return o;o=yT(o)}return r}let n=QJt(t,e);for(;n&&JJt(n)&&Dqe(n);)n=QJt(n,e);return n&&ZF(n)&&Dqe(n)&&!Jme(n)?r:n||ZJt(t)||r}var N1n=async function(t){let e=this.getOffsetParent||o7t,r=this.getDimensions,n=await r(t.floating);return{reference:R1n(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function j1n(t){return My(t).direction==="rtl"}var i7t={convertOffsetParentRelativeRectToViewportRelativeRect:C1n,getDocumentElement:c_,getClippingRect:I1n,getOffsetParent:o7t,getElementRects:N1n,getClientRects:O1n,getDimensions:M1n,getScale:e3,isElement:Iy,isRTL:j1n};function D1n(t,e){let r=null,n,o=c_(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=sJ(c),m=sJ(o.clientWidth-(l+d)),h=sJ(o.clientHeight-(c+f)),b=sJ(l),y={rootMargin:-p+"px "+-m+"px "+-h+"px "+-b+"px",threshold:Cp(0,nO(1,u))||1},x=!0;function S(O){let E=O[0].intersectionRatio;if(E!==u){if(!x)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}x=!1}try{r=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{r=new IntersectionObserver(S,y)}r.observe(t)}return a(!0),i}function bT(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=Lqe(t),c=o||i?[...l?GF(l):[],...GF(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?D1n(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?YF(t):null;u&&b();function b(){let g=YF(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&r(),h=g,m=requestAnimationFrame(b)}return r(),()=>{var g;c.forEach(y=>{o&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var a7t=qJt;var s7t=HJt,u7t=BJt,l7t=WJt,c7t=UJt,kqe=zJt;var d7t=VJt,$qe=(t,e,r)=>{let n=new Map,o={platform:i7t,...r},i={...o.platform,_c:n};return $Jt(t,e,{...o,platform:i})};var Nl=F(ee(),1),ehe=F(ee(),1),p7t=F(Cs(),1),Xme=typeof document<"u"?ehe.useLayoutEffect:ehe.useEffect;function Qme(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(!Qme(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)&&!Qme(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function m7t(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function f7t(t,e){let r=m7t(t);return Math.round(e*r)/r}function zqe(t){let e=Nl.useRef(t);return Xme(()=>{e.current=t}),e}function UR(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]=Nl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=Nl.useState(n);Qme(f,n)||p(n);let[m,h]=Nl.useState(null),[b,g]=Nl.useState(null),y=Nl.useCallback(Z=>{Z!==E.current&&(E.current=Z,h(Z))},[]),x=Nl.useCallback(Z=>{Z!==P.current&&(P.current=Z,g(Z))},[]),S=i||m,O=a||b,E=Nl.useRef(null),P=Nl.useRef(null),A=Nl.useRef(c),I=u!=null,R=zqe(u),N=zqe(o),j=zqe(l),$=Nl.useCallback(()=>{if(!E.current||!P.current)return;let Z={placement:e,strategy:r,middleware:f};N.current&&(Z.platform=N.current),$qe(E.current,P.current,Z).then(D=>{let z={...D,isPositioned:j.current!==!1};k.current&&!Qme(A.current,z)&&(A.current=z,p7t.flushSync(()=>{d(z)}))})},[f,e,r,N,j]);Xme(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(Z=>({...Z,isPositioned:!1})))},[l]);let k=Nl.useRef(!1);Xme(()=>(k.current=!0,()=>{k.current=!1}),[]),Xme(()=>{if(S&&(E.current=S),O&&(P.current=O),S&&O){if(R.current)return R.current(S,O,$);$()}},[S,O,$,R,I]);let H=Nl.useMemo(()=>({reference:E,floating:P,setReference:y,setFloating:x}),[y,x]),V=Nl.useMemo(()=>({reference:S,floating:O}),[S,O]),Q=Nl.useMemo(()=>{let Z={position:r,left:0,top:0};if(!V.floating)return Z;let D=f7t(V.floating,c.x),z=f7t(V.floating,c.y);return s?{...Z,transform:"translate("+D+"px, "+z+"px)",...m7t(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:z}},[r,s,V.floating,c.x,c.y]);return Nl.useMemo(()=>({...c,update:$,refs:H,elements:V,floatingStyles:Q}),[c,$,H,V,Q])}var L1n=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?kqe({element:n.current,padding:o}).fn(r):{}:n?kqe({element:n,padding:o}).fn(r):{}}}},qR=(t,e)=>({...a7t(t),options:[t,e]}),HR=(t,e)=>({...s7t(t),options:[t,e]}),VR=(t,e)=>({...d7t(t),options:[t,e]}),WR=(t,e)=>({...u7t(t),options:[t,e]}),KR=(t,e)=>({...l7t(t),options:[t,e]});var GR=(t,e)=>({...c7t(t),options:[t,e]});var JR=(t,e)=>({...L1n(t),options:[t,e]});var h7t=F(ee(),1);var Bqe=F(bt(),1),F1n="Arrow",g7t=h7t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Bqe.jsx)(Uc.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,Bqe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});g7t.displayName=F1n;var y7t=g7t;var ZR=F(bt(),1);var Uqe="Popper",[b7t,qqe]=na(Uqe),[$1n,_7t]=b7t(Uqe),v7t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=zh.useState(null);return(0,ZR.jsx)($1n,{scope:e,anchor:n,onAnchorChange:o,children:r})};v7t.displayName=Uqe;var w7t="PopperAnchor",x7t=zh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=_7t(w7t,r),a=zh.useRef(null),s=Bd(e,a);return zh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,ZR.jsx)(Uc.div,{...o,ref:s})});x7t.displayName=w7t;var Hqe="PopperContent",[z1n,B1n]=b7t(Hqe),S7t=zh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=_7t(Hqe,r),[g,y]=zh.useState(null),x=Bd(e,Y=>y(Y)),[S,O]=zh.useState(null),E=XC(S),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(q1n),altBoundary:j},{refs:k,floatingStyles:H,placement:V,isPositioned:Q,middlewareData:Z}=UR({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>bT(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[qR({mainAxis:o+A,alignmentAxis:a}),u&&HR({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?VR():void 0,...$}),u&&WR({...$}),KR({...$,apply:({elements:Y,rects:se,availableWidth:Te,availableHeight:de})=>{let{width:Ue,height:Ke}=se.reference,at=Y.floating.style;at.setProperty("--radix-popper-available-width",`${Te}px`),at.setProperty("--radix-popper-available-height",`${de}px`),at.setProperty("--radix-popper-anchor-width",`${Ue}px`),at.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),S&&JR({element:S,padding:s}),H1n({arrowWidth:P,arrowHeight:A}),f&&GR({strategy:"referenceHidden",...$})]}),[D,z]=P7t(V),B=Qr(m);uo(()=>{Q&&B?.()},[Q,B]);let K=Z.arrow?.x,q=Z.arrow?.y,te=Z.arrow?.centerOffset!==0,[U,W]=zh.useState();return uo(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,ZR.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:Q?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,ZR.jsx)(z1n,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:q,shouldHideArrow:te,children:(0,ZR.jsx)(Uc.div,{"data-side":D,"data-align":z,...h,ref:x,style:{...h.style,animation:Q?void 0:"none"}})})})});S7t.displayName=Hqe;var C7t="PopperArrow",U1n={top:"bottom",right:"left",bottom:"top",left:"right"},O7t=zh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=B1n(C7t,n),a=U1n[i.placedSide];return(0,ZR.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,ZR.jsx)(y7t,{...o,ref:r,style:{...o.style,display:"block"}})})});O7t.displayName=C7t;function q1n(t){return t!==null}var H1n=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]=P7t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function P7t(t){let[e,r="center"]=t.split("-");return[e,r]}var Vqe=v7t,E7t=x7t,T7t=S7t,A7t=O7t;var the=F(ee(),1),I7t=F(Cs(),1);var M7t=F(bt(),1),W1n="Portal",Wqe=the.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=the.useState(!1);uo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?I7t.default.createPortal((0,M7t.jsx)(Uc.div,{...n,ref:e}),a):null});Wqe.displayName=W1n;var qc=F(ee(),1);function XF(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var YR=F(ee(),1);var N7t=F(ee(),1);function R7t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Kqe(...t){return e=>{let r=!1,n=t.map(o=>{let i=R7t(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():R7t(t[o],null)}}}}function cJ(...t){return N7t.useCallback(Kqe(...t),t)}var qd=F(ee(),1);var t3=F(bt(),1),r3=qd.forwardRef((t,e)=>{let{children:r,...n}=t,o=qd.Children.toArray(r),i=o.find(G1n);if(i){let a=i.props.children,s=o.map(u=>u===i?qd.Children.count(a)>1?qd.Children.only(null):qd.isValidElement(a)?a.props.children:null:u);return(0,t3.jsx)(Gqe,{...n,ref:e,children:qd.isValidElement(a)?qd.cloneElement(a,void 0,s):null})}return(0,t3.jsx)(Gqe,{...n,ref:e,children:r})});r3.displayName="Slot";var Gqe=qd.forwardRef((t,e)=>{let{children:r,...n}=t;if(qd.isValidElement(r)){let o=Z1n(r);return qd.cloneElement(r,{...J1n(n,r.props),ref:e?Kqe(e,o):o})}return qd.Children.count(r)>1?qd.Children.only(null):null});Gqe.displayName="SlotClone";var K1n=({children:t})=>(0,t3.jsx)(t3.Fragment,{children:t});function G1n(t){return qd.isValidElement(t)&&t.type===K1n}function J1n(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 Z1n(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 rhe=F(bt(),1);function j7t(t){let e=t+"CollectionProvider",[r,n]=na(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=YR.default.useRef(null),g=YR.default.useRef(new Map).current;return(0,rhe.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=YR.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=cJ(m,g.collectionRef);return(0,rhe.jsx)(r3,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=YR.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=YR.default.useRef(null),x=cJ(m,y),S=i(l,h);return YR.default.useEffect(()=>(S.itemMap.set(y,{ref:y,...g}),()=>void S.itemMap.delete(y))),(0,rhe.jsx)(r3,{[c]:"",ref:x,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return YR.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,O)=>g.indexOf(S.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var D7t=F(ee(),1),Y1n=F(Cs(),1);var L7t=F(bt(),1),X1n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Jqe=X1n.reduce((t,e)=>{let r=D7t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?r3:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,L7t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var XR=F(bt(),1),Zqe="rovingFocusGroup.onEntryFocus",Q1n={bubbles:!1,cancelable:!0},nhe="RovingFocusGroup",[Yqe,F7t,eNn]=j7t(nhe),[tNn,Xqe]=na(nhe,[eNn]),[rNn,nNn]=tNn(nhe),k7t=qc.forwardRef((t,e)=>(0,XR.jsx)(Yqe.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,XR.jsx)(Yqe.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,XR.jsx)(oNn,{...t,ref:e})})}));k7t.displayName=nhe;var oNn=qc.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=qc.useRef(null),p=cJ(e,f),m=kR(i),[h=null,b]=Nd({prop:a,defaultProp:s,onChange:u}),[g,y]=qc.useState(!1),x=Qr(l),S=F7t(r),O=qc.useRef(!1),[E,P]=qc.useState(0);return qc.useEffect(()=>{let A=f.current;if(A)return A.addEventListener(Zqe,x),()=>A.removeEventListener(Zqe,x)},[x]),(0,XR.jsx)(rNn,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:qc.useCallback(A=>b(A),[b]),onItemShiftTab:qc.useCallback(()=>y(!0),[]),onFocusableItemAdd:qc.useCallback(()=>P(A=>A+1),[]),onFocusableItemRemove:qc.useCallback(()=>P(A=>A-1),[]),children:(0,XR.jsx)(Jqe.div,{tabIndex:g||E===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:XF(t.onMouseDown,()=>{O.current=!0}),onFocus:XF(t.onFocus,A=>{let I=!O.current;if(A.target===A.currentTarget&&I&&!g){let R=new CustomEvent(Zqe,Q1n);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){let N=S().filter(V=>V.focusable),j=N.find(V=>V.active),$=N.find(V=>V.id===h),H=[j,$,...N].filter(Boolean).map(V=>V.ref.current);B7t(H,c)}}O.current=!1}),onBlur:XF(t.onBlur,()=>y(!1))})})}),$7t="RovingFocusGroupItem",z7t=qc.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=Rl(),u=i||s,l=nNn($7t,r),c=l.currentTabStopId===u,d=F7t(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return qc.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,XR.jsx)(Yqe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,XR.jsx)(Jqe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:XF(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:XF(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:XF(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=sNn(m,l.orientation,l.dir);if(h!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let g=d().filter(y=>y.focusable).map(y=>y.ref.current);if(h==="last")g.reverse();else if(h==="prev"||h==="next"){h==="prev"&&g.reverse();let y=g.indexOf(m.currentTarget);g=l.loop?uNn(g,y+1):g.slice(y+1)}setTimeout(()=>B7t(g))}})})})});z7t.displayName=$7t;var iNn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aNn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function sNn(t,e,r){let n=aNn(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return iNn[n]}function B7t(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function uNn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var U7t=k7t,q7t=z7t;var cNn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},n3=new WeakMap,ohe=new WeakMap,ihe={},Qqe=0,H7t=function(t){return t&&(t.host||H7t(t.parentNode))},dNn=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=H7t(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})},fNn=function(t,e,r,n){var o=dNn(e,Array.isArray(t)?t:[t]);ihe[r]||(ihe[r]=new WeakMap);var i=ihe[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",h=(n3.get(f)||0)+1,b=(i.get(f)||0)+1;n3.set(f,h),i.set(f,b),a.push(f),h===1&&m&&ohe.set(f,!0),b===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),Qqe++,function(){a.forEach(function(d){var f=n3.get(d)-1,p=i.get(d)-1;n3.set(d,f),i.set(d,p),f||(ohe.has(d)||d.removeAttribute(n),ohe.delete(d)),p||d.removeAttribute(r)}),Qqe--,Qqe||(n3=new WeakMap,n3=new WeakMap,ohe=new WeakMap,ihe={})}},QR=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||cNn(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),fNn(n,o,r,"aria-hidden")):function(){return null}};var Oi=function(){return Oi=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},Oi.apply(this,arguments)};function e1(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 o3(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 che=F(ee());var Ff=F(ee());var f_="right-scroll-bar-position",p_="width-before-scroll-bar",e2e="with-scroll-bars-hidden",t2e="--removed-body-scroll-bar-size";function ahe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var V7t=F(ee());function W7t(t,e){var r=(0,V7t.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 she=F(ee());var pNn=typeof window<"u"?she.useLayoutEffect:she.useEffect,K7t=new WeakMap;function QF(t,e){var r=W7t(e||null,function(n){return t.forEach(function(o){return ahe(o,n)})});return pNn(function(){var n=K7t.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||ahe(s,null)}),i.forEach(function(s){o.has(s)||ahe(s,a)})}K7t.set(r,t)},[t]),r}function mNn(t){return t}function hNn(t,e){e===void 0&&(e=mNn);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 ek(t){t===void 0&&(t={});var e=hNn(null);return e.options=Oi({async:!0,ssr:!1},t),e}var G7t=F(ee()),J7t=function(t){var e=t.sideCar,r=e1(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 G7t.createElement(n,Oi({},r))};J7t.isSideCarExport=!0;function tk(t,e){return t.useMedium(e),J7t}var uhe=ek();var r2e=function(){},dJ=Ff.forwardRef(function(t,e){var r=Ff.useRef(null),n=Ff.useState({onScrollCapture:r2e,onWheelCapture:r2e,onTouchMoveCapture:r2e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,x=e1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,O=QF([r,e]),E=Oi(Oi({},x),o);return Ff.createElement(Ff.Fragment,null,c&&Ff.createElement(S,{sideCar:uhe,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?Ff.cloneElement(Ff.Children.only(s),Oi(Oi({},E),{ref:O})):Ff.createElement(g,Oi({},E,{className:u,ref:O}),s))});dJ.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dJ.classNames={fullWidth:p_,zeroRight:f_};var Oa=F(ee());var a3=F(ee());var X7t=F(ee());var Z7t;var Y7t=function(){if(Z7t)return Z7t;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gNn(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Y7t();return e&&t.setAttribute("nonce",e),t}function yNn(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function bNn(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var n2e=function(){var t=0,e=null;return{add:function(r){t==0&&(e=gNn())&&(yNn(e,r),bNn(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var o2e=function(){var t=n2e();return function(e,r){X7t.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var _T=function(){var t=o2e(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var _Nn={left:0,top:0,right:0,gap:0},i2e=function(t){return parseInt(t||"",10)||0},vNn=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[i2e(r),i2e(n),i2e(o)]},a2e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return _Nn;var e=vNn(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 wNn=_T(),i3="data-scroll-locked",xNn=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(e2e,` {
|
||
overflow: hidden `).concat(n,`;
|
||
padding-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
body[`).concat(i3,`] {
|
||
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(f_,` {
|
||
right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(p_,` {
|
||
margin-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(f_," .").concat(f_,` {
|
||
right: 0 `).concat(n,`;
|
||
}
|
||
|
||
.`).concat(p_," .").concat(p_,` {
|
||
margin-right: 0 `).concat(n,`;
|
||
}
|
||
|
||
body[`).concat(i3,`] {
|
||
`).concat(t2e,": ").concat(s,`px;
|
||
}
|
||
`)},Q7t=function(){var t=parseInt(document.body.getAttribute(i3)||"0",10);return isFinite(t)?t:0},SNn=function(){a3.useEffect(function(){return document.body.setAttribute(i3,(Q7t()+1).toString()),function(){var t=Q7t()-1;t<=0?document.body.removeAttribute(i3):document.body.setAttribute(i3,t.toString())}},[])},rk=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;SNn();var i=a3.useMemo(function(){return a2e(o)},[o]);return a3.createElement(wNn,{styles:xNn(i,!e,o,r?"":"!important")})};var s2e=!1;if(typeof window<"u")try{fJ=Object.defineProperty({},"passive",{get:function(){return s2e=!0,!0}}),window.addEventListener("test",fJ,fJ),window.removeEventListener("test",fJ,fJ)}catch{s2e=!1}var fJ,nk=s2e?{passive:!1}:!1;var CNn=function(t){return t.tagName==="TEXTAREA"},eZt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!CNn(t)&&r[e]==="visible")},ONn=function(t){return eZt(t,"overflowY")},PNn=function(t){return eZt(t,"overflowX")},u2e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=tZt(t,n);if(o){var i=rZt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},ENn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},TNn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},tZt=function(t,e){return t==="v"?ONn(e):PNn(e)},rZt=function(t,e){return t==="v"?ENn(e):TNn(e)},ANn=function(t,e){return t==="h"&&e==="rtl"?-1:1},nZt=function(t,e,r,n,o){var i=ANn(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=rZt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&tZt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var lhe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},oZt=function(t){return[t.deltaX,t.deltaY]},iZt=function(t){return t&&"current"in t?t.current:t},INn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},MNn=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},RNn=0,s3=[];function aZt(t){var e=Oa.useRef([]),r=Oa.useRef([0,0]),n=Oa.useRef(),o=Oa.useState(RNn++)[0],i=Oa.useState(_T)[0],a=Oa.useRef(t);Oa.useEffect(function(){a.current=t},[t]),Oa.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=o3([t.lockRef.current],(t.shards||[]).map(iZt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Oa.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=lhe(h),y=r.current,x="deltaX"in h?h.deltaX:y[0]-g[0],S="deltaY"in h?h.deltaY:y[1]-g[1],O,E=h.target,P=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var A=u2e(P,E);if(!A)return!0;if(A?O=P:(O=P==="v"?"h":"v",A=u2e(P,E)),!A)return!1;if(!n.current&&"changedTouches"in h&&(x||S)&&(n.current=O),!O)return!0;var I=n.current||O;return nZt(I,b,h,I==="h"?x:S,!0)},[]),u=Oa.useCallback(function(h){var b=h;if(!(!s3.length||s3[s3.length-1]!==i)){var g="deltaY"in b?oZt(b):lhe(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&INn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var x=(a.current.shards||[]).map(iZt).filter(Boolean).filter(function(O){return O.contains(b.target)}),S=x.length>0?s(b,x[0]):!a.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),l=Oa.useCallback(function(h,b,g,y){var x={name:h,delta:b,target:g,should:y,shadowParent:NNn(g)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(S){return S!==x})},1)},[]),c=Oa.useCallback(function(h){r.current=lhe(h),n.current=void 0},[]),d=Oa.useCallback(function(h){l(h.type,oZt(h),h.target,s(h,t.lockRef.current))},[]),f=Oa.useCallback(function(h){l(h.type,lhe(h),h.target,s(h,t.lockRef.current))},[]);Oa.useEffect(function(){return s3.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,nk),document.addEventListener("touchmove",u,nk),document.addEventListener("touchstart",c,nk),function(){s3=s3.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,nk),document.removeEventListener("touchmove",u,nk),document.removeEventListener("touchstart",c,nk)}},[]);var p=t.removeScrollBar,m=t.inert;return Oa.createElement(Oa.Fragment,null,m?Oa.createElement(i,{styles:MNn(o)}):null,p?Oa.createElement(rk,{gapMode:t.gapMode}):null)}function NNn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var sZt=tk(uhe,aZt);var uZt=che.forwardRef(function(t,e){return che.createElement(dJ,Oi({},t,{ref:e,sideCar:sZt}))});uZt.classNames=dJ.classNames;var l2e=uZt;var Br=F(bt(),1),c2e=["Enter"," "],jNn=["ArrowDown","PageUp","Home"],cZt=["ArrowUp","PageDown","End"],DNn=[...jNn,...cZt],LNn={ltr:[...c2e,"ArrowRight"],rtl:[...c2e,"ArrowLeft"]},FNn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gJ="Menu",[mJ,kNn,$Nn]=hJt(gJ),[ok,d2e]=na(gJ,[$Nn,qqe,Xqe]),yJ=qqe(),dZt=Xqe(),[fZt,t1]=ok(gJ),[zNn,bJ]=ok(gJ),pZt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=yJ(e),[u,l]=Zt.useState(null),c=Zt.useRef(!1),d=Qr(i),f=kR(o);return Zt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),(0,Br.jsx)(Vqe,{...s,children:(0,Br.jsx)(fZt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Br.jsx)(zNn,{scope:e,onClose:Zt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};pZt.displayName=gJ;var BNn="MenuAnchor",f2e=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=yJ(r);return(0,Br.jsx)(E7t,{...o,...n,ref:e})});f2e.displayName=BNn;var p2e="MenuPortal",[UNn,mZt]=ok(p2e,{forceMount:void 0}),hZt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=t1(p2e,e);return(0,Br.jsx)(UNn,{scope:e,forceMount:r,children:(0,Br.jsx)(jd,{present:r||i.open,children:(0,Br.jsx)(Wqe,{asChild:!0,container:o,children:n})})})};hZt.displayName=p2e;var Ry="MenuContent",[qNn,m2e]=ok(Ry),gZt=Zt.forwardRef((t,e)=>{let r=mZt(Ry,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=t1(Ry,t.__scopeMenu),a=bJ(Ry,t.__scopeMenu);return(0,Br.jsx)(mJ.Provider,{scope:t.__scopeMenu,children:(0,Br.jsx)(jd,{present:n||i.open,children:(0,Br.jsx)(mJ.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Br.jsx)(HNn,{...o,ref:e}):(0,Br.jsx)(VNn,{...o,ref:e})})})})}),HNn=Zt.forwardRef((t,e)=>{let r=t1(Ry,t.__scopeMenu),n=Zt.useRef(null),o=Bd(e,n);return Zt.useEffect(()=>{let i=n.current;if(i)return QR(i)},[]),(0,Br.jsx)(h2e,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ia(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),VNn=Zt.forwardRef((t,e)=>{let r=t1(Ry,t.__scopeMenu);return(0,Br.jsx)(h2e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),h2e=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,b=t1(Ry,r),g=bJ(Ry,r),y=yJ(r),x=dZt(r),S=kNn(r),[O,E]=Zt.useState(null),P=Zt.useRef(null),A=Bd(e,P,b.onContentChange),I=Zt.useRef(0),R=Zt.useRef(""),N=Zt.useRef(0),j=Zt.useRef(null),$=Zt.useRef("right"),k=Zt.useRef(0),H=m?l2e:Zt.Fragment,V=m?{as:LR,allowPinchZoom:!0}:void 0,Q=D=>{let z=R.current+D,B=S().filter(Y=>!Y.disabled),K=document.activeElement,q=B.find(Y=>Y.ref.current===K)?.textValue,te=B.map(Y=>Y.textValue),U=ojn(te,z,q),W=B.find(Y=>Y.textValue===U)?.ref.current;(function Y(se){R.current=se,window.clearTimeout(I.current),se!==""&&(I.current=window.setTimeout(()=>Y(""),1e3))})(z),W&&setTimeout(()=>W.focus())};Zt.useEffect(()=>()=>window.clearTimeout(I.current),[]),zR();let Z=Zt.useCallback(D=>$.current===j.current?.side&&ajn(D,j.current?.area),[]);return(0,Br.jsx)(qNn,{scope:r,searchRef:R,onItemEnter:Zt.useCallback(D=>{Z(D)&&D.preventDefault()},[Z]),onItemLeave:Zt.useCallback(D=>{Z(D)||(P.current?.focus(),E(null))},[Z]),onTriggerLeave:Zt.useCallback(D=>{Z(D)&&D.preventDefault()},[Z]),pointerGraceTimerRef:N,onPointerGraceIntentChange:Zt.useCallback(D=>{j.current=D},[]),children:(0,Br.jsx)(H,{...V,children:(0,Br.jsx)(Nqe,{asChild:!0,trapped:o,onMountAutoFocus:ia(i,D=>{D.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Br.jsx)(Aqe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Br.jsx)(U7t,{asChild:!0,...x,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:E,onEntryFocus:ia(u,D=>{g.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Br.jsx)(T7t,{role:"menu","aria-orientation":"vertical","data-state":RZt(b.open),"data-radix-menu-content":"",dir:g.dir,...y,...h,ref:A,style:{outline:"none",...h.style},onKeyDown:ia(h.onKeyDown,D=>{let B=D.target.closest("[data-radix-menu-content]")===D.currentTarget,K=D.ctrlKey||D.altKey||D.metaKey,q=D.key.length===1;B&&(D.key==="Tab"&&D.preventDefault(),!K&&q&&Q(D.key));let te=P.current;if(D.target!==te||!DNn.includes(D.key))return;D.preventDefault();let W=S().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);cZt.includes(D.key)&&W.reverse(),rjn(W)}),onBlur:ia(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),R.current="")}),onPointerMove:ia(t.onPointerMove,hJ(D=>{let z=D.target,B=k.current!==D.clientX;if(D.currentTarget.contains(z)&&B){let K=D.clientX>k.current?"right":"left";$.current=K,k.current=D.clientX}}))})})})})})})});gZt.displayName=Ry;var WNn="MenuGroup",g2e=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Br.jsx)(Uc.div,{role:"group",...n,ref:e})});g2e.displayName=WNn;var KNn="MenuLabel",yZt=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Br.jsx)(Uc.div,{...n,ref:e})});yZt.displayName=KNn;var dhe="MenuItem",lZt="menu.itemSelect",phe=Zt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Zt.useRef(null),a=bJ(dhe,t.__scopeMenu),s=m2e(dhe,t.__scopeMenu),u=Bd(e,i),l=Zt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(lZt,{bubbles:!0,cancelable:!0});d.addEventListener(lZt,p=>n?.(p),{once:!0}),Bme(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Br.jsx)(bZt,{...o,ref:u,disabled:r,onClick:ia(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:ia(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:ia(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||c2e.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});phe.displayName=dhe;var bZt=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=m2e(dhe,r),s=dZt(r),u=Zt.useRef(null),l=Bd(e,u),[c,d]=Zt.useState(!1),[f,p]=Zt.useState("");return Zt.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Br.jsx)(mJ.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Br.jsx)(q7t,{asChild:!0,...s,focusable:!n,children:(0,Br.jsx)(Uc.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:ia(t.onPointerMove,hJ(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ia(t.onPointerLeave,hJ(m=>a.onItemLeave(m))),onFocus:ia(t.onFocus,()=>d(!0)),onBlur:ia(t.onBlur,()=>d(!1))})})})}),GNn="MenuCheckboxItem",_Zt=Zt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Br.jsx)(CZt,{scope:t.__scopeMenu,checked:r,children:(0,Br.jsx)(phe,{role:"menuitemcheckbox","aria-checked":fhe(r)?"mixed":r,...o,ref:e,"data-state":_2e(r),onSelect:ia(o.onSelect,()=>n?.(fhe(r)?!0:!r),{checkForDefaultPrevented:!1})})})});_Zt.displayName=GNn;var vZt="MenuRadioGroup",[JNn,ZNn]=ok(vZt,{value:void 0,onValueChange:()=>{}}),wZt=Zt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=Qr(n);return(0,Br.jsx)(JNn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Br.jsx)(g2e,{...o,ref:e})})});wZt.displayName=vZt;var xZt="MenuRadioItem",SZt=Zt.forwardRef((t,e)=>{let{value:r,...n}=t,o=ZNn(xZt,t.__scopeMenu),i=r===o.value;return(0,Br.jsx)(CZt,{scope:t.__scopeMenu,checked:i,children:(0,Br.jsx)(phe,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":_2e(i),onSelect:ia(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});SZt.displayName=xZt;var y2e="MenuItemIndicator",[CZt,YNn]=ok(y2e,{checked:!1}),OZt=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=YNn(y2e,r);return(0,Br.jsx)(jd,{present:n||fhe(i.checked)||i.checked===!0,children:(0,Br.jsx)(Uc.span,{...o,ref:e,"data-state":_2e(i.checked)})})});OZt.displayName=y2e;var XNn="MenuSeparator",PZt=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Br.jsx)(Uc.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});PZt.displayName=XNn;var QNn="MenuArrow",EZt=Zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=yJ(r);return(0,Br.jsx)(A7t,{...o,...n,ref:e})});EZt.displayName=QNn;var b2e="MenuSub",[ejn,TZt]=ok(b2e),tjn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=t1(b2e,e),a=yJ(e),[s,u]=Zt.useState(null),[l,c]=Zt.useState(null),d=Qr(o);return Zt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Br.jsx)(Vqe,{...a,children:(0,Br.jsx)(fZt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Br.jsx)(ejn,{scope:e,contentId:Rl(),triggerId:Rl(),trigger:s,onTriggerChange:u,children:r})})})};tjn.displayName=b2e;var pJ="MenuSubTrigger",AZt=Zt.forwardRef((t,e)=>{let r=t1(pJ,t.__scopeMenu),n=bJ(pJ,t.__scopeMenu),o=TZt(pJ,t.__scopeMenu),i=m2e(pJ,t.__scopeMenu),a=Zt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Zt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Zt.useEffect(()=>c,[c]),Zt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Br.jsx)(f2e,{asChild:!0,...l,children:(0,Br.jsx)(bZt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":RZt(r.open),...t,ref:oJ(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ia(t.onPointerMove,hJ(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:ia(t.onPointerLeave,hJ(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,b=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:b,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:b,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:ia(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||LNn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});AZt.displayName=pJ;var IZt="MenuSubContent",MZt=Zt.forwardRef((t,e)=>{let r=mZt(Ry,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=t1(Ry,t.__scopeMenu),a=bJ(Ry,t.__scopeMenu),s=TZt(IZt,t.__scopeMenu),u=Zt.useRef(null),l=Bd(e,u);return(0,Br.jsx)(mJ.Provider,{scope:t.__scopeMenu,children:(0,Br.jsx)(jd,{present:n||i.open,children:(0,Br.jsx)(mJ.Slot,{scope:t.__scopeMenu,children:(0,Br.jsx)(h2e,{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:ia(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ia(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ia(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=FNn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});MZt.displayName=IZt;function RZt(t){return t?"open":"closed"}function fhe(t){return t==="indeterminate"}function _2e(t){return fhe(t)?"indeterminate":t?"checked":"unchecked"}function rjn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function njn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function ojn(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=njn(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 ijn(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 ajn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return ijn(r,e)}function hJ(t){return e=>e.pointerType==="mouse"?t(e):void 0}var NZt=pZt,jZt=f2e,DZt=hZt,LZt=gZt,FZt=g2e,kZt=yZt,$Zt=phe,zZt=_Zt,BZt=wZt,UZt=SZt,qZt=OZt,HZt=PZt,VZt=EZt;var WZt=AZt,KZt=MZt;var Hc=F(bt(),1),v2e="DropdownMenu",[ujn,sMi]=na(v2e,[d2e]),Op=d2e(),[ljn,GZt]=ujn(v2e),_J=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=Op(e),l=ac.useRef(null),[c=!1,d]=Nd({prop:o,defaultProp:i,onChange:a});return(0,Hc.jsx)(ljn,{scope:e,triggerId:Rl(),triggerRef:l,contentId:Rl(),open:c,onOpenChange:d,onOpenToggle:ac.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,Hc.jsx)(NZt,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};_J.displayName=v2e;var JZt="DropdownMenuTrigger",vJ=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=GZt(JZt,r),a=Op(r);return(0,Hc.jsx)(jZt,{asChild:!0,...a,children:(0,Hc.jsx)(fJt.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:kme(e,i.triggerRef),onPointerDown:nJ(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:nJ(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});vJ.displayName=JZt;var cjn="DropdownMenuPortal",ZZt=t=>{let{__scopeDropdownMenu:e,...r}=t,n=Op(e);return(0,Hc.jsx)(DZt,{...n,...r})};ZZt.displayName=cjn;var YZt="DropdownMenuContent",XZt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=GZt(YZt,r),i=Op(r),a=ac.useRef(!1);return(0,Hc.jsx)(LZt,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:nJ(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:nJ(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)"}})});XZt.displayName=YZt;var djn="DropdownMenuGroup",fjn=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(FZt,{...o,...n,ref:e})});fjn.displayName=djn;var pjn="DropdownMenuLabel",QZt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(kZt,{...o,...n,ref:e})});QZt.displayName=pjn;var mjn="DropdownMenuItem",eYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)($Zt,{...o,...n,ref:e})});eYt.displayName=mjn;var hjn="DropdownMenuCheckboxItem",tYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(zZt,{...o,...n,ref:e})});tYt.displayName=hjn;var gjn="DropdownMenuRadioGroup",yjn=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(BZt,{...o,...n,ref:e})});yjn.displayName=gjn;var bjn="DropdownMenuRadioItem",rYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(UZt,{...o,...n,ref:e})});rYt.displayName=bjn;var _jn="DropdownMenuItemIndicator",nYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(qZt,{...o,...n,ref:e})});nYt.displayName=_jn;var vjn="DropdownMenuSeparator",oYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(HZt,{...o,...n,ref:e})});oYt.displayName=vjn;var wjn="DropdownMenuArrow",xjn=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(VZt,{...o,...n,ref:e})});xjn.displayName=wjn;var Sjn="DropdownMenuSubTrigger",iYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(WZt,{...o,...n,ref:e})});iYt.displayName=Sjn;var Cjn="DropdownMenuSubContent",aYt=ac.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Op(r);return(0,Hc.jsx)(KZt,{...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)"}})});aYt.displayName=Cjn;var sYt=_J,uYt=vJ,lYt=ZZt,w2e=XZt;var x2e=QZt,S2e=eYt,C2e=tYt;var O2e=rYt,P2e=nYt,E2e=oYt;var T2e=iYt,A2e=aYt;An();$n();var ik=sYt,ak=uYt;var Pjn=Gi.forwardRef(({className:t,inset:e,children:r,...n},o)=>Gi.createElement(T2e,{ref:o,className:ve("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,Gi.createElement(tP,{className:"tw-ml-auto"})));Pjn.displayName=T2e.displayName;var Ejn=Gi.forwardRef(({className:t,...e},r)=>Gi.createElement(A2e,{ref:r,className:ve("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}));Ejn.displayName=A2e.displayName;var m_=Gi.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>Gi.createElement(lYt,{container:r??activeDocument.body},Gi.createElement(w2e,{ref:o,sideOffset:e,className:ve("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})));m_.displayName=w2e.displayName;var Ri=Gi.forwardRef(({className:t,inset:e,...r},n)=>Gi.createElement(S2e,{ref:n,className:ve("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}));Ri.displayName=S2e.displayName;var Tjn=Gi.forwardRef(({className:t,children:e,checked:r,...n},o)=>Gi.createElement(C2e,{ref:o,className:ve("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},Gi.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Gi.createElement(P2e,null,Gi.createElement(gc,{className:"tw-size-4"}))),e));Tjn.displayName=C2e.displayName;var Ajn=Gi.forwardRef(({className:t,children:e,...r},n)=>Gi.createElement(O2e,{ref:n,className:ve("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},Gi.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Gi.createElement(P2e,null,Gi.createElement(d8,{className:"tw-size-2 tw-fill-current"}))),e));Ajn.displayName=O2e.displayName;var Ijn=Gi.forwardRef(({className:t,inset:e,...r},n)=>Gi.createElement(x2e,{ref:n,className:ve("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));Ijn.displayName=x2e.displayName;var Mjn=Gi.forwardRef(({className:t,...e},r)=>Gi.createElement(E2e,{ref:r,className:ve("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));Mjn.displayName=E2e.displayName;var Rjn=({className:t,...e})=>Gi.createElement("span",{className:ve("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});Rjn.displayName="DropdownMenuShortcut";var wJ=F(ee());$n();var u3=wJ.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 wJ.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:ve("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},wJ.createElement("div",{className:ve("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")}))});u3.displayName="SettingSwitch";var CJ=F(ee());var fn=F(ee(),1);function h_(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var dYt=F(ee(),1);function cYt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Njn(...t){return e=>{let r=!1,n=t.map(o=>{let i=cYt(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():cYt(t[o],null)}}}}function g_(...t){return dYt.useCallback(Njn(...t),t)}var vT=F(ee(),1),fYt=F(bt(),1);function mhe(t,e=[]){let r=[];function n(i,a){let s=vT.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=vT.useMemo(()=>m,Object.values(m));return(0,fYt.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=vT.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>vT.createContext(a));return function(s){let u=s?.[t]||i;return vT.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,jjn(o,...e)]}function jjn(...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 vT.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var fs=F(ee(),1);var pYt=F(ee(),1),mYt=F(Cs(),1);HN();var hYt=F(bt(),1),Djn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ny=Djn.reduce((t,e)=>{let r=XO(`Primitive.${e}`),n=pYt.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,hYt.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function gYt(t,e){t&&mYt.flushSync(()=>t.dispatchEvent(e))}var l3=F(ee(),1);function sk(t){let e=l3.useRef(t);return l3.useEffect(()=>{e.current=t}),l3.useMemo(()=>(...r)=>e.current?.(...r),[])}var yYt=F(ee(),1);function bYt(t,e=globalThis?.document){let r=sk(t);yYt.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 M2e=F(bt(),1),Ljn="DismissableLayer",I2e="dismissableLayer.update",Fjn="dismissableLayer.pointerDownOutside",kjn="dismissableLayer.focusOutside",_Yt,wYt=fs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R2e=fs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=fs.useContext(wYt),[c,d]=fs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=fs.useState({}),m=g_(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=y>=g,O=Bjn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=Ujn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return bYt(P=>{y===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),fs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(_Yt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),vYt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=_Yt)}},[c,f,r,l]),fs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),vYt())},[c,l]),fs.useEffect(()=>{let P=()=>p({});return document.addEventListener(I2e,P),()=>document.removeEventListener(I2e,P)},[]),(0,M2e.jsx)(Ny.div,{...u,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:h_(t.onFocusCapture,E.onFocusCapture),onBlurCapture:h_(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:h_(t.onPointerDownCapture,O.onPointerDownCapture)})});R2e.displayName=Ljn;var $jn="DismissableLayerBranch",zjn=fs.forwardRef((t,e)=>{let r=fs.useContext(wYt),n=fs.useRef(null),o=g_(e,n);return fs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,M2e.jsx)(Ny.div,{...t,ref:o})});zjn.displayName=$jn;function Bjn(t,e=globalThis?.document){let r=sk(t),n=fs.useRef(!1),o=fs.useRef(()=>{});return fs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){xYt(Fjn,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 Ujn(t,e=globalThis?.document){let r=sk(t),n=fs.useRef(!1);return fs.useEffect(()=>{let o=i=>{i.target&&!n.current&&xYt(kjn,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 vYt(){let t=new CustomEvent(I2e);document.dispatchEvent(t)}function xYt(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?gYt(o,i):o.dispatchEvent(i)}var N2e=F(ee(),1);var SYt=F(ee(),1),Nm=globalThis?.document?SYt.useLayoutEffect:()=>{};var qjn=N2e[" useId ".trim().toString()]||(()=>{}),Hjn=0;function CYt(t){let[e,r]=N2e.useState(qjn());return Nm(()=>{t||r(n=>n??String(Hjn++))},[t]),t||(e?`radix-${e}`:"")}var Bh=F(ee(),1);var OYt=F(ee(),1);var j2e=F(bt(),1),Vjn="Arrow",PYt=OYt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,j2e.jsx)(Ny.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,j2e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});PYt.displayName=Vjn;var EYt=PYt;var TYt=F(ee(),1);function AYt(t){let[e,r]=TYt.useState(void 0);return Nm(()=>{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 r1=F(bt(),1);var D2e="Popper",[IYt,L2e]=mhe(D2e),[Kjn,MYt]=IYt(D2e),RYt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Bh.useState(null);return(0,r1.jsx)(Kjn,{scope:e,anchor:n,onAnchorChange:o,children:r})};RYt.displayName=D2e;var NYt="PopperAnchor",jYt=Bh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=MYt(NYt,r),a=Bh.useRef(null),s=g_(e,a);return Bh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,r1.jsx)(Ny.div,{...o,ref:s})});jYt.displayName=NYt;var F2e="PopperContent",[Gjn,Jjn]=IYt(F2e),DYt=Bh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=MYt(F2e,r),[g,y]=Bh.useState(null),x=g_(e,Y=>y(Y)),[S,O]=Bh.useState(null),E=AYt(S),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(Yjn),altBoundary:j},{refs:k,floatingStyles:H,placement:V,isPositioned:Q,middlewareData:Z}=UR({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>bT(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[qR({mainAxis:o+A,alignmentAxis:a}),u&&HR({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?VR():void 0,...$}),u&&WR({...$}),KR({...$,apply:({elements:Y,rects:se,availableWidth:Te,availableHeight:de})=>{let{width:Ue,height:Ke}=se.reference,at=Y.floating.style;at.setProperty("--radix-popper-available-width",`${Te}px`),at.setProperty("--radix-popper-available-height",`${de}px`),at.setProperty("--radix-popper-anchor-width",`${Ue}px`),at.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),S&&JR({element:S,padding:s}),Xjn({arrowWidth:P,arrowHeight:A}),f&&GR({strategy:"referenceHidden",...$})]}),[D,z]=kYt(V),B=sk(m);Nm(()=>{Q&&B?.()},[Q,B]);let K=Z.arrow?.x,q=Z.arrow?.y,te=Z.arrow?.centerOffset!==0,[U,W]=Bh.useState();return Nm(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,r1.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:Q?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,r1.jsx)(Gjn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:q,shouldHideArrow:te,children:(0,r1.jsx)(Ny.div,{"data-side":D,"data-align":z,...h,ref:x,style:{...h.style,animation:Q?void 0:"none"}})})})});DYt.displayName=F2e;var LYt="PopperArrow",Zjn={top:"bottom",right:"left",bottom:"top",left:"right"},FYt=Bh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Jjn(LYt,n),a=Zjn[i.placedSide];return(0,r1.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,r1.jsx)(EYt,{...o,ref:r,style:{...o.style,display:"block"}})})});FYt.displayName=LYt;function Yjn(t){return t!==null}var Xjn=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]=kYt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function kYt(t){let[e,r="center"]=t.split("-");return[e,r]}var $Yt=RYt,zYt=jYt,BYt=DYt,UYt=FYt;var hhe=F(ee(),1),qYt=F(Cs(),1);var HYt=F(bt(),1),eDn="Portal",k2e=hhe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=hhe.useState(!1);Nm(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?qYt.default.createPortal((0,HYt.jsx)(Ny.div,{...n,ref:e}),a):null});k2e.displayName=eDn;var jm=F(ee(),1);var VYt=F(ee(),1);function tDn(t,e){return VYt.useReducer((r,n)=>e[r][n]??r,t)}var yhe=t=>{let{present:e,children:r}=t,n=rDn(e),o=typeof r=="function"?r({present:n.isPresent}):jm.Children.only(r),i=g_(n.ref,nDn(o));return typeof r=="function"||n.isPresent?jm.cloneElement(o,{ref:i}):null};yhe.displayName="Presence";function rDn(t){let[e,r]=jm.useState(),n=jm.useRef(null),o=jm.useRef(t),i=jm.useRef("none"),a=t?"mounted":"unmounted",[s,u]=tDn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return jm.useEffect(()=>{let l=ghe(n.current);i.current=s==="mounted"?l:"none"},[s]),Nm(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=ghe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Nm(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=ghe(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=ghe(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:jm.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function ghe(t){return t?.animationName||"none"}function nDn(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)}HN();var jy=F(ee(),1);var bhe=F(ee(),1);var oDn=jy[" useInsertionEffect ".trim().toString()]||Nm;function WYt({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=iDn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=jy.useRef(t!==void 0);jy.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=jy.useCallback(c=>{if(s){let d=aDn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function iDn({defaultProp:t,onChange:e}){let[r,n]=jy.useState(t),o=jy.useRef(r),i=jy.useRef(e);return oDn(()=>{i.current=e},[e]),jy.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function aDn(t){return typeof t=="function"}var ZMi=Symbol("RADIX:SYNC_STATE");var ZYt=F(ee(),1);var KYt=F(ee(),1),sDn=F(Cs(),1);HN();var GYt=F(bt(),1),uDn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],JYt=uDn.reduce((t,e)=>{let r=XO(`Primitive.${e}`),n=KYt.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,GYt.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var YYt=F(bt(),1),lDn=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"}),cDn="VisuallyHidden",XYt=ZYt.forwardRef((t,e)=>(0,YYt.jsx)(JYt.span,{...t,ref:e,style:{...lDn,...t.style}}));XYt.displayName=cDn;var QYt=XYt;var jl=F(bt(),1),[_he,fRi]=mhe("Tooltip",[L2e]),vhe=L2e(),eXt="TooltipProvider",fDn=700,$2e="tooltip.open",[pDn,B2e]=_he(eXt),tXt=t=>{let{__scopeTooltip:e,delayDuration:r=fDn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=fn.useRef(!0),s=fn.useRef(!1),u=fn.useRef(0);return fn.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,jl.jsx)(pDn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:fn.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:fn.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:fn.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};tXt.displayName=eXt;var xJ="Tooltip",[mDn,SJ]=_he(xJ),rXt=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=B2e(xJ,t.__scopeTooltip),l=vhe(e),[c,d]=fn.useState(null),f=CYt(),p=fn.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,b=fn.useRef(!1),[g,y]=WYt({prop:n,defaultProp:o??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent($2e))):u.onClose(),i?.(P)},caller:xJ}),x=fn.useMemo(()=>g?b.current?"delayed-open":"instant-open":"closed",[g]),S=fn.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,y(!0)},[y]),O=fn.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),E=fn.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,y(!0),p.current=0},h)},[h,y]);return fn.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,jl.jsx)($Yt,{...l,children:(0,jl.jsx)(mDn,{scope:e,contentId:f,open:g,stateAttribute:x,trigger:c,onTriggerChange:d,onTriggerEnter:fn.useCallback(()=>{u.isOpenDelayedRef.current?E():S()},[u.isOpenDelayedRef,E,S]),onTriggerLeave:fn.useCallback(()=>{m?O():(window.clearTimeout(p.current),p.current=0)},[O,m]),onOpen:S,onClose:O,disableHoverableContent:m,children:r})})};rXt.displayName=xJ;var z2e="TooltipTrigger",nXt=fn.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=SJ(z2e,r),i=B2e(z2e,r),a=vhe(r),s=fn.useRef(null),u=g_(e,s,o.onTriggerChange),l=fn.useRef(!1),c=fn.useRef(!1),d=fn.useCallback(()=>l.current=!1,[]);return fn.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,jl.jsx)(zYt,{asChild:!0,...a,children:(0,jl.jsx)(Ny.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:h_(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:h_(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:h_(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:h_(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:h_(t.onBlur,o.onClose),onClick:h_(t.onClick,o.onClose)})})});nXt.displayName=z2e;var U2e="TooltipPortal",[hDn,gDn]=_he(U2e,{forceMount:void 0}),oXt=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=SJ(U2e,e);return(0,jl.jsx)(hDn,{scope:e,forceMount:r,children:(0,jl.jsx)(yhe,{present:r||i.open,children:(0,jl.jsx)(k2e,{asChild:!0,container:o,children:n})})})};oXt.displayName=U2e;var c3="TooltipContent",iXt=fn.forwardRef((t,e)=>{let r=gDn(c3,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=SJ(c3,t.__scopeTooltip);return(0,jl.jsx)(yhe,{present:n||a.open,children:a.disableHoverableContent?(0,jl.jsx)(aXt,{side:o,...i,ref:e}):(0,jl.jsx)(yDn,{side:o,...i,ref:e})})}),yDn=fn.forwardRef((t,e)=>{let r=SJ(c3,t.__scopeTooltip),n=B2e(c3,t.__scopeTooltip),o=fn.useRef(null),i=g_(e,o),[a,s]=fn.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=fn.useCallback(()=>{s(null),d(!1)},[d]),p=fn.useCallback((m,h)=>{let b=m.currentTarget,g={x:m.clientX,y:m.clientY},y=xDn(g,b.getBoundingClientRect()),x=SDn(g,y),S=CDn(h.getBoundingClientRect()),O=PDn([...x,...S]);s(O),d(!0)},[d]);return fn.useEffect(()=>()=>f(),[f]),fn.useEffect(()=>{if(u&&c){let m=b=>p(b,c),h=b=>p(b,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),fn.useEffect(()=>{if(a){let m=h=>{let b=h.target,g={x:h.clientX,y:h.clientY},y=u?.contains(b)||c?.contains(b),x=!ODn(g,a);y?f():x&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,jl.jsx)(aXt,{...t,ref:i})}),[bDn,_Dn]=_he(xJ,{isInside:!1}),vDn=JYe("TooltipContent"),aXt=fn.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=SJ(c3,r),l=vhe(r),{onClose:c}=u;return fn.useEffect(()=>(document.addEventListener($2e,c),()=>document.removeEventListener($2e,c)),[c]),fn.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,jl.jsx)(R2e,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,jl.jsxs)(BYt,{"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,jl.jsx)(vDn,{children:n}),(0,jl.jsx)(bDn,{scope:r,isInside:!0,children:(0,jl.jsx)(QYt,{id:u.contentId,role:"tooltip",children:o||n})})]})})});iXt.displayName=c3;var sXt="TooltipArrow",wDn=fn.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=vhe(r);return _Dn(sXt,r).isInside?null:(0,jl.jsx)(UYt,{...o,...n,ref:e})});wDn.displayName=sXt;function xDn(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 SDn(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 CDn(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 ODn(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 PDn(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),EDn(e)}function EDn(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 whe=tXt,uXt=rXt,lXt=nXt,cXt=oXt,q2e=iXt;$n();var lo=whe,Nt=uXt,jt=lXt,At=CJ.forwardRef(({className:t,sideOffset:e=4,...r},n)=>CJ.createElement(cXt,{container:activeDocument.body},CJ.createElement(q2e,{ref:n,sideOffset:e,className:ve("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})));At.displayName=q2e.displayName;Ur();Tn();sP();OC();er();An();var Uh=require("obsidian"),Ut=F(ee());async function TDn(){try{await wa.getInstance().indexVaultToVectorStore(),new Uh.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new Uh.Notice("Failed to refresh vault index. Check console for details.")}}async function ADn(){try{await wa.getInstance().indexVaultToVectorStore(!0),new Uh.Notice("Vault force reindexed.")}catch(t){console.error("Error force reindexing vault:",t),new Uh.Notice("Failed to force reindex vault. Check console for details.")}}async function xhe(){let t=iu();if(!t){new Uh.Notice("No project is currently selected to reload.");return}try{mA(!0),await zb.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new Uh.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){fe("Error reloading project context:",e),sL(e)||new Uh.Notice("Failed to reload project context. Check console for details.")}finally{mA(!1)}}async function IDn(){let t=iu();if(!t){new Uh.Notice("No project is currently selected to rebuild.");return}new $d(app,async()=>{try{mA(!0),new Uh.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),Y9.resetRateLimitNoticeTimer(),await zb.getInstance().clearForProject(t),new Uh.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 Uh.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){fe("Error force rebuilding project context:",r),sL(r)||new Uh.Notice("Failed to force rebuild project context. Check console for details.")}finally{mA(!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 fXt({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=Hn(),[a,s]=nb(),u=Rq(),l=c=>{s(c),n(c),c!=="project"&&(PN(null),o?.())};return Ut.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Ut.default.createElement("div",{className:"tw-flex-1"},Ut.default.createElement(_J,null,Ut.default.createElement(vJ,{asChild:!0},Ut.default.createElement(be,{variant:"ghost2",size:"fit",className:"tw-ml-1"},a==="llm_chain"&&"chat (free)",a==="vault_qa"&&"vault QA (free)",a==="copilot_plus"&&Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ut.default.createElement(Pg,{className:"tw-size-4"}),"copilot plus (beta)"),a==="project"&&"projects (alpha)",Ut.default.createElement(Xi,{className:"tw-mt-0.5 tw-size-5"}))),Ut.default.createElement(m_,{align:"start"},Ut.default.createElement(Ri,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Ut.default.createElement(Ri,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Ut.default.createElement(Ri,{onSelect:()=>{l("copilot_plus")}},Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ut.default.createElement(Pg,{className:"tw-size-4"}),"copilot plus (beta)")):Ut.default.createElement(Ri,{onSelect:()=>{XN(zO.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ut.default.createElement(aP,{className:"tw-size-3"})),u?Ut.default.createElement(Ri,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Ut.default.createElement(GN,{className:"tw-size-4"}),"projects (alpha)"):Ut.default.createElement(Ri,{onSelect:()=>{XN(zO.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ut.default.createElement(aP,{className:"tw-size-3"}))))),Ut.default.createElement("div",null,Ut.default.createElement(Nt,null,Ut.default.createElement(jt,{asChild:!0},Ut.default.createElement(be,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Ut.default.createElement(E8,{className:"tw-size-4"}))),Ut.default.createElement(At,null,"New Chat")),!i.autosaveChat&&Ut.default.createElement(Nt,null,Ut.default.createElement(jt,{asChild:!0},Ut.default.createElement(be,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Ut.default.createElement(g8,{className:"tw-size-4"}))),Ut.default.createElement(At,null,"Save Chat as Note")),Ut.default.createElement(Nt,null,Ut.default.createElement(jt,{asChild:!0},Ut.default.createElement(be,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Ut.default.createElement(C8,{className:"tw-size-4"}))),Ut.default.createElement(At,null,"Chat History")),Ut.default.createElement(_J,null,Ut.default.createElement(vJ,{asChild:!0},Ut.default.createElement(be,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Ut.default.createElement(zA,{className:"tw-size-4"}))),Ut.default.createElement(m_,{align:"end",className:"tw-w-64"},Ut.default.createElement(Ri,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),ht("showSuggestedPrompts",!i.showSuggestedPrompts)}},Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ut.default.createElement(Pg,{className:"tw-size-4"}),"Suggested Prompt"),Ut.default.createElement(u3,{checked:i.showSuggestedPrompts})),Ut.default.createElement(Ri,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),ht("showRelevantNotes",!i.showRelevantNotes)}},Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ut.default.createElement(pb,{className:"tw-size-4"}),"Relevant Note"),Ut.default.createElement(u3,{checked:i.showRelevantNotes})),a==="project"?Ut.default.createElement(Ut.default.Fragment,null,Ut.default.createElement(Ri,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>xhe()},Ut.default.createElement(av,{className:"tw-size-4"}),"Reload Current Project"),Ut.default.createElement(Ri,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>IDn()},Ut.default.createElement(lp,{className:"tw-size-4"}),"Force Rebuild Context")):Ut.default.createElement(Ut.default.Fragment,null,Ut.default.createElement(Ri,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>TDn()},Ut.default.createElement(av,{className:"tw-size-4"}),"Refresh Vault Index"),Ut.default.createElement(Ri,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new $d(app,()=>ADn(),"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()}},Ut.default.createElement(lp,{className:"tw-size-4"}),"Force Reindex Vault"))))))}Us();td();var pXt=require("obsidian");var She=require("obsidian");on();var d3=class extends She.FuzzySuggestModal{constructor(e){super(e),this.activeNote=e.workspace.getActiveFile()}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof She.TFile&&_N(a)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>_N(a)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&_N(this.activeNote)?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var n1=class extends d3{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1}){super(e),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){this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof pXt.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 Che=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 mXt=require("obsidian"),OJ=class extends mXt.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)}};di();Us();td();var hXt=require("obsidian");Ur();var f3=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 hXt.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
|
||
|
||
Embedded PDF (${s}):
|
||
${l}
|
||
|
||
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
|
||
|
||
Embedded PDF (${s}): [Error: Could not process PDF]
|
||
|
||
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=f6)=>{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(s!=="copilot_plus"&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`);return}let p=await r.parseFile(d,n);d.extension==="md"&&s==="copilot_plus"&&(p=await this.processEmbeddedPDFs(p,n,r)),u+=`
|
||
|
||
<${f}>
|
||
Title: [[${d.basename}]]
|
||
Path: ${d.path}
|
||
|
||
${p}
|
||
</${f}>`}catch(p){console.error(`Error processing file ${d.path}:`,p),u+=`
|
||
|
||
<${f}_error>
|
||
Title: [[${d.basename}]]
|
||
Path: ${d.path}
|
||
|
||
[Error: Could not process file]
|
||
</${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=TN();if(!e||e.length===0)return"";let r="";for(let n of e){let o=n.startLine===n.endLine?`L${n.startLine}`:`L${n.startLine}-${n.endLine}`;r+=`
|
||
|
||
<selected_text>
|
||
Title: [[${n.noteTitle}]]
|
||
Path: ${n.notePath}
|
||
Lines: ${o}
|
||
|
||
${n.content}
|
||
</selected_text>`}return r}};er();on();An();var i1=require("obsidian"),ut=F(ee());var Rn=F(ee()),Bi=F(SXt());function o1(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 NDn=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 uk(t,e,r){let n=jDn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&CXt(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),CXt(n,"relativePath",i),n}function jDn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=NDn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function CXt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var DDn=[".DS_Store","Thumbs.db"];function V2e(t){return o1(this,void 0,void 0,function*(){return Ohe(t)&&LDn(t.dataTransfer)?zDn(t.dataTransfer,t.type):FDn(t)?kDn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?$Dn(t):[]})}function LDn(t){return Ohe(t)}function FDn(t){return Ohe(t)&&Ohe(t.target)}function Ohe(t){return typeof t=="object"&&t!==null}function kDn(t){return H2e(t.target.files).map(e=>uk(e))}function $Dn(t){return o1(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>uk(r))})}function zDn(t,e){return o1(this,void 0,void 0,function*(){if(t.items){let r=H2e(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(BDn));return OXt(EXt(n))}return OXt(H2e(t.files).map(r=>uk(r)))})}function OXt(t){return t.filter(e=>DDn.indexOf(e.name)===-1)}function H2e(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 BDn(t){if(typeof t.webkitGetAsEntry!="function")return PXt(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?TXt(e):PXt(t,e)}function EXt(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?EXt(r):[r]],[])}function PXt(t,e){return o1(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,uk(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return uk(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function UDn(t){return o1(this,void 0,void 0,function*(){return t.isDirectory?TXt(t):qDn(t)})}function TXt(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>o1(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(UDn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function qDn(t){return o1(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=uk(n,t.fullPath);e(o)},n=>{r(n)})})})}var Phe=F(AXt());function IXt(t){return WDn(t)||VDn(t)||LXt(t)||HDn()}function HDn(){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 VDn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function WDn(t){if(Array.isArray(t))return K2e(t)}function MXt(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 RXt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?MXt(Object(r),!0).forEach(function(n){DXt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):MXt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function DXt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function PJ(t,e){return JDn(t)||GDn(t,e)||LXt(t,e)||KDn()}function KDn(){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 LXt(t,e){if(t){if(typeof t=="string")return K2e(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 K2e(t,e)}}function K2e(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 GDn(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 JDn(t){if(Array.isArray(t))return t}var ZDn=typeof Phe.default=="function"?Phe.default:Phe.default.default,YDn="file-invalid-type",XDn="file-too-large",QDn="file-too-small",eLn="too-many-files";var tLn=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:YDn,message:"File type must be ".concat(n)}},NXt=function(e){return{code:XDn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},jXt=function(e){return{code:QDn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},FXt={code:eLn,message:"Too many files"};function G2e(t,e){var r=t.type==="application/x-moz-file"||ZDn(t,e);return[r,r?null:tLn(e)]}function J2e(t,e,r){if(lk(t.size))if(lk(e)&&lk(r)){if(t.size>r)return[!1,NXt(r)];if(t.size<e)return[!1,jXt(e)]}else{if(lk(e)&&t.size<e)return[!1,jXt(e)];if(lk(r)&&t.size>r)return[!1,NXt(r)]}return[!0,null]}function lk(t){return t!=null}function kXt(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=G2e(u,r),c=PJ(l,1),d=c[0],f=J2e(u,n,o),p=PJ(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function EJ(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function TJ(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 Z2e(t){t.preventDefault()}function rLn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function nLn(t){return t.indexOf("Edge/")!==-1}function $Xt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return rLn(t)||nLn(t)}function y_(){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!EJ(n)&&s&&s.apply(void 0,[n].concat(i)),EJ(n)})}}function zXt(){return"showOpenFilePicker"in window}function BXt(t){if(lk(t)){var e=Object.entries(t).filter(function(r){var n=PJ(r,2),o=n[0],i=n[1],a=!0;return VXt(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(WXt))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=PJ(n,2),i=o[0],a=o[1];return RXt(RXt({},r),{},DXt({},i,a))},{});return[{description:"Files",accept:e}]}return t}function UXt(t){if(lk(t))return Object.entries(t).reduce(function(e,r){var n=PJ(r,2),o=n[0],i=n[1];return[].concat(IXt(e),[o],IXt(i))},[]).filter(function(e){return VXt(e)||WXt(e)}).join(",")}function qXt(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function HXt(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function VXt(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function WXt(t){return/^.*\.[\w]+$/.test(t)}var oLn=["children"],iLn=["open"],aLn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],sLn=["refKey","onChange","onClick"];function uLn(t){return dLn(t)||cLn(t)||JXt(t)||lLn()}function lLn(){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 cLn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function dLn(t){if(Array.isArray(t))return X2e(t)}function Y2e(t,e){return mLn(t)||pLn(t,e)||JXt(t,e)||fLn()}function fLn(){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 JXt(t,e){if(t){if(typeof t=="string")return X2e(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 X2e(t,e)}}function X2e(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 pLn(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 mLn(t){if(Array.isArray(t))return t}function KXt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function ps(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?KXt(Object(r),!0).forEach(function(n){Q2e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):KXt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Q2e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ehe(t,e){if(t==null)return{};var r=hLn(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 hLn(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 t4e=(0,Rn.forwardRef)(function(t,e){var r=t.children,n=Ehe(t,oLn),o=r4e(n),i=o.open,a=Ehe(o,iLn);return(0,Rn.useImperativeHandle)(e,function(){return{open:i}},[i]),Rn.default.createElement(Rn.Fragment,null,r(ps(ps({},a),{},{open:i})))});t4e.displayName="Dropzone";var ZXt={disabled:!1,getFilesFromEvent:V2e,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};t4e.defaultProps=ZXt;t4e.propTypes={children:Bi.default.func,accept:Bi.default.objectOf(Bi.default.arrayOf(Bi.default.string)),multiple:Bi.default.bool,preventDropOnDocument:Bi.default.bool,noClick:Bi.default.bool,noKeyboard:Bi.default.bool,noDrag:Bi.default.bool,noDragEventsBubbling:Bi.default.bool,minSize:Bi.default.number,maxSize:Bi.default.number,maxFiles:Bi.default.number,disabled:Bi.default.bool,getFilesFromEvent:Bi.default.func,onFileDialogCancel:Bi.default.func,onFileDialogOpen:Bi.default.func,useFsAccessApi:Bi.default.bool,autoFocus:Bi.default.bool,onDragEnter:Bi.default.func,onDragLeave:Bi.default.func,onDragOver:Bi.default.func,onDrop:Bi.default.func,onDropAccepted:Bi.default.func,onDropRejected:Bi.default.func,onError:Bi.default.func,validator:Bi.default.func};var e4e={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function r4e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=ps(ps({},ZXt),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,b=e.onFileDialogOpen,g=e.useFsAccessApi,y=e.autoFocus,x=e.preventDropOnDocument,S=e.noClick,O=e.noKeyboard,E=e.noDrag,P=e.noDragEventsBubbling,A=e.onError,I=e.validator,R=(0,Rn.useMemo)(function(){return UXt(r)},[r]),N=(0,Rn.useMemo)(function(){return BXt(r)},[r]),j=(0,Rn.useMemo)(function(){return typeof b=="function"?b:GXt},[b]),$=(0,Rn.useMemo)(function(){return typeof h=="function"?h:GXt},[h]),k=(0,Rn.useRef)(null),H=(0,Rn.useRef)(null),V=(0,Rn.useReducer)(gLn,e4e),Q=Y2e(V,2),Z=Q[0],D=Q[1],z=Z.isFocused,B=Z.isFileDialogActive,K=(0,Rn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&zXt()),q=function(){!K.current&&B&&setTimeout(function(){if(H.current){var pe=H.current.files;pe.length||(D({type:"closeDialog"}),$())}},300)};(0,Rn.useEffect)(function(){return window.addEventListener("focus",q,!1),function(){window.removeEventListener("focus",q,!1)}},[H,B,$,K]);var te=(0,Rn.useRef)([]),U=function(pe){k.current&&k.current.contains(pe.target)||(pe.preventDefault(),te.current=[])};(0,Rn.useEffect)(function(){return x&&(document.addEventListener("dragover",Z2e,!1),document.addEventListener("drop",U,!1)),function(){x&&(document.removeEventListener("dragover",Z2e),document.removeEventListener("drop",U))}},[k,x]),(0,Rn.useEffect)(function(){return!n&&y&&k.current&&k.current.focus(),function(){}},[k,y,n]);var W=(0,Rn.useCallback)(function(ue){A?A(ue):console.error(ue)},[A]),Y=(0,Rn.useCallback)(function(ue){ue.preventDefault(),ue.persist(),ce(ue),te.current=[].concat(uLn(te.current),[ue.target]),TJ(ue)&&Promise.resolve(o(ue)).then(function(pe){if(!(EJ(ue)&&!P)){var Pe=pe.length,Ae=Pe>0&&kXt({files:pe,accept:R,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),ot=Pe>0&&!Ae;D({isDragAccept:Ae,isDragReject:ot,isDragActive:!0,type:"setDraggedFiles"}),l&&l(ue)}}).catch(function(pe){return W(pe)})},[o,l,W,P,R,a,i,s,u,I]),se=(0,Rn.useCallback)(function(ue){ue.preventDefault(),ue.persist(),ce(ue);var pe=TJ(ue);if(pe&&ue.dataTransfer)try{ue.dataTransfer.dropEffect="copy"}catch{}return pe&&d&&d(ue),!1},[d,P]),Te=(0,Rn.useCallback)(function(ue){ue.preventDefault(),ue.persist(),ce(ue);var pe=te.current.filter(function(Ae){return k.current&&k.current.contains(Ae)}),Pe=pe.indexOf(ue.target);Pe!==-1&&pe.splice(Pe,1),te.current=pe,!(pe.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),TJ(ue)&&c&&c(ue))},[k,c,P]),de=(0,Rn.useCallback)(function(ue,pe){var Pe=[],Ae=[];ue.forEach(function(ot){var Nr=G2e(ot,R),ua=Y2e(Nr,2),Va=ua[0],km=ua[1],qy=J2e(ot,a,i),ys=Y2e(qy,2),Jh=ys[0],$m=ys[1],Zh=I?I(ot):null;if(Va&&Jh&&!Zh)Pe.push(ot);else{var Qn=[km,$m];Zh&&(Qn=Qn.concat(Zh)),Ae.push({file:ot,errors:Qn.filter(function(FT){return FT})})}}),(!s&&Pe.length>1||s&&u>=1&&Pe.length>u)&&(Pe.forEach(function(ot){Ae.push({file:ot,errors:[FXt]})}),Pe.splice(0)),D({acceptedFiles:Pe,fileRejections:Ae,isDragReject:Ae.length>0,type:"setFiles"}),f&&f(Pe,Ae,pe),Ae.length>0&&m&&m(Ae,pe),Pe.length>0&&p&&p(Pe,pe)},[D,s,R,a,i,u,f,p,m,I]),Ue=(0,Rn.useCallback)(function(ue){ue.preventDefault(),ue.persist(),ce(ue),te.current=[],TJ(ue)&&Promise.resolve(o(ue)).then(function(pe){EJ(ue)&&!P||de(pe,ue)}).catch(function(pe){return W(pe)}),D({type:"reset"})},[o,de,W,P]),Ke=(0,Rn.useCallback)(function(){if(K.current){D({type:"openDialog"}),j();var ue={multiple:s,types:N};window.showOpenFilePicker(ue).then(function(pe){return o(pe)}).then(function(pe){de(pe,null),D({type:"closeDialog"})}).catch(function(pe){qXt(pe)?($(pe),D({type:"closeDialog"})):HXt(pe)?(K.current=!1,H.current?(H.current.value=null,H.current.click()):W(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):W(pe)});return}H.current&&(D({type:"openDialog"}),j(),H.current.value=null,H.current.click())},[D,j,$,g,de,W,N,s]),at=(0,Rn.useCallback)(function(ue){!k.current||!k.current.isEqualNode(ue.target)||(ue.key===" "||ue.key==="Enter"||ue.keyCode===32||ue.keyCode===13)&&(ue.preventDefault(),Ke())},[k,Ke]),hr=(0,Rn.useCallback)(function(){D({type:"focus"})},[]),Nn=(0,Rn.useCallback)(function(){D({type:"blur"})},[]),De=(0,Rn.useCallback)(function(){S||($Xt()?setTimeout(Ke,0):Ke())},[S,Ke]),_t=function(pe){return n?null:pe},Oe=function(pe){return O?null:_t(pe)},$e=function(pe){return E?null:_t(pe)},ce=function(pe){P&&pe.stopPropagation()},qt=(0,Rn.useMemo)(function(){return function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},pe=ue.refKey,Pe=pe===void 0?"ref":pe,Ae=ue.role,ot=ue.onKeyDown,Nr=ue.onFocus,ua=ue.onBlur,Va=ue.onClick,km=ue.onDragEnter,qy=ue.onDragOver,ys=ue.onDragLeave,Jh=ue.onDrop,$m=Ehe(ue,aLn);return ps(ps(Q2e({onKeyDown:Oe(y_(ot,at)),onFocus:Oe(y_(Nr,hr)),onBlur:Oe(y_(ua,Nn)),onClick:_t(y_(Va,De)),onDragEnter:$e(y_(km,Y)),onDragOver:$e(y_(qy,se)),onDragLeave:$e(y_(ys,Te)),onDrop:$e(y_(Jh,Ue)),role:typeof Ae=="string"&&Ae!==""?Ae:"presentation"},Pe,k),!n&&!O?{tabIndex:0}:{}),$m)}},[k,at,hr,Nn,De,Y,se,Te,Ue,O,E,n]),Ze=(0,Rn.useCallback)(function(ue){ue.stopPropagation()},[]),Ne=(0,Rn.useMemo)(function(){return function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},pe=ue.refKey,Pe=pe===void 0?"ref":pe,Ae=ue.onChange,ot=ue.onClick,Nr=Ehe(ue,sLn),ua=Q2e({accept:R,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:_t(y_(Ae,Ue)),onClick:_t(y_(ot,Ze)),tabIndex:-1},Pe,H);return ps(ps({},ua),Nr)}},[H,r,s,Ue,n]);return ps(ps({},Z),{},{isFocused:z&&!n,getRootProps:qt,getInputProps:Ne,rootRef:k,inputRef:H,open:_t(Ke)})}function gLn(t,e){switch(e.type){case"focus":return ps(ps({},t),{},{isFocused:!0});case"blur":return ps(ps({},t),{},{isFocused:!1});case"openDialog":return ps(ps({},e4e),{},{isFileDialogActive:!0});case"closeDialog":return ps(ps({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return ps(ps({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return ps(ps({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return ps({},e4e);default:return t}}function GXt(){}Us();var QXt=F(ee());td();An();var li=F(ee());di();var The=F(ee());bQ();$n();var yLn=pz("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"}}),Dm=The.forwardRef(({className:t,variant:e,...r},n)=>The.createElement("div",{ref:n,className:ve(yLn({variant:e}),t),...r}));Dm.displayName="Badge";function YXt({note:t,isActive:e=!1,onRemoveContext:r}){return li.default.createElement(Dm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},li.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},li.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&li.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&li.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),li.default.createElement(be,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},li.default.createElement(Qi,{className:"tw-size-4"})))}function bLn({url:t,onRemoveUrl:e}){return li.default.createElement(Dm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},li.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},li.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),li.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),li.default.createElement(be,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},li.default.createElement(Qi,{className:"tw-size-4"})))}function _Ln({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return li.default.createElement(Dm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},li.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},li.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),li.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),li.default.createElement(be,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context"},li.default.createElement(Qi,{className:"tw-size-4"})))}var XXt=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s})=>{let u=li.default.useMemo(()=>{let d=new Map(e.map(f=>[f.path,f]));return Array.from(d.values()).filter(f=>f.wasAddedManually?!0:!(t&&f.path===t.path))},[e,t]),l=li.default.useMemo(()=>Array.from(new Set(r)),[r]),c=u.length>0||l.length>0||n.length>0||!!t;return li.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},li.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},li.default.createElement(be,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border"},li.default.createElement(nh,{className:"tw-size-4"}),!c&&li.default.createElement("span",{className:"tw-pr-1 tw-text-xs tw-leading-4"},"Add context"))),li.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&li.default.createElement(YXt,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),u.map(d=>li.default.createElement(YXt,{key:d.path,note:d,isActive:!1,onRemoveContext:i})),l.map(d=>li.default.createElement(bLn,{key:d,url:d,onRemoveUrl:a})),n.map(d=>li.default.createElement(_Ln,{key:d.id,selectedText:d,onRemoveSelectedText:s||(()=>{})}))))};var vLn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})=>{let[d]=nb(),f=()=>{new n1({app:t,onNoteSelect:m=>{a&&m.path===a.path?(i(!0),n(h=>h.filter(b=>b.path!==m.path))):n(h=>[...h,Object.assign(m,{wasAddedManually:!0})])},excludeNotePaths:e}).open()},p=m=>{let h=r.find(g=>g.path===m);h&&h.wasAddedManually?n(g=>g.filter(y=>y.path!==m)):(i(!1),n(g=>g.filter(y=>y.path!==m)))};return d!=="copilot_plus"&&d!=="project"?null:QXt.default.createElement(XXt,{activeNote:o?a:null,contextNotes:r,onAddContext:f,onRemoveContext:p,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})},eQt=vLn;var tQt=(0,ut.forwardRef)(({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,mention:c,selectedImages:d,onAddImage:f,setSelectedImages:p,disableModelSwitch:m,selectedTextContexts:h,onRemoveSelectedText:b},g)=>{let[y,x]=(0,ut.useState)(!1),[S,O]=(0,ut.useState)([]),E=(0,ut.useRef)(null),P=(0,ut.useRef)(null),[A,I]=D$(),[R,N]=(0,ut.useState)(null),[j]=nb(),[$]=hJe(),[k,H]=(0,ut.useState)(()=>{let De=i.workspace.getActiveFile();return _N(De)?De:null}),[V,Q]=(0,ut.useState)(null),Z=Hn(),D=j==="copilot_plus"||j==="project",[z,B]=(0,ut.useState)(0),K=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,ut.useImperativeHandle)(g,()=>({focus:()=>{E.current?.focus()}})),(0,ut.useEffect)(()=>{if(j==="project"){Q(iu());let De=L$(_t=>{Q(_t)});return()=>{De()}}else Q(null)},[j]),(0,ut.useEffect)(()=>{if(!$)return;let De=setInterval(()=>{B(_t=>(_t+1)%K.length)},3e3);return()=>clearInterval(De)},[$,K.length]);let q=()=>V&&j==="project"&&V.projectModelKey?V.projectModelKey:A,te=De=>{if(!D){r();return}r({toolCalls:De?["@vault"]:[],contextNotes:a,urls:S})},U=async De=>{let _t=De.target.value,Oe=De.target.selectionStart,$e=Oe>0&&_t[Oe-1]==="/"&&(Oe===1||_t[Oe-2]===" ");e(_t),W();let qt=c.extractAllUrls(_t).filter(Ze=>!S.includes(Ze));qt.length>0&&O(Ze=>Array.from(new Set([...Ze,...qt]))),Oe>=2&&_t.slice(Oe-2,Oe)==="[["?Y(Oe):$e?se(Oe,_t):_t.slice(-1)==="@"&&D&&Te()},W=()=>{E.current&&(E.current.style.height="auto",E.current.style.height=`${E.current.scrollHeight}px`)};(0,ut.useEffect)(()=>{W()},[t]);let Y=De=>{(async()=>{let Oe=f3.getInstance();new n1({app:i,onNoteSelect:async $e=>{let ce=t.slice(0,De-2),qt=t.slice(De-1),Ne=Yve($e.basename,i.vault)?$e.basename:$e.path,ue=`${ce}[[${Ne}]]${qt}`;e(ue);let pe=i.workspace.getActiveFile();$e&&await Oe.addNoteToContext($e,i.vault,a,pe,s,l),setTimeout(()=>{if(E.current){let Pe=De+Ne.length+2;E.current.setSelectionRange(Pe,Pe)}},0)},excludeNotePaths:Nn}).open()})()},se=(De,_t)=>{let Oe=Fd.getInstance(),$e=Mm(),ce=rJt($e.filter(ue=>ue.showInSlashMenu)),qt=ce.map(ue=>ue.title),Ze=De-1;new OJ(i,qt,ue=>{let pe=ce.find(Pe=>Pe.title===ue);if(pe){Oe.recordUsage(pe);let Pe="",Ae="";Ze>=0&&_t[Ze]==="/"&&(Pe=_t.slice(0,Ze),Ae=_t.slice(Ze+1));let ot=Pe+pe.content+Ae;e(ot),setTimeout(()=>{if(E.current){let Nr=Pe.length+pe.content.length;E.current.setSelectionRange(Nr,Nr),E.current.focus()}},0)}}).open()},Te=()=>{let De=iK.map(_t=>({title:_t,description:rzt(_t)}));new OJ(i,De.map(_t=>_t.title),_t=>{e(t+_t+" ")},De.map(_t=>_t.description)).open()},de=De=>{if(!De.nativeEvent.isComposing){if(De.key==="Enter"&&De.shiftKey&&(i1.Platform.isMacOS?De.metaKey:De.ctrlKey)){De.preventDefault(),De.stopPropagation(),te(!0);return}if(De.key==="Enter"){if(!(!De.shiftKey&&!i1.Platform.isMobile||De.shiftKey&&i1.Platform.isMobile))return;De.preventDefault(),te(!1)}}},Ue=(0,ut.useCallback)(async De=>{let _t=De.clipboardData?.items;if(!_t||!D)return;let Oe=Array.from(_t).filter($e=>$e.type.indexOf("image")!==-1);if(Oe.length>0){De.preventDefault();let ce=(await Promise.all(Oe.map(qt=>{let Ze=qt.getAsFile();return Ze||null}))).filter(qt=>qt!==null);ce.length>0&&f(ce)}},[f,D]);(0,ut.useEffect)(()=>{let De=new Set(tb(t,i.vault)),_t=c.extractAllUrls(t);s(Oe=>Oe.filter($e=>{if($e.wasAddedManually===!0)return!0;let qt=$e.wasAddedViaReference===!0;return $e.path===k?.path?qt?De.has($e):u:qt?De.has($e):!0})),O(Oe=>Oe.filter($e=>_t.includes($e)))},[t,u,k,c,s,i.vault]),(0,ut.useEffect)(()=>{let De,_t=()=>{clearTimeout(De),De=setTimeout(()=>{let $e=i.workspace.getActiveFile();H(_N($e)?$e:null)},100)},Oe=i.workspace.on("active-leaf-change",_t);return()=>{clearTimeout(De),i.workspace.offref(Oe)}},[i.workspace]);let{getRootProps:Ke,getInputProps:at,isDragActive:hr}=r4e({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:De=>{f(De)},noClick:!0,noDragEventsBubbling:!0}),Nn=(0,ut.useMemo)(()=>[...a.map(De=>De.path),...u&&k?[k.path]:[]].filter(De=>De!=null),[a,u,k]);return ut.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:P},ut.default.createElement(eQt,{app:i,excludeNotePaths:Nn,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:k,contextUrls:S,onRemoveUrl:De=>O(_t=>_t.filter(Oe=>Oe!==De)),selectedTextContexts:h,onRemoveSelectedText:b}),d.length>0&&ut.default.createElement("div",{className:"selected-images"},d.map((De,_t)=>ut.default.createElement("div",{key:_t,className:"image-preview-container"},ut.default.createElement("img",{src:URL.createObjectURL(De),alt:De.name,className:"selected-image-preview"}),ut.default.createElement("button",{className:"remove-image-button",onClick:()=>p(Oe=>Oe.filter(($e,ce)=>ce!==_t)),title:"Remove image"},ut.default.createElement(Qi,{className:"tw-size-4"}))))),ut.default.createElement("div",{className:"tw-relative",...D?Ke():{}},$&&ut.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"},ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ut.default.createElement(yc,{className:"tw-size-4 tw-animate-spin"}),ut.default.createElement("span",{className:"tw-text-sm"},K[z]))),ut.default.createElement("textarea",{ref:E,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 focus-visible:tw-ring-0",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(D?"@ for tools.":""),value:t,onChange:U,onKeyDown:de,onPaste:Ue,disabled:$}),D&&ut.default.createElement(ut.default.Fragment,null,ut.default.createElement("input",{...at()}),hr&&ut.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"},ut.default.createElement("span",null,"Drop images here...")))),ut.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-faint"},ut.default.createElement(yc,{className:"tw-size-3 tw-animate-spin"}),ut.default.createElement("span",null,"Generating...")):ut.default.createElement(ik,{open:y,onOpenChange:x},ut.default.createElement(ak,{asChild:!0},ut.default.createElement(be,{variant:"ghost2",size:"fit",disabled:m},R?ut.default.createElement("span",{className:"tw-text-error"},"Model Load Failed"):Z.activeModels.find(De=>De.enabled&&Yr(De)===q())?ut.default.createElement(bqe,{model:Z.activeModels.find(De=>De.enabled&&Yr(De)===q()),iconSize:8}):"Select Model",!m&&ut.default.createElement(Xi,{className:"tw-mt-0.5 tw-size-5"}))),ut.default.createElement(m_,{align:"start"},!m&&Z.activeModels.filter(De=>De.enabled).map(De=>{let{hasApiKey:_t,errorNotice:Oe}=T$(De,Z);return ut.default.createElement(Ri,{key:Yr(De),onSelect:async $e=>{if(!_t&&Oe){$e.preventDefault(),new i1.Notice(Oe);return}try{N(null),I(Yr(De))}catch(ce){let qt="Model switch failed: "+ci(ce);N(qt),new i1.Notice(qt);let Ze=Z.activeModels.find(Ne=>Ne.enabled&&Yr(Ne)===A);Ze&&I(Yr(Ze))}},className:_t?"":"tw-cursor-not-allowed tw-opacity-50"},ut.default.createElement(bqe,{model:De,iconSize:12}))}))),ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?ut.default.createElement(be,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},ut.default.createElement(kA,{className:"tw-size-4"}),"Stop"):ut.default.createElement(ut.default.Fragment,null,D&&ut.default.createElement(be,{variant:"ghost2",size:"fit",onClick:()=>{new Che(i,f).open()}},ut.default.createElement(O8,{className:"tw-size-4"})),ut.default.createElement(be,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>te(!1)},ut.default.createElement(rh,{className:"!tw-size-3"}),ut.default.createElement("span",null,"chat")),j==="copilot_plus"&&ut.default.createElement(be,{variant:"ghost2",size:"fit",className:"tw-hidden tw-text-muted @xs/chat-input:tw-inline-flex",onClick:()=>te(!0)},ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},i1.Platform.isMacOS?ut.default.createElement("div",{className:"tw-flex tw-items-center"},ut.default.createElement(rv,{className:"!tw-size-3"}),ut.default.createElement(eP,{className:"!tw-size-3"}),ut.default.createElement(rh,{className:"!tw-size-3"})):ut.default.createElement("div",{className:"tw-flex tw-items-center"},ut.default.createElement("span",null,"Ctrl"),ut.default.createElement(eP,{className:"tw-size-4"}),ut.default.createElement(rh,{className:"!tw-size-3"})),ut.default.createElement("span",null,"vault")))))))});tQt.displayName="ChatInput";var rQt=tQt;di();Ur();$n();An();var nQt=require("obsidian"),Ar=F(ee()),oQt=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Ar.default.createElement("div",{className:ve("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!nQt.Platform.isMobile})},t.sender===Ei?Ar.default.createElement(Ar.default.Fragment,null,Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Ar.default.createElement(gc,{className:"tw-size-4"}):Ar.default.createElement(th,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Copy")),Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Ar.default.createElement(nm,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Edit")),Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Ar.default.createElement(oh,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Delete"))):Ar.default.createElement(Ar.default.Fragment,null,u&&Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Ar.default.createElement(GN,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Show Sources")),Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Ar.default.createElement(I8,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Insert / Replace at cursor")),Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Ar.default.createElement(gc,{className:"tw-size-4"}):Ar.default.createElement(th,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Copy")),Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Ar.default.createElement(A8,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Regenerate")),Ar.default.createElement(Nt,null,Ar.default.createElement(jt,{asChild:!0},Ar.default.createElement(be,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Ar.default.createElement(oh,{className:"tw-size-4"}))),Ar.default.createElement(At,null,"Delete"))));Ur();var iQt=require("obsidian"),Ahe=class extends iQt.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"});let r=this.sources.filter(o=>o.score>=nwe),n=this.sources.filter(o=>o.score<nwe);r.length>0&&(e.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(e,r)),n.length>0&&(e.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(e,n))}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",i.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.title)}`,text:o.title}).addEventListener("click",s=>{s.preventDefault(),this.app.workspace.openLinkText(o.title,"")}),o.score&&o.score<=1&&i.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(3)}`))})}onClose(){let{contentEl:e}=this;e.empty()}};Ur();$n();on();An();var ST=require("obsidian");function b_(){}b_.prototype={diff:function(e,r){var n,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={});var a=this;function s(S){return S=a.postProcess(S,o),i?(setTimeout(function(){i(S)},0),!0):S}e=this.castInput(e,o),r=this.castInput(r,o),e=this.removeEmpty(this.tokenize(e,o)),r=this.removeEmpty(this.tokenize(r,o));var u=r.length,l=e.length,c=1,d=u+l;o.maxEditLength!=null&&(d=Math.min(d,o.maxEditLength));var f=(n=o.timeout)!==null&&n!==void 0?n:1/0,p=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(m[0],r,e,0,o);if(m[0].oldPos+1>=l&&h+1>=u)return s(aQt(a,m[0].lastComponent,r,e,a.useLongestToken));var b=-1/0,g=1/0;function y(){for(var S=Math.max(b,-c);S<=Math.min(g,c);S+=2){var O=void 0,E=m[S-1],P=m[S+1];E&&(m[S-1]=void 0);var A=!1;if(P){var I=P.oldPos-S;A=P&&0<=I&&I<u}var R=E&&E.oldPos+1<l;if(!A&&!R){m[S]=void 0;continue}if(!R||A&&E.oldPos<P.oldPos?O=a.addToPath(P,!0,!1,0,o):O=a.addToPath(E,!1,!0,1,o),h=a.extractCommon(O,r,e,S,o),O.oldPos+1>=l&&h+1>=u)return s(aQt(a,O.lastComponent,r,e,a.useLongestToken));m[S]=O,O.oldPos+1>=l&&(g=Math.min(g,S-1)),h+1>=u&&(b=Math.max(b,S+1))}c++}if(i)(function S(){setTimeout(function(){if(c>d||Date.now()>p)return i();y()||S()},0)})();else for(;c<=d&&Date.now()<=p;){var x=y();if(x)return x}},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}};function aQt(t,e,r,n,o){for(var i=[],a;e;)i.push(e),a=e.previousComponent,delete e.previousComponent,e=a;i.reverse();for(var s=0,u=i.length,l=0,c=0;s<u;s++){var d=i[s];if(d.removed)d.value=t.join(n.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&o){var f=r.slice(l,l+d.count);f=f.map(function(p,m){var h=n[c+m];return h.length>p.length?h:p}),d.value=t.join(f)}else d.value=t.join(r.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}var tNi=new b_;function sQt(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 uQt(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 n4e(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 o4e(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 AJ(t,e){return n4e(t,e,"")}function Ihe(t,e){return o4e(t,e,"")}function lQt(t,e){return e.slice(0,wLn(t,e))}function wLn(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}var Mhe="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}",xLn=new RegExp("[".concat(Mhe,"]+|\\s+|[^").concat(Mhe,"]"),"ug"),MJ=new b_;MJ.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};MJ.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(xLn)||[];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};MJ.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};MJ.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)&&cQt(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&cQt(r,o,n,null),t};function dQt(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?SLn(t,e,r):MJ.diff(t,e,r)}function cQt(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=sQt(o,a);t.value=o4e(t.value,a,u),e.value=AJ(e.value,u),r.value=AJ(r.value,u)}if(n){var l=uQt(i,s);n.value=n4e(n.value,s,l),e.value=Ihe(e.value,l),r.value=Ihe(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=sQt(c,d);e.value=AJ(e.value,p);var m=uQt(AJ(c,p),f);e.value=Ihe(e.value,m),n.value=n4e(n.value,c,m),t.value=o4e(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],b=e.value.match(/\s*$/)[0],g=lQt(b,h);e.value=Ihe(e.value,g)}else if(t){var y=t.value.match(/\s*$/)[0],x=e.value.match(/^\s*/)[0],S=lQt(y,x);e.value=AJ(e.value,S)}}var fQt=new b_;fQt.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(Mhe,"]+|[^\\S\\n\\r]+|[^").concat(Mhe,"]"),"ug");return t.match(e)||[]};function SLn(t,e,r){return fQt.diff(t,e,r)}function CLn(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}var Rhe=new b_;Rhe.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};Rhe.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))),b_.prototype.equals.call(this,t,e,r)};function pQt(t,e,r){var n=CLn(r,{ignoreWhitespace:!0});return Rhe.diff(t,e,n)}var OLn=new b_;OLn.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var PLn=new b_;PLn.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function i4e(t){"@babel/helpers - typeof";return i4e=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},i4e(t)}var IJ=new b_;IJ.useLongestToken=!0;IJ.tokenize=Rhe.tokenize;IJ.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(a4e(t,null,null,o),o," ")};IJ.equals=function(t,e,r){return b_.prototype.equals.call(IJ,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function a4e(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]=a4e(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),i4e(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]=a4e(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var s4e=new b_;s4e.tokenize=function(t){return t.slice()};s4e.join=s4e.removeEmpty=function(t){return t};var Mr=F(ee()),_Qt=F(id());var __=F(ee());di();An();$n();Tn();An();var wT=require("obsidian"),Ir=F(ee()),mQt=F(id());di();var hQt=F(ee());function ELn(t){return t.trim().split(`
|
||
`).map(r=>"- "+r).join(`
|
||
`)}function u4e(t){return t.map(r=>{let n=r.some(a=>a.added),o=r.some(a=>a.removed),i="";return n?i=r.map(a=>a.added?a.value:"").join(`
|
||
`):o?i=r.map(a=>a.removed?ELn(a.value):"").join(`
|
||
`):r.map(s=>s.value).join(`
|
||
`).trim().length>0&&(i="..."),i}).join(`
|
||
`)}function RJ(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 NJ="obsidian-copilot-apply-view",Nhe=class extends wT.ItemView{constructor(r){super(r);this.root=null;this.state=null}getViewType(){return NJ}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)}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,mQt.createRoot)(n)),this.root.render(Ir.default.createElement(TLn,{app:this.app,state:this.state,close:()=>this.leaf.detach()}))}},gQt=(0,Ir.memo)(({oldLine:t,newLine:e})=>{let r=dQt(t,e);return Ir.default.createElement(Ir.default.Fragment,null,r.map((n,o)=>n.added?Ir.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?Ir.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):Ir.default.createElement("span",{key:o},n.value)))});gQt.displayName="WordDiff";var TLn=({app:t,state:e,close:r})=>{let[n,o]=(0,hQt.useState)(()=>e.changes.map(p=>({...p,accepted:null}))),i=RJ(n),a=(0,Ir.useRef)([]);if(!e||!e.changes)return fe("Invalid state:",e),Ir.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},Ir.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),Ir.default.createElement(be,{onClick:r,className:"tw-mt-4"},"Close"));let s=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!0}:m);await l(p)}catch(p){fe("Error applying changes:",p),new wT.Notice(`Error applying changes: ${p.message}`)}},u=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!1}:m);await l(p)}catch(p){fe("Error applying changes:",p),new wT.Notice(`Error applying changes: ${p.message}`)}},l=async p=>{let m=p.filter(b=>b.added?b.accepted===!0:b.removed?b.accepted===!1:!0).map(b=>b.value).join(""),h=t.vault.getAbstractFileByPath(e.path);if(!h||!(h instanceof wT.TFile)){new wT.Notice("File not found:"+e.path),r();return}await t.vault.modify(h,m),new wT.Notice("Changes applied successfully"),r()},c=p=>{if(!i)return;let m=-1;for(let h=p+1;h<i.length;h++){let b=i[h],g=b.some(x=>x.added||x.removed),y=b.some(x=>(x.added||x.removed)&&x.accepted===null);if(g&&y){m=h;break}}m!==-1&&a.current[m]&&a.current[m]?.scrollIntoView({behavior:"smooth",block:"center"})},d=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let y=h.findIndex(x=>x===g);y!==-1&&(h[y]={...h[y],accepted:!0})}),h}),setTimeout(()=>c(p),0)},f=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let y=h.findIndex(x=>x===g);y!==-1&&(h[y]={...h[y],accepted:!1})}),h}),setTimeout(()=>c(p),0)};return Ir.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Ir.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"},Ir.default.createElement(be,{variant:"destructive",size:"sm",onClick:u},Ir.default.createElement(Qi,{className:"tw-size-4"}),"Reject"),Ir.default.createElement(be,{variant:"success",size:"sm",onClick:s},Ir.default.createElement(gc,{className:"tw-size-4"}),"Accept")),Ir.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),Ir.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((p,m)=>{let h=p.some(g=>g.added||g.removed),b=h?p.every(g=>!g.added&&!g.removed||g.accepted===!0)?"accepted":p.every(g=>!g.added&&!g.removed||g.accepted===!1)?"rejected":"undecided":"unchanged";return Ir.default.createElement("div",{key:m,ref:g=>a.current[m]=g,className:ve("tw-mb-4 tw-overflow-hidden tw-rounded-md")},b==="accepted"?Ir.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"},p.filter(g=>!g.removed).map((g,y)=>Ir.default.createElement("div",{key:y},g.value))):b==="rejected"?Ir.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"},p.filter(g=>!g.added).map((g,y)=>Ir.default.createElement("div",{key:y},g.value))):p.map((g,y)=>{if(g.added){let x=p.findIndex((S,O)=>S.removed&&O!==y);if(x!==-1){let S=p[x].value;return Ir.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},Ir.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},Ir.default.createElement(gQt,{oldLine:S,newLine:g.value})))}}return g.removed&&p.findIndex((S,O)=>S.added&&O!==y)!==-1?null:Ir.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},Ir.default.createElement("div",{className:ve("tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm",{"tw-text-success":g.added,"tw-text-error":g.removed,"tw-text-normal":!g.added&&!g.removed,"tw-line-through":g.removed})},g.value))}),h&&b==="undecided"&&Ir.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"},Ir.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ir.default.createElement(be,{variant:"destructive",size:"sm",onClick:()=>f(m)},Ir.default.createElement(Qi,{className:"tw-size-4"}),"Reject"),Ir.default.createElement(be,{variant:"success",size:"sm",onClick:()=>d(m)},Ir.default.createElement(gc,{className:"tw-size-4"}),"Accept"))),h&&(b==="accepted"||b==="rejected")&&Ir.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"},Ir.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ir.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},b==="accepted"?Ir.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},Ir.default.createElement(gc,{className:"tw-size-4"}),Ir.default.createElement("div",null,"Accepted")):Ir.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},Ir.default.createElement(Qi,{className:"tw-size-4"}),Ir.default.createElement("div",null,"Rejected"))),Ir.default.createElement(be,{variant:"secondary",size:"sm",onClick:()=>{o(g=>{let y=[...g],x=i?.[m];return x&&x.forEach(S=>{let O=y.findIndex(E=>E===S);O!==-1&&(y[O]={...y[O],accepted:null})}),y})}},"Revert"))))})))};Tn();var xT=require("obsidian"),yQt=require("obsidian");var bQt=({note_path:t,note_content:e,note_changes:r})=>__.default.createElement("div",{className:"tw-my-2 tw-flex tw-flex-col tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border"},t&&__.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-overflow-hidden tw-border-[0px] tw-border-b tw-border-solid tw-border-border tw-p-2"},__.default.createElement("div",{className:"tw-flex-1 tw-truncate tw-p-1 tw-text-xs tw-text-muted"},t),__.default.createElement("div",{className:"tw-flex tw-gap-2"},__.default.createElement(be,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:()=>{try{let i=r.length>0?u4e(RJ(r)):e;navigator.clipboard.writeText(i),new xT.Notice("Content copied to clipboard")}catch(i){fe("Error copying to clipboard:",i),new xT.Notice(`Failed to copy: ${i.message}`)}}},__.default.createElement(f8,{className:"tw-size-4"}),"Copy"),__.default.createElement(be,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:async()=>{if(t)try{let i=app.vault.getAbstractFileByPath(t),a=!1;if(!i)try{if(t.includes("/")){let l=t.split("/").slice(0,-1).join("/");app.vault.getAbstractFileByPath(l)||await app.vault.createFolder(l)}if(i=await app.vault.create(t,e),i)new xT.Notice(`Created new file: ${t}`),a=!0;else{new xT.Notice(`Failed to create file: ${t}`);return}a=!0}catch(l){fe("Error creating file:",l),new xT.Notice(`Failed to create file: ${l.message}`);return}if(!(i instanceof yQt.TFile)){new xT.Notice(`Path is not a file: ${t}`);return}let s=app.workspace.getActiveFile();if((!s||s.path!==t)&&(await app.workspace.getLeaf().openFile(i),new xT.Notice(`Switched to ${i.name}`)),a)return;await app.workspace.getLeaf(!0).setViewState({type:NJ,active:!0,state:{changes:r,path:t}})}catch(i){fe("Error calling composer apply:",i),new xT.Notice(`Error processing code: ${i.message}`)}}},__.default.createElement(gc,{className:"tw-size-4"}),app.vault.getAbstractFileByPath(t)?"Preview":"Apply"))),__.default.createElement("pre",{className:"tw-m-0 tw-border-none"},__.default.createElement("code",null,r.length>0?u4e(RJ(r)):e)));function ALn({context:t}){return!t||!t.notes?.length&&!t.urls?.length?null:Mr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>Mr.default.createElement(Nt,{key:`${r}-${e.path}`},Mr.default.createElement(jt,{asChild:!0},Mr.default.createElement(Dm,{variant:"secondary"},Mr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),Mr.default.createElement(At,null,e.path))),t.urls.map((e,r)=>Mr.default.createElement(Nt,{key:`${r}-${e}`},Mr.default.createElement(jt,{asChild:!0},Mr.default.createElement(Dm,{variant:"secondary"},Mr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),Mr.default.createElement(At,null,e))))}var ILn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,Mr.useState)(!1),[l,c]=(0,Mr.useState)(!1),[d,f]=(0,Mr.useState)(t.message),p=(0,Mr.useRef)(null),m=(0,Mr.useRef)(null),h=(0,Mr.useRef)(null),b=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},g=(0,Mr.useCallback)(j=>{let $=e.workspace.getActiveFile(),k=$?$.path:"",H=te=>{let U="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",W="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",Y="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&te.includes("<think>"))return te=te.replace(/<think>([\s\S]*?)<\/think>/g,(Te,de)=>`<details style="${U}">
|
||
<summary style="${W}">Thought for a second</summary>
|
||
<div class="tw-text-muted" style="${Y}">${de.trim()}</div>
|
||
</details>
|
||
|
||
`),te=te.replace(/<think>([\s\S]*)$/,(Te,de)=>`<div style="${U}">
|
||
<div style="${W}">Thinking...</div>
|
||
<div class="tw-text-muted" style="${Y}">${de.trim()}</div>
|
||
</div>`),te;let se=/<think>([\s\S]*?)<\/think>/g;return te.replace(se,(Te,de)=>`<details style="${U}">
|
||
<summary style="${W}">Thought for a second</summary>
|
||
<div class="tw-text-muted" style="${Y}">${de.trim()}</div>
|
||
</details>
|
||
|
||
`)},V=te=>{let U=W=>`\u23F3 Generating changes for ${W}...`;if(r){let W=/(\{[\s\S]*?"type"\s*:\s*"composer"[\s\S]*?)(?=\}|$)/g,Y;for(;(Y=W.exec(te))!==null;){let se=Y[1],Te=Y.index,de=se.match(/"path"\s*:\s*"([^"]+)"/),Ue=de?de[1].trim():"...";te=te.substring(0,Te)+U(Ue);break}}return te},Q=(te,U,W)=>te.split(/(```[\s\S]*?```|`[^`]*`)/g).map((se,Te)=>Te%2===0?se.replace(U,(de,Ue)=>{let Ke=e.metadataCache.getFirstLinkpathDest(Ue,k);return Ke?W(Ke):de}):se).join(""),Z=j.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),D=V(Z),z=Q(D,/!\[\[(.*?)]]/g,te=>`})`),B=H(z),K=y(B);return Q(K,/(?<!!)\[\[([^\]]+)]]/g,te=>`<a href="obsidian://open?file=${encodeURIComponent(te.path)}">${te.basename}</a>`)},[e,r]),y=j=>{let $=j.split(`
|
||
|
||
#### Sources:
|
||
|
||
`);if($.length!==2)return j;let[k,H]=$,V=H.split(`
|
||
`).map(Q=>{let Z=Q.match(/- \[\[(.*?)\]\]/);return Z?`<li>[[${Z[1]}]]</li>`:Q}).join(`
|
||
`);return k+`
|
||
|
||
<br/>
|
||
<details><summary>Sources</summary>
|
||
<ul>
|
||
`+V+`
|
||
</ul>
|
||
</details>`};(0,Mr.useEffect)(()=>{let j=[],$=!1;if(p.current&&t.sender!==Ei){p.current.innerHTML="",m.current||(m.current=new ST.Component);let k=g(t.message);if(!$&&(ST.MarkdownRenderer.renderMarkdown(k,p.current,"",m.current),!r)){let H=p.current.querySelectorAll("pre");H.length>0&&H.forEach(V=>{if($)return;let Q=V.querySelector("code");if(!Q)return;let Z=Q.textContent||"";try{if(Z.trim().startsWith("{")&&Z.trim().endsWith("}")){let D=JSON.parse(Z);if(D.type==="composer"&&D.path&&(typeof D.content=="string"||typeof D.canvas_json=="object")){let z;typeof D.content=="string"?z=D.content:z=JSON.stringify(D.canvas_json);let B=D.path.trim();B.startsWith("/")&&(B=B.slice(1));let K=document.createElement("div");V.parentNode?.replaceChild(K,V);let q=(0,_Qt.createRoot)(K);j.push(q);let te=e.vault.getAbstractFileByPath(B),U=[];(async()=>{if(te instanceof ST.TFile){let W=await e.vault.read(te);U=pQt(W,z,{newlineIsToken:!0})}else{let W=B.split("/").pop()?.split(".")[0],Y=z.split(`
|
||
`);(Y[0]===`# ${W}
|
||
`||Y[0]===`## ${W}`)&&Y.shift(),z=Y.join(`
|
||
`)}$||q.render(Mr.default.createElement(bQt,{note_path:B,note_content:z,note_changes:U}))})()}}}catch(D){console.error("Failed to parse composer JSON:",D)}})}}return()=>{$=!0,setTimeout(()=>{m.current&&(m.current.unload(),m.current=null),j.forEach(k=>{try{k.unmount()}catch{}})},0)}},[t,e,m,r,g]),(0,Mr.useEffect)(()=>{l&&h.current&&x(h.current)},[l]),(0,Mr.useEffect)(()=>{f(t.message)},[t.message]);let x=j=>{j.style.height="auto",j.style.height=`${j.scrollHeight}px`},S=j=>{f(j.target.value),x(j.target)},O=j=>{j.nativeEvent.isComposing||(j.key==="Enter"&&!j.shiftKey?(j.preventDefault(),A()):j.key==="Escape"&&(j.preventDefault(),E()))},E=()=>{c(!1),f(t.message)},P=()=>{c(!0)},A=()=>{c(!1),o&&o(d)},I=()=>{t.sources&&t.sources.length>0&&new Ahe(e,t.sources).open()},R=()=>{let j=e.workspace.getMostRecentLeaf();if((!j||!(j.view instanceof ST.MarkdownView))&&(j=e.workspace.getLeaf(!1),!j||!(j.view instanceof ST.MarkdownView)))return;let k=j.view.editor.getSelection().length>0;u6(t.message,k)},N=()=>t.content?Mr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((j,$)=>j.type==="text"?Mr.default.createElement("div",{key:$},t.sender===Ei&&l?Mr.default.createElement("textarea",{ref:h,value:d,onChange:S,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Ei?Mr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Mr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):j.type==="image_url"?Mr.default.createElement("div",{key:$,className:"message-image-content"},Mr.default.createElement("img",{src:j.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Ei&&l?Mr.default.createElement("textarea",{ref:h,value:d,onChange:S,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Ei?Mr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Mr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return Mr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Mr.default.createElement("div",{className:ve("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===Ei&&"tw-border tw-border-solid tw-border-border")},Mr.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===Ei?Mr.default.createElement(M8,null):Mr.default.createElement(VN,null)),Mr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&Mr.default.createElement(ALn,{context:t.context}),Mr.default.createElement("div",{className:"message-content"},N()),!r&&Mr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Mr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),Mr.default.createElement(oQt,{message:t,onCopy:b,isCopied:s,onInsertIntoEditor:R,onRegenerate:n,onEdit:P,onDelete:i,onShowSources:I,hasSources:!!(t.sources&&t.sources.length>0)})))))},l4e=ILn;di();var Vd=F(ee(),1);function vQt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var xQt=F(ee(),1);function wQt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function c4e(...t){return e=>{let r=!1,n=t.map(o=>{let i=wQt(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():wQt(t[o],null)}}}}function SQt(...t){return xQt.useCallback(c4e(...t),t)}var CQt=F(ee(),1),DLn=F(Cs(),1);var Hd=F(ee(),1);var p3=F(bt(),1),f4e=Hd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Hd.Children.toArray(r),i=o.find(RLn);if(i){let a=i.props.children,s=o.map(u=>u===i?Hd.Children.count(a)>1?Hd.Children.only(null):Hd.isValidElement(a)?a.props.children:null:u);return(0,p3.jsx)(d4e,{...n,ref:e,children:Hd.isValidElement(a)?Hd.cloneElement(a,void 0,s):null})}return(0,p3.jsx)(d4e,{...n,ref:e,children:r})});f4e.displayName="Slot";var d4e=Hd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Hd.isValidElement(r)){let o=jLn(r);return Hd.cloneElement(r,{...NLn(n,r.props),ref:e?c4e(e,o):o})}return Hd.Children.count(r)>1?Hd.Children.only(null):null});d4e.displayName="SlotClone";var MLn=({children:t})=>(0,p3.jsx)(p3.Fragment,{children:t});function RLn(t){return Hd.isValidElement(t)&&t.type===MLn}function NLn(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 jLn(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 OQt=F(bt(),1),LLn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jhe=LLn.reduce((t,e)=>{let r=CQt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?f4e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,OQt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var ck=F(bt(),1),p4e="Collapsible",[FLn,GNi]=na(p4e),[kLn,m4e]=FLn(p4e),PQt=Vd.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=Nd({prop:n,defaultProp:o,onChange:a});return(0,ck.jsx)(kLn,{scope:r,disabled:i,contentId:Rl(),open:u,onOpenToggle:Vd.useCallback(()=>l(c=>!c),[l]),children:(0,ck.jsx)(jhe.div,{"data-state":b4e(u),"data-disabled":i?"":void 0,...s,ref:e})})});PQt.displayName=p4e;var EQt="CollapsibleTrigger",h4e=Vd.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=m4e(EQt,r);return(0,ck.jsx)(jhe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":b4e(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:vQt(t.onClick,o.onOpenToggle)})});h4e.displayName=EQt;var g4e="CollapsibleContent",y4e=Vd.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=m4e(g4e,t.__scopeCollapsible);return(0,ck.jsx)(jd,{present:r||o.open,children:({present:i})=>(0,ck.jsx)($Ln,{...n,ref:e,present:i})})});y4e.displayName=g4e;var $Ln=Vd.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=m4e(g4e,r),[s,u]=Vd.useState(n),l=Vd.useRef(null),c=SQt(e,l),d=Vd.useRef(0),f=d.current,p=Vd.useRef(0),m=p.current,h=a.open||s,b=Vd.useRef(h),g=Vd.useRef(void 0);return Vd.useEffect(()=>{let y=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(y)},[]),uo(()=>{let y=l.current;if(y){g.current=g.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";let x=y.getBoundingClientRect();d.current=x.height,p.current=x.width,b.current||(y.style.transitionDuration=g.current.transitionDuration,y.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,ck.jsx)(jhe.div,{"data-state":b4e(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function b4e(t){return t?"open":"closed"}var TQt=PQt;var CT=TQt,dk=h4e,OT=y4e;var kJ=F(ee());var Ha=F(ee(),1);function aO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var IQt=F(ee(),1);function AQt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _4e(...t){return e=>{let r=!1,n=t.map(o=>{let i=AQt(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():AQt(t[o],null)}}}}function v_(...t){return IQt.useCallback(_4e(...t),t)}var ms=F(ee(),1);var MQt=F(ee(),1),RQt=F(Cs(),1);var Wd=F(ee(),1);var m3=F(bt(),1),jJ=Wd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Wd.Children.toArray(r),i=o.find(ULn);if(i){let a=i.props.children,s=o.map(u=>u===i?Wd.Children.count(a)>1?Wd.Children.only(null):Wd.isValidElement(a)?a.props.children:null:u);return(0,m3.jsx)(v4e,{...n,ref:e,children:Wd.isValidElement(a)?Wd.cloneElement(a,void 0,s):null})}return(0,m3.jsx)(v4e,{...n,ref:e,children:r})});jJ.displayName="Slot";var v4e=Wd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Wd.isValidElement(r)){let o=HLn(r);return Wd.cloneElement(r,{...qLn(n,r.props),ref:e?_4e(e,o):o})}return Wd.Children.count(r)>1?Wd.Children.only(null):null});v4e.displayName="SlotClone";var BLn=({children:t})=>(0,m3.jsx)(m3.Fragment,{children:t});function ULn(t){return Wd.isValidElement(t)&&t.type===BLn}function qLn(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 HLn(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 NQt=F(bt(),1),VLn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Pp=VLn.reduce((t,e)=>{let r=MQt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?jJ:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,NQt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function jQt(t,e){t&&RQt.flushSync(()=>t.dispatchEvent(e))}var x4e=F(bt(),1),WLn="DismissableLayer",w4e="dismissableLayer.update",KLn="dismissableLayer.pointerDownOutside",GLn="dismissableLayer.focusOutside",DQt,FQt=ms.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S4e=ms.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=ms.useContext(FQt),[c,d]=ms.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=ms.useState({}),m=v_(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=y>=g,O=YLn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=XLn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return $R(P=>{y===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),ms.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(DQt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),LQt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=DQt)}},[c,f,r,l]),ms.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),LQt())},[c,l]),ms.useEffect(()=>{let P=()=>p({});return document.addEventListener(w4e,P),()=>document.removeEventListener(w4e,P)},[]),(0,x4e.jsx)(Pp.div,{...u,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:aO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:aO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:aO(t.onPointerDownCapture,O.onPointerDownCapture)})});S4e.displayName=WLn;var JLn="DismissableLayerBranch",ZLn=ms.forwardRef((t,e)=>{let r=ms.useContext(FQt),n=ms.useRef(null),o=v_(e,n);return ms.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,x4e.jsx)(Pp.div,{...t,ref:o})});ZLn.displayName=JLn;function YLn(t,e=globalThis?.document){let r=Qr(t),n=ms.useRef(!1),o=ms.useRef(()=>{});return ms.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){kQt(KLn,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 XLn(t,e=globalThis?.document){let r=Qr(t),n=ms.useRef(!1);return ms.useEffect(()=>{let o=i=>{i.target&&!n.current&&kQt(GLn,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 LQt(){let t=new CustomEvent(w4e);document.dispatchEvent(t)}function kQt(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?jQt(o,i):o.dispatchEvent(i)}var Dy=F(ee(),1);var qQt=F(bt(),1),C4e="focusScope.autoFocusOnMount",O4e="focusScope.autoFocusOnUnmount",$Qt={bubbles:!1,cancelable:!0},QLn="FocusScope",P4e=Dy.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Dy.useState(null),l=Qr(o),c=Qr(i),d=Dy.useRef(null),f=v_(e,h=>u(h)),p=Dy.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Dy.useEffect(()=>{if(n){let y=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:a1(d.current,{select:!0})},x=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||a1(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&a1(s)};var h=y,b=x,g=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);let O=new MutationObserver(S);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),O.disconnect()}}},[n,s,p.paused]),Dy.useEffect(()=>{if(s){BQt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(C4e,$Qt);s.addEventListener(C4e,l),s.dispatchEvent(g),g.defaultPrevented||(eFn(iFn(HQt(s)),{select:!0}),document.activeElement===h&&a1(s))}return()=>{s.removeEventListener(C4e,l),setTimeout(()=>{let g=new CustomEvent(O4e,$Qt);s.addEventListener(O4e,c),s.dispatchEvent(g),g.defaultPrevented||a1(h??document.body,{select:!0}),s.removeEventListener(O4e,c),BQt.remove(p)},0)}}},[s,l,c,p]);let m=Dy.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[x,S]=tFn(y);x&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&a1(x,{select:!0})):h.shiftKey&&g===x&&(h.preventDefault(),r&&a1(S,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,qQt.jsx)(Pp.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});P4e.displayName=QLn;function eFn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(a1(n,{select:e}),document.activeElement!==r)return}function tFn(t){let e=HQt(t),r=zQt(e,t),n=zQt(e.reverse(),t);return[r,n]}function HQt(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 zQt(t,e){for(let r of t)if(!rFn(r,{upTo:e}))return r}function rFn(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 nFn(t){return t instanceof HTMLInputElement&&"select"in t}function a1(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&nFn(t)&&e&&t.select()}}var BQt=oFn();function oFn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=UQt(t,e),t.unshift(e)},remove(e){t=UQt(t,e),t[0]?.resume()}}}function UQt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function iFn(t){return t.filter(e=>e.tagName!=="A")}var qh=F(ee(),1);var VQt=F(ee(),1);var E4e=F(bt(),1),aFn="Arrow",WQt=VQt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,E4e.jsx)(Pp.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,E4e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});WQt.displayName=aFn;var KQt=WQt;var s1=F(bt(),1);var T4e="Popper",[GQt,A4e]=na(T4e),[uFn,JQt]=GQt(T4e),ZQt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=qh.useState(null);return(0,s1.jsx)(uFn,{scope:e,anchor:n,onAnchorChange:o,children:r})};ZQt.displayName=T4e;var YQt="PopperAnchor",XQt=qh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=JQt(YQt,r),a=qh.useRef(null),s=v_(e,a);return qh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,s1.jsx)(Pp.div,{...o,ref:s})});XQt.displayName=YQt;var I4e="PopperContent",[lFn,cFn]=GQt(I4e),QQt=qh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=JQt(I4e,r),[g,y]=qh.useState(null),x=v_(e,Y=>y(Y)),[S,O]=qh.useState(null),E=XC(S),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(fFn),altBoundary:j},{refs:k,floatingStyles:H,placement:V,isPositioned:Q,middlewareData:Z}=UR({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>bT(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[qR({mainAxis:o+A,alignmentAxis:a}),u&&HR({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?VR():void 0,...$}),u&&WR({...$}),KR({...$,apply:({elements:Y,rects:se,availableWidth:Te,availableHeight:de})=>{let{width:Ue,height:Ke}=se.reference,at=Y.floating.style;at.setProperty("--radix-popper-available-width",`${Te}px`),at.setProperty("--radix-popper-available-height",`${de}px`),at.setProperty("--radix-popper-anchor-width",`${Ue}px`),at.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),S&&JR({element:S,padding:s}),pFn({arrowWidth:P,arrowHeight:A}),f&&GR({strategy:"referenceHidden",...$})]}),[D,z]=rer(V),B=Qr(m);uo(()=>{Q&&B?.()},[Q,B]);let K=Z.arrow?.x,q=Z.arrow?.y,te=Z.arrow?.centerOffset!==0,[U,W]=qh.useState();return uo(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,s1.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:Q?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,s1.jsx)(lFn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:q,shouldHideArrow:te,children:(0,s1.jsx)(Pp.div,{"data-side":D,"data-align":z,...h,ref:x,style:{...h.style,animation:Q?void 0:"none"}})})})});QQt.displayName=I4e;var eer="PopperArrow",dFn={top:"bottom",right:"left",bottom:"top",left:"right"},ter=qh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=cFn(eer,n),a=dFn[i.placedSide];return(0,s1.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,s1.jsx)(KQt,{...o,ref:r,style:{...o.style,display:"block"}})})});ter.displayName=eer;function fFn(t){return t!==null}var pFn=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]=rer(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function rer(t){let[e,r="center"]=t.split("-");return[e,r]}var ner=ZQt,M4e=XQt,oer=QQt,ier=ter;var Dhe=F(ee(),1),aer=F(Cs(),1);var ser=F(bt(),1),hFn="Portal",R4e=Dhe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Dhe.useState(!1);uo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?aer.default.createPortal((0,ser.jsx)(Pp.div,{...n,ref:e}),a):null});R4e.displayName=hFn;var khe=F(ee());var kf=F(ee());var Lhe=ek();var N4e=function(){},DJ=kf.forwardRef(function(t,e){var r=kf.useRef(null),n=kf.useState({onScrollCapture:N4e,onWheelCapture:N4e,onTouchMoveCapture:N4e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,x=e1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,O=QF([r,e]),E=Oi(Oi({},x),o);return kf.createElement(kf.Fragment,null,c&&kf.createElement(S,{sideCar:Lhe,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?kf.cloneElement(kf.Children.only(s),Oi(Oi({},E),{ref:O})):kf.createElement(g,Oi({},E,{className:u,ref:O}),s))});DJ.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};DJ.classNames={fullWidth:p_,zeroRight:f_};var Pa=F(ee());var j4e=!1;if(typeof window<"u")try{LJ=Object.defineProperty({},"passive",{get:function(){return j4e=!0,!0}}),window.addEventListener("test",LJ,LJ),window.removeEventListener("test",LJ,LJ)}catch{j4e=!1}var LJ,fk=j4e?{passive:!1}:!1;var gFn=function(t){return t.tagName==="TEXTAREA"},uer=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!gFn(t)&&r[e]==="visible")},yFn=function(t){return uer(t,"overflowY")},bFn=function(t){return uer(t,"overflowX")},D4e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=ler(t,n);if(o){var i=cer(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},_Fn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},vFn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},ler=function(t,e){return t==="v"?yFn(e):bFn(e)},cer=function(t,e){return t==="v"?_Fn(e):vFn(e)},wFn=function(t,e){return t==="h"&&e==="rtl"?-1:1},der=function(t,e,r,n,o){var i=wFn(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=cer(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&ler(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Fhe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},fer=function(t){return[t.deltaX,t.deltaY]},per=function(t){return t&&"current"in t?t.current:t},xFn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},SFn=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},CFn=0,h3=[];function mer(t){var e=Pa.useRef([]),r=Pa.useRef([0,0]),n=Pa.useRef(),o=Pa.useState(CFn++)[0],i=Pa.useState(_T)[0],a=Pa.useRef(t);Pa.useEffect(function(){a.current=t},[t]),Pa.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=o3([t.lockRef.current],(t.shards||[]).map(per),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Pa.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Fhe(h),y=r.current,x="deltaX"in h?h.deltaX:y[0]-g[0],S="deltaY"in h?h.deltaY:y[1]-g[1],O,E=h.target,P=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var A=D4e(P,E);if(!A)return!0;if(A?O=P:(O=P==="v"?"h":"v",A=D4e(P,E)),!A)return!1;if(!n.current&&"changedTouches"in h&&(x||S)&&(n.current=O),!O)return!0;var I=n.current||O;return der(I,b,h,I==="h"?x:S,!0)},[]),u=Pa.useCallback(function(h){var b=h;if(!(!h3.length||h3[h3.length-1]!==i)){var g="deltaY"in b?fer(b):Fhe(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&xFn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var x=(a.current.shards||[]).map(per).filter(Boolean).filter(function(O){return O.contains(b.target)}),S=x.length>0?s(b,x[0]):!a.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),l=Pa.useCallback(function(h,b,g,y){var x={name:h,delta:b,target:g,should:y,shadowParent:OFn(g)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(S){return S!==x})},1)},[]),c=Pa.useCallback(function(h){r.current=Fhe(h),n.current=void 0},[]),d=Pa.useCallback(function(h){l(h.type,fer(h),h.target,s(h,t.lockRef.current))},[]),f=Pa.useCallback(function(h){l(h.type,Fhe(h),h.target,s(h,t.lockRef.current))},[]);Pa.useEffect(function(){return h3.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,fk),document.addEventListener("touchmove",u,fk),document.addEventListener("touchstart",c,fk),function(){h3=h3.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,fk),document.removeEventListener("touchmove",u,fk),document.removeEventListener("touchstart",c,fk)}},[]);var p=t.removeScrollBar,m=t.inert;return Pa.createElement(Pa.Fragment,null,m?Pa.createElement(i,{styles:SFn(o)}):null,p?Pa.createElement(rk,{gapMode:t.gapMode}):null)}function OFn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var her=tk(Lhe,mer);var ger=khe.forwardRef(function(t,e){return khe.createElement(DJ,Oi({},t,{ref:e,sideCar:her}))});ger.classNames=DJ.classNames;var L4e=ger;var Dl=F(bt(),1),F4e="Popover",[yer,lDi]=na(F4e,[A4e]),FJ=A4e(),[PFn,u1]=yer(F4e),ber=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=FJ(e),u=Ha.useRef(null),[l,c]=Ha.useState(!1),[d=!1,f]=Nd({prop:n,defaultProp:o,onChange:i});return(0,Dl.jsx)(ner,{...s,children:(0,Dl.jsx)(PFn,{scope:e,contentId:Rl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Ha.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Ha.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Ha.useCallback(()=>c(!1),[]),modal:a,children:r})})};ber.displayName=F4e;var _er="PopoverAnchor",EFn=Ha.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=u1(_er,r),i=FJ(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Ha.useEffect(()=>(a(),()=>s()),[a,s]),(0,Dl.jsx)(M4e,{...i,...n,ref:e})});EFn.displayName=_er;var ver="PopoverTrigger",wer=Ha.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=u1(ver,r),i=FJ(r),a=v_(e,o.triggerRef),s=(0,Dl.jsx)(Pp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Per(o.open),...n,ref:a,onClick:aO(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,Dl.jsx)(M4e,{asChild:!0,...i,children:s})});wer.displayName=ver;var k4e="PopoverPortal",[TFn,AFn]=yer(k4e,{forceMount:void 0}),xer=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=u1(k4e,e);return(0,Dl.jsx)(TFn,{scope:e,forceMount:r,children:(0,Dl.jsx)(jd,{present:r||i.open,children:(0,Dl.jsx)(R4e,{asChild:!0,container:o,children:n})})})};xer.displayName=k4e;var g3="PopoverContent",Ser=Ha.forwardRef((t,e)=>{let r=AFn(g3,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=u1(g3,t.__scopePopover);return(0,Dl.jsx)(jd,{present:n||i.open,children:i.modal?(0,Dl.jsx)(IFn,{...o,ref:e}):(0,Dl.jsx)(MFn,{...o,ref:e})})});Ser.displayName=g3;var IFn=Ha.forwardRef((t,e)=>{let r=u1(g3,t.__scopePopover),n=Ha.useRef(null),o=v_(e,n),i=Ha.useRef(!1);return Ha.useEffect(()=>{let a=n.current;if(a)return QR(a)},[]),(0,Dl.jsx)(L4e,{as:jJ,allowPinchZoom:!0,children:(0,Dl.jsx)(Cer,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:aO(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:aO(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:aO(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),MFn=Ha.forwardRef((t,e)=>{let r=u1(g3,t.__scopePopover),n=Ha.useRef(!1),o=Ha.useRef(!1);return(0,Dl.jsx)(Cer,{...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()}})}),Cer=Ha.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=u1(g3,r),p=FJ(r);return zR(),(0,Dl.jsx)(P4e,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Dl.jsx)(S4e,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Dl.jsx)(oer,{"data-state":Per(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)"}})})})}),Oer="PopoverClose",RFn=Ha.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=u1(Oer,r);return(0,Dl.jsx)(Pp.button,{type:"button",...n,ref:e,onClick:aO(t.onClick,()=>o.onOpenChange(!1))})});RFn.displayName=Oer;var NFn="PopoverArrow",jFn=Ha.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=FJ(r);return(0,Dl.jsx)(ier,{...o,...n,ref:e})});jFn.displayName=NFn;function Per(t){return t?"open":"closed"}var Eer=ber;var Ter=wer,Aer=xer,$4e=Ser;$n();var Ier=Eer,Mer=Ter;var z4e=kJ.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>kJ.createElement(Aer,{container:n??activeDocument.body},kJ.createElement($4e,{ref:i,align:e,sideOffset:r,className:ve("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})));z4e.displayName=$4e.displayName;Ur();var B4e=F(ee()),$he=B4e.createContext(void 0),y3=B4e.createContext(void 0);var b3=F(ee());function U4e(){let[t,e]=(0,b3.useState)(null),r=(0,b3.useContext)(y3);return(0,b3.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(gg.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(gg.ACTIVE_LEAF_CHANGE,n)}},[r]),t}$n();OC();An();var $J=require("obsidian"),Xe=F(ee());function LFn(t){let[e,r]=(0,Xe.useState)([]),n=U4e();return(0,Xe.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await wa.getInstance().getDb(),a=await wme({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function FFn(t,e){let[r,n]=(0,Xe.useState)(!0);return(0,Xe.useEffect)(()=>{if(!t)return;async function o(){let i=await wa.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}function kFn({score:t}){let e=vme(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 $Fn({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 $J.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(CT,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Xe.default.createElement("div",{className:ve("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Xe.default.createElement(be,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Xe.default.createElement(dk,null,Xe.default.createElement(tP,{className:ve("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(kFn,{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"},t.document.title)),Xe.default.createElement(Nt,null,Xe.default.createElement(jt,{asChild:!0},Xe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Xe.default.createElement(eh,{className:"tw-size-4"}))),Xe.default.createElement(At,null,"Add to Chat"))),Xe.default.createElement(OT,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(w8,{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(v8,{className:"tw-size-4"}),Xe.default.createElement("span",null,"Backlinks")))))}function zFn({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Xe.default.createElement(Ier,{key:t.document.path},Xe.default.createElement(Mer,{asChild:!0},n),Xe.default.createElement(z4e,{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(eh,{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(c8,{className:"tw-size-4"})))))}var zhe=(0,Xe.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,Xe.useState)(0),[i,a]=(0,Xe.useState)(r),s=LFn(n),u=U4e(),l=FFn(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof $J.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await wa.getInstance().reindexFile(u),new $J.Notice(`Reindexed ${u.name}`),o(n+1))};return Xe.default.createElement("div",{className:ve("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Xe.default.createElement(CT,{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(Nt,null,Xe.default.createElement(jt,{asChild:!0},Xe.default.createElement(ov,{className:"tw-size-4 tw-text-muted"})),Xe.default.createElement(At,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&Xe.default.createElement(Nt,null,Xe.default.createElement(jt,{asChild:!0},Xe.default.createElement(lp,{className:"tw-size-4 tw-text-warning"})),Xe.default.createElement(At,{side:"bottom"},"Note has not been indexed"))),Xe.default.createElement("div",{className:"tw-flex tw-items-center"},Xe.default.createElement(Nt,null,Xe.default.createElement(jt,{asChild:!0},Xe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:f},Xe.default.createElement(T8,{className:"tw-size-4"}))),Xe.default.createElement(At,{side:"bottom"},"Reindex Current Note")),s.length>0&&Xe.default.createElement(dk,{asChild:!0},Xe.default.createElement(be,{variant:"ghost2",size:"icon"},i?Xe.default.createElement(fb,{className:"tw-size-5"}):Xe.default.createElement(Xi,{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"},"No relevant notes found")),!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(zFn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},Xe.default.createElement(Dm,{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(OT,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($Fn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});zhe.displayName="RelevantNotes";Us();td();di();var Lm=F(ee());$n();var zJ=Lm.forwardRef(({className:t,...e},r)=>Lm.createElement("div",{ref:r,className:ve("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));zJ.displayName="Card";var BJ=Lm.forwardRef(({className:t,...e},r)=>Lm.createElement("div",{ref:r,className:ve("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));BJ.displayName="CardHeader";var q4e=Lm.forwardRef(({className:t,...e},r)=>Lm.createElement("div",{ref:r,className:ve("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));q4e.displayName="CardTitle";var BFn=Lm.forwardRef(({className:t,...e},r)=>Lm.createElement("div",{ref:r,className:ve("tw-text-sm tw-text-muted",t),...e}));BFn.displayName="CardDescription";var UJ=Lm.forwardRef(({className:t,...e},r)=>Lm.createElement("div",{ref:r,className:ve("tw-p-6 tw-pt-0",t),...e}));UJ.displayName="CardContent";var UFn=Lm.forwardRef(({className:t,...e},r)=>Lm.createElement("div",{ref:r,className:ve("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));UFn.displayName="CardFooter";Ur();er();An();var aa=F(ee()),H4e={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>]]"]}},Rer={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function qFn(t="llm_chain"){let e=Rer[t]||Rer.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...H4e[n].prompts].sort(()=>Math.random()-.5)),{title:H4e[n].title,text:r[n].pop()||H4e[n].prompts[0]}))}var Ner=({onClick:t})=>{let[e]=nb(),r=(0,aa.useMemo)(()=>qFn(e),[e]),o=Hn().indexVaultToVectorStore;return aa.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},aa.default.createElement(zJ,{className:"tw-w-full tw-bg-transparent"},aa.default.createElement(BJ,{className:"tw-px-2"},aa.default.createElement(q4e,null,"Suggested Prompts")),aa.default.createElement(UJ,{className:"tw-p-2 tw-pt-0"},aa.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>aa.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"},aa.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},aa.default.createElement("div",{className:"tw-text-muted"},i.title),aa.default.createElement("div",null,i.text)),aa.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},aa.default.createElement(Nt,null,aa.default.createElement(jt,{asChild:!0},aa.default.createElement(be,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},aa.default.createElement(eh,{className:"tw-size-4"}))),aa.default.createElement(At,null,"Add to Chat")))))))),e==="vault_qa"&&aa.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"&&aa.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},aa.default.createElement("div",null,aa.default.createElement(lp,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",aa.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",aa.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",aa.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};er();var $f=F(ee()),jer=(0,$f.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,$f.useState)(""),p=Hn(),m=()=>{let b=document.querySelector("[data-testid='chat-messages']");b&&(b.scrollTop=b.scrollHeight)};if((0,$f.useEffect)(()=>{r||m()},[r]),(0,$f.useEffect)(()=>{let b;return r?b=setInterval(()=>{f(g=>g.length<6?g+".":"")},200):f(""),()=>clearInterval(b)},[r]),!t.filter(b=>b.isVisible).length&&!e)return $f.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&$f.default.createElement(zhe,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&$f.default.createElement(Ner,{onClick:l}));let h=()=>n?`${n} ${d}`:d;return $f.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&$f.default.createElement(zhe,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),$f.default.createElement("div",{"data-testid":"chat-messages",className:"tw-mt-auto tw-box-border 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((b,g)=>b.isVisible&&$f.default.createElement(l4e,{key:g,message:b,app:o,isStreaming:!1,onRegenerate:()=>i(g),onEdit:y=>a(g,y),onDelete:()=>s(g),chatHistory:t})),(e||r)&&$f.default.createElement(l4e,{key:`ai_message_${e}`,message:{sender:"AI",message:e||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t})))});jer.displayName="ChatMessages";var Der=jer;di();on();var Bhe=F(ee());function Uhe(t){let[e,r]=(0,Bhe.useState)(null);(0,Bhe.useEffect)(()=>{(async()=>{let i=await RGe();i.version&&r(i.version)})()},[]);let n=e!==null&&kY(e,t);return{latestVersion:e,hasUpdate:n}}$n();er();on();An();var Ly=F(ee());function Ler({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=Uhe(t),n=Hn().lastDismissedVersion,[o,i]=(0,Ly.useState)(!0),a=r&&e&&kY(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{ht("lastDismissedVersion",e)},300))};return a?Ly.default.createElement("div",{className:ve("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")},Ly.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"},Ly.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ly.default.createElement("span",{className:"tw-font-medium"},"Update available:"),Ly.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),Ly.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ly.default.createElement(be,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),Ly.default.createElement(be,{variant:"ghost2",size:"icon",onClick:s},Ly.default.createElement(Qi,{className:"tw-size-4"}))))):null}Us();var Fer=require("obsidian");Qg();var _3=class extends Fer.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=Uue(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 V4e=require("obsidian");var qJ=class extends d3{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 V4e.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 V4e.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}};on();var ker=require("obsidian"),v3=class extends ker.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)bN(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var w3=F(ee());$n();var qhe=F(ee()),HFn=2;function VFn(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+HFn<t.current?.scrollWidth)??!1}function WFn(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var l1=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,qhe.useRef)(null),[a,s]=(0,qhe.useState)(!1);return w3.default.createElement(lo,{delayDuration:0},w3.default.createElement(Nt,{open:a,onOpenChange:l=>{s(l&&VFn(i,r))}},w3.default.createElement(jt,{asChild:!0},w3.default.createElement("div",{...o,ref:i,className:ve("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&WFn(r),e),"data-testid":"truncatedText"},t)),w3.default.createElement(At,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};di();var GJ=F(ee());An();var Ker=F(ee(),1),Ot=F(ee(),1),Ghe=(0,Ot.createContext)(null);Ghe.displayName="PanelGroupContext";var js={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"},X4e=10,mk=Ot.useLayoutEffect,$er=Ker.useId,KFn=typeof $er=="function"?$er:()=>null,GFn=0;function Q4e(t=null){let e=KFn(),r=(0,Ot.useRef)(t||e||null);return r.current===null&&(r.current=""+GFn++),t??r.current}function Ger({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:o,forwardedRef:i,id:a,maxSize:s,minSize:u,onCollapse:l,onExpand:c,onResize:d,order:f,style:p,tagName:m="div",...h}){let b=(0,Ot.useContext)(Ghe);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:y,getPanelSize:x,getPanelStyle:S,groupId:O,isPanelCollapsed:E,reevaluatePanelConstraints:P,registerPanel:A,resizePanel:I,unregisterPanel:R}=b,N=Q4e(a),j=(0,Ot.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:N,idIsFromProps:a!==void 0,order:f});(0,Ot.useRef)({didLogMissingDefaultSizeWarning:!1}),mk(()=>{let{callbacks:k,constraints:H}=j.current,V={...H};j.current.id=N,j.current.idIsFromProps=a!==void 0,j.current.order=f,k.onCollapse=l,k.onExpand=c,k.onResize=d,H.collapsedSize=r,H.collapsible=n,H.defaultSize=o,H.maxSize=s,H.minSize=u,(V.collapsedSize!==H.collapsedSize||V.collapsible!==H.collapsible||V.maxSize!==H.maxSize||V.minSize!==H.minSize)&&P(j.current,V)}),mk(()=>{let k=j.current;return A(k),()=>{R(k)}},[f,N,A,R]),(0,Ot.useImperativeHandle)(i,()=>({collapse:()=>{g(j.current)},expand:k=>{y(j.current,k)},getId(){return N},getSize(){return x(j.current)},isCollapsed(){return E(j.current)},isExpanded(){return!E(j.current)},resize:k=>{I(j.current,k)}}),[g,y,x,E,N,I]);let $=S(j.current,o);return(0,Ot.createElement)(m,{...h,children:t,className:e,id:N,style:{...$,...p},[js.groupId]:O,[js.panel]:"",[js.panelCollapsible]:n||void 0,[js.panelId]:N,[js.panelSize]:parseFloat(""+$.flexGrow).toFixed(1)})}var e3e=(0,Ot.forwardRef)((t,e)=>(0,Ot.createElement)(Ger,{...t,forwardedRef:e}));Ger.displayName="Panel";e3e.displayName="forwardRef(Panel)";var JFn;function ZFn(){return JFn}var Y4e=null,YFn=!0,Vhe=-1,PT=null;function XFn(t,e){if(e){let r=(e&Qer)!==0,n=(e&etr)!==0,o=(e&ttr)!==0,i=(e&rtr)!==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 QFn(){PT!==null&&(document.head.removeChild(PT),Y4e=null,PT=null,Vhe=-1)}function W4e(t,e){var r,n;if(!YFn)return;let o=XFn(t,e);if(Y4e!==o){if(Y4e=o,PT===null){PT=document.createElement("style");let a=ZFn();a&&PT.setAttribute("nonce",a),document.head.appendChild(PT)}if(Vhe>=0){var i;(i=PT.sheet)===null||i===void 0||i.removeRule(Vhe)}Vhe=(r=(n=PT.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Jer(t){return t.type==="keydown"}function Zer(t){return t.type.startsWith("pointer")}function Yer(t){return t.type.startsWith("mouse")}function Jhe(t){if(Zer(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Yer(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function ekn(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function tkn(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 rkn(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:Uer(t),b:Uer(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;On(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:Ber(zer(r.a)),b:Ber(zer(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 nkn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function okn(t){var e;let r=getComputedStyle((e=Xer(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function ikn(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||okn(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"||nkn.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function zer(t){let e=t.length;for(;e--;){let r=t[e];if(On(r,"Missing node"),ikn(r))return r}return null}function Ber(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Uer(t){let e=[];for(;t;)e.push(t),t=Xer(t);return e}function Xer(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var Qer=1,etr=2,ttr=4,rtr=8,akn=ekn()==="coarse",w_=[],O3=!1,c1=new Map,Zhe=new Map,WJ=new Set;function skn(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=c1.get(a))!==null&&i!==void 0?i:0;return c1.set(a,u+1),WJ.add(s),Whe(),function(){var c;Zhe.delete(t),WJ.delete(s);let d=(c=c1.get(a))!==null&&c!==void 0?c:1;if(c1.set(a,d-1),Whe(),d===1&&c1.delete(a),w_.includes(s)){let f=w_.indexOf(s);f>=0&&w_.splice(f,1),r3e(),o("up",!0,null)}}}function ukn(t){let{target:e}=t,{x:r,y:n}=Jhe(t);O3=!0,t3e({target:e,x:r,y:n}),Whe(),w_.length>0&&(Khe("down",t),t.preventDefault(),ntr(e)||t.stopImmediatePropagation())}function K4e(t){let{x:e,y:r}=Jhe(t);if(O3&&t.buttons===0&&(O3=!1,Khe("up",t)),!O3){let{target:n}=t;t3e({target:n,x:e,y:r})}Khe("move",t),r3e(),w_.length>0&&t.preventDefault()}function G4e(t){let{target:e}=t,{x:r,y:n}=Jhe(t);Zhe.clear(),O3=!1,w_.length>0&&(t.preventDefault(),ntr(e)||t.stopImmediatePropagation()),Khe("up",t),t3e({target:e,x:r,y:n}),r3e(),Whe()}function ntr(t){let e=t;for(;e;){if(e.hasAttribute(js.resizeHandle))return!0;e=e.parentElement}return!1}function t3e({target:t,x:e,y:r}){w_.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),WJ.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=akn?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)&&rkn(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(tkn(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}w_.push(o)}})}function J4e(t,e){Zhe.set(t,e)}function r3e(){let t=!1,e=!1;w_.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;Zhe.forEach(n=>{r|=n}),t&&e?W4e("intersection",r):t?W4e("horizontal",r):e?W4e("vertical",r):QFn()}var Z4e=new AbortController;function Whe(){Z4e.abort(),Z4e=new AbortController;let t={capture:!0,signal:Z4e.signal};WJ.size&&(O3?(w_.length>0&&c1.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",G4e,t),n.addEventListener("pointerleave",K4e,t),n.addEventListener("pointermove",K4e,t))}),c1.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",G4e,t),n.addEventListener("pointercancel",G4e,t)})):c1.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",ukn,t),n.addEventListener("pointermove",K4e,t))}))}function Khe(t,e){WJ.forEach(r=>{let{setResizeHandlerState:n}=r,o=w_.includes(r);n(t,o,e)})}function lkn(){let[t,e]=(0,Ot.useState)(0);return(0,Ot.useCallback)(()=>e(r=>r+1),[])}function On(t,e){if(!t)throw console.error(e),Error(e)}function hk(t,e,r=X4e){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function ET(t,e,r=X4e){return hk(t,e,r)===0}function Hh(t,e,r){return hk(t,e,r)===0}function ckn(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(!Hh(o,i,r))return!1}return!0}function C3({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];On(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(hk(r,s)<0)if(i){let u=(o+s)/2;hk(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(X4e)),r}function HJ({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(Hh(t,0))return e;let a=[...e],[s,u]=n;On(s!=null,"Invalid first pivot index"),On(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];On(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let b=e[d];if(On(b!=null,`Previous layout not found for panel index ${d}`),Hh(b,p)){let g=h-b;hk(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];On(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let b=e[d];if(On(b!=null,`Previous layout not found for panel index ${d}`),Hh(b,h)){let g=b-p;hk(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let h=e[f];On(h!=null,`Previous layout not found for panel index ${f}`);let g=C3({panelConstraints:r,panelIndex:f,size:100})-h;if(p+=g,f+=d,f<0||f>=r.length)break}let m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let f=t<0?s:u;for(;f>=0&&f<r.length;){let p=Math.abs(t)-Math.abs(l),m=e[f];On(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,b=C3({panelConstraints:r,panelIndex:f,size:h});if(!Hh(m,b)&&(l+=m-b,a[f]=b,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(ckn(o,a))return o;{let d=t<0?u:s,f=e[d];On(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=C3({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!Hh(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g<r.length;){let y=a[g];On(y!=null,`Previous layout not found for panel index ${g}`);let x=y+h,S=C3({panelConstraints:r,panelIndex:g,size:x});if(Hh(y,S)||(h-=S-y,a[g]=S),Hh(h,0))break;t>0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return Hh(c,100)?a:o}function dkn({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];On(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:m=100,minSize:h=0}=p;f===s?(n=h,o=m):(i+=h,a+=m)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function KJ(t,e=document){return Array.from(e.querySelectorAll(`[${js.resizeHandleId}][data-panel-group-id="${t}"]`))}function otr(t,e,r=document){let o=KJ(t,r).findIndex(i=>i.getAttribute(js.resizeHandleId)===e);return o??null}function itr(t,e,r){let n=otr(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function fkn(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function atr(t,e=document){if(fkn(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Yhe(t,e=document){let r=e.querySelector(`[${js.resizeHandleId}="${t}"]`);return r||null}function pkn(t,e,r,n=document){var o,i,a,s;let u=Yhe(e,n),l=KJ(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 mkn({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,Ot.useRef)({didWarnAboutMissingResizeHandle:!1}),mk(()=>{if(!i)return;let s=KJ(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=dkn({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];On(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,Ot.useEffect)(()=>{if(!i)return;let s=e.current;On(s,"Eager values not found");let{panelDataArray:u}=s,l=atr(r,i);On(l!=null,`No group found for id "${r}"`);let c=KJ(r,i);On(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(js.resizeHandleId);On(p,"Resize handle element has no handle id attribute");let[m,h]=pkn(r,p,u,i);if(m==null||h==null)return()=>{};let b=g=>{if(!g.defaultPrevented)switch(g.key){case"Enter":{g.preventDefault();let y=u.findIndex(x=>x.id===m);if(y>=0){let x=u[y];On(x,`No panel data found for index ${y}`);let S=n[y],{collapsedSize:O=0,collapsible:E,minSize:P=0}=x.constraints;if(S!=null&&E){let A=HJ({delta:Hh(S,O)?P-O:O-S,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:itr(r,p,i),prevLayout:n,trigger:"keyboard"});n!==A&&a(A)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function qer(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 str(t,e){let r=t==="horizontal",{x:n,y:o}=Jhe(e);return r?n:o}function hkn(t,e,r,n,o){let i=r==="horizontal",a=Yhe(e,o);On(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(js.groupId);On(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=str(r,t),c=atr(s,o);On(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function gkn(t,e,r,n,o,i){if(Jer(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:hkn(t,e,r,n,i)}function ykn({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];On(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];On(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 x3(t,e,r){e.forEach((n,o)=>{let i=t[o];On(i,`Panel data not found for index ${o}`);let{callbacks:a,constraints:s,id:u}=i,{collapsedSize:l=0,collapsible:c}=s,d=r[u];if(d==null||n!==d){r[u]=n;let{onCollapse:f,onExpand:p,onResize:m}=a;m&&m(n,d),c&&(f||p)&&(p&&(d==null||ET(d,l))&&!ET(n,l)&&p(),f&&(d==null||!ET(d,l))&&ET(n,l)&&f())}})}function Hhe(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 bkn({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 _kn(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function Her(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 utr(t){return`react-resizable-panels:${t}`}function ltr(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 ctr(t,e){try{let r=utr(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function vkn(t,e,r){var n,o;let i=(n=ctr(t,r))!==null&&n!==void 0?n:{},a=ltr(e);return(o=i[a])!==null&&o!==void 0?o:null}function wkn(t,e,r,n,o){var i;let a=utr(t),s=ltr(e),u=(i=ctr(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 Ver({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(!Hh(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];On(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];On(a!=null,`No layout data found for index ${i}`);let s=C3({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!Hh(o,0))for(let i=0;i<e.length;i++){let a=r[i];On(a!=null,`No layout data found for index ${i}`);let s=a+o,u=C3({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,Hh(o,0)))break}return r}var xkn=100,VJ={getItem:t=>(Her(VJ),VJ.getItem(t)),setItem:(t,e)=>{Her(VJ),VJ.setItem(t,e)}},Wer={};function dtr({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=VJ,style:l,tagName:c="div",...d}){let f=Q4e(i),p=(0,Ot.useRef)(null),[m,h]=(0,Ot.useState)(null),[b,g]=(0,Ot.useState)([]),y=lkn(),x=(0,Ot.useRef)({}),S=(0,Ot.useRef)(new Map),O=(0,Ot.useRef)(0),E=(0,Ot.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),P=(0,Ot.useRef)({layout:b,panelDataArray:[],panelDataArrayChanged:!1});(0,Ot.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,Ot.useImperativeHandle)(o,()=>({getId:()=>E.current.id,getLayout:()=>{let{layout:q}=P.current;return q},setLayout:q=>{let{onLayout:te}=E.current,{layout:U,panelDataArray:W}=P.current,Y=Ver({layout:q,panelConstraints:W.map(se=>se.constraints)});qer(U,Y)||(g(Y),P.current.layout=Y,te&&te(Y),x3(W,Y,x.current))}}),[]),mk(()=>{E.current.autoSaveId=t,E.current.direction=n,E.current.dragState=m,E.current.id=f,E.current.onLayout=a,E.current.storage=u}),mkn({committedValuesRef:E,eagerValuesRef:P,groupId:f,layout:b,panelDataArray:P.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,Ot.useEffect)(()=>{let{panelDataArray:q}=P.current;if(t){if(b.length===0||b.length!==q.length)return;let te=Wer[t];te==null&&(te=_kn(wkn,xkn),Wer[t]=te);let U=[...q],W=new Map(S.current);te(t,U,W,b,u)}},[t,b,u]),(0,Ot.useEffect)(()=>{});let A=(0,Ot.useCallback)(q=>{let{onLayout:te}=E.current,{layout:U,panelDataArray:W}=P.current;if(q.constraints.collapsible){let Y=W.map(Ue=>Ue.constraints),{collapsedSize:se=0,panelSize:Te,pivotIndices:de}=pk(W,q,U);if(On(Te!=null,`Panel size not found for panel "${q.id}"`),!ET(Te,se)){S.current.set(q.id,Te);let Ke=S3(W,q)===W.length-1?Te-se:se-Te,at=HJ({delta:Ke,initialLayout:U,panelConstraints:Y,pivotIndices:de,prevLayout:U,trigger:"imperative-api"});Hhe(U,at)||(g(at),P.current.layout=at,te&&te(at),x3(W,at,x.current))}}},[]),I=(0,Ot.useCallback)((q,te)=>{let{onLayout:U}=E.current,{layout:W,panelDataArray:Y}=P.current;if(q.constraints.collapsible){let se=Y.map(hr=>hr.constraints),{collapsedSize:Te=0,panelSize:de=0,minSize:Ue=0,pivotIndices:Ke}=pk(Y,q,W),at=te??Ue;if(ET(de,Te)){let hr=S.current.get(q.id),Nn=hr!=null&&hr>=at?hr:at,_t=S3(Y,q)===Y.length-1?de-Nn:Nn-de,Oe=HJ({delta:_t,initialLayout:W,panelConstraints:se,pivotIndices:Ke,prevLayout:W,trigger:"imperative-api"});Hhe(W,Oe)||(g(Oe),P.current.layout=Oe,U&&U(Oe),x3(Y,Oe,x.current))}}},[]),R=(0,Ot.useCallback)(q=>{let{layout:te,panelDataArray:U}=P.current,{panelSize:W}=pk(U,q,te);return On(W!=null,`Panel size not found for panel "${q.id}"`),W},[]),N=(0,Ot.useCallback)((q,te)=>{let{panelDataArray:U}=P.current,W=S3(U,q);return bkn({defaultSize:te,dragState:m,layout:b,panelData:U,panelIndex:W})},[m,b]),j=(0,Ot.useCallback)(q=>{let{layout:te,panelDataArray:U}=P.current,{collapsedSize:W=0,collapsible:Y,panelSize:se}=pk(U,q,te);return On(se!=null,`Panel size not found for panel "${q.id}"`),Y===!0&&ET(se,W)},[]),$=(0,Ot.useCallback)(q=>{let{layout:te,panelDataArray:U}=P.current,{collapsedSize:W=0,collapsible:Y,panelSize:se}=pk(U,q,te);return On(se!=null,`Panel size not found for panel "${q.id}"`),!Y||hk(se,W)>0},[]),k=(0,Ot.useCallback)(q=>{let{panelDataArray:te}=P.current;te.push(q),te.sort((U,W)=>{let Y=U.order,se=W.order;return Y==null&&se==null?0:Y==null?-1:se==null?1:Y-se}),P.current.panelDataArrayChanged=!0,y()},[y]);mk(()=>{if(P.current.panelDataArrayChanged){P.current.panelDataArrayChanged=!1;let{autoSaveId:q,onLayout:te,storage:U}=E.current,{layout:W,panelDataArray:Y}=P.current,se=null;if(q){let de=vkn(q,Y,U);de&&(S.current=new Map(Object.entries(de.expandToSizes)),se=de.layout)}se==null&&(se=ykn({panelDataArray:Y}));let Te=Ver({layout:se,panelConstraints:Y.map(de=>de.constraints)});qer(W,Te)||(g(Te),P.current.layout=Te,te&&te(Te),x3(Y,Te,x.current))}}),mk(()=>{let q=P.current;return()=>{q.layout=[]}},[]);let H=(0,Ot.useCallback)(q=>{let te=!1,U=p.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&(te=!0),function(Y){Y.preventDefault();let se=p.current;if(!se)return()=>null;let{direction:Te,dragState:de,id:Ue,keyboardResizeBy:Ke,onLayout:at}=E.current,{layout:hr,panelDataArray:Nn}=P.current,{initialLayout:De}=de??{},_t=itr(Ue,q,se),Oe=gkn(Y,q,Te,de,Ke,se),$e=Te==="horizontal";$e&&te&&(Oe=-Oe);let ce=Nn.map(Ne=>Ne.constraints),qt=HJ({delta:Oe,initialLayout:De??hr,panelConstraints:ce,pivotIndices:_t,prevLayout:hr,trigger:Jer(Y)?"keyboard":"mouse-or-touch"}),Ze=!Hhe(hr,qt);(Zer(Y)||Yer(Y))&&O.current!=Oe&&(O.current=Oe,!Ze&&Oe!==0?$e?J4e(q,Oe<0?Qer:etr):J4e(q,Oe<0?ttr:rtr):J4e(q,0)),Ze&&(g(qt),P.current.layout=qt,at&&at(qt),x3(Nn,qt,x.current))}},[]),V=(0,Ot.useCallback)((q,te)=>{let{onLayout:U}=E.current,{layout:W,panelDataArray:Y}=P.current,se=Y.map(hr=>hr.constraints),{panelSize:Te,pivotIndices:de}=pk(Y,q,W);On(Te!=null,`Panel size not found for panel "${q.id}"`);let Ke=S3(Y,q)===Y.length-1?Te-te:te-Te,at=HJ({delta:Ke,initialLayout:W,panelConstraints:se,pivotIndices:de,prevLayout:W,trigger:"imperative-api"});Hhe(W,at)||(g(at),P.current.layout=at,U&&U(at),x3(Y,at,x.current))},[]),Q=(0,Ot.useCallback)((q,te)=>{let{layout:U,panelDataArray:W}=P.current,{collapsedSize:Y=0,collapsible:se}=te,{collapsedSize:Te=0,collapsible:de,maxSize:Ue=100,minSize:Ke=0}=q.constraints,{panelSize:at}=pk(W,q,U);at!=null&&(se&&de&&ET(at,Y)?ET(Y,Te)||V(q,Te):at<Ke?V(q,Ke):at>Ue&&V(q,Ue))},[V]),Z=(0,Ot.useCallback)((q,te)=>{let{direction:U}=E.current,{layout:W}=P.current;if(!p.current)return;let Y=Yhe(q,p.current);On(Y,`Drag handle element not found for id "${q}"`);let se=str(U,te);h({dragHandleId:q,dragHandleRect:Y.getBoundingClientRect(),initialCursorPosition:se,initialLayout:W})},[]),D=(0,Ot.useCallback)(()=>{h(null)},[]),z=(0,Ot.useCallback)(q=>{let{panelDataArray:te}=P.current,U=S3(te,q);U>=0&&(te.splice(U,1),delete x.current[q.id],P.current.panelDataArrayChanged=!0,y())},[y]),B=(0,Ot.useMemo)(()=>({collapsePanel:A,direction:n,dragState:m,expandPanel:I,getPanelSize:R,getPanelStyle:N,groupId:f,isPanelCollapsed:j,isPanelExpanded:$,reevaluatePanelConstraints:Q,registerPanel:k,registerResizeHandle:H,resizePanel:V,startDragging:Z,stopDragging:D,unregisterPanel:z,panelGroupElement:p.current}),[A,m,n,I,R,N,f,j,$,Q,k,H,V,Z,D,z]),K={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,Ot.createElement)(Ghe.Provider,{value:B},(0,Ot.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...K,...l},[js.group]:"",[js.groupDirection]:n,[js.groupId]:f}))}var n3e=(0,Ot.forwardRef)((t,e)=>(0,Ot.createElement)(dtr,{...t,forwardedRef:e}));dtr.displayName="PanelGroup";n3e.displayName="forwardRef(PanelGroup)";function S3(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function pk(t,e,r){let n=S3(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function Skn({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,Ot.useEffect)(()=>{if(t||r==null||n==null)return;let o=Yhe(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(js.groupId);On(s,`No group element found for id "${s}"`);let u=KJ(s,n),l=otr(s,e,n);On(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 o3e({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:o,onBlur:i,onClick:a,onDragging:s,onFocus:u,onPointerDown:l,onPointerUp:c,style:d={},tabIndex:f=0,tagName:p="div",...m}){var h,b;let g=(0,Ot.useRef)(null),y=(0,Ot.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,Ot.useEffect)(()=>{y.current.onClick=a,y.current.onDragging=s,y.current.onPointerDown=l,y.current.onPointerUp=c});let x=(0,Ot.useContext)(Ghe);if(x===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:S,groupId:O,registerResizeHandle:E,startDragging:P,stopDragging:A,panelGroupElement:I}=x,R=Q4e(o),[N,j]=(0,Ot.useState)("inactive"),[$,k]=(0,Ot.useState)(!1),[H,V]=(0,Ot.useState)(null),Q=(0,Ot.useRef)({state:N});mk(()=>{Q.current.state=N}),(0,Ot.useEffect)(()=>{if(r)V(null);else{let B=E(R);V(()=>B)}},[r,R,E]);let Z=(h=n?.coarse)!==null&&h!==void 0?h:15,D=(b=n?.fine)!==null&&b!==void 0?b:5;return(0,Ot.useEffect)(()=>{if(r||H==null)return;let B=g.current;On(B,"Element ref not attached");let K=!1;return skn(R,B,S,{coarse:Z,fine:D},(te,U,W)=>{if(!U){j("inactive");return}switch(te){case"down":{j("drag"),K=!1,On(W,'Expected event to be defined for "down" action'),P(R,W);let{onDragging:Y,onPointerDown:se}=y.current;Y?.(!0),se?.();break}case"move":{let{state:Y}=Q.current;K=!0,Y!=="drag"&&j("hover"),On(W,'Expected event to be defined for "move" action'),H(W);break}case"up":{j("hover"),A();let{onClick:Y,onDragging:se,onPointerUp:Te}=y.current;se?.(!1),Te?.(),K||Y?.();break}}})},[Z,S,r,D,E,R,H,P,A]),Skn({disabled:r,handleId:R,resizeHandler:H,panelGroupElement:I}),(0,Ot.createElement)(p,{...m,children:t,className:e,id:o,onBlur:()=>{k(!1),i?.()},onFocus:()=>{k(!0),u?.()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[js.groupDirection]:S,[js.groupId]:O,[js.resizeHandle]:"",[js.resizeHandleActive]:N==="drag"?"pointer":$?"keyboard":void 0,[js.resizeHandleEnabled]:!r,[js.resizeHandleId]:R,[js.resizeHandleState]:N})}o3e.displayName="PanelResizeHandle";$n();var ftr=({className:t,...e})=>GJ.createElement(n3e,{className:ve("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),i3e=e3e,ptr=({withHandle:t,className:e,...r})=>GJ.createElement(o3e,{className:ve("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&&GJ.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"},GJ.createElement(nv,{className:"tw-size-2.5"})));var uO=F(ee());var sr=F(ee(),1);var mtr=F(ee(),1),Okn=F(Cs(),1);HN();var htr=F(bt(),1),Pkn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],P3=Pkn.reduce((t,e)=>{let r=XO(`Primitive.${e}`),n=mtr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,htr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Fm=F(ee(),1);var ytr=F(ee(),1);function gtr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ekn(...t){return e=>{let r=!1,n=t.map(o=>{let i=gtr(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():gtr(t[o],null)}}}}function TT(...t){return ytr.useCallback(Ekn(...t),t)}var btr=F(ee(),1),JJ=globalThis?.document?btr.useLayoutEffect:()=>{};var _tr=F(ee(),1);function Tkn(t,e){return _tr.useReducer((r,n)=>e[r][n]??r,t)}var E3=t=>{let{present:e,children:r}=t,n=Akn(e),o=typeof r=="function"?r({present:n.isPresent}):Fm.Children.only(r),i=TT(n.ref,Ikn(o));return typeof r=="function"||n.isPresent?Fm.cloneElement(o,{ref:i}):null};E3.displayName="Presence";function Akn(t){let[e,r]=Fm.useState(),n=Fm.useRef(null),o=Fm.useRef(t),i=Fm.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Tkn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Fm.useEffect(()=>{let l=Xhe(n.current);i.current=s==="mounted"?l:"none"},[s]),JJ(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Xhe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),JJ(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Xhe(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Xhe(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:Fm.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Xhe(t){return t?.animationName||"none"}function Ikn(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 AT=F(ee(),1),vtr=F(bt(),1);function wtr(t,e=[]){let r=[];function n(i,a){let s=AT.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=AT.useMemo(()=>m,Object.values(m));return(0,vtr.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=AT.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>AT.createContext(a));return function(s){let u=s?.[t]||i;return AT.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Mkn(o,...e)]}function Mkn(...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 AT.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var T3=F(ee(),1);function d1(t){let e=T3.useRef(t);return T3.useEffect(()=>{e.current=t}),T3.useMemo(()=>(...r)=>e.current?.(...r),[])}var Qhe=F(ee(),1),Rkn=F(bt(),1),Nkn=Qhe.createContext(void 0);function xtr(t){let e=Qhe.useContext(Nkn);return t||e||"ltr"}function Str(t,[e,r]){return Math.min(r,Math.max(e,t))}function f1(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Otr=F(ee(),1),vi=F(bt(),1);function jkn(t,e){return Otr.useReducer((r,n)=>e[r][n]??r,t)}var a3e="ScrollArea",[Ptr,$Li]=wtr(a3e),[Dkn,Fy]=Ptr(a3e),Etr=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=sr.useState(null),[l,c]=sr.useState(null),[d,f]=sr.useState(null),[p,m]=sr.useState(null),[h,b]=sr.useState(null),[g,y]=sr.useState(0),[x,S]=sr.useState(0),[O,E]=sr.useState(!1),[P,A]=sr.useState(!1),I=TT(e,N=>u(N)),R=xtr(o);return(0,vi.jsx)(Dkn,{scope:r,type:n,dir:R,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:O,onScrollbarXEnabledChange:E,scrollbarY:h,onScrollbarYChange:b,scrollbarYEnabled:P,onScrollbarYEnabledChange:A,onCornerWidthChange:y,onCornerHeightChange:S,children:(0,vi.jsx)(P3.div,{dir:R,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":x+"px",...t.style}})})});Etr.displayName=a3e;var Ttr="ScrollAreaViewport",Atr=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=Fy(Ttr,r),s=sr.useRef(null),u=TT(e,s,a.onViewportChange);return(0,vi.jsxs)(vi.Fragment,{children:[(0,vi.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,vi.jsx)(P3.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,vi.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Atr.displayName=Ttr;var sO="ScrollAreaScrollbar",rge=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Fy(sO,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return sr.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,vi.jsx)(Lkn,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,vi.jsx)(Fkn,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,vi.jsx)(Itr,{...n,ref:e,forceMount:r}):o.type==="always"?(0,vi.jsx)(s3e,{...n,ref:e}):null});rge.displayName=sO;var Lkn=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Fy(sO,t.__scopeScrollArea),[i,a]=sr.useState(!1);return sr.useEffect(()=>{let s=o.scrollArea,u=0;if(s){let l=()=>{window.clearTimeout(u),a(!0)},c=()=>{u=window.setTimeout(()=>a(!1),o.scrollHideDelay)};return s.addEventListener("pointerenter",l),s.addEventListener("pointerleave",c),()=>{window.clearTimeout(u),s.removeEventListener("pointerenter",l),s.removeEventListener("pointerleave",c)}}},[o.scrollArea,o.scrollHideDelay]),(0,vi.jsx)(E3,{present:r||i,children:(0,vi.jsx)(Itr,{"data-state":i?"visible":"hidden",...n,ref:e})})}),Fkn=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Fy(sO,t.__scopeScrollArea),i=t.orientation==="horizontal",a=oge(()=>u("SCROLL_END"),100),[s,u]=jkn("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return sr.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),sr.useEffect(()=>{let l=o.viewport,c=i?"scrollLeft":"scrollTop";if(l){let d=l[c],f=()=>{let p=l[c];d!==p&&(u("SCROLL"),a()),d=p};return l.addEventListener("scroll",f),()=>l.removeEventListener("scroll",f)}},[o.viewport,i,u,a]),(0,vi.jsx)(E3,{present:r||s!=="hidden",children:(0,vi.jsx)(s3e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:f1(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:f1(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),Itr=sr.forwardRef((t,e)=>{let r=Fy(sO,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=sr.useState(!1),s=t.orientation==="horizontal",u=oge(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return A3(r.viewport,u),A3(r.content,u),(0,vi.jsx)(E3,{present:n||i,children:(0,vi.jsx)(s3e,{"data-state":i?"visible":"hidden",...o,ref:e})})}),s3e=sr.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=Fy(sO,t.__scopeScrollArea),i=sr.useRef(null),a=sr.useRef(0),[s,u]=sr.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=jtr(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 qkn(f,a.current,s,p)}return r==="horizontal"?(0,vi.jsx)(kkn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=Ctr(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,vi.jsx)($kn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=Ctr(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}),kkn=sr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=Fy(sO,t.__scopeScrollArea),[a,s]=sr.useState(),u=sr.useRef(null),l=TT(e,u,i.onScrollbarXChange);return sr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,vi.jsx)(Rtr,{"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":nge(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),Ltr(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:tge(a.paddingLeft),paddingEnd:tge(a.paddingRight)}})}})}),$kn=sr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=Fy(sO,t.__scopeScrollArea),[a,s]=sr.useState(),u=sr.useRef(null),l=TT(e,u,i.onScrollbarYChange);return sr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,vi.jsx)(Rtr,{"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":nge(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),Ltr(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:tge(a.paddingTop),paddingEnd:tge(a.paddingBottom)}})}})}),[zkn,Mtr]=Ptr(sO),Rtr=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:u,onDragScroll:l,onWheelScroll:c,onResize:d,...f}=t,p=Fy(sO,r),[m,h]=sr.useState(null),b=TT(e,I=>h(I)),g=sr.useRef(null),y=sr.useRef(""),x=p.viewport,S=n.content-n.viewport,O=d1(c),E=d1(u),P=oge(d,10);function A(I){if(g.current){let R=I.clientX-g.current.left,N=I.clientY-g.current.top;l({x:R,y:N})}}return sr.useEffect(()=>{let I=R=>{let N=R.target;m?.contains(N)&&O(R,S)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[x,m,S,O]),sr.useEffect(E,[n,E]),A3(m,P),A3(p.content,P),(0,vi.jsx)(zkn,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:d1(i),onThumbPointerUp:d1(a),onThumbPositionChange:E,onThumbPointerDown:d1(s),children:(0,vi.jsx)(P3.div,{...f,ref:b,style:{position:"absolute",...f.style},onPointerDown:f1(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),g.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(I))}),onPointerMove:f1(t.onPointerMove,A),onPointerUp:f1(t.onPointerUp,I=>{let R=I.target;R.hasPointerCapture(I.pointerId)&&R.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),ege="ScrollAreaThumb",u3e=sr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Mtr(ege,t.__scopeScrollArea);return(0,vi.jsx)(E3,{present:r||o.hasThumb,children:(0,vi.jsx)(Bkn,{ref:e,...n})})}),Bkn=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=Fy(ege,r),a=Mtr(ege,r),{onThumbPositionChange:s}=a,u=TT(e,d=>a.onThumbChange(d)),l=sr.useRef(void 0),c=oge(()=>{l.current&&(l.current(),l.current=void 0)},100);return sr.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=Hkn(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,vi.jsx)(P3.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:f1(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),m=d.clientX-p.left,h=d.clientY-p.top;a.onThumbPointerDown({x:m,y:h})}),onPointerUp:f1(t.onPointerUp,a.onThumbPointerUp)})});u3e.displayName=ege;var l3e="ScrollAreaCorner",Ntr=sr.forwardRef((t,e)=>{let r=Fy(l3e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,vi.jsx)(Ukn,{...t,ref:e}):null});Ntr.displayName=l3e;var Ukn=sr.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=Fy(l3e,r),[i,a]=sr.useState(0),[s,u]=sr.useState(0),l=!!(i&&s);return A3(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),A3(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,vi.jsx)(P3.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 tge(t){return t?parseInt(t,10):0}function jtr(t,e){let r=t/e;return isNaN(r)?0:r}function nge(t){let e=jtr(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function qkn(t,e,r,n="ltr"){let o=nge(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 Dtr([u,l],d)(t)}function Ctr(t,e,r="ltr"){let n=nge(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=Str(t,u);return Dtr([0,a],[0,s])(l)}function Dtr(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 Ltr(t,e){return t>0&&t<e}var Hkn=(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 oge(t,e){let r=d1(t),n=sr.useRef(0);return sr.useEffect(()=>()=>window.clearTimeout(n.current),[]),sr.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function A3(t,e){let r=d1(e);JJ(()=>{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 c3e=Etr,Ftr=Atr;var ktr=Ntr;$n();var ige=uO.forwardRef(({className:t,children:e,...r},n)=>uO.createElement(c3e,{ref:n,className:ve("tw-relative tw-overflow-hidden",t),...r},uO.createElement(Ftr,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),uO.createElement($tr,null),uO.createElement(ktr,null)));ige.displayName=c3e.displayName;var $tr=uO.forwardRef(({className:t,orientation:e="vertical",...r},n)=>uO.createElement(rge,{ref:n,orientation:e,className:ve("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},uO.createElement(u3e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));$tr.displayName=rge.displayName;var I3=F(ee());di();An();var age=({value:t,onChange:e,placeholder:r="Search..."})=>I3.default.createElement("div",{className:"tw-relative"},I3.default.createElement(si,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&I3.default.createElement(be,{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"},I3.default.createElement($A,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),I3.default.createElement(JN,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var sge=F(ee());var Htr=F(ee(),1);var ztr=F(ee(),1),Wkn=F(Cs(),1);HN();var Btr=F(bt(),1),Kkn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Utr=Kkn.reduce((t,e)=>{let r=XO(`Primitive.${e}`),n=ztr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Btr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Vtr=F(bt(),1),Gkn="Separator",qtr="horizontal",Jkn=["horizontal","vertical"],Wtr=Htr.forwardRef((t,e)=>{let{decorative:r,orientation:n=qtr,...o}=t,i=Zkn(n)?n:qtr,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,Vtr.jsx)(Utr.div,{"data-orientation":i,...s,...o,ref:e})});Wtr.displayName=Gkn;function Zkn(t){return Jkn.includes(t)}var d3e=Wtr;$n();var ZJ=sge.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>sge.createElement(d3e,{ref:o,decorative:r,orientation:e,className:ve("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}));ZJ.displayName=d3e.displayName;$n();Qg();on();An();var lge=require("obsidian"),Le=F(ee()),Gtr=F(id());function Xkn({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Le.default.createElement(_8,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Le.default.createElement(b8,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Le.default.createElement(x8,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Le.default.createElement(pb,{className:`${e}`}):Le.default.createElement(pb,{className:`tw-text-faint ${e}`})}var f3e=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>Le.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},Le.default.createElement("div",{className:"tw-flex tw-items-center"},Le.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),Le.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&Le.default.createElement(lo,{delayDuration:0},Le.default.createElement(Nt,null,Le.default.createElement(jt,{asChild:!0},Le.default.createElement(Mo,{className:"tw-ml-2 tw-size-4 tw-text-muted"})),Le.default.createElement(At,null,Le.default.createElement("div",{className:"tw-max-w-80"},o))))),Le.default.createElement(be,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Le.default.createElement(eh,{className:`tw-size-4 ${r}`}))),Ktr=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>Le.default.createElement("div",null,Le.default.createElement(f3e,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),Le.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>Le.default.createElement("div",{key:f.id,className:ve("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)},Le.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):Le.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),Le.default.createElement(l1,{className:"tw-flex-1 tw-text-sm"},f.name)),Le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Le.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),Le.default.createElement(Qi,{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 Qkn({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?nh:Qi;return Le.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"},Le.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Le.default.createElement(Xkn,{extension:n,size:"tw-size-8"})),Le.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Le.default.createElement(l1,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&Le.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&Le.default.createElement(l1,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),Le.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},Le.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 e$n({initialProject:t,onSave:e,onCancel:r,app:n}){let{inclusions:o,exclusions:i}=(0,Le.useMemo)(()=>Tf({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),a=(0,Le.useMemo)(()=>n.vault.getFiles(),[n.vault]),s=(0,Le.useCallback)((z,B,K)=>{let q=z.filter(Te=>gu(Te,B,K)),te=(Te,de,Ue,Ke)=>{de&&de.forEach(at=>{let hr={[Ue]:[at]};gu(Te,hr,null)&&!Ke[at].some(Nn=>Nn.id===Te.path)&&Ke[at].push({id:Te.path,name:Te.basename})})},U={},W={},Y={},se=[];return(B?.tagPatterns??[]).forEach(Te=>{U[Te]=[]}),(B?.folderPatterns??[]).forEach(Te=>{W[Te]=[]}),(B?.extensionPatterns??[]).forEach(Te=>{Y[Te]=[]}),q.forEach(Te=>{te(Te,B?.tagPatterns,"tagPatterns",U),te(Te,B?.folderPatterns,"folderPatterns",W),te(Te,B?.extensionPatterns,"extensionPatterns",Y),B?.notePatterns&&gu(Te,{notePatterns:B.notePatterns},null)&&!se.some(de=>de.id===Te.path)&&se.push({id:Te.path,name:Te.basename})}),{tags:U,folders:W,extensions:Y,notes:se}},[]),[u,l]=(0,Le.useState)(()=>s(a,o,i)),[c,d]=(0,Le.useState)(()=>{let z=a.filter(B=>i&&gu(B,i,null));return{files:new Set(z)}}),f=(0,Le.useRef)(u),p=(0,Le.useRef)(c),[m,h]=(0,Le.useState)(""),[b,g]=(0,Le.useState)(null),[y,x]=(0,Le.useState)(null),S=(0,Le.useCallback)((z,B)=>{let K=Object.keys(z.tags),q=Object.keys(z.folders),te=Object.keys(z.extensions),U=z.notes.map(W=>{let Y=B.find(se=>se.path===W.id);if(Y)return G9(Y)}).filter(Boolean);return K9({tagPatterns:K,folderPatterns:q,extensionPatterns:te,notePatterns:U})},[]),O=(0,Le.useCallback)(z=>{let B=new Array(...z.files).map(K=>G9(K));return K9({notePatterns:B})||""},[]);(0,Le.useEffect)(()=>{f.current=u,p.current=c},[u,c]);let E=(0,Le.useMemo)(()=>{let z=[],B=(q,te)=>{te.forEach(U=>{q.some(W=>W.id===U.id)||q.push({id:U.id,name:U.name})})};return[u.tags,u.folders,u.extensions,{notes:u.notes}].forEach(q=>{Object.values(q).forEach(te=>{B(z,te)})}),z},[u]),P=(0,Le.useCallback)(z=>{let B=[],K=[],q=[];return z.split(",").map(U=>U.trim()).filter(U=>U).forEach(U=>{U.startsWith("#")?B.push(U.substring(1)):U.startsWith(".")||U.startsWith("*.")?q.push(U.replace("*","")):K.push(U)}),{tags:B,titles:K,extensions:q}},[]),A=(0,Le.useMemo)(()=>{if(m){let z=P(m);return E.filter(B=>{let K=a.find(se=>se.path===B.id);if(!K)return!1;let q=K.extension==="md",te=z.tags.length>0&&q&&z.tags.some(se=>bN(K).some(de=>(de.startsWith("#")?de.substring(1):de).toLowerCase().includes(se.toLowerCase()))),U=z.titles.length>0&&z.titles.some(se=>K.basename.toLowerCase().includes(se.toLowerCase())),W=z.extensions.length>0&&z.extensions.some(se=>`.${K.extension}`.toLowerCase()===se.toLowerCase());return z.tags.length>0||z.titles.length>0||z.extensions.length>0?te||U||W:!1}).map(B=>({id:B.id,name:B.name}))}if(b==="tags"&&y){let z=u.tags[y];return z||[]}if(b==="folders"&&y){let z=u.folders[y];return z||[]}if(b==="files")return u.notes;if(b==="extensions"&&y){let z=u.extensions[y];return z||[]}return b==="ignoreFiles"?Array.from(c.files).map(z=>({id:z.path,name:z.basename})):[]},[m,b,y,P,E,a,u.tags,u.folders,u.notes,u.extensions,c.files]),I=(0,Le.useCallback)(z=>[...z].sort((B,K)=>B.name.toLowerCase().localeCompare(K.name.toLowerCase())),[]),R=(0,Le.useCallback)((z,B)=>Object.entries(z).sort(([K],[q])=>K.localeCompare(q)).map(([K,q])=>({id:K,name:B?B(K):K,count:q.length})),[]),N=(0,Le.useCallback)((z,B,K)=>{let q=W=>a.filter(Y=>gu(Y,W,null)).map(Y=>({id:Y.path,name:Y.basename})),te=[...p.current.files],U=q(K).map(W=>({...W,isIgnored:te.some(Y=>Y.path===W.id)}));l(W=>({...W,[z]:{...W[z],[B]:U}}))},[a]),j=(0,Le.useCallback)((z,B)=>{let K={tags:{...z.tags},folders:{...z.folders},extensions:{...z.extensions},notes:[...z.notes]},q=te=>{Object.keys(te).forEach(U=>{te[U]=te[U].filter(W=>W.id!==B)})};return q(K.tags),q(K.folders),q(K.extensions),K.notes=K.notes.filter(te=>te.id!==B),K},[]),$=(0,Le.useCallback)((z,B=null,K=!0)=>{g(z),x(B),K&&h("")},[]),k=(0,Le.useMemo)(()=>{let z=B=>(K,q)=>{K.stopPropagation(),l(te=>{let U={...te[B]};return delete U[q.id],{...te,[B]:U}})};return{delete:{tag:z("tags"),folder:z("folders"),extension:z("extensions")},add:{tag:()=>{new v3(n,B=>{let K=que(B);N("tags",K,{tagPatterns:[K]})}).open()},folder:()=>{new _3(n,B=>{N("folders",B,{folderPatterns:[B]})}).open()},file:()=>{new qJ({app:n,onFileSelect:B=>{u.notes.find(q=>q.id===B.path)||(d(q=>{let te=new Set(q.files);return te.delete(B),{...q,files:te}}),l(q=>({...q,notes:[...q.notes,{id:B.path,name:B.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new lge.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new qJ({app:n,onFileSelect:B=>{c.files.has(B)||(d(q=>{let te=new Set(q.files);return te.add(B),{...q,files:te}}),l(q=>j(q,B.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:B=>{$("tags",B)},folder:B=>{$("folders",B)},extension:B=>{$("extensions",B)},files:()=>{$("files")},ignoreFiles:()=>{$("ignoreFiles")}}}},[n,u.notes,c.files,N,j,$]),H=()=>m?`Search Results for: "${m}"`:b==="tags"&&y?`Tag: ${y}`:b==="folders"&&y?`Folder: ${y}`:b==="files"?"Files":b==="extensions"&&y?`Extension: ${y}`:b==="ignoreFiles"?"Ignore Files":"Select a category to view items",V=(z,B)=>{z.stopPropagation();let K=a.find(q=>q.path===B.id);K&&(d(q=>{let te=new Set(q.files);return te.add(K),{...q,files:te}}),l(q=>j(q,B.id)))},Q=(0,Le.useCallback)(()=>{let z=S(f.current,a),B=O(p.current),{inclusions:K,exclusions:q}=Tf({inclusions:z,exclusions:B,isProject:!0}),te=s(a,K,q);l(te)},[a,O,S,s]),Z=(z,B)=>{z.stopPropagation();let K=a.find(q=>q.path===B.id);K&&(d(q=>{let te=new Set(q.files);return te.delete(K),{...q,files:te}}),Q())},D=()=>{let z=S(u,a),B=O(c);e({...t,contextSource:{...t.contextSource,inclusions:z,exclusions:B}})};return Le.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Le.default.createElement(ftr,{direction:"horizontal",className:"tw-flex-1"},Le.default.createElement(i3e,{defaultSize:30,minSize:20,maxSize:40},Le.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Le.default.createElement("div",{className:"tw-border-b tw-p-4"},Le.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),Le.default.createElement(ige,{className:"tw-max-h-[500px] tw-flex-1"},Le.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Le.default.createElement(Ktr,{title:"Tags",IconComponent:ZN,iconColorClassName:"tw-text-context-manager-orange",items:R(u.tags,z=>z.slice(1)),activeItem:y,activeSection:b,sectionType:"tags",renderIcon:z=>Le.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:k.click.tag,onAddClick:k.add.tag,onDeleteItem:(z,B)=>k.delete.tag(z,B),tooltip:"must be in note property"}),Le.default.createElement(ZJ,null),Le.default.createElement(Ktr,{title:"Folders",IconComponent:mb,iconColorClassName:"tw-text-context-manager-yellow",items:R(u.folders),activeItem:y,activeSection:b,sectionType:"folders",onItemClick:k.click.folder,onAddClick:k.add.folder,onDeleteItem:(z,B)=>k.delete.folder(z,B)}),Le.default.createElement(ZJ,null),Le.default.createElement("div",null,Le.default.createElement(f3e,{IconComponent:pb,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:k.add.file}),Le.default.createElement("div",{className:ve("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",b==="files"&&"tw-bg-secondary tw-text-normal"),onClick:k.click.files},"Files (",u.notes.length,")")),Le.default.createElement(ZJ,null),Le.default.createElement("div",null,Le.default.createElement(f3e,{IconComponent:Qi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:k.add.ignoreFile}),Le.default.createElement("div",{className:ve("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",b==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:k.click.ignoreFiles},"Ignore Files (",c.files.size,")")))))),Le.default.createElement(ptr,{withHandle:!0}),Le.default.createElement(i3e,{defaultSize:70},Le.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Le.default.createElement("div",{className:"tw-border-b tw-p-4"},Le.default.createElement(age,{placeholder:"Custom search: title, #tag1, .jpg",value:m,onChange:z=>{h(z),z&&$("search",null,!1)}})),Le.default.createElement("div",{className:"tw-p-4"},Le.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},H())),Le.default.createElement(ige,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},A.length===0?Le.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},b?"No items found.":"Select a category from the sidebar to view items."):Le.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},I(A).map(z=>Le.default.createElement(Qkn,{key:z.id,item:z,viewMode:"list",onDelete:b==="ignoreFiles"||z.isIgnored?Z:V}))))))),Le.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Le.default.createElement(be,{variant:"ghost",onClick:r},"Cancel"),Le.default.createElement(be,{onClick:D},"Save")))}var uge=class extends lge.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,Gtr.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Le.default.createElement(e$n,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};di();var M3=F(ee());var Bn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>M3.default.createElement("div",{className:"tw-space-y-2"},M3.default.createElement(Sp,{className:r?"tw-text-error":""},t," ",e&&M3.default.createElement("span",{className:"tw-text-error"},"*")),n&&M3.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&M3.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var gk=F(ee());$n();An();function cge({options:t,placeholder:e,containerClassName:r,className:n,...o}){return gk.default.createElement("div",{className:ve("tw-group tw-relative tw-w-full",r)},gk.default.createElement("select",{className:ve("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&&gk.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>gk.default.createElement("option",{key:i.value,value:i.value},i.label))),gk.default.createElement("div",{className:ve("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")},gk.default.createElement(Xi,{className:"tw-size-4"})))}var m1=F(ee());$n();var yk=F(ee());var Ji=F(ee(),1);function R3(t,[e,r]){return Math.min(r,Math.max(e,t))}function Ni(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var p1=F(ee(),1);var IT=F(ee(),1),Jtr=F(bt(),1);function Ztr(t,e=[]){let r=[];function n(i,a){let s=IT.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=IT.useMemo(()=>m,Object.values(m));return(0,Jtr.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=IT.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>IT.createContext(a));return function(s){let u=s?.[t]||i;return IT.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,t$n(o,...e)]}function t$n(...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 IT.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Kd=F(ee(),1);var N3=F(bt(),1),dge=Kd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Kd.Children.toArray(r),i=o.find(n$n);if(i){let a=i.props.children,s=o.map(u=>u===i?Kd.Children.count(a)>1?Kd.Children.only(null):Kd.isValidElement(a)?a.props.children:null:u);return(0,N3.jsx)(p3e,{...n,ref:e,children:Kd.isValidElement(a)?Kd.cloneElement(a,void 0,s):null})}return(0,N3.jsx)(p3e,{...n,ref:e,children:r})});dge.displayName="Slot";var p3e=Kd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Kd.isValidElement(r)){let o=i$n(r);return Kd.cloneElement(r,{...o$n(n,r.props),ref:e?kF(e,o):o})}return Kd.Children.count(r)>1?Kd.Children.only(null):null});p3e.displayName="SlotClone";var r$n=({children:t})=>(0,N3.jsx)(N3.Fragment,{children:t});function n$n(t){return Kd.isValidElement(t)&&t.type===r$n}function o$n(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 i$n(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 fge=F(bt(),1);function pge(t){let e=t+"CollectionProvider",[r,n]=Ztr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=p1.default.useRef(null),g=p1.default.useRef(new Map).current;return(0,fge.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=p1.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=zi(m,g.collectionRef);return(0,fge.jsx)(dge,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=p1.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=p1.default.useRef(null),x=zi(m,y),S=i(l,h);return p1.default.useEffect(()=>(S.itemMap.set(y,{ref:y,...g}),()=>void S.itemMap.delete(y))),(0,fge.jsx)(dge,{[c]:"",ref:x,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return p1.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,O)=>g.indexOf(S.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var sc=F(bt(),1),Ytr=["PageUp","PageDown"],Xtr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Qtr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},j3="Slider",[m3e,a$n,s$n]=pge(j3),[err,zFi]=na(j3,[s$n]),[u$n,mge]=err(j3),trr=Ji.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=t,b=Ji.useRef(new Set),g=Ji.useRef(0),x=a==="horizontal"?l$n:c$n,[S=[],O]=Nd({prop:c,defaultProp:l,onChange:N=>{[...b.current][g.current]?.focus(),d(N)}}),E=Ji.useRef(S);function P(N){let j=h$n(S,N);R(N,j)}function A(N){R(N,g.current)}function I(){let N=E.current[g.current];S[g.current]!==N&&f(S)}function R(N,j,{commit:$}={commit:!1}){let k=_$n(i),H=v$n(Math.round((N-n)/i)*i+n,k),V=R3(H,[n,o]);O((Q=[])=>{let Z=p$n(Q,V,j);if(b$n(Z,u*i)){g.current=Z.indexOf(V);let D=String(Z)!==String(Q);return D&&$&&f(Z),D?Z:Q}else return Q})}return(0,sc.jsx)(u$n,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:b.current,values:S,orientation:a,form:m,children:(0,sc.jsx)(m3e.Provider,{scope:t.__scopeSlider,children:(0,sc.jsx)(m3e.Slot,{scope:t.__scopeSlider,children:(0,sc.jsx)(x,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:Ni(h.onPointerDown,()=>{s||(E.current=S)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&R(n,0,{commit:!0}),onEndKeyDown:()=>!s&&R(o,S.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:j})=>{if(!s){let H=Ytr.includes(N.key)||N.shiftKey&&Xtr.includes(N.key)?10:1,V=g.current,Q=S[V],Z=i*H*j;R(Q+Z,V,{commit:!0})}}})})})})});trr.displayName=j3;var[rrr,nrr]=err(j3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),l$n=Ji.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=Ji.useState(null),p=zi(e,x=>f(x)),m=Ji.useRef(),h=kR(o),b=h==="ltr",g=b&&!i||!b&&i;function y(x){let S=m.current||d.getBoundingClientRect(),O=[0,S.width],P=y3e(O,g?[r,n]:[n,r]);return m.current=S,P(x-S.left)}return(0,sc.jsx)(rrr,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,sc.jsx)(orr,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:x=>{let S=y(x.clientX);a?.(S)},onSlideMove:x=>{let S=y(x.clientX);s?.(S)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:x=>{let O=Qtr[g?"from-left":"from-right"].includes(x.key);l?.({event:x,direction:O?-1:1})}})})}),c$n=Ji.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=Ji.useRef(null),d=zi(e,c),f=Ji.useRef(),p=!o;function m(h){let b=f.current||c.current.getBoundingClientRect(),g=[0,b.height],x=y3e(g,p?[n,r]:[r,n]);return f.current=b,x(h-b.top)}return(0,sc.jsx)(rrr,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,sc.jsx)(orr,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let b=m(h.clientY);i?.(b)},onSlideMove:h=>{let b=m(h.clientY);a?.(b)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=Qtr[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),orr=Ji.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=mge(j3,r);return(0,sc.jsx)(Po.span,{...l,ref:e,onKeyDown:Ni(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):Ytr.concat(Xtr).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:Ni(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:Ni(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:Ni(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),irr="SliderTrack",arr=Ji.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=mge(irr,r);return(0,sc.jsx)(Po.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});arr.displayName=irr;var h3e="SliderRange",srr=Ji.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=mge(h3e,r),i=nrr(h3e,r),a=Ji.useRef(null),s=zi(e,a),u=o.values.length,l=o.values.map(f=>lrr(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,sc.jsx)(Po.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});srr.displayName=h3e;var g3e="SliderThumb",urr=Ji.forwardRef((t,e)=>{let r=a$n(t.__scopeSlider),[n,o]=Ji.useState(null),i=zi(e,s=>o(s)),a=Ji.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,sc.jsx)(d$n,{...t,ref:i,index:a})}),d$n=Ji.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=mge(g3e,r),s=nrr(g3e,r),[u,l]=Ji.useState(null),c=zi(e,y=>l(y)),d=u?a.form||!!u.closest("form"):!0,f=XC(u),p=a.values[n],m=p===void 0?0:lrr(p,a.min,a.max),h=m$n(n,a.values.length),b=f?.[s.size],g=b?g$n(b,m,s.direction):0;return Ji.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,sc.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,sc.jsx)(m3e.ItemSlot,{scope:t.__scopeSlider,children:(0,sc.jsx)(Po.span,{role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:Ni(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,sc.jsx)(f$n,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});urr.displayName=g3e;var f$n=t=>{let{value:e,...r}=t,n=Ji.useRef(null),o=q4(e);return Ji.useEffect(()=>{let i=n.current,a=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==e&&u){let l=new Event("input",{bubbles:!0});u.call(i,e),i.dispatchEvent(l)}},[o,e]),(0,sc.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function p$n(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function lrr(t,e,r){let i=100/(r-e)*(t-e);return R3(i,[0,100])}function m$n(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function h$n(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 g$n(t,e,r){let n=t/2,i=y3e([0,50],[0,n]);return(n-i(e)*r)*r}function y$n(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function b$n(t,e){if(e>0){let r=y$n(t);return Math.min(...r)>=e}return!0}function y3e(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 _$n(t){return(String(t).split(".")[1]||"").length}function v$n(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var b3e=trr,crr=arr,drr=srr,frr=urr;$n();var _3e=yk.forwardRef(({className:t,...e},r)=>yk.createElement(b3e,{ref:r,className:ve("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},yk.createElement(crr,{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"},yk.createElement(drr,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),yk.createElement(frr,{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"})));_3e.displayName=b3e.displayName;function lO({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,m1.useState)(t);return(0,m1.useEffect)(()=>{u(t)},[t]),m1.default.createElement("div",{className:ve("tw-flex tw-items-center tw-gap-4",a)},m1.default.createElement(_3e,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),m1.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},s))}Ur();Qg();er();on();An();var D3=require("obsidian"),Qt=F(ee()),prr=F(id());function x$n({initialProject:t,onSave:e,onCancel:r}){let n=Hn(),[o,i]=(0,Qt.useState)(!1),[a,s]=(0,Qt.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,Qt.useState)(t||{id:NGe(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:pg.TEMPERATURE,maxTokens:pg.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=Xg(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{new uge(app,async g=>{l(g)},h).open()},f=()=>u.name&&u.projectModelKey,p=(h,b)=>{l(g=>{if(typeof b=="string"&&h==="projectModelKey"&&(b=b.trim()),Array.isArray(b)&&b.every(y=>typeof y=="string")&&(b=b.map(y=>y.trim()).filter(Boolean)),h.includes(".")){let[y,x]=h.split("."),O=g[y];if(typeof O=="object"&&O!==null)return{...g,[y]:{...O,[x]:b}}}return{...g,[h]:b}})},m=async()=>{u.name&&(u.name=u.name.trim());let b=["name","projectModelKey"].filter(g=>!u[g]);if(b.length>0){s(g=>({...g,...Object.fromEntries(b.map(y=>[y,!0]))})),new D3.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new D3.Notice(ci(g)),s(y=>({...y,name:!0}))}finally{i(!1)}};return Qt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},Qt.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),Qt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qt.default.createElement(Bn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},Qt.default.createElement(si,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),Qt.default.createElement(Bn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},Qt.default.createElement(si,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),Qt.default.createElement(Bn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},Qt.default.createElement(dT,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),Qt.default.createElement(Bn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},Qt.default.createElement(cge,{value:u.projectModelKey,onChange:h=>{let b=h.target.value,g=n.activeModels.find(S=>S.enabled&&Yr(S)===b);if(!g)return;let{hasApiKey:y,errorNotice:x}=T$(g,n);if(!y&&x){new D3.Notice(x);return}p("projectModelKey",b)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:ZG(h),value:Yr(h)}))})),Qt.default.createElement("div",{className:"tw-space-y-4"},Qt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),Qt.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},Qt.default.createElement(Bn,{label:"Temperature"},Qt.default.createElement(lO,{value:u.modelConfigs?.temperature??pg.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),Qt.default.createElement(Bn,{label:"Token Limit"},Qt.default.createElement(lO,{value:u.modelConfigs?.maxTokens??pg.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),Qt.default.createElement("div",{className:"tw-space-y-4"},Qt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),Qt.default.createElement(Bn,{label:Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement("span",null,"File Context"),Qt.default.createElement(lo,{delayDuration:0},Qt.default.createElement(Nt,null,Qt.default.createElement(jt,{asChild:!0},Qt.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),Qt.default.createElement(At,null,Qt.default.createElement("div",{className:"tw-max-w-80"},Qt.default.createElement("strong",null,"Supported File Types:"),Qt.default.createElement("br",null),Qt.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",Qt.default.createElement("br",null),Qt.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",Qt.default.createElement("br",null),Qt.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",Qt.default.createElement("br",null),Qt.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",Qt.default.createElement("br",null),Qt.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."},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},Qt.default.createElement(l1,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),Qt.default.createElement(be,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),Qt.default.createElement(Bn,{label:"Web URLs"},Qt.default.createElement(dT,{value:u.contextSource?.webUrls,onChange:h=>{let g=h.target.value.split(`
|
||
`).map(y=>{if(!y.trim())return y;try{return new URL(y.trim()),y}catch{return y}});p("contextSource.webUrls",g.join(`
|
||
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),Qt.default.createElement(Bn,{label:"YouTube URLs"},Qt.default.createElement(dT,{value:u.contextSource?.youtubeUrls,onChange:h=>{let g=h.target.value.split(`
|
||
`).map(y=>{if(!y.trim())return y;try{let x=new URL(y.trim());return x.hostname.includes("youtube.com")||x.hostname.includes("youtu.be"),y}catch{return y}});p("contextSource.youtubeUrls",g.join(`
|
||
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),Qt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},Qt.default.createElement(be,{variant:"ghost",onClick:r,disabled:o},"Cancel"),Qt.default.createElement(be,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var YJ=class extends D3.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,prr.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(Qt.default.createElement(x$n,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};di();var Ui=F(ee());var pt=F(ee(),1),U3e=F(Cs(),1);var hs=F(ee(),1);var w3e=F(bt(),1),S$n="DismissableLayer",v3e="dismissableLayer.update",C$n="dismissableLayer.pointerDownOutside",O$n="dismissableLayer.focusOutside",mrr,grr=hs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),x3e=hs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=hs.useContext(grr),[c,d]=hs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=hs.useState({}),m=zi(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=y>=g,O=T$n(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=A$n(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return $R(P=>{y===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),hs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(mrr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),hrr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=mrr)}},[c,f,r,l]),hs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),hrr())},[c,l]),hs.useEffect(()=>{let P=()=>p({});return document.addEventListener(v3e,P),()=>document.removeEventListener(v3e,P)},[]),(0,w3e.jsx)(Po.div,{...u,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:Ni(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Ni(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ni(t.onPointerDownCapture,O.onPointerDownCapture)})});x3e.displayName=S$n;var P$n="DismissableLayerBranch",E$n=hs.forwardRef((t,e)=>{let r=hs.useContext(grr),n=hs.useRef(null),o=zi(e,n);return hs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,w3e.jsx)(Po.div,{...t,ref:o})});E$n.displayName=P$n;function T$n(t,e=globalThis?.document){let r=Qr(t),n=hs.useRef(!1),o=hs.useRef(()=>{});return hs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){yrr(C$n,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 A$n(t,e=globalThis?.document){let r=Qr(t),n=hs.useRef(!1);return hs.useEffect(()=>{let o=i=>{i.target&&!n.current&&yrr(O$n,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 hrr(){let t=new CustomEvent(v3e);document.dispatchEvent(t)}function yrr(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?MGt(o,i):o.dispatchEvent(i)}var ky=F(ee(),1);var xrr=F(bt(),1),S3e="focusScope.autoFocusOnMount",C3e="focusScope.autoFocusOnUnmount",brr={bubbles:!1,cancelable:!0},I$n="FocusScope",O3e=ky.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ky.useState(null),l=Qr(o),c=Qr(i),d=ky.useRef(null),f=zi(e,h=>u(h)),p=ky.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ky.useEffect(()=>{if(n){let y=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:h1(d.current,{select:!0})},x=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||h1(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&h1(s)};var h=y,b=x,g=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);let O=new MutationObserver(S);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),O.disconnect()}}},[n,s,p.paused]),ky.useEffect(()=>{if(s){vrr.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(S3e,brr);s.addEventListener(S3e,l),s.dispatchEvent(g),g.defaultPrevented||(M$n(L$n(Srr(s)),{select:!0}),document.activeElement===h&&h1(s))}return()=>{s.removeEventListener(S3e,l),setTimeout(()=>{let g=new CustomEvent(C3e,brr);s.addEventListener(C3e,c),s.dispatchEvent(g),g.defaultPrevented||h1(h??document.body,{select:!0}),s.removeEventListener(C3e,c),vrr.remove(p)},0)}}},[s,l,c,p]);let m=ky.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[x,S]=R$n(y);x&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&h1(x,{select:!0})):h.shiftKey&&g===x&&(h.preventDefault(),r&&h1(S,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,xrr.jsx)(Po.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});O3e.displayName=I$n;function M$n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(h1(n,{select:e}),document.activeElement!==r)return}function R$n(t){let e=Srr(t),r=_rr(e,t),n=_rr(e.reverse(),t);return[r,n]}function Srr(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 _rr(t,e){for(let r of t)if(!N$n(r,{upTo:e}))return r}function N$n(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 j$n(t){return t instanceof HTMLInputElement&&"select"in t}function h1(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&j$n(t)&&e&&t.select()}}var vrr=D$n();function D$n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=wrr(t,e),t.unshift(e)},remove(e){t=wrr(t,e),t[0]?.resume()}}}function wrr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function L$n(t){return t.filter(e=>e.tagName!=="A")}var Vh=F(ee(),1);var Crr=F(ee(),1);var P3e=F(bt(),1),F$n="Arrow",Orr=Crr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,P3e.jsx)(Po.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,P3e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Orr.displayName=F$n;var Prr=Orr;var MT=F(ee(),1),Err=F(bt(),1);function Trr(t,e=[]){let r=[];function n(i,a){let s=MT.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=MT.useMemo(()=>m,Object.values(m));return(0,Err.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=MT.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>MT.createContext(a));return function(s){let u=s?.[t]||i;return MT.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,$$n(o,...e)]}function $$n(...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 MT.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var g1=F(bt(),1);var E3e="Popper",[Arr,T3e]=Trr(E3e),[z$n,Irr]=Arr(E3e),Mrr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Vh.useState(null);return(0,g1.jsx)(z$n,{scope:e,anchor:n,onAnchorChange:o,children:r})};Mrr.displayName=E3e;var Rrr="PopperAnchor",Nrr=Vh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Irr(Rrr,r),a=Vh.useRef(null),s=zi(e,a);return Vh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,g1.jsx)(Po.div,{...o,ref:s})});Nrr.displayName=Rrr;var A3e="PopperContent",[B$n,U$n]=Arr(A3e),jrr=Vh.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=Irr(A3e,r),[g,y]=Vh.useState(null),x=zi(e,Y=>y(Y)),[S,O]=Vh.useState(null),E=XC(S),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],j=N.length>0,$={padding:R,boundary:N.filter(H$n),altBoundary:j},{refs:k,floatingStyles:H,placement:V,isPositioned:Q,middlewareData:Z}=UR({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>bT(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[qR({mainAxis:o+A,alignmentAxis:a}),u&&HR({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?VR():void 0,...$}),u&&WR({...$}),KR({...$,apply:({elements:Y,rects:se,availableWidth:Te,availableHeight:de})=>{let{width:Ue,height:Ke}=se.reference,at=Y.floating.style;at.setProperty("--radix-popper-available-width",`${Te}px`),at.setProperty("--radix-popper-available-height",`${de}px`),at.setProperty("--radix-popper-anchor-width",`${Ue}px`),at.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),S&&JR({element:S,padding:s}),V$n({arrowWidth:P,arrowHeight:A}),f&&GR({strategy:"referenceHidden",...$})]}),[D,z]=Frr(V),B=Qr(m);uo(()=>{Q&&B?.()},[Q,B]);let K=Z.arrow?.x,q=Z.arrow?.y,te=Z.arrow?.centerOffset!==0,[U,W]=Vh.useState();return uo(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,g1.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:Q?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,g1.jsx)(B$n,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:q,shouldHideArrow:te,children:(0,g1.jsx)(Po.div,{"data-side":D,"data-align":z,...h,ref:x,style:{...h.style,animation:Q?void 0:"none"}})})})});jrr.displayName=A3e;var Drr="PopperArrow",q$n={top:"bottom",right:"left",bottom:"top",left:"right"},Lrr=Vh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=U$n(Drr,n),a=q$n[i.placedSide];return(0,g1.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,g1.jsx)(Prr,{...o,ref:r,style:{...o.style,display:"block"}})})});Lrr.displayName=Drr;function H$n(t){return t!==null}var V$n=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]=Frr(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function Frr(t){let[e,r="center"]=t.split("-");return[e,r]}var krr=Mrr,$rr=Nrr,zrr=jrr,Brr=Lrr;var hge=F(ee(),1),Urr=F(Cs(),1);var qrr=F(bt(),1),K$n="Portal",I3e=hge.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=hge.useState(!1);uo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Urr.default.createPortal((0,qrr.jsx)(Po.div,{...n,ref:e}),a):null});I3e.displayName=K$n;var Gd=F(ee(),1);var L3=F(bt(),1),R3e=Gd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Gd.Children.toArray(r),i=o.find(J$n);if(i){let a=i.props.children,s=o.map(u=>u===i?Gd.Children.count(a)>1?Gd.Children.only(null):Gd.isValidElement(a)?a.props.children:null:u);return(0,L3.jsx)(M3e,{...n,ref:e,children:Gd.isValidElement(a)?Gd.cloneElement(a,void 0,s):null})}return(0,L3.jsx)(M3e,{...n,ref:e,children:r})});R3e.displayName="Slot";var M3e=Gd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Gd.isValidElement(r)){let o=Y$n(r);return Gd.cloneElement(r,{...Z$n(n,r.props),ref:e?kF(e,o):o})}return Gd.Children.count(r)>1?Gd.Children.only(null):null});M3e.displayName="SlotClone";var G$n=({children:t})=>(0,L3.jsx)(L3.Fragment,{children:t});function J$n(t){return Gd.isValidElement(t)&&t.type===G$n}function Z$n(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 Y$n(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 Hrr=F(ee(),1);var Vrr=F(bt(),1),X$n="VisuallyHidden",N3e=Hrr.forwardRef((t,e)=>(0,Vrr.jsx)(Po.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}}));N3e.displayName=X$n;var bge=F(ee());var zf=F(ee());var gge=ek();var j3e=function(){},XJ=zf.forwardRef(function(t,e){var r=zf.useRef(null),n=zf.useState({onScrollCapture:j3e,onWheelCapture:j3e,onTouchMoveCapture:j3e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,y=t.gapMode,x=e1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,O=QF([r,e]),E=Oi(Oi({},x),o);return zf.createElement(zf.Fragment,null,c&&zf.createElement(S,{sideCar:gge,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?zf.cloneElement(zf.Children.only(s),Oi(Oi({},E),{ref:O})):zf.createElement(g,Oi({},E,{className:u,ref:O}),s))});XJ.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};XJ.classNames={fullWidth:p_,zeroRight:f_};var Ea=F(ee());var D3e=!1;if(typeof window<"u")try{QJ=Object.defineProperty({},"passive",{get:function(){return D3e=!0,!0}}),window.addEventListener("test",QJ,QJ),window.removeEventListener("test",QJ,QJ)}catch{D3e=!1}var QJ,bk=D3e?{passive:!1}:!1;var Q$n=function(t){return t.tagName==="TEXTAREA"},Wrr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Q$n(t)&&r[e]==="visible")},ezn=function(t){return Wrr(t,"overflowY")},tzn=function(t){return Wrr(t,"overflowX")},L3e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Krr(t,n);if(o){var i=Grr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rzn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},nzn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Krr=function(t,e){return t==="v"?ezn(e):tzn(e)},Grr=function(t,e){return t==="v"?rzn(e):nzn(e)},ozn=function(t,e){return t==="h"&&e==="rtl"?-1:1},Jrr=function(t,e,r,n,o){var i=ozn(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=Grr(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&Krr(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var yge=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Zrr=function(t){return[t.deltaX,t.deltaY]},Yrr=function(t){return t&&"current"in t?t.current:t},izn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},azn=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},szn=0,F3=[];function Xrr(t){var e=Ea.useRef([]),r=Ea.useRef([0,0]),n=Ea.useRef(),o=Ea.useState(szn++)[0],i=Ea.useState(_T)[0],a=Ea.useRef(t);Ea.useEffect(function(){a.current=t},[t]),Ea.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=o3([t.lockRef.current],(t.shards||[]).map(Yrr),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Ea.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=yge(h),y=r.current,x="deltaX"in h?h.deltaX:y[0]-g[0],S="deltaY"in h?h.deltaY:y[1]-g[1],O,E=h.target,P=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var A=L3e(P,E);if(!A)return!0;if(A?O=P:(O=P==="v"?"h":"v",A=L3e(P,E)),!A)return!1;if(!n.current&&"changedTouches"in h&&(x||S)&&(n.current=O),!O)return!0;var I=n.current||O;return Jrr(I,b,h,I==="h"?x:S,!0)},[]),u=Ea.useCallback(function(h){var b=h;if(!(!F3.length||F3[F3.length-1]!==i)){var g="deltaY"in b?Zrr(b):yge(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&izn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var x=(a.current.shards||[]).map(Yrr).filter(Boolean).filter(function(O){return O.contains(b.target)}),S=x.length>0?s(b,x[0]):!a.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),l=Ea.useCallback(function(h,b,g,y){var x={name:h,delta:b,target:g,should:y,shadowParent:uzn(g)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(S){return S!==x})},1)},[]),c=Ea.useCallback(function(h){r.current=yge(h),n.current=void 0},[]),d=Ea.useCallback(function(h){l(h.type,Zrr(h),h.target,s(h,t.lockRef.current))},[]),f=Ea.useCallback(function(h){l(h.type,yge(h),h.target,s(h,t.lockRef.current))},[]);Ea.useEffect(function(){return F3.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,bk),document.addEventListener("touchmove",u,bk),document.addEventListener("touchstart",c,bk),function(){F3=F3.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,bk),document.removeEventListener("touchmove",u,bk),document.removeEventListener("touchstart",c,bk)}},[]);var p=t.removeScrollBar,m=t.inert;return Ea.createElement(Ea.Fragment,null,m?Ea.createElement(i,{styles:azn(o)}):null,p?Ea.createElement(rk,{gapMode:t.gapMode}):null)}function uzn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Qrr=tk(gge,Xrr);var enr=bge.forwardRef(function(t,e){return bge.createElement(XJ,Oi({},t,{ref:e,sideCar:Qrr}))});enr.classNames=XJ.classNames;var e7=enr;var mr=F(bt(),1),lzn=[" ","Enter","ArrowUp","ArrowDown"],czn=[" ","Enter"],r7="Select",[vge,wge,dzn]=pge(r7),[k3,T$i]=na(r7,[dzn,T3e]),xge=T3e(),[fzn,y1]=k3(r7),[pzn,mzn]=k3(r7),tnr=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:m}=t,h=xge(e),[b,g]=pt.useState(null),[y,x]=pt.useState(null),[S,O]=pt.useState(!1),E=kR(l),[P=!1,A]=Nd({prop:n,defaultProp:o,onChange:i}),[I,R]=Nd({prop:a,defaultProp:s,onChange:u}),N=pt.useRef(null),j=b?m||!!b.closest("form"):!0,[$,k]=pt.useState(new Set),H=Array.from($).map(V=>V.props.value).join(";");return(0,mr.jsx)(krr,{...h,children:(0,mr.jsxs)(fzn,{required:p,scope:e,trigger:b,onTriggerChange:g,valueNode:y,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:O,contentId:Rl(),value:I,onValueChange:R,open:P,onOpenChange:A,dir:E,triggerPointerDownPosRef:N,disabled:f,children:[(0,mr.jsx)(vge.Provider,{scope:e,children:(0,mr.jsx)(pzn,{scope:t.__scopeSelect,onNativeOptionAdd:pt.useCallback(V=>{k(Q=>new Set(Q).add(V))},[]),onNativeOptionRemove:pt.useCallback(V=>{k(Q=>{let Z=new Set(Q);return Z.delete(V),Z})},[]),children:r})}),j?(0,mr.jsxs)(Pnr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:V=>R(V.target.value),disabled:f,form:m,children:[I===void 0?(0,mr.jsx)("option",{value:""}):null,Array.from($)]},H):null]})})};tnr.displayName=r7;var rnr="SelectTrigger",nnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=xge(r),a=y1(rnr,r),s=a.disabled||n,u=zi(e,a.onTriggerChange),l=wge(r),c=pt.useRef("touch"),[d,f,p]=Enr(h=>{let b=l().filter(x=>!x.disabled),g=b.find(x=>x.value===a.value),y=Tnr(b,h,g);y!==void 0&&a.onValueChange(y.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,mr.jsx)($rr,{asChild:!0,...i,children:(0,mr.jsx)(Po.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":Onr(a.value)?"":void 0,...o,ref:u,onClick:Ni(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:Ni(o.onPointerDown,h=>{c.current=h.pointerType;let b=h.target;b.hasPointerCapture(h.pointerId)&&b.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:Ni(o.onKeyDown,h=>{let b=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(b&&h.key===" ")&&lzn.includes(h.key)&&(m(),h.preventDefault())})})})});nnr.displayName=rnr;var onr="SelectValue",inr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=y1(onr,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=zi(e,u.onValueNodeChange);return uo(()=>{l(c)},[l,c]),(0,mr.jsx)(Po.span,{...s,ref:d,style:{pointerEvents:"none"},children:Onr(u.value)?(0,mr.jsx)(mr.Fragment,{children:a}):i})});inr.displayName=onr;var hzn="SelectIcon",anr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,mr.jsx)(Po.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});anr.displayName=hzn;var gzn="SelectPortal",snr=t=>(0,mr.jsx)(I3e,{asChild:!0,...t});snr.displayName=gzn;var _k="SelectContent",unr=pt.forwardRef((t,e)=>{let r=y1(_k,t.__scopeSelect),[n,o]=pt.useState();if(uo(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?U3e.createPortal((0,mr.jsx)(lnr,{scope:t.__scopeSelect,children:(0,mr.jsx)(vge.Slot,{scope:t.__scopeSelect,children:(0,mr.jsx)("div",{children:t.children})})}),i):null}return(0,mr.jsx)(cnr,{...t,ref:e})});unr.displayName=_k;var x_=10,[lnr,b1]=k3(_k),yzn="SelectContentImpl",cnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b,...g}=t,y=y1(_k,r),[x,S]=pt.useState(null),[O,E]=pt.useState(null),P=zi(e,Y=>S(Y)),[A,I]=pt.useState(null),[R,N]=pt.useState(null),j=wge(r),[$,k]=pt.useState(!1),H=pt.useRef(!1);pt.useEffect(()=>{if(x)return QR(x)},[x]),zR();let V=pt.useCallback(Y=>{let[se,...Te]=j().map(Ke=>Ke.ref.current),[de]=Te.slice(-1),Ue=document.activeElement;for(let Ke of Y)if(Ke===Ue||(Ke?.scrollIntoView({block:"nearest"}),Ke===se&&O&&(O.scrollTop=0),Ke===de&&O&&(O.scrollTop=O.scrollHeight),Ke?.focus(),document.activeElement!==Ue))return},[j,O]),Q=pt.useCallback(()=>V([A,x]),[V,A,x]);pt.useEffect(()=>{$&&Q()},[$,Q]);let{onOpenChange:Z,triggerPointerDownPosRef:D}=y;pt.useEffect(()=>{if(x){let Y={x:0,y:0},se=de=>{Y={x:Math.abs(Math.round(de.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(D.current?.y??0))}},Te=de=>{Y.x<=10&&Y.y<=10?de.preventDefault():x.contains(de.target)||Z(!1),document.removeEventListener("pointermove",se),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Te,{capture:!0})}}},[x,Z,D]),pt.useEffect(()=>{let Y=()=>Z(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[Z]);let[z,B]=Enr(Y=>{let se=j().filter(Ue=>!Ue.disabled),Te=se.find(Ue=>Ue.ref.current===document.activeElement),de=Tnr(se,Y,Te);de&&setTimeout(()=>de.ref.current.focus())}),K=pt.useCallback((Y,se,Te)=>{let de=!H.current&&!Te;(y.value!==void 0&&y.value===se||de)&&(I(Y),de&&(H.current=!0))},[y.value]),q=pt.useCallback(()=>x?.focus(),[x]),te=pt.useCallback((Y,se,Te)=>{let de=!H.current&&!Te;(y.value!==void 0&&y.value===se||de)&&N(Y)},[y.value]),U=n==="popper"?F3e:dnr,W=U===F3e?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b}:{};return(0,mr.jsx)(lnr,{scope:r,content:x,viewport:O,onViewportChange:E,itemRefCallback:K,selectedItem:A,onItemLeave:q,itemTextRefCallback:te,focusSelectedItem:Q,selectedItemText:R,position:n,isPositioned:$,searchRef:z,children:(0,mr.jsx)(e7,{as:R3e,allowPinchZoom:!0,children:(0,mr.jsx)(O3e,{asChild:!0,trapped:y.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Ni(o,Y=>{y.trigger?.focus({preventScroll:!0}),Y.preventDefault()}),children:(0,mr.jsx)(x3e,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,mr.jsx)(U,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:Y=>Y.preventDefault(),...g,...W,onPlaced:()=>k(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:Ni(g.onKeyDown,Y=>{let se=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!se&&Y.key.length===1&&B(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let de=j().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){let Ue=Y.target,Ke=de.indexOf(Ue);de=de.slice(Ke+1)}setTimeout(()=>V(de)),Y.preventDefault()}})})})})})})});cnr.displayName=yzn;var bzn="SelectItemAlignedPosition",dnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=y1(_k,r),a=b1(_k,r),[s,u]=pt.useState(null),[l,c]=pt.useState(null),d=zi(e,P=>c(P)),f=wge(r),p=pt.useRef(!1),m=pt.useRef(!0),{viewport:h,selectedItem:b,selectedItemText:g,focusSelectedItem:y}=a,x=pt.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&b&&g){let P=i.trigger.getBoundingClientRect(),A=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),R=g.getBoundingClientRect();if(i.dir!=="rtl"){let Ue=R.left-A.left,Ke=I.left-Ue,at=P.left-Ke,hr=P.width+at,Nn=Math.max(hr,A.width),De=window.innerWidth-x_,_t=R3(Ke,[x_,Math.max(x_,De-Nn)]);s.style.minWidth=hr+"px",s.style.left=_t+"px"}else{let Ue=A.right-R.right,Ke=window.innerWidth-I.right-Ue,at=window.innerWidth-P.right-Ke,hr=P.width+at,Nn=Math.max(hr,A.width),De=window.innerWidth-x_,_t=R3(Ke,[x_,Math.max(x_,De-Nn)]);s.style.minWidth=hr+"px",s.style.right=_t+"px"}let N=f(),j=window.innerHeight-x_*2,$=h.scrollHeight,k=window.getComputedStyle(l),H=parseInt(k.borderTopWidth,10),V=parseInt(k.paddingTop,10),Q=parseInt(k.borderBottomWidth,10),Z=parseInt(k.paddingBottom,10),D=H+V+$+Z+Q,z=Math.min(b.offsetHeight*5,D),B=window.getComputedStyle(h),K=parseInt(B.paddingTop,10),q=parseInt(B.paddingBottom,10),te=P.top+P.height/2-x_,U=j-te,W=b.offsetHeight/2,Y=b.offsetTop+W,se=H+V+Y,Te=D-se;if(se<=te){let Ue=N.length>0&&b===N[N.length-1].ref.current;s.style.bottom="0px";let Ke=l.clientHeight-h.offsetTop-h.offsetHeight,at=Math.max(U,W+(Ue?q:0)+Ke+Q),hr=se+at;s.style.height=hr+"px"}else{let Ue=N.length>0&&b===N[0].ref.current;s.style.top="0px";let at=Math.max(te,H+h.offsetTop+(Ue?K:0)+W)+Te;s.style.height=at+"px",h.scrollTop=se-te+h.offsetTop}s.style.margin=`${x_}px 0`,s.style.minHeight=z+"px",s.style.maxHeight=j+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,b,g,i.dir,n]);uo(()=>x(),[x]);let[S,O]=pt.useState();uo(()=>{l&&O(window.getComputedStyle(l).zIndex)},[l]);let E=pt.useCallback(P=>{P&&m.current===!0&&(x(),y?.(),m.current=!1)},[x,y]);return(0,mr.jsx)(vzn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:E,children:(0,mr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,mr.jsx)(Po.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});dnr.displayName=bzn;var _zn="SelectPopperPosition",F3e=pt.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=x_,...i}=t,a=xge(r);return(0,mr.jsx)(zrr,{...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)"}})});F3e.displayName=_zn;var[vzn,q3e]=k3(_k,{}),k3e="SelectViewport",fnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=b1(k3e,r),a=q3e(k3e,r),s=zi(e,i.onViewportChange),u=pt.useRef(0);return(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.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,mr.jsx)(vge.Slot,{scope:r,children:(0,mr.jsx)(Po.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ni(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let m=window.innerHeight-x_*2,h=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),g=Math.max(h,b);if(g<m){let y=g+p,x=Math.min(m,y),S=y-x;d.style.height=x+"px",d.style.bottom==="0px"&&(c.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});fnr.displayName=k3e;var pnr="SelectGroup",[wzn,xzn]=k3(pnr),Szn=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Rl();return(0,mr.jsx)(wzn,{scope:r,id:o,children:(0,mr.jsx)(Po.div,{role:"group","aria-labelledby":o,...n,ref:e})})});Szn.displayName=pnr;var mnr="SelectLabel",hnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=xzn(mnr,r);return(0,mr.jsx)(Po.div,{id:o.id,...n,ref:e})});hnr.displayName=mnr;var _ge="SelectItem",[Czn,gnr]=k3(_ge),ynr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=y1(_ge,r),u=b1(_ge,r),l=s.value===n,[c,d]=pt.useState(i??""),[f,p]=pt.useState(!1),m=zi(e,y=>u.itemRefCallback?.(y,n,o)),h=Rl(),b=pt.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,mr.jsx)(Czn,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:pt.useCallback(y=>{d(x=>x||(y?.textContent??"").trim())},[]),children:(0,mr.jsx)(vge.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,mr.jsx)(Po.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:m,onFocus:Ni(a.onFocus,()=>p(!0)),onBlur:Ni(a.onBlur,()=>p(!1)),onClick:Ni(a.onClick,()=>{b.current!=="mouse"&&g()}),onPointerUp:Ni(a.onPointerUp,()=>{b.current==="mouse"&&g()}),onPointerDown:Ni(a.onPointerDown,y=>{b.current=y.pointerType}),onPointerMove:Ni(a.onPointerMove,y=>{b.current=y.pointerType,o?u.onItemLeave?.():b.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ni(a.onPointerLeave,y=>{y.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Ni(a.onKeyDown,y=>{u.searchRef?.current!==""&&y.key===" "||(czn.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});ynr.displayName=_ge;var t7="SelectItemText",bnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=y1(t7,r),s=b1(t7,r),u=gnr(t7,r),l=mzn(t7,r),[c,d]=pt.useState(null),f=zi(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=pt.useMemo(()=>(0,mr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:b}=l;return uo(()=>(h(m),()=>b(m)),[h,b,m]),(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.jsx)(Po.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?U3e.createPortal(i.children,a.valueNode):null]})});bnr.displayName=t7;var _nr="SelectItemIndicator",vnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return gnr(_nr,r).isSelected?(0,mr.jsx)(Po.span,{"aria-hidden":!0,...n,ref:e}):null});vnr.displayName=_nr;var $3e="SelectScrollUpButton",wnr=pt.forwardRef((t,e)=>{let r=b1($3e,t.__scopeSelect),n=q3e($3e,t.__scopeSelect),[o,i]=pt.useState(!1),a=zi(e,n.onScrollButtonChange);return uo(()=>{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,mr.jsx)(Snr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});wnr.displayName=$3e;var z3e="SelectScrollDownButton",xnr=pt.forwardRef((t,e)=>{let r=b1(z3e,t.__scopeSelect),n=q3e(z3e,t.__scopeSelect),[o,i]=pt.useState(!1),a=zi(e,n.onScrollButtonChange);return uo(()=>{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,mr.jsx)(Snr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});xnr.displayName=z3e;var Snr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=b1("SelectScrollButton",r),a=pt.useRef(null),s=wge(r),u=pt.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return pt.useEffect(()=>()=>u(),[u]),uo(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,mr.jsx)(Po.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Ni(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Ni(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Ni(o.onPointerLeave,()=>{u()})})}),Ozn="SelectSeparator",Cnr=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,mr.jsx)(Po.div,{"aria-hidden":!0,...n,ref:e})});Cnr.displayName=Ozn;var B3e="SelectArrow",Pzn=pt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=xge(r),i=y1(B3e,r),a=b1(B3e,r);return i.open&&a.position==="popper"?(0,mr.jsx)(Brr,{...o,...n,ref:e}):null});Pzn.displayName=B3e;function Onr(t){return t===""||t===void 0}var Pnr=pt.forwardRef((t,e)=>{let{value:r,...n}=t,o=pt.useRef(null),i=zi(e,o),a=q4(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,mr.jsx)(N3e,{asChild:!0,children:(0,mr.jsx)("select",{...n,ref:i,defaultValue:r})})});Pnr.displayName="BubbleSelect";function Enr(t){let e=Qr(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 Tnr(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=Ezn(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 Ezn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var Anr=tnr,H3e=nnr,Inr=inr,Mnr=anr,Rnr=snr,V3e=unr,Nnr=fnr;var W3e=hnr,K3e=ynr,jnr=bnr,Dnr=vnr,G3e=wnr,J3e=xnr,Z3e=Cnr;An();$n();var RT=Anr;var NT=Inr,cO=Ui.forwardRef(({className:t,children:e,...r},n)=>Ui.createElement(H3e,{ref:n,className:ve("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,Ui.createElement(Mnr,{asChild:!0},Ui.createElement(Xi,{className:"tw-size-4"}))));cO.displayName=H3e.displayName;var Lnr=Ui.forwardRef(({className:t,...e},r)=>Ui.createElement(G3e,{ref:r,className:ve("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Ui.createElement(fb,{className:"tw-size-4"})));Lnr.displayName=G3e.displayName;var Fnr=Ui.forwardRef(({className:t,...e},r)=>Ui.createElement(J3e,{ref:r,className:ve("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Ui.createElement(Xi,{className:"tw-size-4"})));Fnr.displayName=J3e.displayName;var dO=Ui.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>Ui.createElement(Rnr,{container:n},Ui.createElement(V3e,{ref:i,className:ve("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},Ui.createElement(Lnr,null),Ui.createElement(Nnr,{className:ve("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),Ui.createElement(Fnr,null))));dO.displayName=V3e.displayName;var Azn=Ui.forwardRef(({className:t,...e},r)=>Ui.createElement(W3e,{ref:r,className:ve("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));Azn.displayName=W3e.displayName;var Ep=Ui.forwardRef(({className:t,children:e,...r},n)=>Ui.createElement(K3e,{ref:n,className:ve("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},Ui.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Ui.createElement(Dnr,null,Ui.createElement(gc,{className:"tw-size-4"}))),Ui.createElement(jnr,null,e)));Ep.displayName=K3e.displayName;var Izn=Ui.forwardRef(({className:t,...e},r)=>Ui.createElement(Z3e,{ref:r,className:ve("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));Izn.displayName=Z3e.displayName;$n();Tn();er();An();var $nr=require("obsidian"),Fe=F(ee());function Mzn(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 knr(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>Mzn(n,e,r)):t}function Rzn({project:t,loadContext:e,onEdit:r,onDelete:n}){return Fe.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-gap-2 tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-3 tw-transition-all tw-duration-200 tw-bg-secondary/40 hover:tw-border-interactive-accent hover:tw-text-accent hover:tw-shadow-[0_2px_12px_rgba(0,0,0,0.1)] active:tw-scale-[0.98]",onClick:()=>e(t)},Fe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},Fe.default.createElement("div",{className:"tw-text-accent"},Fe.default.createElement(mb,{className:"tw-size-4"})),Fe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},Fe.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&Fe.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),Fe.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},Fe.default.createElement(Nt,null,Fe.default.createElement(jt,{asChild:!0},Fe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},Fe.default.createElement(iP,{className:"tw-size-4"}))),Fe.default.createElement(At,{side:"bottom"},"Edit Project")),Fe.default.createElement(Nt,null,Fe.default.createElement(jt,{asChild:!0},Fe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},Fe.default.createElement(gz,{className:"tw-size-4"}))),Fe.default.createElement(At,{side:"bottom"},"Start Chat")),Fe.default.createElement(Nt,null,Fe.default.createElement(jt,{asChild:!0},Fe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new $d(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},Fe.default.createElement(oh,{className:"tw-size-4"}))),Fe.default.createElement(At,{side:"bottom"},"Delete Project"))))}var Y3e=(0,Fe.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,inputRef:l})=>{let[c,d]=(0,Fe.useState)(r),[f,p]=(0,Fe.useState)(!1),[m,h]=(0,Fe.useState)(null),[b,g]=(0,Fe.useState)("");(0,Fe.useEffect)(()=>{a&&d(!1)},[a]);let y=(0,Fe.useMemo)(()=>knr(e,b),[e,b]),x=()=>{new YJ(n,async I=>{o(I)}).open()},S=A=>{new YJ(n,async R=>{i(A,R),m&&m.name===A.name&&h(R)},A).open()},O=A=>{let R=(e||[]).filter(N=>N.name!==A.name);m?.name===A.name&&E(!1),ht("projectList",R),new $nr.Notice(`Project "${A.name}" deleted successfully`)},E=(A,I)=>{if(A){if(!I){fe("Must be exist one project.");return}h(I),p(!0),d(!1)}else{h(null),p(!1),d(!0),s(!1),PN(null);return}},P=A=>{h(A),p(!0),d(!1),s(!0),PN(A),setTimeout(()=>{l.current&&l.current.focus()},0)};return Fe.default.createElement("div",{className:ve("tw-flex tw-flex-col",t)},Fe.default.createElement("div",{className:"tw-overflow-y-auto"},Fe.default.createElement("div",{className:"tw-flex tw-flex-col"},f&&m?Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Fe.default.createElement(RT,{value:m.name,onValueChange:A=>{let I=e.find(R=>R.name===A);I&&P(I)}},Fe.default.createElement(cO,{className:"tw-w-[200px]"},Fe.default.createElement(NT,null,Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(mb,{className:"tw-size-4 tw-text-accent/70"}),Fe.default.createElement("span",null,m.name)))),Fe.default.createElement(dO,null,e.map(A=>Fe.default.createElement(Ep,{key:A.name,value:A.name,className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(mb,{className:"tw-size-4"}),A.name)))))),Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(be,{variant:"secondary",onClick:()=>S(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},Fe.default.createElement(iP,{className:"tw-mr-1 tw-size-4"}),"Edit"),Fe.default.createElement(Nt,null,Fe.default.createElement(jt,{asChild:!0},Fe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:()=>{E(!1)},"aria-label":"Close Current Project"},Fe.default.createElement(Qi,{className:"tw-size-4"}))),Fe.default.createElement(At,{side:"bottom"},"Close Current Project")))):Fe.default.createElement(CT,{open:c,onOpenChange:d,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},Fe.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Fe.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Fe.default.createElement(Nt,null,Fe.default.createElement(jt,{asChild:!0},Fe.default.createElement(ov,{className:"tw-size-4 tw-text-muted"})),Fe.default.createElement(At,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(be,{className:"tw-px-2",variant:"secondary",onClick:x},"Create",Fe.default.createElement(nh,{className:"tw-size-3"})),e.length>0&&Fe.default.createElement(dk,{asChild:!0},Fe.default.createElement(be,{variant:"ghost2",size:"icon"},c?Fe.default.createElement(fb,{className:"tw-size-5"}):Fe.default.createElement(Xi,{className:"tw-size-5"}))),Fe.default.createElement(Nt,null,Fe.default.createElement(jt,{asChild:!0},Fe.default.createElement(be,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},Fe.default.createElement(Qi,{className:"tw-size-4"}))),Fe.default.createElement(At,{side:"bottom"},"Close Project Mode")))),e.length===0&&Fe.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),Fe.default.createElement(OT,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Fe.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&Fe.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},Fe.default.createElement("div",{className:"tw-relative"},Fe.default.createElement(age,{value:b,onChange:g,placeholder:"Search projects..."}))),Fe.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 @2xl:tw-grid @2xl:tw-grid-cols-2 @4xl:tw-grid-cols-3"},y.map(A=>Fe.default.createElement(Rzn,{key:A.name,project:A,loadContext:P,onEdit:S,onDelete:O}))),b.trim()&&y.length===0&&Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},Fe.default.createElement(JN,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),Fe.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),Fe.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&Fe.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!f&&Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-4 tw-p-8 tw-text-muted tw-bg-secondary/30"},Fe.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},Fe.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),Fe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},Fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fe.default.createElement(gz,{className:"tw-size-4"}),Fe.default.createElement("span",null,"Click a project card to start chatting")))))))});Y3e.displayName="ProjectList";Ur();var Vc=F(ee());function znr(t){let[e,r]=(0,Vc.useState)([]);(0,Vc.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,Vc.useCallback)(async(b,g,y,x=!1)=>await t.sendMessage(b,g,y,x),[t]),o=(0,Vc.useCallback)(async(b,g,y,x=!1)=>await t.editMessage(b,g,y,x),[t]),i=(0,Vc.useCallback)(async(b,g,y)=>await t.regenerateMessage(b,g,y),[t]),a=(0,Vc.useCallback)(async b=>await t.deleteMessage(b),[t]),s=(0,Vc.useCallback)((b,g,y)=>t.addDisplayMessage(b,g,y),[t]),u=(0,Vc.useCallback)(b=>t.addFullMessage(b),[t]),l=(0,Vc.useCallback)(()=>{t.clearMessages()},[t]),c=(0,Vc.useCallback)(async b=>{await t.truncateAfterMessageId(b)},[t]),d=(0,Vc.useCallback)(b=>{t.addMessage(b)},[t]),f=(0,Vc.useCallback)(b=>{t.loadMessages(b)},[t]),p=(0,Vc.useCallback)(b=>t.getMessage(b),[t]),m=(0,Vc.useCallback)(()=>t.getLLMMessages(),[t]),h=(0,Vc.useCallback)(()=>t.getDebugInfo(),[t]);return{messages:e,sendMessage:n,editMessage:o,regenerateMessage:i,deleteMessage:a,addDisplayMessage:s,addFullMessage:u,clearMessages:l,truncateAfterMessageId:c,addMessage:d,loadMessages:f,getMessage:p,getLLMMessages:m,getDebugInfo:h}}Ur();on();Tn();I1();var Sge=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){fe("Model request failed:",s);let u="Model request failed: "+ci(s);r({id:Rp(),sender:mg,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:Bs(new Date)})}};sP();er();on();var Bnr=F(Yp()),uc=require("obsidian"),Rr=F(ee()),Nzn=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i})=>{let a=Hn(),s=(0,Rr.useContext)(y3),{messages:u,addMessage:l}=znr(i),[c]=D$(),[d]=nb(),[f,p]=(0,Rr.useState)(""),[m,h]=(0,Rr.useState)(""),[b,g]=(0,Rr.useState)(null),[y,x]=(0,Rr.useState)(!1),[S,O]=(0,Rr.useState)(K_.DEFAULT),[E,P]=(0,Rr.useState)([]),[A,I]=(0,Rr.useState)(!1),[R,N]=(0,Rr.useState)([]),[j,$]=(0,Rr.useState)(!1),[k]=_Je(),[H,V]=(0,Rr.useState)(null),[Q,Z]=nb(),D=Rq(),z=_M.getInstance(),B=(0,Rr.useRef)(null);(0,Rr.useEffect)(()=>{let Oe=()=>{B.current&&B.current.focus()};return s?.addEventListener(gg.CHAT_IS_VISIBLE,Oe),()=>{s?.removeEventListener(gg.CHAT_IS_VISIBLE,Oe)}},[s]);let K=(0,Rr.useContext)($he),q=o.app||K,te=async({toolCalls:Oe,urls:$e,contextNotes:ce}={})=>{if(!(!m&&R.length===0))try{let qt=[];m&&qt.push({type:"text",text:m});for(let Nr of R){let ua=await Nr.arrayBuffer(),Va=Bnr.Buffer.from(ua).toString("base64");qt.push({type:"image_url",image_url:{url:`data:${Nr.type};base64,${Va}`}})}let Ne=[...ce||[],...E].filter((Nr,ua,Va)=>Va.findIndex(km=>km.path===Nr.path)===ua),ue=m,pe=await _Ge();m.includes("@composer")&&pe!==""&&(ue=m+`
|
||
|
||
<output_format>
|
||
`+pe+`
|
||
</output_format>`),Oe&&(ue+=" "+Oe.join(`
|
||
`));let Pe={notes:Ne,urls:$e||[],selectedTextContexts:k};h(""),N([]),x(!0),O(K_.DEFAULT);let Ae=await i.sendMessage(ue,Pe,d,A);m&&r(m),a.autosaveChat&&U();let ot=i.getLLMMessage(Ae);ot&&await Sge(ot,t,l,p,g,{debug:a.debug,updateLoadingMessage:O}),a.autosaveChat&&U()}catch(qt){console.error("Error sending message:",qt),new uc.Notice("Failed to send message. Please try again.")}finally{x(!1),O(K_.DEFAULT)}},U=(0,Rr.useCallback)(async()=>{if(!q){console.error("App instance is not available.");return}try{await i.saveChat(c)}catch(Oe){console.error("Error saving chat as note:",ci(Oe)),new uc.Notice("Failed to save chat as note. Check console for details.")}},[q,i,c]),W=(0,Rr.useCallback)(Oe=>{b&&(a.debug&&console.log(`stopping generation..., reason: ${Oe}`),b.abort(Oe),x(!1),O(K_.DEFAULT))},[b,a.debug]),Y=(0,Rr.useCallback)(async Oe=>{if(Oe<=0){new uc.Notice("Cannot regenerate the first message.");return}let $e=u[Oe];if(!$e){new uc.Notice("Message not found.");return}x(!0);try{await i.regenerateMessage($e.id,p,l)?a.debug&&console.log("Message regenerated successfully"):new uc.Notice("Failed to regenerate message. Please try again."),a.autosaveChat&&U()}catch(ce){console.error("Error regenerating message:",ce),new uc.Notice("Failed to regenerate message. Please try again.")}finally{x(!1)}},[u,i,a.debug,a.autosaveChat,U,l]),se=(0,Rr.useCallback)(async(Oe,$e)=>{let ce=u[Oe];if(!(!ce||ce.message===$e))try{if(!await i.editMessage(ce.id,$e,d,A)){new uc.Notice("Failed to edit message. Please try again.");return}if(ce.sender===Ei){let Ze=Oe<u.length-1;if(await i.truncateAfterMessageId(ce.id),Ze){x(!0);try{let Ne=i.getLLMMessage(ce.id);Ne&&await Sge(Ne,t,l,p,g,{debug:a.debug,updateLoadingMessage:O})}catch(Ne){console.error("Error regenerating AI response:",Ne),new uc.Notice("Failed to regenerate AI response. Please try again.")}finally{x(!1)}}}a.autosaveChat&&U()}catch(qt){console.error("Error editing message:",qt),new uc.Notice("Failed to edit message. Please try again.")}},[u,i,d,A,l,t,a.debug,a.autosaveChat,U]);(0,Rr.useEffect)(((Oe,$e)=>()=>{let ce=ae().debug,qt=async Ze=>{let Ne=await $e(Ze.detail.selectedText,Ze.detail.eventSubtype);try{let ue=await i.sendMessage(Ne,{notes:[],urls:[],selectedTextContexts:[]},d,A),pe=i.getLLMMessage(ue);pe&&(x(!0),await Sge(pe,t,l,p,g,{debug:ce,ignoreSystemMessage:!0}),x(!1))}catch(ue){console.error("Error processing adhoc prompt:",ue),x(!1)}};return s?.addEventListener(Oe,qt),()=>{s?.removeEventListener(Oe,qt)}})(qr.APPLY_ADHOC_PROMPT,async(Oe,$e)=>$e?(await tJ($e,Oe,q.vault,q.workspace.getActiveFile())).processedPrompt:Oe),[]),(0,Rr.useEffect)(()=>{e&&e(U)},[e,U]);let de=(0,Rr.useCallback)(Oe=>{let $e=a.projectList||[];if($e.findIndex(Ne=>Ne.name===Oe.name)>=0)throw new Error(`Project "${Oe.name}" already exists, please use a different name`);let qt=[...$e,Oe];return ht("projectList",qt),iu()?.id===Oe.id?xhe().then(()=>{new uc.Notice(`${Oe.name} added and context loaded`)}).catch(Ne=>{console.error("Error loading project context:",Ne),new uc.Notice(`${Oe.name} added but context loading failed`)}):new uc.Notice(`${Oe.name} added successfully`),!0},[a.projectList]),Ue=(0,Rr.useCallback)((Oe,$e)=>{let ce=a.projectList||[];if(!ce.find(ue=>ue.name===Oe.name))throw new Error(`Project "${Oe.name}" does not exist`);let Ze=ce.map(ue=>ue.name===Oe.name?$e:ue);return ht("projectList",Ze),iu()?.id===Oe.id?(PN($e),xhe().then(()=>{new uc.Notice(`${Oe.name} updated and context reloaded`)}).catch(ue=>{console.error("Error reloading project context:",ue),new uc.Notice(`${Oe.name} updated but context reload failed`)})):new uc.Notice(`${Oe.name} updated successfully`),!0},[a.projectList]),Ke=(0,Rr.useCallback)(Oe=>{h($e=>`${$e} ${Oe} `)},[]),at=(0,Rr.useCallback)(Oe=>{yJe(Oe)},[]),hr=(0,Rr.useCallback)(async Oe=>{let $e=u[Oe];if(!$e){new uc.Notice("Message not found.");return}try{await i.deleteMessage($e.id)||new uc.Notice("Failed to delete message. Please try again.")}catch(ce){console.error("Error deleting message:",ce),new uc.Notice("Failed to delete message. Please try again.")}},[u,i]),Nn=(0,Rr.useCallback)(async()=>{W("new-chat"),a.autosaveChat&&await U(),i.clearMessages(),p(""),P([]),bJe(),Q!=="copilot_plus"?I(!1):I(a.includeActiveNoteAsContext)},[W,i,a.autosaveChat,a.includeActiveNoteAsContext,Q,U]),De=(0,Rr.useCallback)(()=>{o.loadCopilotChatHistory()},[o]);(0,Rr.useEffect)(()=>{let Oe=$e=>{let ce=$e.detail?.reason||"new-chat";W(ce)};return s?.addEventListener(gg.ABORT_STREAM,Oe),()=>{s?.removeEventListener(gg.ABORT_STREAM,Oe)}},[s,W]),(0,Rr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(Q==="copilot_plus"?I(a.includeActiveNoteAsContext):I(!1))},[a.includeActiveNoteAsContext,Q]);let _t=()=>Rr.default.createElement(Rr.default.Fragment,null,Rr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},Rr.default.createElement(Ler,{currentVersion:o.manifest.version}),Rr.default.createElement(Der,{chatHistory:u,currentAiMessage:f,loading:y,loadingMessage:S,app:q,onRegenerate:Y,onEdit:se,onDelete:hr,onInsertToChat:Ke,onReplaceChat:h,showHelperComponents:Q!=="project"}),Rr.default.createElement(fXt,{onNewChat:Nn,onSaveAsNote:()=>U(),onLoadHistory:De,onModeChange:Oe=>{V(Q),Oe==="project"&&$(!1)}}),Rr.default.createElement(rQt,{ref:B,inputMessage:m,setInputMessage:h,handleSendMessage:te,isGenerating:y,onStopGenerating:()=>W("user-stopped"),app:q,contextNotes:E,setContextNotes:P,includeActiveNote:A,setIncludeActiveNote:I,mention:z,selectedImages:R,onAddImage:Oe=>N($e=>[...$e,...Oe]),setSelectedImages:N,disableModelSwitch:Q==="project",selectedTextContexts:k,onRemoveSelectedText:at})));return Rr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},Rr.default.createElement("div",{className:"tw-h-full"},Rr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Q==="project"&&Rr.default.createElement("div",{className:`${Q==="project"?"tw-z-modal":""}`},Rr.default.createElement(Y3e,{projects:a.projectList||[],defaultOpen:!0,app:q,hasMessages:!1,onProjectAdded:de,onEditProject:Ue,inputRef:B,onClose:()=>{H?(Z(H),V(null)):Z(D?"copilot_plus":"llm_chain")},showChatUI:Oe=>$(Oe)})),(Q!=="project"||Q==="project"&&j)&&_t())))},Unr=Nzn;Ur();var qnr=require("obsidian"),_1=F(ee()),Hnr=F(id()),v1=class extends qnr.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 xs}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,Hnr.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(_1.createElement($he.Provider,{value:this.app},_1.createElement(y3.Provider,{value:this.eventTarget},_1.createElement(_1.StrictMode,null,_1.createElement(whe,{delayDuration:0},_1.createElement(Unr,{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)}};on();var Vnr=require("obsidian"),Cge=class extends Vnr.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 o=r.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim(),i,a=this.app.metadataCache.getFileCache(r)?.frontmatter;return a&&a.epoch?i=Bs(new Date(a.epoch)):i=Bs(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};Ur();Ur();function Wnr(t){t.addItem(n=>{n.setTitle("Copilot: Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${qr.ADD_SELECTION_TO_CHAT_CONTEXT}`)})});let e=Mm();e.filter(n=>n.showInContextMenu).length>0&&t.addSeparator(),eJ(e.filter(n=>n.showInContextMenu)).forEach(n=>{t.addItem(o=>{o.setTitle(`Copilot: ${n.title}`).onClick(()=>{app.commands.executeCommandById(`copilot:${K4(n.title)}`)})})})}CN();Tn();sP();OC();Ur();er();var E7=require("obsidian"),MHe=F(ee()),Xir=F(id());var Oge=class extends $d{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")}};di();var n7=F(ee());$n();var Knr=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>n7.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:ve("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")},n7.default.createElement("div",{className:ve("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),n7.default.createElement("span",{className:ve("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)),Gnr=({id:t,children:e,isSelected:r})=>r?n7.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:ve("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 Wh=F(ee()),Jnr=(0,Wh.createContext)(void 0),Znr=({children:t})=>{let[e,r]=(0,Wh.useState)("basic"),[n,o]=(0,Wh.useState)(null),i=(0,Wh.useRef)(!1);return(0,Wh.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),Wh.default.createElement(Jnr.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},$3=()=>{let t=(0,Wh.useContext)(Jnr);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};er();var Dt=F(ee());di();An();var lc=F(ee());$n();var o7=lc.forwardRef(({className:t,...e},r)=>lc.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},lc.createElement("table",{ref:r,className:ve("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));o7.displayName="Table";var i7=lc.forwardRef(({className:t,...e},r)=>lc.createElement("thead",{ref:r,className:ve("[&_tr]:tw-border-b",t),...e}));i7.displayName="TableHeader";var a7=lc.forwardRef(({className:t,...e},r)=>lc.createElement("tbody",{ref:r,className:t,...e}));a7.displayName="TableBody";var jzn=lc.forwardRef(({className:t,...e},r)=>lc.createElement("tfoot",{ref:r,className:ve("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));jzn.displayName="TableFooter";var w1=lc.forwardRef(({className:t,...e},r)=>lc.createElement("tr",{ref:r,className:ve("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));w1.displayName="TableRow";var Tp=lc.forwardRef(({className:t,...e},r)=>lc.createElement("th",{ref:r,className:ve("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}));Tp.displayName="TableHead";var Bf=lc.forwardRef(({className:t,...e},r)=>lc.createElement("td",{ref:r,className:ve("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));Bf.displayName="TableCell";var Dzn=lc.forwardRef(({className:t,...e},r)=>lc.createElement("caption",{ref:r,className:ve("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));Dzn.displayName="TableCaption";var Me=F(ee()),Pk=F(Cs());var Xs=F(ee());function Xnr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Xs.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var s7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function vk(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Pge(t){return"nodeType"in t}function Ap(t){var e,r;return t?vk(t)?t:Pge(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Ege(t){let{Document:e}=Ap(t);return t instanceof e}function z3(t){return vk(t)?!1:t instanceof Ap(t).HTMLElement}function Q3e(t){return t instanceof Ap(t).SVGElement}function wk(t){return t?vk(t)?t.document:Pge(t)?Ege(t)?t:z3(t)||Q3e(t)?t.ownerDocument:document:document:document}var $y=s7?Xs.useLayoutEffect:Xs.useEffect;function Tge(t){let e=(0,Xs.useRef)(t);return $y(()=>{e.current=t}),(0,Xs.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 Qnr(){let t=(0,Xs.useRef)(null),e=(0,Xs.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,Xs.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function B3(t,e){e===void 0&&(e=[t]);let r=(0,Xs.useRef)(t);return $y(()=>{r.current!==t&&(r.current=t)},e),r}function U3(t,e){let r=(0,Xs.useRef)();return(0,Xs.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function u7(t){let e=Tge(t),r=(0,Xs.useRef)(null),n=(0,Xs.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function Age(t){let e=(0,Xs.useRef)();return(0,Xs.useEffect)(()=>{e.current=t},[t]),e.current}var X3e={};function xk(t,e){return(0,Xs.useMemo)(()=>{if(e)return e;let r=X3e[t]==null?0:X3e[t]+1;return X3e[t]=r,t+"-"+r},[t,e])}function eor(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 Sk=eor(1),Ck=eor(-1);function Lzn(t){return"clientX"in t&&"clientY"in t}function l7(t){if(!t)return!1;let{KeyboardEvent:e}=Ap(t.target);return e&&t instanceof e}function Fzn(t){if(!t)return!1;let{TouchEvent:e}=Ap(t.target);return e&&t instanceof e}function Ige(t){if(Fzn(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 Lzn(t)?{x:t.clientX,y:t.clientY}:null}var S_=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[S_.Translate.toString(t),S_.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),Ynr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function tor(t){return t.matches(Ynr)?t:t.querySelector(Ynr)}var Ok=F(ee()),kzn={display:"none"};function ror(t){let{id:e,value:r}=t;return Ok.default.createElement("div",{id:e,style:kzn},r)}function nor(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 Ok.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function oor(){let[t,e]=(0,Ok.useState)("");return{announce:(0,Ok.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var bor=(0,Me.createContext)(null);function $zn(t){let e=(0,Me.useContext)(bor);(0,Me.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function zzn(){let[t]=(0,Me.useState)(()=>new Set),e=(0,Me.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Me.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 Bzn={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.
|
||
`},Uzn={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 qzn(t){let{announcements:e=Uzn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Bzn}=t,{announce:i,announcement:a}=oor(),s=xk("DndLiveRegion"),[u,l]=(0,Me.useState)(!1);if((0,Me.useEffect)(()=>{l(!0)},[]),$zn((0,Me.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=Me.default.createElement(Me.default.Fragment,null,Me.default.createElement(ror,{id:n,value:o.draggable}),Me.default.createElement(nor,{id:s,announcement:a}));return r?(0,Pk.createPortal)(c,r):c}var cc;(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"})(cc||(cc={}));function Rge(){}function q3(t,e){return(0,Me.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function jge(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Me.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var C_=Object.freeze({x:0,y:0});function _or(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function vor(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function Hzn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function ior(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 uHe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function aor(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 m7=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=aor(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=_or(aor(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(vor)},wor=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=ior(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=ior(u),c=o.reduce((f,p,m)=>f+_or(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(vor)};function Vzn(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 Wzn=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=Vzn(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(Hzn)};function Kzn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function xor(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:C_}function Gzn(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 Jzn=Gzn(1);function Zzn(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 Yzn(t,e,r){let n=Zzn(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 Xzn={ignoreTransform:!1};function Ak(t,e){e===void 0&&(e=Xzn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=Ap(t).getComputedStyle(t);l&&(r=Yzn(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 sor(t){return Ak(t,{ignoreTransform:!0})}function Qzn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function eBn(t,e){return e===void 0&&(e=Ap(t).getComputedStyle(t)),e.position==="fixed"}function tBn(t,e){e===void 0&&(e=Ap(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 h7(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(Ege(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!z3(o)||Q3e(o)||r.includes(o))return r;let i=Ap(t).getComputedStyle(o);return o!==t&&tBn(o,i)&&r.push(o),eBn(o,i)?r:n(o.parentNode)}return t?n(t):r}function Sor(t){let[e]=h7(t,1);return e??null}function eHe(t){return!s7||!t?null:vk(t)?t:Pge(t)?Ege(t)||t===wk(t).scrollingElement?window:z3(t)?t:null:null}function Cor(t){return vk(t)?t.scrollX:t.scrollLeft}function Oor(t){return vk(t)?t.scrollY:t.scrollTop}function nHe(t){return{x:Cor(t),y:Oor(t)}}var Wc;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Wc||(Wc={}));function Por(t){return!s7||!t?!1:t===document.scrollingElement}function Eor(t){let e={x:0,y:0},r=Por(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 rBn={x:.2,y:.2};function nBn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=rBn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=Eor(t),p={x:0,y:0},m={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+h.height?(p.y=Wc.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=Wc.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=Wc.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=Wc.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function oBn(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 Tor(t){return t.reduce((e,r)=>Sk(e,nHe(r)),C_)}function iBn(t){return t.reduce((e,r)=>e+Cor(r),0)}function aBn(t){return t.reduce((e,r)=>e+Oor(r),0)}function sBn(t,e){if(e===void 0&&(e=Ak),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);Sor(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var uBn=[["x",["left","right"],iBn],["y",["top","bottom"],aBn]],d7=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=h7(r),o=Tor(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of uBn)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})}},Ek=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 lBn(t){let{EventTarget:e}=Ap(t);return t instanceof e?t:wk(t)}function tHe(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 zy;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(zy||(zy={}));function uor(t){t.preventDefault()}function cBn(t){t.stopPropagation()}var Yn;(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"})(Yn||(Yn={}));var Aor={start:[Yn.Space,Yn.Enter],cancel:[Yn.Esc],end:[Yn.Space,Yn.Enter,Yn.Tab]},dBn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case Yn.Right:return{...r,x:r.x+25};case Yn.Left:return{...r,x:r.x-25};case Yn.Down:return{...r,y:r.y+25};case Yn.Up:return{...r,y:r.y-25}}},S1=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 Ek(wk(r)),this.windowListeners=new Ek(Ap(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zy.Resize,this.handleCancel),this.windowListeners.add(zy.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zy.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&sBn(n),r(C_)}handleKeyDown(e){if(l7(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=Aor,coordinateGetter:a=dBn,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}:C_;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=Ck(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let b=e.code,{isTop:g,isRight:y,isLeft:x,isBottom:S,maxScroll:O,minScroll:E}=Eor(h),P=oBn(h),A={x:Math.min(b===Yn.Right?P.right-P.width/2:P.right,Math.max(b===Yn.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(b===Yn.Down?P.bottom-P.height/2:P.bottom,Math.max(b===Yn.Down?P.top:P.top+P.height/2,d.y))},I=b===Yn.Right&&!y||b===Yn.Left&&!x,R=b===Yn.Down&&!S||b===Yn.Up&&!g;if(I&&A.x!==d.x){let N=h.scrollLeft+f.x,j=b===Yn.Right&&N<=O.x||b===Yn.Left&&N>=E.x;if(j&&!f.y){h.scrollTo({left:N,behavior:s});return}j?p.x=h.scrollLeft-N:p.x=b===Yn.Right?h.scrollLeft-O.x:h.scrollLeft-E.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(R&&A.y!==d.y){let N=h.scrollTop+f.y,j=b===Yn.Down&&N<=O.y||b===Yn.Up&&N>=E.y;if(j&&!f.x){h.scrollTo({top:N,behavior:s});return}j?p.y=h.scrollTop-N:p.y=b===Yn.Down?h.scrollTop-O.y:h.scrollTop-E.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,Sk(Ck(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()}};S1.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=Aor,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 lor(t){return!!(t&&"distance"in t)}function cor(t){return!!(t&&"delay"in t)}var f7=class{constructor(e,r,n){var o;n===void 0&&(n=lBn(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=wk(a),this.documentListeners=new Ek(this.document),this.listeners=new Ek(n),this.windowListeners=new Ek(Ap(a)),this.initialCoordinates=(o=Ige(i))!=null?o:C_,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(zy.Resize,this.handleCancel),this.windowListeners.add(zy.DragStart,uor),this.windowListeners.add(zy.VisibilityChange,this.handleCancel),this.windowListeners.add(zy.ContextMenu,uor),this.documentListeners.add(zy.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(cor(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(lor(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(zy.Click,cBn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zy.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=Ige(e))!=null?r:C_,l=Ck(o,u);if(!n&&s){if(lor(s)){if(s.tolerance!=null&&tHe(l,s.tolerance))return this.handleCancel();if(tHe(l,s.distance))return this.handleStart()}if(cor(s)&&tHe(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===Yn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},fBn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},C1=class extends f7{constructor(e){let{event:r}=e,n=wk(r.target);super(e,fBn,n)}};C1.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 pBn={move:{name:"mousemove"},end:{name:"mouseup"}},oHe;(function(t){t[t.RightClick=2]="RightClick"})(oHe||(oHe={}));var iHe=class extends f7{constructor(e){super(e,pBn,wk(e.event.target))}};iHe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===oHe.RightClick?!1:(n?.({event:r}),!0)}}];var rHe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},aHe=class extends f7{constructor(e){super(e,rHe)}static setup(){return window.addEventListener(rHe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(rHe.move.name,e)};function e(){}}};aHe.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 c7;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(c7||(c7={}));var Nge;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nge||(Nge={}));function mBn(t){let{acceleration:e,activator:r=c7.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=Nge.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=gBn({delta:d,disabled:!i}),[m,h]=Qnr(),b=(0,Me.useRef)({x:0,y:0}),g=(0,Me.useRef)({x:0,y:0}),y=(0,Me.useMemo)(()=>{switch(r){case c7.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case c7.DraggableRect:return o}},[r,o,u]),x=(0,Me.useRef)(null),S=(0,Me.useCallback)(()=>{let E=x.current;if(!E)return;let P=b.current.x*g.current.x,A=b.current.y*g.current.y;E.scrollBy(P,A)},[]),O=(0,Me.useMemo)(()=>s===Nge.TreeOrder?[...l].reverse():l,[s,l]);(0,Me.useEffect)(()=>{if(!i||!l.length||!y){h();return}for(let E of O){if(n?.(E)===!1)continue;let P=l.indexOf(E),A=c[P];if(!A)continue;let{direction:I,speed:R}=nBn(E,A,y,e,f);for(let N of["x","y"])p[N][I[N]]||(R[N]=0,I[N]=0);if(R.x>0||R.y>0){h(),x.current=E,m(S,a),b.current=R,g.current=I;return}}b.current={x:0,y:0},g.current={x:0,y:0},h()},[e,S,n,h,i,a,JSON.stringify(y),JSON.stringify(p),m,l,O,c,JSON.stringify(f)])}var hBn={x:{[Wc.Backward]:!1,[Wc.Forward]:!1},y:{[Wc.Backward]:!1,[Wc.Forward]:!1}};function gBn(t){let{delta:e,disabled:r}=t,n=Age(e);return U3(o=>{if(r||!n||!o)return hBn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Wc.Backward]:o.x[Wc.Backward]||i.x===-1,[Wc.Forward]:o.x[Wc.Forward]||i.x===1},y:{[Wc.Backward]:o.y[Wc.Backward]||i.y===-1,[Wc.Forward]:o.y[Wc.Forward]||i.y===1}}},[r,e,n])}function yBn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return U3(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function bBn(t,e){return(0,Me.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 p7;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(p7||(p7={}));var sHe;(function(t){t.Optimized="optimized"})(sHe||(sHe={}));var dor=new Map;function _Bn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Me.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Me.useRef)(t),d=b(),f=B3(d),p=(0,Me.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(y=>y===null?g:y.concat(g.filter(x=>!y.includes(x))))},[f]),m=(0,Me.useRef)(null),h=U3(g=>{if(d&&!r)return dor;if(!g||g===dor||c.current!==t||i!=null){let y=new Map;for(let x of t){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){y.set(x.id,x.rect.current);continue}let S=x.node.current,O=S?new d7(u(S),S):null;x.rect.current=O,O&&y.set(x.id,O)}return y}return g},[t,i,r,d,u]);return(0,Me.useEffect)(()=>{c.current=t},[t]),(0,Me.useEffect)(()=>{d||p()},[r,d]),(0,Me.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Me.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(l){case p7.Always:return!1;case p7.BeforeDragging:return r;default:return!r}}}function Ior(t,e){return U3(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function vBn(t,e){return Ior(t,e)}function wBn(t){let{callback:e,disabled:r}=t,n=Tge(e),o=(0,Me.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Me.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Dge(t){let{callback:e,disabled:r}=t,n=Tge(e),o=(0,Me.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Me.useEffect)(()=>()=>o?.disconnect(),[o]),o}function xBn(t){return new d7(Ak(t),t)}function por(t,e,r){e===void 0&&(e=xBn);let[n,o]=(0,Me.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=wBn({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=Dge({callback:i});return $y(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function SBn(t){let e=Ior(t);return xor(t,e)}var mor=[];function CBn(t){let e=(0,Me.useRef)(t),r=U3(n=>t?n&&n!==mor&&t&&e.current&&t.parentNode===e.current.parentNode?n:h7(t):mor,[t]);return(0,Me.useEffect)(()=>{e.current=t},[t]),r}function OBn(t){let[e,r]=(0,Me.useState)(null),n=(0,Me.useRef)(t),o=(0,Me.useCallback)(i=>{let a=eHe(i.target);a&&r(s=>s?(s.set(a,nHe(a)),new Map(s)):null)},[]);return(0,Me.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=eHe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,nHe(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=eHe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Me.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>Sk(i,a),C_):Tor(t):C_,[t,e])}function hor(t,e){e===void 0&&(e=[]);let r=(0,Me.useRef)(null);return(0,Me.useEffect)(()=>{r.current=null},e),(0,Me.useEffect)(()=>{let n=t!==C_;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?Ck(t,r.current):C_}function PBn(t){(0,Me.useEffect)(()=>{if(!s7)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 EBn(t,e){return(0,Me.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function Mor(t){return(0,Me.useMemo)(()=>t?Qzn(t):null,[t])}var gor=[];function TBn(t,e){e===void 0&&(e=Ak);let[r]=t,n=Mor(r?Ap(r):null),[o,i]=(0,Me.useState)(gor);function a(){i(()=>t.length?t.map(u=>Por(u)?n:new d7(e(u),u)):gor)}let s=Dge({callback:a});return $y(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function ABn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return z3(e)?e:t}function IBn(t){let{measure:e}=t,[r,n]=(0,Me.useState)(null),o=(0,Me.useCallback)(l=>{for(let{target:c}of l)if(z3(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=Dge({callback:o}),a=(0,Me.useCallback)(l=>{let c=ABn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=u7(a);return(0,Me.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var MBn=[{sensor:C1,options:{}},{sensor:S1,options:{}}],RBn={current:{}},Mge={draggable:{measure:sor},droppable:{measure:sor,strategy:p7.WhileDragging,frequency:sHe.Optimized},dragOverlay:{measure:Ak}},Tk=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}},NBn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Tk,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Rge},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mge,measureDroppableContainers:Rge,windowRect:null,measuringScheduled:!1},jBn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Rge,draggableNodes:new Map,over:null,measureDroppableContainers:Rge},Lge=(0,Me.createContext)(jBn),Ror=(0,Me.createContext)(NBn);function DBn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Tk}}}function LBn(t,e){switch(e.type){case cc.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case cc.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 cc.DragEnd:case cc.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case cc.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new Tk(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case cc.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 Tk(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case cc.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new Tk(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function FBn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Me.useContext)(Lge),i=Age(n),a=Age(r?.id);return(0,Me.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!l7(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=tor(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function kBn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function $Bn(t){return(0,Me.useMemo)(()=>({draggable:{...Mge.draggable,...t?.draggable},droppable:{...Mge.droppable,...t?.droppable},dragOverlay:{...Mge.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function zBn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Me.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;$y(()=>{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=xor(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=Sor(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var Nor=(0,Me.createContext)({...C_,scaleX:1,scaleY:1}),x1;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(x1||(x1={}));var g7=(0,Me.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=MBn,collisionDetection:d=Wzn,measuring:f,modifiers:p,...m}=e,h=(0,Me.useReducer)(LBn,void 0,DBn),[b,g]=h,[y,x]=zzn(),[S,O]=(0,Me.useState)(x1.Uninitialized),E=S===x1.Initialized,{draggable:{active:P,nodes:A,translate:I},droppable:{containers:R}}=b,N=P!=null?A.get(P):null,j=(0,Me.useRef)({initial:null,translated:null}),$=(0,Me.useMemo)(()=>{var bs;return P!=null?{id:P,data:(bs=N?.data)!=null?bs:RBn,rect:j}:null},[P,N]),k=(0,Me.useRef)(null),[H,V]=(0,Me.useState)(null),[Q,Z]=(0,Me.useState)(null),D=B3(m,Object.values(m)),z=xk("DndDescribedBy",a),B=(0,Me.useMemo)(()=>R.getEnabled(),[R]),K=$Bn(f),{droppableRects:q,measureDroppableContainers:te,measuringScheduled:U}=_Bn(B,{dragging:E,dependencies:[I.x,I.y],config:K.droppable}),W=yBn(A,P),Y=(0,Me.useMemo)(()=>Q?Ige(Q):null,[Q]),se=kT(),Te=vBn(W,K.draggable.measure);zBn({activeNode:P!=null?A.get(P):null,config:se.layoutShiftCompensation,initialRect:Te,measure:K.draggable.measure});let de=por(W,K.draggable.measure,Te),Ue=por(W?W.parentElement:null),Ke=(0,Me.useRef)({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=R.getNodeFor((r=Ke.current.over)==null?void 0:r.id),hr=IBn({measure:K.dragOverlay.measure}),Nn=(n=hr.nodeRef.current)!=null?n:W,De=E?(o=hr.rect)!=null?o:de:null,_t=!!(hr.nodeRef.current&&hr.rect),Oe=SBn(_t?null:de),$e=Mor(Nn?Ap(Nn):null),ce=CBn(E?at??W:null),qt=TBn(ce),Ze=kBn(p,{transform:{x:I.x-Oe.x,y:I.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:Q,active:$,activeNodeRect:de,containerNodeRect:Ue,draggingNodeRect:De,over:Ke.current.over,overlayNodeRect:hr.rect,scrollableAncestors:ce,scrollableAncestorRects:qt,windowRect:$e}),Ne=Y?Sk(Y,I):null,ue=OBn(ce),pe=hor(ue),Pe=hor(ue,[de]),Ae=Sk(Ze,pe),ot=De?Jzn(De,Ze):null,Nr=$&&ot?d({active:$,collisionRect:ot,droppableRects:q,droppableContainers:B,pointerCoordinates:Ne}):null,ua=uHe(Nr,"id"),[Va,km]=(0,Me.useState)(null),qy=_t?Ze:Sk(Ze,Pe),ys=Kzn(qy,(i=Va?.rect)!=null?i:null,de),Jh=(0,Me.useRef)(null),$m=(0,Me.useCallback)((bs,tu)=>{let{sensor:Wa,options:Uf}=tu;if(k.current==null)return;let Yd=A.get(k.current);if(!Yd)return;let Ds=bs.nativeEvent,Mp=new Wa({active:k.current,activeNode:Yd,event:Ds,options:Uf,context:Ke,onAbort(Un){if(!A.get(Un))return;let{onDragAbort:Hf}=D.current,zm={id:Un};Hf?.(zm),y({type:"onDragAbort",event:zm})},onPending(Un,et,Hf,zm){if(!A.get(Un))return;let{onDragPending:mO}=D.current,Fn={id:Un,constraint:et,initialCoordinates:Hf,offset:zm};mO?.(Fn),y({type:"onDragPending",event:Fn})},onStart(Un){let et=k.current;if(et==null)return;let Hf=A.get(et);if(!Hf)return;let{onDragStart:zm}=D.current,Fl={activatorEvent:Ds,active:{id:et,data:Hf.data,rect:j}};(0,Pk.unstable_batchedUpdates)(()=>{zm?.(Fl),O(x1.Initializing),g({type:cc.DragStart,initialCoordinates:Un,active:et}),y({type:"onDragStart",event:Fl}),V(Jh.current),Z(Ds)})},onMove(Un){g({type:cc.DragMove,coordinates:Un})},onEnd:qf(cc.DragEnd),onCancel:qf(cc.DragCancel)});Jh.current=Mp;function qf(Un){return async function(){let{active:Hf,collisions:zm,over:Fl,scrollAdjustedTranslate:mO}=Ke.current,Fn=null;if(Hf&&mO){let{cancelDrop:Hy}=D.current;Fn={activatorEvent:Ds,active:Hf,collisions:zm,delta:mO,over:Fl},Un===cc.DragEnd&&typeof Hy=="function"&&await Promise.resolve(Hy(Fn))&&(Un=cc.DragCancel)}k.current=null,(0,Pk.unstable_batchedUpdates)(()=>{g({type:Un}),O(x1.Uninitialized),km(null),V(null),Z(null),Jh.current=null;let Hy=Un===cc.DragEnd?"onDragEnd":"onDragCancel";if(Fn){let G3=D.current[Hy];G3?.(Fn),y({type:Hy,event:Fn})}})}}},[A]),Zh=(0,Me.useCallback)((bs,tu)=>(Wa,Uf)=>{let Yd=Wa.nativeEvent,Ds=A.get(Uf);if(k.current!==null||!Ds||Yd.dndKit||Yd.defaultPrevented)return;let Mp={active:Ds};bs(Wa,tu.options,Mp)===!0&&(Yd.dndKit={capturedBy:tu.sensor},k.current=Uf,$m(Wa,tu))},[A,$m]),Qn=bBn(c,Zh);PBn(c),$y(()=>{de&&S===x1.Initializing&&O(x1.Initialized)},[de,S]),(0,Me.useEffect)(()=>{let{onDragMove:bs}=D.current,{active:tu,activatorEvent:Wa,collisions:Uf,over:Yd}=Ke.current;if(!tu||!Wa)return;let Ds={active:tu,activatorEvent:Wa,collisions:Uf,delta:{x:Ae.x,y:Ae.y},over:Yd};(0,Pk.unstable_batchedUpdates)(()=>{bs?.(Ds),y({type:"onDragMove",event:Ds})})},[Ae.x,Ae.y]),(0,Me.useEffect)(()=>{let{active:bs,activatorEvent:tu,collisions:Wa,droppableContainers:Uf,scrollAdjustedTranslate:Yd}=Ke.current;if(!bs||k.current==null||!tu||!Yd)return;let{onDragOver:Ds}=D.current,Mp=Uf.get(ua),qf=Mp&&Mp.rect.current?{id:Mp.id,rect:Mp.rect.current,data:Mp.data,disabled:Mp.disabled}:null,Un={active:bs,activatorEvent:tu,collisions:Wa,delta:{x:Yd.x,y:Yd.y},over:qf};(0,Pk.unstable_batchedUpdates)(()=>{km(qf),Ds?.(Un),y({type:"onDragOver",event:Un})})},[ua]),$y(()=>{Ke.current={activatorEvent:Q,active:$,activeNode:W,collisionRect:ot,collisions:Nr,droppableRects:q,draggableNodes:A,draggingNode:Nn,draggingNodeRect:De,droppableContainers:R,over:Va,scrollableAncestors:ce,scrollAdjustedTranslate:Ae},j.current={initial:De,translated:ot}},[$,W,Nr,ot,A,Nn,De,q,R,Va,ce,Ae]),mBn({...se,delta:I,draggingRect:ot,pointerCoordinates:Ne,scrollableAncestors:ce,scrollableAncestorRects:qt});let FT=(0,Me.useMemo)(()=>({active:$,activeNode:W,activeNodeRect:de,activatorEvent:Q,collisions:Nr,containerNodeRect:Ue,dragOverlay:hr,draggableNodes:A,droppableContainers:R,droppableRects:q,over:Va,measureDroppableContainers:te,scrollableAncestors:ce,scrollableAncestorRects:qt,measuringConfiguration:K,measuringScheduled:U,windowRect:$e}),[$,W,de,Q,Nr,Ue,hr,A,R,q,Va,te,ce,qt,K,U,$e]),P1=(0,Me.useMemo)(()=>({activatorEvent:Q,activators:Qn,active:$,activeNodeRect:de,ariaDescribedById:{draggable:z},dispatch:g,draggableNodes:A,over:Va,measureDroppableContainers:te}),[Q,Qn,$,de,g,z,A,Va,te]);return Me.default.createElement(bor.Provider,{value:x},Me.default.createElement(Lge.Provider,{value:P1},Me.default.createElement(Ror.Provider,{value:FT},Me.default.createElement(Nor.Provider,{value:ys},l)),Me.default.createElement(FBn,{disabled:s?.restoreFocus===!1})),Me.default.createElement(qzn,{...s,hiddenTextDescribedById:z}));function kT(){let bs=H?.autoScrollEnabled===!1,tu=typeof u=="object"?u.enabled===!1:u===!1,Wa=E&&!bs&&!tu;return typeof u=="object"?{...u,enabled:Wa}:{enabled:Wa}}}),BBn=(0,Me.createContext)(null),yor="button",UBn="Draggable";function jor(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=xk(UBn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Me.useContext)(Lge),{role:p=yor,roleDescription:m="draggable",tabIndex:h=0}=o??{},b=u?.id===e,g=(0,Me.useContext)(b?Nor:BBn),[y,x]=u7(),[S,O]=u7(),E=EBn(a,e),P=B3(r);$y(()=>(d.set(e,{id:e,key:i,node:y,activatorNode:S,data:P}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let A=(0,Me.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":b&&p===yor?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,b,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:A,isDragging:b,listeners:n?void 0:E,node:y,over:f,setNodeRef:x,setActivatorNodeRef:O,transform:g}}function Dor(){return(0,Me.useContext)(Ror)}var qBn="Droppable",HBn={timeout:25};function Lor(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=xk(qBn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Me.useContext)(Lge),c=(0,Me.useRef)({disabled:r}),d=(0,Me.useRef)(!1),f=(0,Me.useRef)(null),p=(0,Me.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:b}={...HBn,...o},g=B3(h??n),y=(0,Me.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},b)},[b]),x=Dge({callback:y,disabled:m||!a}),S=(0,Me.useCallback)((A,I)=>{x&&(I&&(x.unobserve(I),d.current=!1),A&&x.observe(A))},[x]),[O,E]=u7(S),P=B3(e);return(0,Me.useEffect)(()=>{!x||!O.current||(x.disconnect(),d.current=!1,x.observe(O.current))},[O,x]),(0,Me.useEffect)(()=>(s({type:cc.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:P}}),()=>s({type:cc.UnregisterDroppable,key:i,id:n})),[n]),(0,Me.useEffect)(()=>{r!==c.current.disabled&&(s({type:cc.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:O,over:u,setNodeRef:E}}var Qs=F(ee());function zge(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function VBn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function Fge(t){return t!==null&&t>=0}function WBn(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 KBn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var For=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=zge(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 kge={scaleX:1,scaleY:1},y7=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,...kge}:null}let u=GBn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...kge}:o<r&&o>=a?{x:0,y:s.height+u,...kge}:{x:0,y:0,...kge}};function GBn(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 kor="Sortable",$or=Qs.default.createContext({activeIndex:-1,containerId:kor,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:For,disabled:{draggable:!1,droppable:!1}});function b7(t){let{children:e,id:r,items:n,strategy:o=For,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=Dor(),d=xk(kor,r),f=s.rect!==null,p=(0,Qs.useMemo)(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,b=l?p.indexOf(l.id):-1,g=(0,Qs.useRef)(p),y=!WBn(p,g.current),x=b!==-1&&h===-1||y,S=KBn(i);$y(()=>{y&&m&&c(p)},[y,p,m,c]),(0,Qs.useEffect)(()=>{g.current=p},[p]);let O=(0,Qs.useMemo)(()=>({activeIndex:h,containerId:d,disabled:S,disableTransforms:x,items:p,overIndex:b,useDragOverlay:f,sortedRects:VBn(p,u),strategy:o}),[h,d,S.draggable,S.droppable,x,p,b,u,f,o]);return Qs.default.createElement($or.Provider,{value:O},e)}var JBn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return zge(r,n,o).indexOf(e)},ZBn=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},YBn={duration:200,easing:"ease"},zor="transform",XBn=S_.Transition.toString({property:zor,duration:0,easing:"linear"}),QBn={roleDescription:"sortable"};function eUn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,Qs.useState)(null),s=(0,Qs.useRef)(r);return $y(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=Ak(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,Qs.useEffect)(()=>{i&&a(null)},[i]),i}function _7(t){let{animateLayoutChanges:e=ZBn,attributes:r,disabled:n,data:o,getNewIndex:i=JBn,id:a,strategy:s,resizeObserverConfig:u,transition:l=YBn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:b,useDragOverlay:g,strategy:y}=(0,Qs.useContext)($or),x=tUn(n,p),S=c.indexOf(a),O=(0,Qs.useMemo)(()=>({sortable:{containerId:d,index:S,items:c},...o}),[d,o,S,c]),E=(0,Qs.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:P,node:A,isOver:I,setNodeRef:R}=Lor({id:a,data:O,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...u}}),{active:N,activatorEvent:j,activeNodeRect:$,attributes:k,setNodeRef:H,listeners:V,isDragging:Q,over:Z,setActivatorNodeRef:D,transform:z}=jor({id:a,data:O,attributes:{...QBn,...r},disabled:x.draggable}),B=Xnr(R,H),K=!!N,q=K&&!m&&Fge(f)&&Fge(b),te=!g&&Q,U=te&&q?z:null,Y=q?U??(s??y)({rects:h,activeNodeRect:$,activeIndex:f,overIndex:b,index:S}):null,se=Fge(f)&&Fge(b)?i({id:a,items:c,activeIndex:f,overIndex:b}):S,Te=N?.id,de=(0,Qs.useRef)({activeId:Te,items:c,newIndex:se,containerId:d}),Ue=c!==de.current.items,Ke=e({active:N,containerId:d,isDragging:Q,isSorting:K,id:a,index:S,items:c,newIndex:de.current.newIndex,previousItems:de.current.items,previousContainerId:de.current.containerId,transition:l,wasDragging:de.current.activeId!=null}),at=eUn({disabled:!Ke,index:S,node:A,rect:P});return(0,Qs.useEffect)(()=>{K&&de.current.newIndex!==se&&(de.current.newIndex=se),d!==de.current.containerId&&(de.current.containerId=d),c!==de.current.items&&(de.current.items=c)},[K,se,d,c]),(0,Qs.useEffect)(()=>{if(Te===de.current.activeId)return;if(Te!=null&&de.current.activeId==null){de.current.activeId=Te;return}let Nn=setTimeout(()=>{de.current.activeId=Te},50);return()=>clearTimeout(Nn)},[Te]),{active:N,activeIndex:f,attributes:k,data:O,rect:P,index:S,newIndex:se,items:c,isOver:I,isSorting:K,isDragging:Q,listeners:V,node:A,overIndex:b,over:Z,setNodeRef:B,setActivatorNodeRef:D,setDroppableNodeRef:R,setDraggableNodeRef:H,transform:at??Y,transition:hr()};function hr(){if(at||Ue&&de.current.newIndex===S)return XBn;if(!(te&&!l7(j)||!l)&&(K||Ke))return S_.Transition.toString({...l,property:zor})}}function tUn(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 $ge(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 rUn=[Yn.Down,Yn.Right,Yn.Up,Yn.Left],Bge=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(rUn.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 Yn.Down:n.top<f.top&&u.push(d);break;case Yn.Up:n.top>f.top&&u.push(d);break;case Yn.Left:n.left>f.left&&u.push(d);break;case Yn.Right:n.left<f.left&&u.push(d);break}});let l=wor({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=uHe(l,"id");if(c===a?.id&&l.length>1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let b=h7(m).some((E,P)=>s[P]!==E),g=Bor(d,f),y=nUn(d,f),x=b||!g?{x:0,y:0}:{x:y?n.width-p.width:0,y:y?n.height-p.height:0},S={x:p.left,y:p.top};return x.x&&x.y?S:Ck(S,x)}}}};function Bor(t,e){return!$ge(t)||!$ge(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function nUn(t,e){return!$ge(t)||!$ge(e)||!Bor(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}$n();er();er();d6();var Vge=require("obsidian");var Ta=F(ee());$n();var Kh=F(ee());$n();An();CN();Tn();on();function fO({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,Kh.useState)(!1),s=(0,Kh.useRef)(null),u=(0,Kh.useRef)(!0);return(0,Kh.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await po(t)}catch(c){fe("Failed to decrypt value:"+ci(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Kh.default.createElement("div",{className:ve("tw-relative",o)},Kh.default.createElement(si,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:ve("tw-w-full !tw-pr-7")}),Kh.default.createElement("div",{onClick:()=>!n&&a(!i),className:ve("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?Kh.default.createElement(y8,{className:ve("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):Kh.default.createElement(nP,{className:ve("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}An();var Zd=F(ee());var sa=F(ee(),1);function pO(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var qor=F(ee(),1);function Uor(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function lHe(...t){return e=>{let r=!1,n=t.map(o=>{let i=Uor(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():Uor(t[o],null)}}}}function jT(...t){return qor.useCallback(lHe(...t),t)}var gs=F(ee(),1);var Hor=F(ee(),1),Vor=F(Cs(),1);var Jd=F(ee(),1);var H3=F(bt(),1),v7=Jd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Jd.Children.toArray(r),i=o.find(iUn);if(i){let a=i.props.children,s=o.map(u=>u===i?Jd.Children.count(a)>1?Jd.Children.only(null):Jd.isValidElement(a)?a.props.children:null:u);return(0,H3.jsx)(cHe,{...n,ref:e,children:Jd.isValidElement(a)?Jd.cloneElement(a,void 0,s):null})}return(0,H3.jsx)(cHe,{...n,ref:e,children:r})});v7.displayName="Slot";var cHe=Jd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Jd.isValidElement(r)){let o=sUn(r);return Jd.cloneElement(r,{...aUn(n,r.props),ref:e?lHe(e,o):o})}return Jd.Children.count(r)>1?Jd.Children.only(null):null});cHe.displayName="SlotClone";var oUn=({children:t})=>(0,H3.jsx)(H3.Fragment,{children:t});function iUn(t){return Jd.isValidElement(t)&&t.type===oUn}function aUn(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 sUn(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 Wor=F(bt(),1),uUn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gh=uUn.reduce((t,e)=>{let r=Hor.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?v7:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Wor.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Kor(t,e){t&&Vor.flushSync(()=>t.dispatchEvent(e))}var fHe=F(bt(),1),lUn="DismissableLayer",dHe="dismissableLayer.update",cUn="dismissableLayer.pointerDownOutside",dUn="dismissableLayer.focusOutside",Gor,Zor=gs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pHe=gs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=gs.useContext(Zor),[c,d]=gs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=gs.useState({}),m=jT(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,S=y>=g,O=mUn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!S||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=hUn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return $R(P=>{y===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),gs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Gor=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Jor(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Gor)}},[c,f,r,l]),gs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Jor())},[c,l]),gs.useEffect(()=>{let P=()=>p({});return document.addEventListener(dHe,P),()=>document.removeEventListener(dHe,P)},[]),(0,fHe.jsx)(Gh.div,{...u,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:pO(t.onFocusCapture,E.onFocusCapture),onBlurCapture:pO(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:pO(t.onPointerDownCapture,O.onPointerDownCapture)})});pHe.displayName=lUn;var fUn="DismissableLayerBranch",pUn=gs.forwardRef((t,e)=>{let r=gs.useContext(Zor),n=gs.useRef(null),o=jT(e,n);return gs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,fHe.jsx)(Gh.div,{...t,ref:o})});pUn.displayName=fUn;function mUn(t,e=globalThis?.document){let r=Qr(t),n=gs.useRef(!1),o=gs.useRef(()=>{});return gs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Yor(cUn,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 hUn(t,e=globalThis?.document){let r=Qr(t),n=gs.useRef(!1);return gs.useEffect(()=>{let o=i=>{i.target&&!n.current&&Yor(dUn,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 Jor(){let t=new CustomEvent(dHe);document.dispatchEvent(t)}function Yor(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?Kor(o,i):o.dispatchEvent(i)}var By=F(ee(),1);var rir=F(bt(),1),mHe="focusScope.autoFocusOnMount",hHe="focusScope.autoFocusOnUnmount",Xor={bubbles:!1,cancelable:!0},gUn="FocusScope",gHe=By.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=By.useState(null),l=Qr(o),c=Qr(i),d=By.useRef(null),f=jT(e,h=>u(h)),p=By.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;By.useEffect(()=>{if(n){let y=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:O1(d.current,{select:!0})},x=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||O1(d.current,{select:!0}))},S=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&O1(s)};var h=y,b=x,g=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);let O=new MutationObserver(S);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),O.disconnect()}}},[n,s,p.paused]),By.useEffect(()=>{if(s){eir.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(mHe,Xor);s.addEventListener(mHe,l),s.dispatchEvent(g),g.defaultPrevented||(yUn(xUn(nir(s)),{select:!0}),document.activeElement===h&&O1(s))}return()=>{s.removeEventListener(mHe,l),setTimeout(()=>{let g=new CustomEvent(hHe,Xor);s.addEventListener(hHe,c),s.dispatchEvent(g),g.defaultPrevented||O1(h??document.body,{select:!0}),s.removeEventListener(hHe,c),eir.remove(p)},0)}}},[s,l,c,p]);let m=By.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let y=h.currentTarget,[x,S]=bUn(y);x&&S?!h.shiftKey&&g===S?(h.preventDefault(),r&&O1(x,{select:!0})):h.shiftKey&&g===x&&(h.preventDefault(),r&&O1(S,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,rir.jsx)(Gh.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});gHe.displayName=gUn;function yUn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(O1(n,{select:e}),document.activeElement!==r)return}function bUn(t){let e=nir(t),r=Qor(e,t),n=Qor(e.reverse(),t);return[r,n]}function nir(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 Qor(t,e){for(let r of t)if(!_Un(r,{upTo:e}))return r}function _Un(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 vUn(t){return t instanceof HTMLInputElement&&"select"in t}function O1(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&vUn(t)&&e&&t.select()}}var eir=wUn();function wUn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=tir(t,e),t.unshift(e)},remove(e){t=tir(t,e),t[0]?.resume()}}}function tir(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function xUn(t){return t.filter(e=>e.tagName!=="A")}var Uge=F(ee(),1),oir=F(Cs(),1);var iir=F(bt(),1),SUn="Portal",yHe=Uge.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Uge.useState(!1);uo(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?oir.default.createPortal((0,iir.jsx)(Gh.div,{...n,ref:e}),a):null});yHe.displayName=SUn;var qi=F(bt(),1),bHe="Dialog",[air,FBi]=na(bHe),[CUn,O_]=air(bHe),sir=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=sa.useRef(null),u=sa.useRef(null),[l=!1,c]=Nd({prop:n,defaultProp:o,onChange:i});return(0,qi.jsx)(CUn,{scope:e,triggerRef:s,contentRef:u,contentId:Rl(),titleId:Rl(),descriptionId:Rl(),open:l,onOpenChange:c,onOpenToggle:sa.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};sir.displayName=bHe;var uir="DialogTrigger",lir=sa.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=O_(uir,r),i=jT(e,o.triggerRef);return(0,qi.jsx)(Gh.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":wHe(o.open),...n,ref:i,onClick:pO(t.onClick,o.onOpenToggle)})});lir.displayName=uir;var _He="DialogPortal",[OUn,cir]=air(_He,{forceMount:void 0}),dir=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=O_(_He,e);return(0,qi.jsx)(OUn,{scope:e,forceMount:r,children:sa.Children.map(n,a=>(0,qi.jsx)(jd,{present:r||i.open,children:(0,qi.jsx)(yHe,{asChild:!0,container:o,children:a})}))})};dir.displayName=_He;var qge="DialogOverlay",fir=sa.forwardRef((t,e)=>{let r=cir(qge,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=O_(qge,t.__scopeDialog);return i.modal?(0,qi.jsx)(jd,{present:n||i.open,children:(0,qi.jsx)(PUn,{...o,ref:e})}):null});fir.displayName=qge;var PUn=sa.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=O_(qge,r);return(0,qi.jsx)(e7,{as:v7,allowPinchZoom:!0,shards:[o.contentRef],children:(0,qi.jsx)(Gh.div,{"data-state":wHe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Ik="DialogContent",pir=sa.forwardRef((t,e)=>{let r=cir(Ik,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=O_(Ik,t.__scopeDialog);return(0,qi.jsx)(jd,{present:n||i.open,children:i.modal?(0,qi.jsx)(EUn,{...o,ref:e}):(0,qi.jsx)(TUn,{...o,ref:e})})});pir.displayName=Ik;var EUn=sa.forwardRef((t,e)=>{let r=O_(Ik,t.__scopeDialog),n=sa.useRef(null),o=jT(e,r.contentRef,n);return sa.useEffect(()=>{let i=n.current;if(i)return QR(i)},[]),(0,qi.jsx)(mir,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pO(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:pO(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:pO(t.onFocusOutside,i=>i.preventDefault())})}),TUn=sa.forwardRef((t,e)=>{let r=O_(Ik,t.__scopeDialog),n=sa.useRef(!1),o=sa.useRef(!1);return(0,qi.jsx)(mir,{...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()}})}),mir=sa.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=O_(Ik,r),u=sa.useRef(null),l=jT(e,u);return zR(),(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)(gHe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,qi.jsx)(pHe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":wHe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)(AUn,{titleId:s.titleId}),(0,qi.jsx)(MUn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),vHe="DialogTitle",hir=sa.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=O_(vHe,r);return(0,qi.jsx)(Gh.h2,{id:o.titleId,...n,ref:e})});hir.displayName=vHe;var gir="DialogDescription",yir=sa.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=O_(gir,r);return(0,qi.jsx)(Gh.p,{id:o.descriptionId,...n,ref:e})});yir.displayName=gir;var bir="DialogClose",_ir=sa.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=O_(bir,r);return(0,qi.jsx)(Gh.button,{type:"button",...n,ref:e,onClick:pO(t.onClick,()=>o.onOpenChange(!1))})});_ir.displayName=bir;function wHe(t){return t?"open":"closed"}var vir="DialogTitleWarning",[kBi,wir]=kGt(vir,{contentName:Ik,titleName:vHe,docsSlug:"dialog"}),AUn=({titleId:t})=>{let e=wir(vir),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 sa.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},IUn="DialogDescriptionWarning",MUn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wir(IUn).contentName}}.`;return sa.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},xir=sir,Sir=lir,Cir=dir,xHe=fir,SHe=pir,CHe=hir,OHe=yir,Oir=_ir;An();$n();var Hge=xir,Pir=Sir,NUn=Cir;var Eir=Zd.forwardRef(({className:t,...e},r)=>Zd.createElement(xHe,{ref:r,className:ve("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}));Eir.displayName=xHe.displayName;var w7=Zd.forwardRef(({className:t,children:e,container:r,...n},o)=>Zd.createElement(NUn,{container:r},Zd.createElement(Eir,null),Zd.createElement(SHe,{ref:o,className:ve("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,Zd.createElement(Oir,{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"},Zd.createElement(Qi,{className:"tw-size-4"}),Zd.createElement("span",{className:"tw-sr-only"},"Close")))));w7.displayName=SHe.displayName;var x7=({className:t,...e})=>Zd.createElement("div",{className:ve("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});x7.displayName="DialogHeader";var jUn=({className:t,...e})=>Zd.createElement("div",{className:ve("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});jUn.displayName="DialogFooter";var S7=Zd.forwardRef(({className:t,...e},r)=>Zd.createElement(CHe,{ref:r,className:ve("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));S7.displayName=CHe.displayName;var C7=Zd.forwardRef(({className:t,...e},r)=>Zd.createElement(OHe,{ref:r,className:ve("tw-text-sm tw-text-muted",t),...e}));C7.displayName=OHe.displayName;on();function Pn(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=$3(),a="onChange"in t?t.onChange:void 0,s=(0,Ta.useMemo)(()=>{if(a)return FY(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return Ta.default.createElement(si,{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 Ta.default.createElement(fO,{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 Ta.default.createElement(dT,{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 Ta.default.createElement(u3,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return Ta.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},Ta.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:ve("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&&Ta.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>Ta.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),Ta.default.createElement("div",{className:ve("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")},Ta.default.createElement(Xi,{className:"tw-size-4"})));case"slider":return Ta.default.createElement(lO,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return Ta.default.createElement(Hge,null,Ta.default.createElement(Pir,{asChild:!0},t.trigger),Ta.default.createElement(w7,{container:i},(t.dialogTitle||t.dialogDescription)&&Ta.default.createElement(x7,null,t.dialogTitle&&Ta.default.createElement(S7,null,t.dialogTitle),t.dialogDescription&&Ta.default.createElement(C7,null,t.dialogDescription)),t.children));case"custom":return t.children}};return Ta.default.createElement("div",{className:ve("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)},Ta.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},Ta.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&Ta.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),Ta.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}er();function DUn(t){let r=`${DR()}/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[fT]=o.showInContextMenu,s[pT]=o.showInSlashMenu,s[rO]=o.order,s[mT]=o.modelKey,s[hT]=0})}))}async function Tir(){let t=ae().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=Mm(),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=Dme(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
|
||
|
||
Original name: ${a.title}
|
||
|
||
${a.content}`}):e.push(a)}await Fd.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 ${DR()}.`;r.length>0&&(await DUn(r),i+=`
|
||
|
||
We found ${r.length} unsupported commands. They are saved in ${DR()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),ht("inlineEditCommands",[]),new $d(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function PHe(){let t=Mm(),e=QGt.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];Fd.getInstance().updateCommands(r)}async function Air(){if(ae().suggestedDefaultCommands)return;Mm().length===0&&(new $d(app,()=>{PHe()},"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(),ht("suggestedDefaultCommands",!0))}var LUn=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=_7({id:t.title}),d={transform:S_.Transform.toString(u),transition:l},f=()=>{n(t)};return Dt.default.createElement(w1,{ref:s,style:d,className:ve("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Dt.default.createElement(Bf,{className:"tw-w-10"},Dt.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Dt.default.createElement(nv,{className:"tw-size-4"}))),Dt.default.createElement(Bf,null,t.title),Dt.default.createElement(Bf,{className:"tw-text-center"},Dt.default.createElement(Ld,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Dt.default.createElement(Bf,{className:"tw-text-center"},Dt.default.createElement(Ld,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Dt.default.createElement(Bf,{className:"tw-text-center"},Dt.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Dt.default.createElement(be,{variant:"ghost",size:"icon",onClick:()=>{new HF(app,e,t,async m=>{await r(m,t.title)}).open()}},Dt.default.createElement(iv,{className:"tw-size-4"})),Dt.default.createElement(be,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},Dt.default.createElement(th,{className:"tw-size-4"})),Dt.default.createElement(be,{variant:"ghost",size:"icon",onClick:()=>{new $d(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()}},Dt.default.createElement(oh,{className:"tw-size-4"})))))},Iir=()=>{let t=eJt(),e=(0,Dt.useMemo)(()=>eJ([...t]),[t]),r=Hn(),n=jge(q3(C1,{activationConstraint:{distance:8}}),q3(S1,{coordinateGetter:Bge})),o=async(l,c)=>{await Fd.getInstance().updateCommand(l,c)},i=async l=>{await Fd.getInstance().createCommand(l)},a=async l=>{try{await Fd.getInstance().deleteCommand(l),new Vge.Notice(`Command "${l.title}" deleted successfully!`)}catch(c){throw console.error("Failed to delete command:",c),new Vge.Notice("Failed to delete command. Please try again."),c}},s=async l=>{try{let c=nJt(l.title,e),d={...l,title:c};await Fd.getInstance().createCommand(d,{autoOrder:!1})}catch(c){console.error("Failed to copy command:",c),new Vge.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(b=>b.title===c.id),p=e.findIndex(b=>b.title===d.id);if(f===-1||p===-1)return;let m=[...e],[h]=m.splice(f,1);m.splice(p,0,h),await Fd.getInstance().reorderCommands(m)};return Dt.default.createElement("div",{className:"tw-space-y-4"},Dt.default.createElement("section",null,Dt.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Dt.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Dt.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 ",Dt.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),Dt.default.createElement(Pn,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:l=>{ht("customPromptsFolder",l),Lme()},placeholder:"copilot-custom-prompts"}),Dt.default.createElement(Pn,{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=>{ht("enableCustomPromptTemplating",l)}}),Dt.default.createElement(Pn,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:l=>ht("promptSortStrategy",l),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),Dt.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"},Dt.default.createElement(oP,{className:"tw-size-5"})," ",Dt.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",Dt.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),Dt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Dt.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between"},Dt.default.createElement("div",null,Dt.default.createElement(be,{variant:"secondary",onClick:()=>new $d(app,PHe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default Commands")),Dt.default.createElement(be,{variant:"default",className:"tw-gap-2",onClick:()=>{let l={...tO};new HF(app,e,l,async d=>{await i(d)}).open()}},Dt.default.createElement(nh,{className:"tw-size-4"}),"Add Command")),Dt.default.createElement(g7,{sensors:n,collisionDetection:m7,onDragEnd:u},Dt.default.createElement(o7,null,Dt.default.createElement(i7,null,Dt.default.createElement(w1,null,Dt.default.createElement(Tp,{className:"tw-w-10"}),Dt.default.createElement(Tp,null,"Name"),Dt.default.createElement(Tp,{className:"tw-w-24 tw-text-center"},Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",Dt.default.createElement(lo,null,Dt.default.createElement(Nt,null,Dt.default.createElement(jt,{asChild:!0},Dt.default.createElement(ov,{className:"tw-size-4"})),Dt.default.createElement(At,{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."))))),Dt.default.createElement(Tp,{className:"tw-w-28 tw-text-center"},Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",Dt.default.createElement(lo,null,Dt.default.createElement(Nt,null,Dt.default.createElement(jt,{asChild:!0},Dt.default.createElement(ov,{className:"tw-size-4"})),Dt.default.createElement(At,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat."))))),Dt.default.createElement(Tp,{className:"tw-w-32 tw-text-center"},"Actions"))),Dt.default.createElement(b7,{items:e.map(l=>l.title),strategy:y7},Dt.default.createElement(a7,null,e.length===0?Dt.default.createElement(w1,null,Dt.default.createElement(Bf,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(l=>Dt.default.createElement(LUn,{key:l.title,command:l,commands:e,onUpdate:o,onRemove:a,onCopy:s})))))))))};An();var Xn=F(ee());er();var Mk=F(ee()),Mir=()=>{let t=Hn();return Mk.default.createElement("div",{className:"tw-space-y-4"},Mk.default.createElement("section",null,Mk.default.createElement(Pn,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>ht("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),Mk.default.createElement("div",{className:"tw-space-y-4"},Mk.default.createElement(Pn,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{ht("enableEncryption",e)}}),Mk.default.createElement(Pn,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{ht("debug",e)}}))))};td();var V3=class extends $d{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")}};di();Ur();sP();OC();er();var Ll=F(ee()),Rir=require("obsidian"),Nir=F(id());di();sP();er();An();function FUn({onConfirm:t,onCancel:e}){let r=ae();return Ll.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Ll.default.createElement("div",null,Ll.default.createElement("p",null,"Thanks for purchasing ",Ll.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!"),Ll.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),Ll.default.createElement("ul",{className:"tw-pl-4"},Ll.default.createElement("li",null,"Default mode: ",Ll.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),Ll.default.createElement("li",null,"Chat model: ",Ll.default.createElement("b",{className:"tw-text-accent"},rFe)),Ll.default.createElement("li",null,Ll.default.createElement("div",null,"Embedding model:"," ",Ll.default.createElement("b",{className:"tw-text-accent"},nFe)),r.embeddingModelKey!==oFe&&Ll.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},Ll.default.createElement(lp,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),Ll.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Ll.default.createElement(be,{variant:"ghost",onClick:e},"Apply Later"),Ll.default.createElement(be,{variant:"default",onClick:t},"Apply Now")))}var Wge=class extends Rir.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Nir.createRoot)(e);let r=()=>{B$t(),this.close()},n=()=>{this.close()};this.root.render(Ll.default.createElement(FUn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};di();Ur();sP();er();An();var eu=F(ee());function jir(){let t=Hn(),[e,r]=(0,eu.useState)(null),[n,o]=(0,eu.useState)(!1),i=Rq(),[a,s]=(0,eu.useState)(t.plusLicenseKey);return(0,eu.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),eu.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},eu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},eu.default.createElement("span",null,"Copilot Plus (beta)"),i&&eu.default.createElement(Dm,{variant:"outline",className:"tw-text-success"},"Active")),eu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},eu.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."),eu.default.createElement("div",null,"Currently in beta, Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),eu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},eu.default.createElement(fO,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),eu.default.createElement(be,{disabled:n,onClick:async()=>{ht("plusLicenseKey",a),o(!0);let u=await Zue();o(!1),u?(r(null),new Wge(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?eu.default.createElement(yc,{className:"tw-size-4 tw-animate-spin"}):"Apply"),eu.default.createElement(be,{variant:"secondary",onClick:()=>XN(zO.SETTINGS)},"Join Now ",eu.default.createElement(WN,{className:"tw-size-4"}))),eu.default.createElement("div",{className:"tw-text-error"},e))}on();An();var W3=require("obsidian"),Qe=F(ee());di();Ur();CN();Tn();er();Ur();var kUn={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"}))||[]},$Un=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})):[],zUn=t=>kUn[t]||$Un(t),Dir=(t,e)=>{let r=zUn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};on();An();var P_=require("obsidian"),Yt=F(ee()),Lir=F(id());function BUn({onClose:t}){let e=Hn(),[r,n]=(0,Yt.useState)(new Set),[o,i]=(0,Yt.useState)(new Set),[a,s]=(0,Yt.useState)(null),[u,l]=(0,Yt.useState)({}),[c,d]=(0,Yt.useState)(null),[f,p]=(0,Yt.useState)(null),[m,h]=(0,Yt.useState)(null),[b,g]=(0,Yt.useState)(!1),y=(0,Yt.useRef)(o);(0,Yt.useEffect)(()=>{y.current=o},[o]),(0,Yt.useEffect)(()=>(i(new Set),s(null),h(null),()=>{y.current.forEach(I=>{let R=W_[I];ht(R,"")})}),[]);let x=I=>{let R=W_[I];return e[R]??""},S=twe().map(I=>{let R=I,N=x(R);return{provider:R,apiKey:N,isVerified:!!N&&!o.has(R)}}),O=(I,R)=>{x(I)!==R&&(ht(W_[I],R),i(j=>new Set(j).add(I)),l(j=>({...j,[I]:void 0})),p(j=>j===I?null:j))},E=async(I,R)=>{n(N=>new Set(N).add(I));try{J(`Verifying ${I} API key`);let N=V_(I).testModel;if(!N){new P_.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let j={name:N,provider:I,apiKey:R,enabled:!0};await Ec.instance.getCurrentChainManager().chatModelManager.ping(j),new P_.Notice("API key verified successfully!"),i($=>{let k=new Set($);return k.delete(I),k})}catch(N){console.error("API key verification failed:",N),new P_.Notice("API key verification failed: "+ci(N),1e4)}finally{n(N=>{let j=new Set(N);return j.delete(I),j})}},P=async(I,R)=>{d(I),p(null);try{R=await po(R);let N=V_(I).listModelURL,j={Authorization:`Bearer ${R}`};I==="google"?(N+=`?key=${R}`,j={}):I==="anthropic"&&(j={"x-api-key":R,"anthropic-version":"2023-06-01"});let $=async Q=>{let Z=new AbortController,D=setTimeout(()=>Z.abort(),3e3);try{let z=await(Q?ou:fetch)(N,{headers:j,signal:Z.signal,method:"GET"});if(!z.ok){let B=ci(await z.json());throw fe(B),new Error(`Failed to fetch models: ${z.statusText}
|
||
detail: `+B)}return z}finally{clearTimeout(D)}},k;try{k=await $(!1)}catch(Q){console.log("First fetch attempt failed, trying with safeFetch...");try{k=await $(!0)}catch(Z){let D=`
|
||
without CORS Error: `+ci(Q)+`
|
||
with CORS Error: `+ci(Z);throw new Error(D)}}let H=await k.json(),V=Dir(I,H);l(Q=>({...Q,[I]:V})),d(null)}catch(N){console.error(`Error fetching models for ${I}:`,N),p(I),d(null),new P_.Notice(`Failed to load models for ${op(I)}: ${ci(N)}`,5e3)}},A=async()=>{if(!m){new P_.Notice("Please select a model first");return}g(!0);try{let I=x(m.provider),R={name:m.name,provider:m.provider,apiKey:I,enabled:!0};if(await Ec.instance.getCurrentChainManager().chatModelManager.ping(R),e.activeModels.find(j=>j.name===m.name&&j.provider===m.provider))new P_.Notice(`Model ${m.name} verified successfully! It already exists in your models list.`);else{let j=[...e.activeModels,R];ht("activeModels",j),new P_.Notice(`Model ${m.name} verified successfully and added to your models list!`)}}catch(I){console.error("Model verification failed:",I),new P_.Notice("Model verification failed: "+ci(I),1e4)}finally{g(!1)}};return Yt.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Yt.default.createElement("div",{className:"tw-mb-4"},Yt.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Yt.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Yt.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Yt.default.createElement("div",{className:"tw-space-y-4"},S.map(I=>Yt.default.createElement(Yt.default.Fragment,{key:I.provider},Yt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Yt.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Yt.default.createElement("div",{className:"tw-truncate"},op(I.provider))),Yt.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Yt.default.createElement("div",{className:"tw-flex-1"},Yt.default.createElement(fO,{className:"tw-max-w-full",value:I.apiKey,onChange:R=>O(I.provider,R),disabled:r.has(I.provider)})),Yt.default.createElement("div",{className:"tw-w-[72px]"},I.isVerified?Yt.default.createElement("span",{className:"tw-flex tw-h-9 tw-items-center tw-justify-center tw-text-sm tw-text-success"},"Verified"):Yt.default.createElement(be,{onClick:()=>E(I.provider,I.apiKey),disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},r.has(I.provider)?Yt.default.createElement(yc,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Verify")),Yt.default.createElement("div",{className:""},Yt.default.createElement(be,{onClick:()=>{let R=a===I.provider?null:I.provider;s(R),R&&I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&P(I.provider,I.apiKey)},disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-p-0.5"},"Add Model",a===I.provider?Yt.default.createElement(fb,{className:"tw-ml-1 tw-size-4"}):Yt.default.createElement(Xi,{className:"tw-ml-1 tw-size-4"})))),Yt.default.createElement("div",null,V_(I.provider).keyManagementURL&&Yt.default.createElement("a",{href:V_(I.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",op(I.provider)," Key"))),Yt.default.createElement(CT,{open:a===I.provider,className:"tw-mt-2"},Yt.default.createElement(OT,{className:"tw-rounded-md tw-p-3"},Yt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Yt.default.createElement(Bn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Yt.default.createElement("div",null,Yt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Yt.default.createElement("div",{className:"tw-flex-1"},Yt.default.createElement(cge,{options:u[I.provider]?.sort((R,N)=>R.name.localeCompare(N.name)).map(R=>({label:R.name,value:R.id}))||[],onChange:R=>{let N=R.target.value,j=u[I.provider]?.find($=>$.id===N);j&&h({id:j.id,name:j.name,provider:I.provider})},onClick:()=>{I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&P(I.provider,I.apiKey)},value:m?.provider===I.provider?m.id:"",placeholder:"Select Model",disabled:!I.apiKey||c===I.provider||f===I.provider&&u[I.provider]!==null})),Yt.default.createElement("div",{className:"tw-w-[72px]"},Yt.default.createElement(be,{onClick:A,disabled:!m||m.provider!==I.provider||b,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},b?Yt.default.createElement(yc,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Yt.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},c===I.provider&&Yt.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),f===I.provider&&Yt.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",u[I.provider]===null&&" Check API Key or network."),u[I.provider]&&u[I.provider].length===0&&Yt.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),u[I.provider]===void 0&&f!==I.provider&&c!==I.provider&&Yt.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Yt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Yt.default.createElement(be,{onClick:t},"Close")))}var Kge=class extends P_.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,Lir.createRoot)(e),this.root.render(Yt.default.createElement(BUn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};$n();var qUn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)",project:"Projects (alpha)"},Fir=()=>{let t=Hn(),[e,r]=(0,Qe.useState)(!1),[n,o]=(0,Qe.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=async l=>{l!==t.embeddingModelKey&&new V3(app,async()=>{ht("embeddingModelKey",l),await wa.getInstance().indexVaultToVectorStore(!0)}).open()},a=()=>{r(!0);try{let l=n||"{$date}_{$time}__{$topic}",d=["{$date}","{$time}","{$topic}"].filter(g=>!l.includes(g));if(d.length>0){new W3.Notice(`Error: Missing required variables: ${d.join(", ")}`,4e3);return}let f=/[\\/:*?"<>|]/,p=l.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(f.test(p)){new W3.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=Bs(new Date),b=l.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",m.split("_")[0]).replace("{$time}",m.split("_")[1]);ht("defaultConversationNoteName",l),o(l),new W3.Notice(`Format applied successfully! Example: ${b}`,4e3)}catch(l){new W3.Notice(`Error applying format: ${l.message}`,4e3)}finally{r(!1)}},s=!!t.activeModels.find(l=>l.enabled&&Yr(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:ZG(l),value:Yr(l)}));return Qe.default.createElement("div",{className:"tw-space-y-4"},Qe.default.createElement(jir,null),Qe.default.createElement("section",null,Qe.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),Qe.default.createElement("div",{className:"tw-space-y-4"},Qe.default.createElement("div",{className:"tw-space-y-4"},Qe.default.createElement(Pn,{type:"custom",title:"API Keys",description:Qe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Qe.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),Qe.default.createElement(lo,{delayDuration:0},Qe.default.createElement(Nt,null,Qe.default.createElement(jt,{asChild:!0},Qe.default.createElement(Mo,{className:"tw-size-4"})),Qe.default.createElement(At,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Qe.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),Qe.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.")))))},Qe.default.createElement(be,{onClick:()=>{new Kge(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",Qe.default.createElement(P8,{className:"tw-size-4"})))),Qe.default.createElement(Pn,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:s?t.defaultModelKey:"Select Model",onChange:l=>{let c=t.activeModels.find(p=>p.enabled&&Yr(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=T$(c,t);if(!d&&f){new W3.Notice(f);return}ht("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),Qe.default.createElement(Pn,{type:"select",title:"Embedding Model",description:Qe.default.createElement("div",{className:"tw-space-y-2"},Qe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Qe.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Core Feature: Powers Semantic Search & QA"),Qe.default.createElement(lo,{delayDuration:0},Qe.default.createElement(Nt,null,Qe.default.createElement(jt,{asChild:!0},Qe.default.createElement(Mo,{className:"tw-size-4"})),Qe.default.createElement(At,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Qe.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 QA functionality. Changing the embedding model will:"),Qe.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Qe.default.createElement("li",null,"Require rebuilding your vault's vector index"),Qe.default.createElement("li",null,"Affect semantic search quality"),Qe.default.createElement("li",null,"Impact QA feature performance"))))))),value:t.embeddingModelKey,onChange:i,options:t.activeEmbeddingModels.map(l=>({label:ZG(l),value:Yr(l)})),placeholder:"Model"}),Qe.default.createElement(Pn,{type:"select",title:"Default Mode",description:Qe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Qe.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),Qe.default.createElement(lo,{delayDuration:0},Qe.default.createElement(Nt,null,Qe.default.createElement(jt,{asChild:!0},Qe.default.createElement(Mo,{className:"tw-size-4"})),Qe.default.createElement(At,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Qe.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Qe.default.createElement("li",null,Qe.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Qe.default.createElement("i",null,"Free to use with your own API key.")),Qe.default.createElement("li",null,Qe.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Qe.default.createElement("i",null,"Free to use with your own API key.")),Qe.default.createElement("li",null,Qe.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"," ",Qe.default.createElement("a",{href:iFe(zO.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:l=>ht("defaultChainType",l),options:Object.entries(qUn).map(([l,c])=>({label:c,value:l}))}),Qe.default.createElement(Pn,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>ht("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Qe.default.createElement(Pn,{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:l=>ht("defaultSaveFolder",l),placeholder:"copilot-conversations"}),Qe.default.createElement(Pn,{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:l=>ht("defaultConversationTag",l),placeholder:"ai-conversations"}),Qe.default.createElement(Pn,{type:"custom",title:"Conversation Filename Template",description:Qe.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},Qe.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),Qe.default.createElement(lo,{delayDuration:0},Qe.default.createElement(Nt,null,Qe.default.createElement(jt,{asChild:!0},Qe.default.createElement(Mo,{className:"tw-size-4"})),Qe.default.createElement(At,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Qe.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),Qe.default.createElement("div",null,Qe.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),Qe.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Qe.default.createElement("li",null,Qe.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Qe.default.createElement("li",null,Qe.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Qe.default.createElement("li",null,Qe.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Qe.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Qe.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},Qe.default.createElement(si,{type:"text",className:ve("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:l=>o(l.target.value),disabled:e}),Qe.default.createElement(be,{onClick:()=>a(),disabled:e,variant:"secondary"},e?Qe.default.createElement(Qe.default.Fragment,null,Qe.default.createElement(yc,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),Qe.default.createElement(Pn,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>ht("autosaveChat",l)}),Qe.default.createElement(Pn,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>ht("showSuggestedPrompts",l)}),Qe.default.createElement(Pn,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>ht("showRelevantNotes",l)}))))};di();Ur();$n();er();An();var Rk=require("obsidian"),co=F(ee()),kir=()=>{let t=Hn(),e=t.autocompleteAcceptKey||hg.KEYBIND,[r,n]=(0,co.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{ht("autocompleteAcceptKey",u),new Rk.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{ht("autocompleteAcceptKey",hg.KEYBIND),new Rk.Notice(`Autocomplete accept key reset to: ${hg.KEYBIND}`)},s=async()=>{if(!r){n(!0),new Rk.Notice("Rebuilding word index...");try{let l=await FF.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new Rk.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new Rk.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new Rk.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return co.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},co.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},co.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},co.default.createElement(Dm,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),co.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},co.default.createElement(Pn,{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=>{ht("includeActiveNoteAsContext",u)}}),co.default.createElement(Pn,{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=>{ht("passMarkdownImages",u)}}),co.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),co.default.createElement(Pn,{type:"switch",title:"Sentence Autocomplete",description:co.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},co.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>ht("enableAutocomplete",u)}),co.default.createElement(Pn,{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=>{ht("enableWordCompletion",u)}}),co.default.createElement(Pn,{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."},co.default.createElement(be,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},co.default.createElement(av,{className:ve("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),co.default.createElement(Pn,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:co.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},co.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),co.default.createElement(lo,{delayDuration:0},co.default.createElement(Nt,null,co.default.createElement(jt,{asChild:!0},co.default.createElement(Mo,{className:"tw-size-4"})),co.default.createElement(At,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},co.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},co.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},co.default.createElement(RT,{value:e,onValueChange:i},co.default.createElement(cO,{className:"tw-w-[180px]"},co.default.createElement(NT,{placeholder:"Select key"})),co.default.createElement(dO,null,o.map(u=>co.default.createElement(Ep,{key:u.value,value:u.value},u.label)))),e&&e!==hg.KEYBIND&&co.default.createElement(be,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),co.default.createElement(Pn,{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=>{ht("allowAdditionalContext",u)}}))))};Ur();XD();Tn();er();var ke=F(ee());er();Ur();on();var O7=require("obsidian");di();An();var EHe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=$3(),a=ae(),s=o?"openai":"openai",[u,l]=(0,ke.useState)(null),[c,d]=(0,ke.useState)(!1),[f,p]=(0,ke.useState)(!1),[m,h]=(0,ke.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),b=(D,z)=>{h(B=>({...B,[D]:z}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},y=()=>{let D=!0,z={...m};return z.name=!O.name,O.name||(D=!1),O.provider==="azure openai"&&(z.instanceName=!O.azureOpenAIApiInstanceName,z.apiVersion=!O.azureOpenAIApiVersion,o?(z.embeddingDeploymentName=!O.azureOpenAIApiEmbeddingDeploymentName,O.azureOpenAIApiEmbeddingDeploymentName||(D=!1)):(z.deploymentName=!O.azureOpenAIApiDeploymentName,O.azureOpenAIApiDeploymentName||(D=!1)),(!O.azureOpenAIApiInstanceName||!O.azureOpenAIApiVersion)&&(D=!1)),h(z),D},x=D=>a[W_[D]]||"",S=(D=s)=>{let z={name:"",provider:D,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:x(D),isEmbeddingModel:o,capabilities:[]};return o?z:{...z,stream:!0}},[O,E]=(0,ke.useState)(S()),P=D=>({...D,name:D.name?.trim(),baseUrl:D.baseUrl?.trim(),apiKey:D.apiKey?.trim(),openAIOrgId:D.openAIOrgId?.trim(),azureOpenAIApiInstanceName:D.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:D.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:D.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:D.azureOpenAIApiVersion?.trim()}),[A,I]=(0,ke.useState)(V_(s)),R=()=>!!(O.name&&O.provider),N=()=>f||!R(),j=()=>{if(!y()){new O7.Notice("Please fill in all required fields");return}let D=P(O);r(D),e(!1),E(S()),g()},$=D=>{I(V_(D)),E({...O,provider:D,apiKey:x(D),...D==="openai"?{openAIOrgId:a.openAIOrgId}:{},...D==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},k=D=>{D||(E(S()),g(),d(!1)),e(D)},H=async()=>{if(!y()){new O7.Notice("Please fill in all required fields");return}p(!0);try{let D=P(O);await n(D),new O7.Notice("Model verification successful!")}catch(D){console.error(D);let z=ci(D);new O7.Notice("Model verification failed: "+z)}finally{p(!1)}},V=()=>{let z=(()=>{switch(O.provider){case"openai":return ke.default.createElement(Bn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},ke.default.createElement(si,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:O.openAIOrgId||"",onChange:B=>E({...O,openAIOrgId:B.target.value})}));case"azure openai":return ke.default.createElement(ke.default.Fragment,null,ke.default.createElement(Bn,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},ke.default.createElement(si,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:O.azureOpenAIApiInstanceName||"",onChange:B=>{E({...O,azureOpenAIApiInstanceName:B.target.value}),b("instanceName",!1)}})),o?ke.default.createElement(Bn,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},ke.default.createElement(si,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:O.azureOpenAIApiEmbeddingDeploymentName||"",onChange:B=>{E({...O,azureOpenAIApiEmbeddingDeploymentName:B.target.value}),b("embeddingDeploymentName",!1)}})):ke.default.createElement(Bn,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},ke.default.createElement(si,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:O.azureOpenAIApiDeploymentName||"",onChange:B=>{E({...O,azureOpenAIApiDeploymentName:B.target.value}),b("deploymentName",!1)}})),ke.default.createElement(Bn,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},ke.default.createElement(si,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:O.azureOpenAIApiVersion||"",onChange:B=>{E({...O,azureOpenAIApiVersion:B.target.value}),b("apiVersion",!1)}})));default:return null}})();return z?ke.default.createElement(CT,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},ke.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},ke.default.createElement(Sp,null,"Additional ",op(O.provider)," Settings"),ke.default.createElement(dk,{asChild:!0},ke.default.createElement(be,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},ke.default.createElement(Xi,{className:"tw-size-4"}),ke.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),ke.default.createElement(OT,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},z)):null},Q=()=>{if(O.provider!=="azure openai")return A.host;let D=O.azureOpenAIApiInstanceName||"[instance]",z=o?O.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":O.azureOpenAIApiDeploymentName||"[deployment]",B=O.azureOpenAIApiVersion||"[api-version]";return`https://${D}.openai.azure.com/openai/deployments/${z}/${o?"embeddings":"chat/completions"}?api-version=${B}`},Z=Object.entries(fA).map(([D,z])=>({id:D,label:D.charAt(0).toUpperCase()+D.slice(1),description:z}));return ke.default.createElement(Hge,{open:t,onOpenChange:k},ke.default.createElement(w7,{className:"sm:tw-max-w-[425px]",container:i,ref:D=>l(D)},ke.default.createElement(x7,null,ke.default.createElement(S7,null,"Add Custom ",o?"Embedding":"Chat"," Model"),ke.default.createElement(C7,null,"Add a new model to your collection.")),ke.default.createElement("div",{className:"tw-space-y-3"},ke.default.createElement(Bn,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},ke.default.createElement(si,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:O.name,onChange:D=>{E({...O,name:D.target.value}),b("name",!1)}})),ke.default.createElement(Bn,{label:ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ke.default.createElement("span",{className:"tw-leading-none"},"Display Name"),ke.default.createElement(lo,{delayDuration:0},ke.default.createElement(Nt,null,ke.default.createElement(jt,{asChild:!0},ke.default.createElement(Mo,{className:"tw-size-4"})),ke.default.createElement(At,{align:"start",className:"tw-max-w-96",side:"bottom"},ke.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},ke.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),ke.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),ke.default.createElement("div",{className:"tw-text-[12px]"},"Example:",ke.default.createElement("li",null,"Direct-Paid:Ds-r1"),ke.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),ke.default.createElement("li",null,"Perplexity-Paid:lg")))))))},ke.default.createElement(si,{type:"text",placeholder:"Custom display name (optional)",value:O.displayName||"",onChange:D=>{E({...O,displayName:D.target.value})}})),ke.default.createElement(Bn,{label:"Provider"},ke.default.createElement(RT,{value:O.provider,onValueChange:$},ke.default.createElement(cO,null,ke.default.createElement(NT,{placeholder:"Select provider"})),ke.default.createElement(dO,{container:u},Object.values(o?s6(cA,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):s6($O,["COPILOT_PLUS"])).map(D=>ke.default.createElement(Ep,{key:D,value:D},op(D)))))),ke.default.createElement(Bn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},ke.default.createElement(si,{type:"text",placeholder:Q()||"https://api.example.com/v1",value:O.baseUrl||"",onChange:D=>E({...O,baseUrl:D.target.value})})),ke.default.createElement(Bn,{label:"API Key"},ke.default.createElement(fO,{placeholder:`Enter ${A.label} API Key`,value:O.apiKey||"",onChange:D=>E({...O,apiKey:D})}),A.keyManagementURL&&ke.default.createElement("p",{className:"tw-text-xs tw-text-muted"},ke.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),ke.default.createElement(Bn,{label:ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ke.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),ke.default.createElement(lo,{delayDuration:0},ke.default.createElement(Nt,null,ke.default.createElement(jt,{asChild:!0},ke.default.createElement(Mo,{className:"tw-size-4"})),ke.default.createElement(At,{align:"start",className:"tw-max-w-96",side:"bottom"},ke.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},Z.map(({id:D,label:z,description:B})=>ke.default.createElement("div",{key:D,className:"tw-flex tw-items-center tw-gap-2"},ke.default.createElement(Ld,{id:D,checked:O.capabilities?.includes(D),onCheckedChange:K=>{let q=O.capabilities||[];E({...O,capabilities:K?[...q,D]:q.filter(te=>te!==D)})}}),ke.default.createElement(Sp,{htmlFor:D,className:"tw-text-sm"},ke.default.createElement(lo,{delayDuration:0},ke.default.createElement(Nt,null,ke.default.createElement(jt,{asChild:!0},ke.default.createElement("span",null,z)),ke.default.createElement(At,{side:"bottom"},B)))))))),V()),ke.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ke.default.createElement(Ld,{id:"enable-cors",checked:O.enableCors||!1,onCheckedChange:D=>E({...O,enableCors:D})}),ke.default.createElement(Sp,{htmlFor:"enable-cors",className:"tw-text-sm"},ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ke.default.createElement("span",null,"Enable CORS"),ke.default.createElement(lo,{delayDuration:0},ke.default.createElement(Nt,null,ke.default.createElement(jt,{asChild:!0},ke.default.createElement(Mo,{className:"tw-size-4"})),ke.default.createElement(At,{align:"start",className:"tw-max-w-96",side:"bottom"},ke.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),ke.default.createElement("div",{className:"tw-flex tw-gap-2"},ke.default.createElement(be,{variant:"secondary",onClick:j,disabled:N()},"Add Model"),ke.default.createElement(be,{variant:"secondary",onClick:H,disabled:N()},f?ke.default.createElement(ke.default.Fragment,null,ke.default.createElement(yc,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};Ur();er();on();An();var $ir=require("obsidian"),le=F(ee()),zir=F(id()),HUn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,le.useState)(t),[a,s]=(0,le.useState)(t),[u,l]=(0,le.useState)({}),c=ae(),d=y=>c[W_[y]]||"";(0,le.useEffect)(()=>{i(t),s(t),t.provider&&l(V_(t.provider))},[t]);let f=(0,le.useMemo)(()=>FY((y,x)=>{e(n,y,x)},500),[n,e]),p=(0,le.useCallback)((y,x)=>{i(S=>{let O={...S,[y]:x};return f(a,O),O})},[a,f]);if(!o)return null;let m=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let y=o.azureOpenAIApiInstanceName||"[instance]",x=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",S=o.azureOpenAIApiVersion||"[api-version]",O=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${y}.openai.azure.com/openai/deployments/${x}/${O}?api-version=${S}`},h=Object.entries(fA).map(([y,x])=>({id:y,label:y.charAt(0).toUpperCase()+y.slice(1),description:x})),b=o.apiKey||d(o.provider),g=!n&&o.provider!=="copilot-plus-jina";return le.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},le.default.createElement("div",{className:"tw-mb-4"},le.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),le.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),le.default.createElement("div",{className:"tw-space-y-3"},le.default.createElement(Bn,{label:"Model Name",required:!0},le.default.createElement(si,{type:"text",disabled:o.core,value:o.name,onChange:y=>p("name",y.target.value),placeholder:"Enter model name"})),le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},le.default.createElement("span",{className:"tw-leading-none"},"Display Name"),le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4"})),le.default.createElement(At,{align:"start",className:"tw-max-w-96",side:"bottom"},le.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},le.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),le.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),le.default.createElement("div",{className:"tw-text-[12px]"},"Example:",le.default.createElement("li",null,"Direct-Paid:Ds-r1"),le.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),le.default.createElement("li",null,"Perplexity-Paid:lg")))))))},le.default.createElement(si,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:y=>p("displayName",y.target.value)})),le.default.createElement(Bn,{label:"Provider"},le.default.createElement(si,{type:"text",value:op(o.provider),disabled:!0})),le.default.createElement(Bn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},le.default.createElement(si,{type:"text",placeholder:m(),value:o.baseUrl||"",onChange:y=>p("baseUrl",y.target.value)})),le.default.createElement(Bn,{label:"API Key"},le.default.createElement(fO,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:b,onChange:y=>p("apiKey",y)}),u.keyManagementURL&&le.default.createElement("p",{className:"tw-text-xs tw-text-muted"},le.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),g&&le.default.createElement(le.default.Fragment,null,le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},le.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4"})),le.default.createElement(At,{align:"start",className:"tw-max-w-96",side:"bottom"},le.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},h.map(({id:y,label:x,description:S})=>le.default.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2"},le.default.createElement(Ld,{id:y,checked:o.capabilities?.includes(y),onCheckedChange:O=>{let E=o.capabilities||[],P=O?[...E,y]:E.filter(A=>A!==y);p("capabilities",P)}}),le.default.createElement(Sp,{htmlFor:y,className:"tw-text-sm"},le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement("span",null,x)),le.default.createElement(At,{side:"bottom"},S)))))))),le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Token limit",le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),le.default.createElement(At,{side:"bottom"},le.default.createElement("div",{className:"tw-w-[300px]"},le.default.createElement("p",null,"The maximum number of ",le.default.createElement("em",null,"output tokens")," to generate. Default is"," ",pg.MAX_TOKENS,"."),le.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))))))},le.default.createElement(lO,{value:o.maxTokens??c.maxTokens??pg.MAX_TOKENS,onChange:y=>p("maxTokens",y),min:0,max:65e3,step:100})),le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Temperature",le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),le.default.createElement(At,{side:"bottom"},le.default.createElement("div",{className:"tw-max-w-[300px]"},"Default is ",pg.TEMPERATURE,". Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.")))))},le.default.createElement(lO,{value:o.temperature??c.temperature??pg.TEMPERATURE,onChange:y=>p("temperature",y),max:2,min:0,step:.05})),le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Top-P",le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),le.default.createElement(At,{side:"bottom"},le.default.createElement("div",{className:"tw-w-[300px]"},"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 Al's vocabulary, the more diverse")))))},le.default.createElement(lO,{value:o.topP??.9,onChange:y=>p("topP",y),max:1,min:0,step:.05})),le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Frequency Penalty",le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),le.default.createElement(At,{side:"bottom"},le.default.createElement("div",{className:"tw-w-[300px]"},le.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."),le.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))))))},le.default.createElement(lO,{value:o.frequencyPenalty??0,onChange:y=>p("frequencyPenalty",y),max:2,min:0,step:.05})),o.provider==="openai"&&(o.name.startsWith("gpt-5")||o.name.startsWith("o1")||o.name.startsWith("o3")||o.name.startsWith("o4"))&&le.default.createElement(le.default.Fragment,null,le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Reasoning Effort",le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),le.default.createElement(At,{side:"bottom"},le.default.createElement("div",{className:"tw-w-[300px]"},le.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!"),le.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},le.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),le.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),le.default.createElement("li",null,"Medium: Balanced performance"),le.default.createElement("li",null,"High: Thorough reasoning, slower responses")))))))},le.default.createElement(RT,{value:o.reasoningEffort||c.reasoningEffort||"low",onValueChange:y=>p("reasoningEffort",y)},le.default.createElement(cO,{className:"tw-w-full"},le.default.createElement(NT,null)),le.default.createElement(dO,null,o.name.startsWith("gpt-5")&&le.default.createElement(Ep,{value:"minimal"},"Minimal"),le.default.createElement(Ep,{value:"low"},"Low"),le.default.createElement(Ep,{value:"medium"},"Medium"),le.default.createElement(Ep,{value:"high"},"High")))),o.name.startsWith("gpt-5")&&le.default.createElement(Bn,{label:le.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Verbosity",le.default.createElement(lo,{delayDuration:0},le.default.createElement(Nt,null,le.default.createElement(jt,{asChild:!0},le.default.createElement(Mo,{className:"tw-size-4 tw-text-muted"})),le.default.createElement(At,{side:"bottom"},le.default.createElement("div",{className:"tw-w-[300px]"},le.default.createElement("p",null,"Controls the length and detail of the model responses."),le.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},le.default.createElement("li",null,"Low: Concise, brief responses"),le.default.createElement("li",null,"Medium: Balanced detail"),le.default.createElement("li",null,"High: Detailed, comprehensive responses")))))))},le.default.createElement(RT,{value:o.verbosity||c.verbosity||"medium",onValueChange:y=>p("verbosity",y)},le.default.createElement(cO,{className:"tw-w-full"},le.default.createElement(NT,null)),le.default.createElement(dO,null,le.default.createElement(Ep,{value:"low"},"Low"),le.default.createElement(Ep,{value:"medium"},"Medium"),le.default.createElement(Ep,{value:"high"},"High"))))))))},Gge=class extends $ir.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,zir.createRoot)(r);let n=(i,a,s)=>{this.onUpdate(i,a,s)},o=()=>{this.close()};this.root.render(le.default.createElement(HUn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:n,onCancel:o}))}onClose(){this.root.unmount()}};di();Ur();$n();er();on();An();var Re=F(ee());var Jge=F(ee()),THe=(0,Jge.createContext)(null),AHe=()=>(0,Jge.useContext)(THe);var VUn={reasoning:{icon:oP,color:"tw-text-model-capabilities-blue",tooltip:fA.reasoning},vision:{icon:nP,color:"tw-text-model-capabilities-green",tooltip:fA.vision},websearch:{icon:KN,color:"tw-text-model-capabilities-blue",tooltip:fA.websearch}},WUn=["reasoning","vision","websearch"],KUn=t=>Re.default.createElement(lo,{delayDuration:0},Re.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},WUn.map(e=>{let r=VUn[e];if(!r)return Re.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Re.default.createElement(Nt,{key:e},Re.default.createElement(jt,{asChild:!0},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Re.default.createElement(n,{className:ve("tw-size-4",r.color)}))),Re.default.createElement(At,{side:"bottom"},r.tooltip)):Re.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Re.default.createElement("div",{className:"tw-size-4"}))}))),GUn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i})=>{let[a,s]=Re.default.useState(!1),u=AHe(),{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:p,isDragging:m}=_7({id:i,disabled:t.core}),h={transform:S_.Transform.toString(f),transition:p};return Re.default.createElement(zJ,{ref:d,style:h,className:ve("tw-mb-2",m&&["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")},Re.default.createElement(BJ,{className:"tw-p-3"},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&Re.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...l,...c},Re.default.createElement(nv,{className:"tw-size-4"})),Re.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>s(!a)},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},a?Re.default.createElement(Xi,{className:"tw-size-3 tw-stroke-[7]"}):Re.default.createElement(tP,{className:"tw-size-3 tw-stroke-[7]"})),Re.default.createElement("div",null,Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Re.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&Re.default.createElement(yqe,{capabilities:t.capabilities,iconSize:14})),Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},op(t.provider,t)))))),Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&Re.default.createElement(be,{variant:"ghost",size:"icon",onClick:b=>{b.stopPropagation(),e(t)}},Re.default.createElement(bz,{className:"tw-size-4"})),Re.default.createElement(ik,null,Re.default.createElement(ak,{asChild:!0},Re.default.createElement(be,{variant:"ghost",size:"icon"},Re.default.createElement(rP,{className:"tw-size-4"}))),Re.default.createElement(m_,{align:"end",container:u},e&&Re.default.createElement(Ri,{onClick:b=>{b.stopPropagation(),e(t)}},Re.default.createElement(yz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Re.default.createElement(Ri,{onClick:b=>{b.stopPropagation(),r(t)}},Re.default.createElement(th,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Re.default.createElement(Ri,{onClick:b=>{b.stopPropagation(),n(Yr(t))},className:"tw-text-error"},Re.default.createElement(oh,{className:"tw-mr-2 tw-size-4"}),"Delete")))))),Re.default.createElement("div",{className:ve("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")},Re.default.createElement(UJ,{className:"tw-p-3 tw-pt-0"},Re.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Re.default.createElement(Ld,{checked:t.enabled,onCheckedChange:b=>o({...t,enabled:b})})),Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement("span",{className:"tw-text-sm"},"CORS"),Re.default.createElement(Ld,{checked:t.enableCors,onCheckedChange:b=>o({...t,enableCors:b})}))))))},JUn=({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}=_7({id:Yr(t),disabled:t.core}),f=AHe(),p={transform:S_.Transform.toString(l),transition:c},m=e||!t.core||r&&!t.core;return Re.default.createElement(w1,{ref:u,style:p,className:ve("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")},Re.default.createElement(Bf,{className:"tw-w-6 tw-px-2"},!t.core&&Re.default.createElement(be,{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},Re.default.createElement(nv,{className:"tw-size-4 tw-transition-colors"}))),Re.default.createElement(Bf,{className:"tw-pl-0"},t.displayName||t.name),Re.default.createElement(Bf,null,op(t.provider,t)),Re.default.createElement(Bf,null,KUn(t)),!i&&Re.default.createElement(Bf,{className:"tw-text-center"},Re.default.createElement(Ld,{id:`${Yr(t)}-enabled`,checked:t.enabled,onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Re.default.createElement(Bf,{className:"tw-text-center"},Re.default.createElement(Ld,{id:`${Yr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Re.default.createElement(Bf,{className:"tw-text-center"},Re.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Re.default.createElement(be,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Re.default.createElement(bz,{className:"tw-size-4"})),m&&Re.default.createElement(ik,null,Re.default.createElement(ak,{asChild:!0},Re.default.createElement(be,{variant:"ghost",size:"icon"},Re.default.createElement(rP,{className:"tw-size-4"}))),Re.default.createElement(m_,{align:"end",container:f},e&&Re.default.createElement(Ri,{onClick:()=>e(t)},Re.default.createElement(yz,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Re.default.createElement(Ri,{onClick:()=>r(t)},Re.default.createElement(th,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Re.default.createElement(Ri,{onClick:()=>n(Yr(t)),className:"tw-text-error"},Re.default.createElement(oh,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},IHe=({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=jge(q3(C1),q3(S1,{coordinateGetter:Bge})),d=t.findIndex(h=>!h.core),f=h=>b=>{let{transform:g,active:y,activeNodeRect:x,over:S}=b;if(!y||!x)return g;let O=t.findIndex(R=>Yr(R)===y.id),E=t.filter(R=>!R.core).length,P=x.height,A=(d-O)*P,I=(d+E-1-O)*P;if(h&&S){let R=t.findIndex(j=>Yr(j)===S.id);if(t[R].core||R<d)return{...g,x:0,y:O*P}}return{...g,x:0,y:Math.min(Math.max(A,g.y),I)}},p=h=>{let{active:b,over:g}=h;if(g&&b.id!==g.id){let y=t.findIndex(E=>Yr(E)===b.id),x=t.findIndex(E=>Yr(E)===g.id),S=t[x];if(x<d||S.core)return;let O=zge(t,y,x);a?.(O)}},m=()=>Re.default.createElement("div",{className:"tw-relative md:tw-hidden"},Re.default.createElement(g7,{sensors:c,collisionDetection:m7,onDragEnd:p,modifiers:[f(!0)]},Re.default.createElement(b7,{items:t.map(h=>Yr(h)),strategy:y7},Re.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(h=>Re.default.createElement(GUn,{key:Yr(h),id:Yr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Re.default.createElement("div",{className:"tw-mb-4"},Re.default.createElement("div",{className:"tw-hidden md:tw-block"},Re.default.createElement(g7,{sensors:c,collisionDetection:m7,onDragEnd:p,modifiers:[f(!1)]},Re.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Re.default.createElement(o7,null,Re.default.createElement(i7,null,Re.default.createElement(w1,null,Re.default.createElement(Tp,{className:"tw-w-6 tw-px-2"}),Re.default.createElement(Tp,{className:"tw-pl-0"},"Model"),Re.default.createElement(Tp,null,"Provider"),Re.default.createElement(Tp,{className:"tw-text-center"},"Capabilities"),!l&&Re.default.createElement(Tp,{className:"tw-text-center"},"Enable"),Re.default.createElement(Tp,{className:"tw-text-center"},"CORS"),Re.default.createElement(Tp,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Re.default.createElement(a7,{className:"tw-relative"},Re.default.createElement(b7,{items:t.map(h=>Yr(h)),strategy:y7},t.map(h=>Re.default.createElement(JUn,{key:Yr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),m(),Re.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},s&&Re.default.createElement(be,{onClick:s,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement(av,{className:"tw-size-4"}),"Refresh Built-in Models"),Re.default.createElement(be,{onClick:o,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement(nh,{className:"tw-size-4"}),"Add Custom Model")))};on();var Zge=require("obsidian"),Ip=F(ee()),Bir=()=>{let t=Hn(),[e,r]=(0,Ip.useState)(!1),[n,o]=(0,Ip.useState)(!1),i=(h,b=!1)=>{let g={...s6(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},y=b?"activeEmbeddingModels":"activeModels";ht(y,[...t[y],g])},a=(h,b=!1)=>{ht(b?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[b,g]=h.split("|"),y=t.activeModels.filter(S=>!(S.name===b&&S.provider===g)),x=t.defaultModelKey;if(h===t.defaultModelKey){let S=y.find(O=>O.enabled);x=S?`${S.name}|${S.provider}`:""}lA({activeModels:y,defaultModelKey:x})},u=(h,b,g)=>{let y=h?"activeEmbeddingModels":"activeModels",x=t[y].findIndex(S=>S.name===b.name&&S.provider===b.provider);if(x!==-1){let S=[...t[y]];S[x]=g,ht(y,S)}else new Zge.Notice("Could not find model to update"),fe("Could not find model to update:",b)},l=h=>{let b=t.activeModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);ht("activeModels",b)},c=h=>{let[b,g]=h.split("|"),y=t.activeEmbeddingModels.filter(x=>!(x.name===b&&x.provider===g));ht("activeEmbeddingModels",y)},d=h=>{let b=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);ht("activeEmbeddingModels",b)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),b=[...H_,...h];ht("activeModels",b),new Zge.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),b=[...yN,...h];ht("activeEmbeddingModels",b),new Zge.Notice("Embedding models refreshed successfully")},m=(h,b=!1)=>{new Gge(app,h,b,u).open()};return Ip.default.createElement("div",{className:"tw-space-y-4"},Ip.default.createElement("section",null,Ip.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),Ip.default.createElement(IHe,{models:t.activeModels,onEdit:h=>m(h),onCopy:h=>i(h),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:h=>a(h),onRefresh:f,title:"Chat Model"}),Ip.default.createElement(EHe,{open:e,onOpenChange:r,onAdd:h=>{let b=[...t.activeModels,h];ht("activeModels",b)},ping:h=>Ec.instance.getCurrentChainManager().chatModelManager.ping(h)}),Ip.default.createElement("div",{className:"tw-space-y-4"},Ip.default.createElement(Pn,{type:"slider",title:"Conversation turns in context",description:"The number of previous conversation turns to include in the context. Default is 15 turns, i.e. 30 messages.",value:t.contextTurns,onChange:h=>ht("contextTurns",h),min:1,max:50,step:1}))),Ip.default.createElement("section",null,Ip.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),Ip.default.createElement(IHe,{models:t.activeEmbeddingModels,onEdit:h=>m(h,!0),onDelete:c,onCopy:h=>i(h,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:h=>a(h,!0),onRefresh:p,title:"Embedding Model"}),Ip.default.createElement(EHe,{open:n,onOpenChange:o,onAdd:h=>{let b=[...t.activeEmbeddingModels,h];ht("activeEmbeddingModels",b)},isEmbeddingModel:!0,ping:h=>mu.getInstance().ping(h)})))};var Wir=require("obsidian");di();var Ln=F(ee()),Kir=F(id());Qg();An();var Uir=require("obsidian"),Uy=F(ee()),qir=F(id());di();function ZUn({onConfirm:t,onCancel:e}){let[r,n]=(0,Uy.useState)(""),[o,i]=(0,Uy.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return Uy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Uy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Uy.default.createElement(si,{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&&Uy.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),Uy.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Uy.default.createElement(be,{variant:"secondary",onClick:e},"Cancel"),Uy.default.createElement(be,{variant:"default",onClick:()=>a(r)},"Confirm")))}var Yge=class extends Uir.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,qir.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Uy.default.createElement(ZUn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var Hir=require("obsidian"),E_=F(ee()),Vir=F(id());di();function YUn({onConfirm:t,onCancel:e}){let[r,n]=(0,E_.useState)("");return E_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},E_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},E_.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"),E_.default.createElement(si,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),E_.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},E_.default.createElement(be,{variant:"secondary",onClick:e},"Cancel"),E_.default.createElement(be,{variant:"default",onClick:()=>t(r)},"Confirm")))}var Xge=class extends Hir.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,Vir.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(E_.default.createElement(YUn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Qge({title:t,patterns:e,onRemove:r}){return Ln.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Ln.default.createElement("div",{className:"tw-font-bold"},t),Ln.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=>Ln.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"},Ln.default.createElement(l1,{className:"tw-flex-1"},n),Ln.default.createElement(be,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Ln.default.createElement(Qi,{className:"tw-size-4"}))))))}function XUn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Ln.useState)(t),i=Xg(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=W9(i),c=f=>{let p=K9({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 Ln.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Ln.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&&Ln.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Ln.default.createElement(Qge,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&Ln.default.createElement(Qge,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&Ln.default.createElement(Qge,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&Ln.default.createElement(Qge,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),Ln.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Ln.default.createElement(ik,null,Ln.default.createElement(ak,{asChild:!0},Ln.default.createElement(be,{variant:"secondary"},"Add...")),Ln.default.createElement(m_,{align:"start",container:r},Ln.default.createElement(Ri,{onSelect:()=>{new v3(app,f=>{let p=que(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(ZN,{className:"tw-size-4"}),"Tag")),Ln.default.createElement(Ri,{onSelect:()=>{new _3(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(mb,{className:"tw-size-4"}),"Folder")),Ln.default.createElement(Ri,{onSelect:()=>{new n1({app,onNoteSelect:f=>{let p=G9(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(pb,{className:"tw-size-4"}),"Note")),Ln.default.createElement(Ri,{onSelect:()=>{new Yge(app,f=>{let p=C$t(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(S8,{className:"tw-size-4"}),"Extension")),Ln.default.createElement(Ri,{onSelect:()=>{new Xge(app,f=>{let p=Xg(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:b,notePatterns:g}=W9(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...b],notePatterns:[...l,...g]})}).open()}},Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ln.default.createElement(YN,{className:"tw-size-4"}),"Custom"))))))}var P7=class extends Wir.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,Kir.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Ln.default.createElement(XUn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};di();Ur();OC();er();An();var en=F(ee()),Gir=()=>{let t=Hn(),e=r=>{let n=parseInt(r);n!==t.numPartitions&&new V3(app,async()=>{ht("numPartitions",n),await wa.getInstance().indexVaultToVectorStore(!0)}).open()};return en.default.createElement("div",{className:"tw-space-y-4"},en.default.createElement("section",null,en.default.createElement("div",{className:"tw-space-y-4"},en.default.createElement(Pn,{type:"select",title:"Auto-Index Strategy",description:en.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},en.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),en.default.createElement(lo,{delayDuration:0},en.default.createElement(Nt,null,en.default.createElement(jt,{asChild:!0},en.default.createElement(Mo,{className:"tw-size-4"})),en.default.createElement(At,null,en.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},en.default.createElement("div",{className:"tw-space-y-1"},en.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),en.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},en.default.createElement("li",null,en.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},en.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),en.default.createElement("span",null,"Manual indexing via command or refresh only"))),en.default.createElement("li",null,en.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},en.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),en.default.createElement("span",null,"Index updates when plugin loads or reloads"))),en.default.createElement("li",null,en.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},en.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),en.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),en.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=>{ht("indexVaultToVectorStore",r)},options:$Ge.map(r=>({label:r,value:r})),placeholder:"Strategy"}),en.default.createElement(Pn,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant blocks and passes the top N blocks to the LLM. Default for N is 3. Increase if you want more sources included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>ht("maxSourceChunks",r)}),en.default.createElement(Pn,{type:"slider",title:"Requests per Minute",description:"Default is 90. Decrease if you are rate limited by your embedding provider.",min:10,max:300,step:10,value:t.embeddingRequestsPerMin,onChange:r=>ht("embeddingRequestsPerMin",r)}),en.default.createElement(Pn,{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=>ht("embeddingBatchSize",r)}),en.default.createElement(Pn,{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:t.numPartitions.toString(),onChange:e,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(r=>({label:r,value:r}))}),en.default.createElement(Pn,{type:"custom",title:"Exclusions",description:en.default.createElement(en.default.Fragment,null,en.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."))},en.default.createElement(be,{variant:"secondary",onClick:()=>new P7(app,r=>ht("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),en.default.createElement(Pn,{type:"custom",title:"Inclusions",description:en.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.")},en.default.createElement(be,{variant:"secondary",onClick:()=>new P7(app,r=>ht("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),en.default.createElement(Pn,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, the index will be stored in the .obsidian folder and synced with Obsidian Sync by default. If disabled, it will be stored in .copilot-index folder at vault root.",checked:t.enableIndexSync,onCheckedChange:r=>ht("enableIndexSync",r)}),en.default.createElement(Pn,{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=>ht("disableIndexOnMobile",r)}))))};var Zir=["basic","model","QA","command","plus","advanced"],QUn={basic:Xn.default.createElement(p8,{className:"tw-size-5"}),model:Xn.default.createElement(m8,{className:"tw-size-5"}),QA:Xn.default.createElement(h8,{className:"tw-size-5"}),command:Xn.default.createElement(rv,{className:"tw-size-5"}),plus:Xn.default.createElement(Pg,{className:"tw-size-5"}),advanced:Xn.default.createElement(YN,{className:"tw-size-5"})},eqn={basic:()=>Xn.default.createElement(Fir,null),model:()=>Xn.default.createElement(Bir,null),QA:()=>Xn.default.createElement(Gir,null),command:()=>Xn.default.createElement(Iir,null),plus:()=>Xn.default.createElement(kir,null),advanced:()=>Xn.default.createElement(Mir,null)},Jir=Zir.map(t=>({id:t,icon:QUn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),tqn=()=>{let{selectedTab:t,setSelectedTab:e}=$3();return Xn.default.createElement("div",{className:"tw-flex tw-flex-col"},Xn.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},Jir.map((r,n)=>Xn.default.createElement(Knr,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===Jir.length-1}))),Xn.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),Xn.default.createElement("div",null,Zir.map(r=>{let n=eqn[r];return Xn.default.createElement(Gnr,{key:r,id:r,isSelected:t===r},Xn.default.createElement(n,null))})))},rqn=({plugin:t})=>{let[e,r]=Xn.default.useState(0),{latestVersion:n,hasUpdate:o}=Uhe(t.manifest.version),i=async()=>{new Oge(app,async()=>{yGe(),r(s=>s+1)}).open()};return Xn.default.createElement(Znr,null,Xn.default.createElement("div",null,Xn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Xn.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Xn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Xn.default.createElement("span",null,"Copilot Settings"),Xn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xn.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&Xn.default.createElement(Xn.default.Fragment,null,o?Xn.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,")"):Xn.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),Xn.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},Xn.default.createElement(be,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Xn.default.createElement(tqn,{key:e})))},Yir=rqn;var eye=class extends E7.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(xs)[0]?.view&&ae().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 E7.Notice("Plugin reloaded successfully.")}catch(e){new E7.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,Xir.createRoot)(r).render(MHe.default.createElement(THe.Provider,{value:e},MHe.default.createElement(Yir,{plugin:this.plugin})))}};er();var LT=require("obsidian");Us();di();Tn();on();sA();Jp();An();var T_=require("obsidian"),It=F(ee()),Qir=F(id());er();function nqn(t){let[e]=(0,It.useState)(new $G({returnMessages:!0,memoryKey:"history"})),[r,n]=(0,It.useState)(null);return(0,It.useEffect)(()=>{async function o(){let i=await DF.getInstance().createModelInstance(t),a=Gp.fromMessages([aA.fromTemplate("You are a helpful assistant. You'll help the user with their content editing needs."),new B_("history"),U_.fromTemplate("{input}")]),s=Pi.from([{input:u=>u.input,memory:()=>e.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},a,i]);n(s)}o()},[t,e]),{chatChain:r,chatMemory:e}}function oqn({originalText:t,command:e,onInsert:r,onReplace:n}){let[o,i]=(0,It.useState)(null),[a,s]=(0,It.useState)(null),[u,l]=(0,It.useState)(""),c=(0,It.useRef)(null),d=(0,It.useRef)(null),[f,p]=(0,It.useState)(!0),[m]=D$(),h=Hn(),b=(0,It.useMemo)(()=>LY(e.modelKey||m,h.activeModels),[e.modelKey,m,h.activeModels]),{chatChain:g,chatMemory:y}=nqn(b),x=e.title,S=(0,It.useCallback)(async(R,N)=>{if(!g)return console.error("Chat chain not initialized"),new T_.Notice("Chat engine not ready. Please try again."),p(!1),null;try{i(null),s(null),p(!0);let j="",k=await g.bind({signal:N.signal}).stream({input:R});for await(let H of k){if(N.signal.aborted)break;let V=typeof H.content=="string"?H.content:"";j+=V,i(j)}if(!N.signal.aborted){let H=j.trim();return s(H),p(!1),await y.saveContext({input:R},{output:H}),H}return null}catch(j){return fe("Error generating response:",j),p(!1),null}},[g,y]);(0,It.useEffect)(()=>{let R=new AbortController;O.current=R;async function N(){if(g)try{let j=await wqe(e.content,t);await S(j,R)}catch(j){fe("Error in initial response:",j),p(!1)}}return N(),()=>{R.abort()}},[e.content,t,g,S]);let O=(0,It.useRef)(null),E=async()=>{if(!u.trim()||!g){g||new T_.Notice("Chat engine not ready. Please try again.");return}let R=new AbortController;O.current=R;let N=await wqe(u,t,!0);try{await S(N,R)&&l("")}finally{R.signal.aborted&&(p(!1),s(o??"")),O.current=null}},P=()=>{O.current&&(O.current.abort(),O.current=null,p(!1))},A=R=>{R.nativeEvent.isComposing||(!f&&a&&!I&&(R.key==="Enter"&&(T_.Platform.isMacOS?R.metaKey:R.ctrlKey)&&!R.shiftKey&&(R.preventDefault(),n(a)),R.key==="Enter"&&(T_.Platform.isMacOS?R.metaKey:R.ctrlKey)&&R.shiftKey&&(R.preventDefault(),r(a))),I&&R.key==="Enter"&&!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&(R.preventDefault(),E()))};(0,It.useEffect)(()=>{if(c.current&&o&&f){let R=c.current;R.scrollTop=R.scrollHeight}},[o,f]);let I=!f&&u.trim().length>0;return It.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:A},It.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),It.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},x&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},It.default.createElement(iv,{className:"tw-size-4"}),x)),It.default.createElement("div",{className:"tw-group tw-relative"},It.default.createElement("textarea",{ref:c,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:a??o??"loading...",disabled:a==null,onChange:R=>s(R.target.value)}),a&&It.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(a),new T_.Notice("Copied to clipboard")}},It.default.createElement(th,{className:"tw-size-4 hover:tw-text-accent"}))),!f&&a&&It.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},It.default.createElement("textarea",{autoFocus:!0,ref:d,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:u,onChange:R=>l(R.target.value)})),It.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},It.default.createElement(VN,{className:"tw-size-4"}),Nme(b)),It.default.createElement("div",{className:"tw-flex tw-gap-2"},f?It.default.createElement(be,{variant:"secondary",onClick:P},"Stop"):I?It.default.createElement(be,{onClick:E,className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement("span",null,"Submit"),It.default.createElement(rh,{className:"tw-size-3"})):It.default.createElement(It.default.Fragment,null,It.default.createElement(be,{onClick:()=>r(a??""),className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement("span",null,"Insert"),It.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},T_.Platform.isMacOS?It.default.createElement(It.default.Fragment,null,It.default.createElement(rv,{className:"tw-size-3"}),It.default.createElement(eP,{className:"tw-size-3"}),It.default.createElement(rh,{className:"tw-size-3"})):It.default.createElement(It.default.Fragment,null,It.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),It.default.createElement(eP,{className:"tw-size-3"}),It.default.createElement(rh,{className:"tw-size-3"})))),It.default.createElement(be,{onClick:()=>n(a??""),className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement("span",null,"Replace"),It.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},T_.Platform.isMacOS?It.default.createElement(It.default.Fragment,null,It.default.createElement(rv,{className:"tw-size-3"}),It.default.createElement(rh,{className:"tw-size-3"})):It.default.createElement(It.default.Fragment,null,It.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),It.default.createElement(rh,{className:"tw-size-3"}))))))))}var tye=class extends T_.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,Qir.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=s=>{u6(s),this.close()},a=s=>{u6(s,!0),this.close()};this.root.render(It.default.createElement(oqn,{originalText:n,command:o,onInsert:i,onReplace:a}))}onClose(){this.root.unmount()}};var ear=F(lFe());Tn();var rye=class{constructor(e,r){this.handleFileModify=(0,ear.default)(async e=>{if(!J4(e)||YG(e.path))return;let r=await QG(e);J("command file modified",e.path,r),this.registerCommand(r),qF(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!J4(e)||YG(e.path)))try{J("new command file created",e.path);let r=await QG(e);if(!tJt(e)){let n=Fme();r={...r,order:n}}await xqe(e,r),qF(r,r.title),this.registerCommand(r)}catch(r){fe(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!J4(e)||YG(e.path))return;let r=K4(e.basename);this.plugin.removeCommand(r),XG(e.basename)};this.handleFileRename=async(e,r)=>{if(YG(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=K4(n);this.plugin.removeCommand(o),XG(n)}if(J4(e)){J("command file renamed",e.path);let o=await QG(e);this.registerCommand(o),qF(o,o.title),await xqe(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await Lme(),this.registerCommands()}async registerCommands(){Mm().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=K4(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new tye(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),Fd.getInstance().recordUsage(e)}})}};er();Tn();Us();td();Tn();on();var nye=class t{constructor(){this.contextProcessor=f3.getInstance(),this.mention=_M.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processMessageContext(e,r,n,o,i,a){try{J(`[ContextManager] Processing context for message ${e.id}`);let s=e.originalMessage||e.message,{processedPrompt:u,includedFiles:l}=await tJ(s,"",n,a),c=o==="copilot_plus"?await this.mention.processUrls(s):{urlContext:"",imageUrls:[]},d=new Set(l.map(g=>g.path)),p=[...e.context?.notes||[]];i&&o!=="project"&&a&&!p.some(g=>g.path===a.path)&&p.push(a);let m=await this.contextProcessor.processContextNotes(d,r,n,p,i,a,o),h=this.contextProcessor.processSelectedTextContexts(),b=u+c.urlContext+m+h;return J(`[ContextManager] Successfully processed context for message ${e.id}`),b}catch(s){return J(`[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;J(`[ContextManager] Reprocessing context for message ${e}`);let l=await this.processMessageContext(u,n,o,i,a,s);r.updateProcessedText(u.id,l),J(`[ContextManager] Completed context reprocessing for message ${e}`)}createMessageContext(e,r,n=TN()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await tb(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return TN()}};on();Tn();var K3=class{constructor(){this.messages=[]}generateId(){return`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}addMessage(e,r,n,o){let i=this.generateId(),a=Bs(new Date),s={id:i,displayText:e,processedText:r,sender:n,timestamp:a,context:o,isVisible:!0,isErrorMessage:!1};return this.messages.push(s),J(`[MessageRepository] Added message with ID: ${i}`),i}addDisplayOnlyMessage(e,r,n){if(n){let o=Bs(new Date),i={id:n,displayText:e,processedText:e,sender:r,timestamp:o,isVisible:!0,isErrorMessage:!1};return this.messages.push(i),J(`[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||Bs(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),J(`[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?(J(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?J(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,J(`[MessageRepository] Edited AI message ${e}`)),!0):(J(`[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,J(`[MessageRepository] Updated processed text for message ${e}`),!0):(J(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(J(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),J(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],J("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),J(`[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),J(`[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||Bs(new Date),context:r.context,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),J(`[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 DT=require("obsidian");Tn();on();Ur();er();Us();var T7=class{constructor(e,r){this.app=e;this.messageRepo=r}async saveChat(e){try{let r=this.messageRepo.getDisplayMessages();if(r.length===0){new DT.Notice("No messages to save.");return}let n=ae(),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=this.generateFileName(r,i),u=this.generateNoteContent(o,i,e),l=this.app.vault.getAbstractFileByPath(s);l instanceof DT.TFile?(await this.app.vault.modify(l,u),J(`[ChatPersistenceManager] Updated existing chat file: ${s}`)):(await this.app.vault.create(s,u),new DT.Notice(`Chat saved as note: ${s}`),J(`[ChatPersistenceManager] Created new chat file: ${s}`))}catch(r){fe("[ChatPersistenceManager] Error saving chat:",r),new DT.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 J(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return fe("[ChatPersistenceManager] Error loading chat:",r),new DT.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=ae(),r=this.app.vault.getAbstractFileByPath(e.defaultSaveFolder);if(!(r instanceof DT.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(a=>a.path.startsWith(r.path)),i=iu();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"?Ei:mg,u=a[2].trim(),l=u.split(`
|
||
`),c=u,d="Unknown time",f=l.length-1;if(f>0&&l[f].startsWith("[Timestamp: ")){let m=l[f].match(/\[Timestamp: (.*?)\]/);m&&(d=m[1],c=l.slice(0,f).join(`
|
||
`).trim())}let p;if(d!=="Unknown time"){let m=new Date(d);isNaN(m.getTime())||(p=m.getTime())}r.push({message:c,sender:s,isVisible:!0,timestamp:p?{epoch:p,display:d,fileName:""}:null})}return r}generateFileName(e,r){let n=ae(),i=Bs(new Date(r)).fileName,a=e.find(f=>f.sender===Ei),s=a?a.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",u=n.defaultConversationNoteName||"{$date}_{$time}__{$topic}";u=u.replace("{$topic}",s.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",i.split("_")[0]).replace("{$time}",i.split("_")[1]);let l=u.replace(/[\\/:*?"<>|]/g,"_"),c=iu(),d=c?`${c.id}__`:"";return`${n.defaultSaveFolder}/${d}${l}.md`}generateNoteContent(e,r,n){let o=ae(),i=iu();return`---
|
||
epoch: ${r}
|
||
modelKey: ${n}
|
||
${i?`projectId: ${i.id}`:""}
|
||
${i?`projectName: ${i.name}`:""}
|
||
tags:
|
||
- ${o.defaultConversationTag}
|
||
---
|
||
|
||
${e}`}};Ur();var oye=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=nye.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new T7(o.app,e)}getCurrentMessageRepo(){let e=this.plugin.projectManager.getCurrentProjectId(),r=e??this.defaultProjectKey;if(this.lastKnownProjectId!==e&&(J(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){J(`[ChatManager] Creating new message repository for project: ${r}`);let o=new K3;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new T7(this.plugin.app,n),n}async sendMessage(e,r,n,o=!1){try{J(`[ChatManager] Sending message: "${e}"`);let i=this.plugin.app.workspace.getActiveFile(),a={...r};if(o&&i){let d=r.notes||[],f=d.some(p=>p.path===i.path);a.notes=f?d:[...d,i]}let s=this.getCurrentMessageRepo(),u=s.addMessage(e,e,Ei,a),l=s.getMessage(u);if(!l)throw new Error(`Failed to retrieve message ${u}`);let c=await this.contextManager.processMessageContext(l,this.fileParserManager,this.plugin.app.vault,n,o,i);return s.updateProcessedText(u,c),J(`[ChatManager] Successfully sent message ${u}`),u}catch(i){throw J("[ChatManager] Error sending message:",i),i}}async editMessage(e,r,n,o=!1){try{J(`[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(),J(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return J(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n){try{J(`[ChatManager] Regenerating message ${e}`);let o=this.getCurrentMessageRepo();if(!o.getMessage(e))return J(`[ChatManager] Message not found: ${e}`),!1;let a=o.getDisplayMessages(),s=a.findIndex(d=>d.id===e);if(s<=0)return J("[ChatManager] Cannot regenerate first message or no user message found"),!1;let u=a[s-1];if(u.sender!==Ei)return J("[ChatManager] Previous message is not from user"),!1;if(o.truncateAfter(s-1),await this.updateChainMemory(),!u.id)return J("[ChatManager] User message has no ID for regeneration"),!1;let l=o.getLLMMessage(u.id);if(!l)return J("[ChatManager] LLM message not found for regeneration"),!1;let c=new AbortController;return await this.chainManager.runChain(l,c,r,n,{debug:ae().debug}),J(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(o){return J(`[ChatManager] Error regenerating message ${e}:`,o),!1}}async deleteMessage(e){try{return J(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),J(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return J(`[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(),J("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),J(`[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 OGt(r,this.chainManager.memoryManager),J(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){J("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addFullMessage(n)}),await this.updateChainMemory(),J(`[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();J(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),J(`[ChatManager] Project switch complete. Messages: ${r.getDisplayMessages().length}`)}};Tn();var iye=class{constructor(e){this.chatManager=e;this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notifyListeners(){this.listeners.forEach(e=>{try{e()}catch(r){J("[ChatUIState] Error in listener:",r)}})}async sendMessage(e,r,n,o=!1){let i=await this.chatManager.sendMessage(e,r,n,o);return this.notifyListeners(),i}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()});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?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)}};var aye=class extends LT.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=Ma(async(i,a)=>{a.enableEncryption?await this.saveData(await sJe(a)):await this.saveData(a),Sqe(this,i,a)}),this.addSettingTab(new eye(this.app,this)),this.vectorStoreManager=wa.getInstance(),this.brevilabsClient=Wi.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),Zue(),this.projectManager=Ec.getInstance(this.app,this.vectorStoreManager,this),this.fileParserManager=new vM(this.brevilabsClient,this.app.vault);let r=new K3,n=this.projectManager.getCurrentChainManager(),o=new oye(r,n,this.fileParserManager,this);this.chatUIState=new iye(o),this.registerView(xs,i=>new v1(i,this)),this.registerView(NJ,i=>new Nhe(i)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",i=>{this.activateView()}),Sqe(this,void 0,ae()),hL.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",i=>Wnr(i))),this.registerEvent(this.app.workspace.on("active-leaf-change",i=>{if(i&&i.view instanceof LT.MarkdownView&&i.view.file){let s=this.app.workspace.getLeavesOfType(xs).find(u=>u.view instanceof v1)?.view;if(s){let u=new CustomEvent(gg.ACTIVE_LEAF_CHANGE);s.eventTarget.dispatchEvent(u)}}})),this.autocompleteService=Cme.getInstance(this),this.customCommandRegister=new rye(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(Tir).then(Air)})}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),J("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ae().autosaveChat){let r=this.app.workspace.getLeavesOfType(xs)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(xs).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(xs).find(l=>l.view instanceof v1)?.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(xs).find(n=>n.view instanceof v1)?.view;if(r){let n=new CustomEvent(gg.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===xs&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(LT.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(xs).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(xs);r.length===0?ae().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:xs,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:xs,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(xs)}async loadSettings(){let r=await this.loadData(),n=bGe(r);lA(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=Yr(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 LT.Notice("No chat history found.");return}new Cge(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ae().defaultSaveFolder);if(!(r instanceof LT.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=iu()?.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=CGt(n),i=this.app.workspace.getLeavesOfType(xs)[0];i||this.activateView(),await this.chatUIState.loadMessages(o);let a=(i||this.app.workspace.getLeavesOfType(xs)[0])?.view;a&&a.updateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(xs)[0];if(r){let n=r.view,o=new CustomEvent(gg.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 new EC({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.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/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-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/clipboard.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-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/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 */ |